API noodling

Peter da Silva peter-dragonfly at taronga.com
Tue Jul 22 18:47:51 PDT 2003


Matthew Dillon wrote:
:Using a union won't give you prebuilt templates for the versionless
:universal compatibility sceme you were talking about.

    The union is really just a space allocation.  We can add some padding,
    and anyway the emulation layer *will* be aware of the user program's
    release since it's syscall entry points (e.g. 'read()') have to be
    compatible.
Yeh, but I thought that the emulation would be providing the glue
between the application version and the kernel version by passing
a structured message to the kernel. I must have misunderstood
something somewhere in that message where you had something like
READ, ARG_HANDLE, fd, ARG_BUFPOINTER, address, ARG_SIZE, length...
:>     A user thread will only be in one direct system call interface 
:>     (i.e. read(), write(), gettimeofday()) at a time, so a single 
:>     union'd syscall message structure embedded in the lwkt_thread is
:>     sufficient.

:Two... one for when it's in a signal... if signals aren't handled in a
:separate thread.

    The td_sysmsg idea was just for messages we might send, to optimize
    standard system calls.  Incoming messages would be handled differently.
    We don't have to use the pre-cache approach for all of our message types,
    just for the ones in the critical path to streamline the interface.
    Signals aren't really in the critical path so those could be allocated.
I'm looking at the case where a signal makes a system call: you don't 
want it re-using the buffer that the system call it interrupted used,
so the wrapper would need to do something like:

	if(in_a_signal_handler) {
		msgp = ...->td_sigmsg;
	} else {
		msgp = ...->td_sysmsg;
	}





More information about the Kernel mailing list