User: Password:
|
|
Subscribe / Log in / New account

Kernel events without kevents

Kernel events without kevents

Posted Mar 17, 2007 0:41 UTC (Sat) by giraffedata (subscriber, #1954)
In reply to: Kernel events without kevents by vmole
Parent article: Kernel events without kevents

If I call sigprocmask() first, am I guaranteed that the masked signals will queued to the signal fd when I get around to creating it?

I haven't seen the implementation, but that would be the most natural way. I don't think signals are queued to a fd at all; I think read of the fd checks for and receives pending signals, in spite of any mask (so poll checks for pending signals). And assuming it's documented with those words, there's not much room for confusion.

This mess is why sigaction(2) was invented, to allow you to set both signal of interest and signals to mask in one operation.

How does it do that? I don't think sigaction modifies the signal mask.

And you don't need it to. Where would it be useful?

However, I agree that there is no practical application of signals arbitrarily being delivered traditionally or to an fd, so except that it's extra code, it would be sensible to have signalfd() automatically block the signal class.


(Log in to post comments)

Kernel events without kevents

Posted Mar 17, 2007 17:19 UTC (Sat) by vmole (guest, #111) [Link]

How does it do that? I don't think sigaction modifies the signal mask.

I misremembered, partially. The sa_mask member of the structure just blocks signals during delivery of the desired signal, not all the time. (Before sigaction(2), you had to try and call sigprocmask(2) from inside your signal handler to get this affect, which was completely unreliable.) This kind of blocking isn't necessary with signalfd because (duh!) the signals aren't delivered asynchronously.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds