Skip to content

Commit

Permalink
Si EAGAIN lors d'une ecriture, reessayer avec 1 caractere seulement.
Browse files Browse the repository at this point in the history
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@778 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
xavierleroy committed Apr 29, 1996
1 parent 521aa9a commit 749243e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions byterun/io.c
Expand Up @@ -122,11 +122,13 @@ static int do_write(fd, p, n)
if (retcode == -1) {
if (errno == EINTR) goto again;
if (errno == EAGAIN || errno == EWOULDBLOCK) {
/* POSIX says that a write on a pipe in non-blocking mode may return
EAGAIN if it attempts to write more than PIPE_BUF characters,
PIPE_BUF being at least 512. In this case, we try again with
strictly less than PIPE_BUF characters. */
if (n >= 512) { n = 256; goto again; }
/* We couldn't do a partial write here, probably because
n <= PIPE_BUF and POSIX says that writes of less than
PIPE_BUF characters must be atomic.
So, we force a partial write of 1 character.
This should always succeed if we've done a select
on writing just before. */
if (n > 1) { n = 1; goto again; }
}
}
#endif
Expand Down

0 comments on commit 749243e

Please sign in to comment.