On Sat, Nov 21, 2015 at 8:13 PM, Masao Uebayashi <uebay...@gmail.com> wrote: > 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.
This should have been read as: trap frame is replaced with signal handler trampoline by sendsig_siginfo().