autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_SYS_RESTARTABLE_SYSCALLS


From: Ian Lance Taylor
Subject: Re: AC_SYS_RESTARTABLE_SYSCALLS
Date: 07 Sep 2003 20:49:29 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Paul Eggert <address@hidden> writes:

> Ian Lance Taylor <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]