Subject: Re: Querying an userland program from the kernel
To: Stephan Uphoff <>
From: Bill Studenmund <>
List: tech-kern
Date: 01/26/2004 10:42:23
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:
> Hi,
> 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=
ioctl(2) will always transfer a fixed amount of data. If you are doing RPC=
that may be as large as 8k but often is much smaller, this size difference=
may matter.

Take care,


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

Version: GnuPG v1.2.3 (NetBSD)