Subject: Re: IOCTL implementation and kernel/userland addresses
To: None <tech-kern@netbsd.org>
From: Frank van der Linden <fvdl@netbsd.org>
List: tech-kern
Date: 02/16/2005 23:37:56
On Wed, Feb 16, 2005 at 11:25:39PM +0100, Reinoud Zandijk wrote:
> > cvs -q diff -u sys/fcntl.h
> Index: sys/fcntl.h
> ===================================================================
> RCS file: /cvsroot/src/sys/sys/fcntl.h,v
> retrieving revision 1.29
> diff -u -r1.29 fcntl.h
> --- sys/fcntl.h 3 Feb 2005 19:20:01 -0000       1.29
> +++ sys/fcntl.h 16 Feb 2005 22:21:31 -0000
> @@ -124,11 +124,12 @@
>  #define        FMARK           0x00001000      /* mark during gc() */
>  #define        FDEFER          0x00002000      /* defer for next gc pass */
>  #define        FHASLOCK        0x00004000      /* descriptor holds advisory lock */
> +#define FKIOCTL                0x80000000
>  /* bits to save after open(2) */
>  #define        FMASK           
> (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FDSYNC|\
> -                        FRSYNC|FALTIO)
> +                        FRSYNC|FALTIO|FKIOCTL)
>  /* bits settable by fcntl(F_SETFL, ...) */
> -#define        FCNTLFLAGS      
> (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FDSYNC|FRSYNC|FALTIO)
> +#define        FCNTLFLAGS      
> (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FDSYNC|FRSYNC|FALTIO|FKIOCTL)
>  #endif /* _KERNEL */

That's wrong.. since FKIOCTL is to be used internally only when passed
in the flags argument to VOP_IOCTL, it should not ever be allowed to
be passed via fcntl() or open().

So, just add the value for FKIOCTL, and you're done there.

- Frank