[PATCH] Handling of stdin as non-tty and stdout as tty (R6B-0)

Samuel Tardieu sam@REDACTED
Thu Nov 25 14:00:12 CET 1999


The following patch fixes a huge CPU hog when the standard input of the
Erlang process is not a tty while the standard output is.

ERRNO_BLOCK is used to unblock the "cat" process; the code in the release
would however continue to try to "cat" the data.

  Sam

--- erts/emulator/sys/unix/sys.c.orig	Thu Nov 25 13:37:04 1999
+++ erts/emulator/sys/unix/sys.c	Thu Nov 25 13:56:36 1999
@@ -1096,7 +1096,7 @@
 	    char *s;
 
 	    n = read(0, sbuf, sizeof(sbuf));
-	    if (n == -1 && (errno == ERRNO_BLOCK || errno == EINTR)) {
+	    if (n == -1 && errno == EINTR) {
 		continue;
 	    } else if (n <= 0) {
 		exit(0);




More information about the erlang-questions mailing list