[TUHS] Unix APIs: elegant or not?

Noel Chiappa jnc at mercury.lcs.mit.edu
Mon Nov 5 08:37:46 AEST 2018

    > From: Chris Hanson

    > you should virtually never use read(2), only ever something like this:
    > ...
    > And do this for every classic system call, since virtually no client
    > code should ever have to care about EINTR.

"Virtually". Maybe there are places that want to know if their read call was
interrupted; if you don't make this version available to them, how can they
tell? Leaving the user as much choice as possible is the only way to go, IMO;
why force them to do it the way _you_ think is best?

And it makes the OS simpler; any time you can move functionality out of the
OS, to the user, that's a Good Thing, IMO. There's nothing stopping people
from using the EINTR-hiding wrapper. (Does the Standard I/O library do this,
does anyone know?)


PS: Only system calls that can block can return EINTR; there are quite a few
that don't, not sure what the counts are in modern Unix.

More information about the TUHS mailing list