Subject: Re: Querying an userland program from the kernel
To: Stephan Uphoff <ups@tree.com>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 01/26/2004 10:42:23
--UBnjLfzoMQYIXCvq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Jan 24, 2004 at 10:06:07PM -0500, Stephan Uphoff wrote:
>=20
> Hi,
>=20
> the usual solution is for the userland program to use a
> system call (example ioctl) to sleep in the kernel waiting for
> a query from the kernel.

When I was at NASA working on the HSM, we used our own device driver=20
(which you need for ioctl to work), and just left userland in read(2).=20
Nices things about read() as opposed to ioctl() are: 1) you can use=20
select(2)/kevent(2), and 2) you can easily handle variable-sized RPC=20
requests. Yes, you have to provide the syscall the same size userland=20
buffer in each case, but read(2) will only transfer what's there, whereas=
=20
ioctl(2) will always transfer a fixed amount of data. If you are doing RPC=
=20
that may be as large as 8k but often is much smaller, this size difference=
=20
may matter.

Take care,

Bill

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

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

iD8DBQFAFV+PWz+3JHUci9cRAq7VAJwP7i3d5VFj+eZsBFoFnyrpdGObzgCgjZjG
dUGfaKVnFgofjw4PE9OezV4=
=djTT
-----END PGP SIGNATURE-----

--UBnjLfzoMQYIXCvq--