# HG changeset patch # User Richard M. Stallman # Date 767078289 0 # Node ID 7032d07f5ad9c8c455f2399a5d9c6ab18dcb46b0 # Parent acf840ff5c1cf8766096bf0da9ccd36c3de1a0ee (max_process_desc): New variable. (wait_reading_process_output): Don't look for process output beyond that many bits. (create_process, Fopen_network_stream, deactivate_process): Update it. (init_process): Initialize it. diff -r acf840ff5c1c -r 7032d07f5ad9 src/process.c --- a/src/process.c Sat Apr 23 05:14:32 1994 +0000 +++ b/src/process.c Sat Apr 23 05:18:09 1994 +0000 @@ -215,6 +215,9 @@ static SELECT_TYPE input_wait_mask; +/* The largest descriptor currently in use for a process object. */ +static int max_process_desc; + /* Descriptor to use for keyboard input. */ static int keyboard_descriptor; @@ -1383,6 +1386,8 @@ XFASTINT (XPROCESS (process)->pid) = pid; FD_SET (inchannel, &input_wait_mask); + if (inchannel > max_process_desc) + max_process_desc = inchannel; /* If the subfork execv fails, and it exits, this close hangs. I don't know why. @@ -1571,6 +1576,8 @@ XSET (XPROCESS (proc)->outfd, Lisp_Int, outch); XPROCESS (proc)->status = Qrun; FD_SET (inch, &input_wait_mask); + if (inch > max_process_desc) + max_process_desc = inch; UNGCPRO; return proc; @@ -1608,6 +1615,16 @@ XSET (p->outfd, Lisp_Int, -1); chan_process[inchannel] = Qnil; FD_CLR (inchannel, &input_wait_mask); + if (inchannel == max_process_desc) + { + int i; + /* We just closed the highest-numbered process input descriptor, + so recompute the highest-numbered one now. */ + max_process_desc = 0; + for (i = 0; i < MAXDESC; i++) + if (!NILP (chan_process[i])) + max_process_desc = i; + } } } @@ -1984,7 +2001,7 @@ /* Really FIRST_PROC_DESC should be 0 on Unix, but this is safer in the short run. */ for (channel = keyboard_descriptor == 0 ? FIRST_PROC_DESC : 0; - channel < MAXDESC; channel++) + channel <= max_process_desc; channel++) { if (FD_ISSET (channel, &Available)) { @@ -3091,6 +3108,7 @@ #endif FD_ZERO (&input_wait_mask); + max_process_desc = 0; keyboard_descriptor = 0; FD_SET (keyboard_descriptor, &input_wait_mask);