Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Apr 1995 01:06:53 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bugs@FreeBSD.org, rw@namu01.gwdg.de
Subject:   Re: signal handling bug
Message-ID:  <199504201506.BAA19958@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>Any unix system, I know, except FreeBSD 2.0, behaves as follows,
>if a process is reading from a slow device like standard input from
>a terminal. If this process receives a signal, for which a signal
>handler was installed by the process, then immediately control
>is tranferred to the signal handler (FreeBSD does this as well).
>After the signal was serviced, the read system call is termianted
>and errno is set to EINTR. Rather then doing this, FreeBSD completes
>the read system call, as if no signal would have arrived. This
>misbehavior breaks some of may programs. No matter, how often
>it gets a signal. It NEVER sets errno to EINTR. This behavior
>also contradicts the man page of read.

This is standard BSD behaviour.  See the man pages for signal(),
sigaction() and siginterrupt() and references to the SA_RESTART
sigaction flag in these man pages and in <sys/signal.h>

New code should normally use sigaction() and not the other functions.
sigaction() is precisely defined by POSIX (as not having the SA_RESTART
behaviour by default).  The behaviour of signal() is system dependent.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504201506.BAA19958>