News for hackers. Stuff that matters.
Re:Should you be scared of Unix signals? by jbarham on Tuesday June 14, 2016 @01:53AM (#11900066)
FWIW Plan 9 uses what it calls a "notification" mechanism: http://plan9.bell-labs.com/magic/man2html/2/notify
Re:Should you be scared of Unix signals? by adrianratnapala on Tuesday June 14, 2016 @02:57AM (#11900266)
While the "notification" system seems is cleaner than the signals system (and presumably avoids those races fixed by BSD) -- it does not seem fundamentally different.

If I am understanding that man page correctly, it does nothing at all to fix EINTR: "If the note interrupted an incomplete system call, that call returns an error (with error string interrupted) after the process resumes."

Re:Should you be scared of Unix signals? by nitwit005 on Tuesday June 14, 2016 @03:57AM (#11900483)
EINTR is only "needed" because of the situation where a call is made to a blocking system call like read, and a signal is received before it completes. It needs to cancel the blocking call so that it can run the signal handler.

If you get rid of signals, you wouldn't need EINTR. Even with signals, what people do 99% of the time is just retry the system call immediately. It would probably have been much better to have it do so automatically by default, avoiding exposing EINTR to most users.

Re:Should you be scared of Unix signals? by noselasd on Tuesday June 14, 2016 @08:55AM (#11901678)
EINTR is retried automatically if you use sigaction() and set the SA_RESTART flag.

If you use signal() instead of sigaction() it depends on your OS whether EINTR is automatically retried - never use signal().

(There's a few exceptions still - partial completed syscalls, e.g. a signal can cause read() to return partial data or sleep() to return before it should - neither case gives you EINTR though)

Re:Should you be scared of Unix signals? by adrianratnapala on Tuesday June 14, 2016 @05:41PM (#11905558)
Yes, but how does the Plan9 "notify" mechanism help with any of that? It seems to just be a tidied up version of signals, and therefore "needs" to do EINTR in much the same way as Unix.
Re:Should you be scared of Unix signals? by to3m on Tuesday June 14, 2016 @08:48AM (#11901634)
More on what EINTR is for: http://250bpm.com/blog:12