

Two things every Unix developer should know - mahmud
http://factor-language.blogspot.com/2010/09/two-things-every-unix-developer-should.html

======
cperciva
_The EINTR error can be raised at any time for any reason, so essentially
every I/O operation on a Unix system must be prepared to handle this error
properly. Surprisingly to some, this includes the C standard library functions
such as fread(), fwrite(), and so on._

I think the editors of C99 and POSIX would be surprised by this too. Any non-
buggy fread or fwrite should retry on EINTR.

~~~
sprout
I came here to ask, does anyone know what Unix means in this context?

~~~
slava_pestov
I should say, Unix in this context means any Unix-like system that Factor runs
on (Linux, FreeBSD, OpenBSD, Mac OS X)

~~~
sprout
There are several claims made in the article, and I'm skeptical that all of
those things are completely true for all of those.

~~~
slava_pestov
Each one is true for at least one of those platforms.

------
hvs
Maybe unrelated, but this made me think of "The Rise of 'Worse is Better'":

(NOTE: In this context, "PC" means "Program Counter".)

"... The PC loser-ing problem occurs when a user program invokes a system
routine to perform a lengthy operation that might have significant state, such
as IO buffers. If an interrupt occurs during the operation, the state of the
user program must be saved. Because the invocation of the system routine is
usually a single instruction, the PC of the user program does not adequately
capture the state of the process. The system routine must either back out or
press forward. The right thing is to back out and restore the user program PC
to the instruction that invoked the system routine so that resumption of the
user program after the interrupt, for example, re-enters the system routine.
..."

<http://www.jwz.org/doc/worse-is-better.html>

------
audidude
glibc: TEMP_FAILURE_RETRY()

<http://www.delorie.com/gnu/docs/glibc/libc_498.html>

