Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Sep 2005 21:47:49 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        nsrashmi@gmail.com
Cc:        freebsd-hackers@freebsd.org, bugi@lists.redbrick.dcu.ie
Subject:   Re: 
Message-ID:  <20050928.214749.111484152.imp@bsdimp.com>
In-Reply-To: <9f9993160509280045586fb14d@mail.gmail.com>
References:  <9f99931605092800402dd1db9a@mail.gmail.com> <9f9993160509280045586fb14d@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <9f9993160509280045586fb14d@mail.gmail.com>
            rashmi ns <nsrashmi@gmail.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050928.214749.111484152.imp>