Implement a new signal delivery mechanism, SA_MAILBOX. If specified the
authorMatthew Dillon <dillon@dragonflybsd.org>
Sun, 14 Jan 2007 07:59:09 +0000 (07:59 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sun, 14 Jan 2007 07:59:09 +0000 (07:59 +0000)
commit7c1212ecd338a9d73c02e3f7f8dae64d45ccfefd
tree450ded7fa3ef95248e0cf8e3b54607f1e388ad30
parentebee7c7fcad9ece89ff7c844f155b520d65a60b7
Implement a new signal delivery mechanism, SA_MAILBOX.  If specified the
sigaction structure's sa_mailbox pointer (field is unioned with sa_handler)
points to a location in user memory.  When the signal occurs, the location
is overwritten with the signal number and the next system call made (or
the current one running) will return EINTR.  NO SIGNAL STATE IS PUSHED,
NO SIGNAL VECTOR IS DISPATCHED.  This makes mailbox signaling very fast.

Userland can interlock against the mailbox simply by polling and clearing
the mailbox prior to doing a system call.  The mailbox signal will be
properly interlocked against the system call.  Userland does not need to
make any other system calls (no sigblock() or sigsetmask() calls) to
properly interlock delivery.  The kernel interrupts at most one system call
per signal delivered via this mechanism, even if the userland does not
clear the mailbox.

As of this implementatino, mailbox delivery can cause an extra 'false'
interruption of a system call.  system calls do not currently poll installed
mailboxes to deal with false hits.  Mailbox signaling is meant to be used
under tightly managed conditions.

Move the virtual kernel check from sendsig() to postsig().  Mailbox
delivery must do any virtual kernel swaps prior to posting a mailbox signal.

Adjust go_user() to take an interrupt frame instead of a trap frame.

Replace the sigblock() based idle loop interlock with a mailbox interlock.
Add mailbox checks to the go_user() vmspace_ctl() loop (currently a bit of
a hack).
13 files changed:
sys/kern/kern_sig.c
sys/kern/kern_synch.c
sys/platform/pc32/i386/machdep.c
sys/platform/vkernel/i386/cpu_regs.c
sys/platform/vkernel/i386/fork_tramp.s
sys/platform/vkernel/i386/trap.c
sys/platform/vkernel/include/globaldata.h
sys/platform/vkernel/include/md_var.h
sys/platform/vkernel/platform/systimer.c
sys/sys/proc.h
sys/sys/signal.h
sys/sys/signalvar.h
sys/vm/vm_vmspace.c