PlashGlibc calls not async signal safe

A number of calls are defined by POSIX as being "async signal safe", which means safe to call from signal handlers. See this list. It includes open() and other calls which in PlashGlibc are implemented via RPCs. Currently these calls are not safe to re-enter from signal handlers and doing so could corrupt PlashGlibc's data structures or send mixed-up messages over the socket connection to the ServerProcess. I noticed this problem while looking at PlashIssues/ForkDeadlock.

It could be difficult to implement this.

There are two halves to this:

Is there a way to find out whether we are currently inside a signal handler? Probably not. It is possible to jump out of signal handlers using longjmp(). Signal handlers can themselves be re-entered if a second signal occurs. If the process is set to use a separate signal stack, we could detect whether we are in a signal handler based on the stack pointer; but the process won't always be using a separate stack for signal handling.

Does the Hurd have any difficulties implementing this? What about Cygwin? Did Ostia handle this?

PlashIssues/CallsNotAsyncSignalSafe (last edited 2008-08-17 11:55:53 by MarkSeaborn)