Subject: Re: IOCTL implementation and kernel/userland addresses
To: Reinoud Zandijk <reinoud@netbsd.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 02/16/2005 15:02:02
--NklN7DEeGtkPCoo3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Feb 16, 2005 at 11:37:56PM +0100, Frank van der Linden wrote:
> On Wed, Feb 16, 2005 at 11:25:39PM +0100, Reinoud Zandijk wrote:
> > > cvs -q diff -u sys/fcntl.h
> > Index: sys/fcntl.h
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > 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 pa=
ss */
> >  #define        FHASLOCK        0x00004000      /* descriptor holds adv=
isory lock */
> > +#define FKIOCTL                0x80000000
> >  /* bits to save after open(2) */
> >  #define        FMASK          =20
> > (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FDSYNC|\
> > -                        FRSYNC|FALTIO)
> > +                        FRSYNC|FALTIO|FKIOCTL)
> >  /* bits settable by fcntl(F_SETFL, ...) */
> > -#define        FCNTLFLAGS     =20
> > (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FDSYNC|FRSYNC|FALTIO)
> > +#define        FCNTLFLAGS     =20
> > (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FDSYNC|FRSYNC|FALTIO|FKIOCTL)
> >  #endif /* _KERNEL */
>=20
> 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().

Vehemently agreed. :-)

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

Indeed.

Take care,

Bill

--NklN7DEeGtkPCoo3
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFCE9DqWz+3JHUci9cRAmVKAKCFajJmgTAsL0RJWTB8rmKAoaEFAwCfcxUy
rffjhZChXM/yOVPCr7uiaWk=
=Mlb6
-----END PGP SIGNATURE-----

--NklN7DEeGtkPCoo3--