Subject: Re: zbufs for NetBSD
To: David Laight <david@l8s.co.uk>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-kern
Date: 08/23/2002 15:03:47
>Is it possible (without a massive rewrite) to get a kernel function
>called to process data that arrives on a socket?
>nfs would certainly benefit from such a call.

Uh, you mean as in SB_UPCALL?  See sys/kern/uipc_socket2.c:sowakeup().

Some vendor OSes move the callback function and arg into the socket
buffer, so you get independent callbacks for read data arriving and
blocked-write-side-becomes writable events.

Makes a very nice hook to implement sendfile(), splice() etc.

If your kernel has support for tacking arbitrary kernel closures onto
file I/O (rather than silly scheduler overhead, to wake up a process,
just to run the callback), that's icing on the cake.

Parts of the implementation I did at WRL one summer shipped in Tru64.
I really should re-implemnt it someday.

Jason -- what d'you think of passing an additional argument,
	 struct kclosure { void * usrarg, void (*fn){void *arg, void *obj) }
through the vnode layer?