> Hello!
> 
> I have:
> 
> int ziva_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct
> proc* pr)
> 
> when this function catches a ioctl from userspace, called as:
>       int foo = 199;
>       ioctl(fd, 10, &foo);
> 
> the u_long cmd contains 10, which is correct (so the ioctl-handler is
> called correctly).
> 
> However, I can't get the value of the int.
> 
> I tried something like:
>       if (*((int *) arg) == 199)
>               <bleh>.
> 
> But this doesn't work, <bleh> is not executed. Somehow, I can't access 
> the memory this way.
> 
> Anyone knows, what I'm doing wrong?

The request parameter to ioctl needs to contain length information.

I think you want something like:

#define ZIVA_IOCTL   _IOW('c', 10, int)

int foo = 199;
ioctl(fd, ZIVA_IOCTL, &foo);

Then arg should be right.  See iocomm.h.



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to