Re: Lack of Documentation about SA_RESTART...

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

 




On Mon, 11 Jul 2005, Theodore Ts'o wrote:
> 
> According to the Single Unix Specification V3, all functions that
> return EINTR are supposed to restart if a process receives a signal
> where signal handler has been installed with the SA_RESTART flag.  

That can't be right.

Some operations, like "select()" and "pause()" always return EINTR, and 
indeed, real applications will break if you always restart. Restarting a 
pause() would be nonsensical.

This is why the kernel has ERESTARTSYS (restart always) and ERESTARTNOHAND
(restart if the signal had no handler) which will be turned into EINTR if
SA_RESTART isn't set. And even then, there are some ops that just always
use EINTR and don't even try to restart.

> There may be a few places in the kernel where this isn't happenning,
> that's what the specification states. 

The specs are broken, and apparently don't take real life (or sanity -
pause() in particular just doesn't make sense if restarted) into account.  

Afaik, the historical BSD behaviour (which is what SA_RESTART is all
about) always was to just restart some system calls, not all of them.

		Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux