tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern_sig.c



I'm too young to understand how signal works in kernel.  But I guess
I'm not alone.

I think that renaming things a bit would help people to understand the code.

*
- sendsig() -> netbsd_sendsig()
- trapsignal() -> netbsd_trapsignal()

These are native emul functions of e_sendsig and e_trapsignal respectively.

*

- postsig() -> sendsig()

This is so badly named and incredibly confusing, as these is a
function called sigpost() which is completely different.

sigpost() posts a signal to a signal queue.  sigpost() can be called
from anywhere including interrupt context, because all it does is to

sendsig(), the function which is called as postsig() now, and referred
to by the signal(9) manual page and comments all over the tree, is the
sequence of code that is called when a signal is delivered (some
actual action is taking place).

sendsig() ("postsig()") is only called from userret() -> mi_userret()
-> lwp_userret().  If a pending signal is found and it is decided to
be delivered, trap frame is overwritten by signal handler trampoline.
When lwp returns back to user mode, it knows it is running signal
handler.

*

Hopefully these verbs in signal(9) man page and comments are
thoroughly reviewed, sorted out, and updated:

- send
- post
- deliver
- invoke
- schedule


Home | Main Index | Thread Index | Old Index