Erlang build on Linux
Samuel Tardieu
sam@REDACTED
Thu Nov 25 13:18:14 CET 1999
| FYI, it built fine on my Debian 2.0 (slink) machine with gcc 2.7.2.3.
Yes, but you built it my hand, not as a Debian package (which gives the beam
compiler a non-tty FD as input and a tty FD as output).
The culprit seems to be in erts/emulator/sys/unix/sys.c. In start_cat(),
the following piece of code loops unendlessly when connected to /dev/null:
/*
* Copy standard input to standard output.
*/
for (;;) {
char sbuf[1024];
int n;
int written;
char *s;
n = read(0, sbuf, sizeof(sbuf));
if (n == -1 && (errno == ERRNO_BLOCK || errno == EINTR)) {
continue;
}
0 is a descriptor in non-blocking mode. When there is nothing to read, read()
returns -1 with errno equal to EAGAIN (== ERRNO_BLOCK), thus provoking a loop.
I haven't read this code carefully, but I must admit that I am quite surprised
at this time.
More information about the erlang-questions
mailing list