Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Aug 1997 14:35:24 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        ache@nagual.pp.ru (=?KOI8-R?B?4c7E0sXKIP7F0s7P1w==?=)
Cc:        sos@sos.freebsd.dk, terry@lambert.org, current@FreeBSD.ORG
Subject:   Re: Error in sleep !
Message-ID:  <199708122135.OAA07747@phaeton.artisoft.com>
In-Reply-To: <Pine.BSF.3.96.970813011057.29729A-100000@lsd.relcom.eu.net> from "=?KOI8-R?B?4c7E0sXKIP7F0s7P1w==?=" at Aug 13, 97 01:12:44 am

next in thread | previous in thread | raw e-mail | index | archive | help
> > > Type "man siginterrupt".
> >
> > Hmm, then that man page is in error too in -current :(
> 
> This man page have nothing common with sleep signals interruption which
> directly required by POSIX in any case.

The man page is for the BSD'ism of "siginterrupt", which was
introduced in Ultrix.

By default, in traditional BSD, after a signal, the call was
restarted.

This man page is incorrect about the default for FreeBSD; so
is the signal man page.

However, the function operates as expected, and can turn on call
restart.

There are *also* POSIX mechanisms to turn on call restart on
a per-signal basis (man sigaction; look for SA_RESTART).

The difference is that historically BSD programs will expect the
call to restart, and historically System V programs will expect
the call to return EINTR (and the programmer to garbage up his
code and his libc with a bazillion checks for EINTR that he really
doesn't want to have to make).

In BSD's 4.2 and prior (except Ultrix), the lack of a siginterrupt()
was handled by setjmp() in the code and longjmp() in the handler to
prevent call restart.  This was usually used in combination with an
alarm() call... mostly for things like device open() timeouts, etc..

One hopes to God that whoever turned on POSIX behaviour as the
default patched each and every lib(3) call that is supposed to
act atomic to correctly deal with idempotence across multiple
system calls for a supposedly atomic operation (for example,
an alarm firing and interrupting an opendir() operation with
an allocation made, but the first getdents() not performed, etc.).

Otherwise, we are just waiting for all hell to break loose... 8-(.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



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