Subject: Re: Question on ioctl
To: None <netbsd-users@netbsd.org>
From: David Laight <dsl@l8s.co.uk>
List: netbsd-users
Date: 02/15/2002 18:12:40
> > What is the maximum size of the buffer that
> > can be passed to ioctl?
>
> >>From <sys/ioccom.h>:
>
> /*
> * Ioctl's have the command encoded in the lower word, and the size of
> * any in or out parameters in the upper word. The high 3 bits of the
> * upper word are used to encode the in/out status of the parameter.
> */
> #define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
>
Is this format for 'request' enforced anywhere in NetBsd, or is
it just a convention?
Every other unix I've met treats the ioctl 'request' and 'argp'
values as token which are passed transparantly to the relevant
device driver.
In a vague attempt to get unique ioctl 'request' values I've
often used 3 characters + a number.
I'm also fairly convinced that 'traditionally' the 'argument'
was prototyped (rather not prototyped, in trad. C) as an 'int'.
However it was often used as a pointer :-)
David