In message: <[EMAIL PROTECTED]>
            rashmi ns <[EMAIL PROTECTED]> 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
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to