From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 29 03:47:54 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4E4EB16A41F for ; Thu, 29 Sep 2005 03:47:54 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id E41AC43D48 for ; Thu, 29 Sep 2005 03:47:53 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1] (may be forged)) by harmony.bsdimp.com (8.13.3/8.13.3) with ESMTP id j8T3lAfU023387; Wed, 28 Sep 2005 21:47:11 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 28 Sep 2005 21:47:49 -0600 (MDT) Message-Id: <20050928.214749.111484152.imp@bsdimp.com> To: nsrashmi@gmail.com From: "M. Warner Losh" In-Reply-To: <9f9993160509280045586fb14d@mail.gmail.com> References: <9f99931605092800402dd1db9a@mail.gmail.com> <9f9993160509280045586fb14d@mail.gmail.com> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Wed, 28 Sep 2005 21:47:11 -0600 (MDT) Cc: freebsd-hackers@freebsd.org, bugi@lists.redbrick.dcu.ie Subject: Re: X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 03:47:54 -0000 In message: <9f9993160509280045586fb14d@mail.gmail.com> rashmi ns writes: : Hello All , : I was trying to add a new ioctl cnd like : #define HDLCMODE _IOR('6',0xF,int) : when i try to uprintf the data which was sent from the user-space in the : device-driver-ioctl-routine i'll get a different value than which is passed. : Can anybody please tell me why this is happening . I pass the address of : integer from the user space as third arg to the ioctl call . : thanks and regards, Remember that there's a level of indirection here. For the userland call, you'll have something like: int i = 10; ioctl (fd, HDLCMODE, &i); in the kernel, this translates into a call to the driver's ioctl routine: int fooioctl(struct cdev *tp, u_long cmd, void *data, int flag, struct thread *t) { switch (cmd) { case HDLCMODE: printf("this should be 10: %d\n", *(int *)data); break; } Warner