Subject: Re: Moving to struct timespec in the kernel.
To: Jonathan Stone <jonathan@dsg.stanford.edu>
From: Quentin Garnier <cube@cubidou.net>
List: tech-kern
Date: 02/23/2005 12:10:04
--R+WA+n3pAWWgNWUs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Feb 22, 2005 at 06:39:26PM -0800, Jonathan Stone wrote:
> In message <6.1.2.0.2.20050222161932.039ecae8@localhost>,
> Matt Thomas writes:
[...]
> >I can't imagine it'd be all that difficult.  But I don't know
> >what the FreeBSD version looks like.
>=20
> IIRC, FreeBSD used 16-bit ints for fields in struct kevent where we
> used 32-bit (or bigger) ints, and a 32-bit (intptr_t) filter-specific
> field where we used a 64-bit field.  So the user-to-kernel ABI is
> different on all platforms.
>=20
> Last I looked, there was code nested inside a loop that walked a
> pointer through the copied-in list. I could split the logic into a
> kevent_common(), but tha'd mean walking the list twice, once to copy
> the non-NetBSD args into the NetBSDD-native kevent format.
>=20
> Hmm.  That still doesn't help the copyout()s in kqueue_scan(), called
> from sys_kqueue().  I'll think about it.

I have a COMPAT_NETBSD32-friendly version of sys_kevent in my local
tree.  Because I didn't want to go over the event lists twice, I
adapted the loop in sys_kevent into a similar loop in netbsd32_kevent,
and modified kqueue_scan to pass a flag (UIO_*SPACE seemed
appropriate) so it would do the copyout only in the UIO_USERSPACE
case.

The same could be done for COMPAT_FREEBSD: adapting the loop to the
FreeBSD specificities, and then calling kqueue_scan, and translating
the results.

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.

--R+WA+n3pAWWgNWUs
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iQEVAwUBQhxkjNgoQloHrPnoAQJRewgAwSHHfUsfcRogsF28JdbN89Vm9rE3MDLS
VszEi3hvCxAjNBIUAMMNDVfqrBMT+zr/Jj47z/+0o4dv8FUXVUYZ/SvK6ki67snK
AyUl1IMrTBhoxB5yIDF2Qet6vlGj7TIqFoCSvjrayao4Kgc15F/o3+TcObwlPB0O
sGGvAIIicBwKxZXjeu2QpnN+Qza8mFl4916JytwvkI0CswnrFdjNyW3tRvoEpzW3
MmEoGXJFtuhASza/ZmC+w1/L+WhEbnjW/L1H3Df19hKrfRqnG93Hf83FpAFfh40b
+J011wmQdDYgrB/wbJTHd70+Vo7q8vGibAW9bzP+cdQgBoq+Zhpp9Q==
=AG3p
-----END PGP SIGNATURE-----

--R+WA+n3pAWWgNWUs--