Paul Eggert <eggert@xxxxxxxxxxx> writes: > Ian Lance Taylor <ian@xxxxxxxx> writes: > > > I couldn't think of any dynamic test which ran quickly. Note that the > > autoconf test takes a few seconds. > > Here's an idea. Create a pipe, but close the read side. Let the > write side be file descriptor W. Write to W. This will give you a > SIGPIPE signal. In the SIGPIPE handler, use dup2 to cause W to point > to /dev/null instead of to the pipe's write side. If system calls are > restarted, the write will succeed; if not, it'll fail with errno set > to SIGINT. It's a clever idea, but it doesn't work on Linux (pipe_write returns EPIPE on a failed write, not ERESTARTSYS, regardless of the signal handler behaviour), and it's hard to convince myself that it will work on 4.2BSD. The 4.2BSD man pages say that system calls are restarted after an interrupt only for certain system calls in certain cases. Specifically, read(), write(), or ioctl() on a ``slow device,'' which means a terminal, or flock() or wait(). If write() to a pipe blocks, it will probably be restarted after a signal (this does happen on Linux). If write() fails with SIGPIPE, the kernel is executing different code. > > How about something like this: > > Thanks. I added a few more details and installed the following: Thanks. Ian