diff options
| author | Richard M. Stallman | 1994-04-23 05:18:09 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-04-23 05:18:09 +0000 |
| commit | 7d0e672ed43a49f5aaae972b0522bb845d7f9853 (patch) | |
| tree | eb08010c6d3ccbeb0a16e9ef94d30ba034ed6183 /src/process.c | |
| parent | 085fa795f5d6d75891752448e786ae01935fc739 (diff) | |
| download | emacs-7d0e672ed43a49f5aaae972b0522bb845d7f9853.tar.gz emacs-7d0e672ed43a49f5aaae972b0522bb845d7f9853.zip | |
(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.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/process.c b/src/process.c index f33339f5e22..c2b086e810d 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -215,6 +215,9 @@ static int update_tick; | |||
| 215 | 215 | ||
| 216 | static SELECT_TYPE input_wait_mask; | 216 | static SELECT_TYPE input_wait_mask; |
| 217 | 217 | ||
| 218 | /* The largest descriptor currently in use for a process object. */ | ||
| 219 | static int max_process_desc; | ||
| 220 | |||
| 218 | /* Descriptor to use for keyboard input. */ | 221 | /* Descriptor to use for keyboard input. */ |
| 219 | static int keyboard_descriptor; | 222 | static int keyboard_descriptor; |
| 220 | 223 | ||
| @@ -1383,6 +1386,8 @@ create_process (process, new_argv, current_dir) | |||
| 1383 | XFASTINT (XPROCESS (process)->pid) = pid; | 1386 | XFASTINT (XPROCESS (process)->pid) = pid; |
| 1384 | 1387 | ||
| 1385 | FD_SET (inchannel, &input_wait_mask); | 1388 | FD_SET (inchannel, &input_wait_mask); |
| 1389 | if (inchannel > max_process_desc) | ||
| 1390 | max_process_desc = inchannel; | ||
| 1386 | 1391 | ||
| 1387 | /* If the subfork execv fails, and it exits, | 1392 | /* If the subfork execv fails, and it exits, |
| 1388 | this close hangs. I don't know why. | 1393 | this close hangs. I don't know why. |
| @@ -1571,6 +1576,8 @@ Fourth arg SERVICE is name of the service desired, or an integer\n\ | |||
| 1571 | XSET (XPROCESS (proc)->outfd, Lisp_Int, outch); | 1576 | XSET (XPROCESS (proc)->outfd, Lisp_Int, outch); |
| 1572 | XPROCESS (proc)->status = Qrun; | 1577 | XPROCESS (proc)->status = Qrun; |
| 1573 | FD_SET (inch, &input_wait_mask); | 1578 | FD_SET (inch, &input_wait_mask); |
| 1579 | if (inch > max_process_desc) | ||
| 1580 | max_process_desc = inch; | ||
| 1574 | 1581 | ||
| 1575 | UNGCPRO; | 1582 | UNGCPRO; |
| 1576 | return proc; | 1583 | return proc; |
| @@ -1608,6 +1615,16 @@ deactivate_process (proc) | |||
| 1608 | XSET (p->outfd, Lisp_Int, -1); | 1615 | XSET (p->outfd, Lisp_Int, -1); |
| 1609 | chan_process[inchannel] = Qnil; | 1616 | chan_process[inchannel] = Qnil; |
| 1610 | FD_CLR (inchannel, &input_wait_mask); | 1617 | FD_CLR (inchannel, &input_wait_mask); |
| 1618 | if (inchannel == max_process_desc) | ||
| 1619 | { | ||
| 1620 | int i; | ||
| 1621 | /* We just closed the highest-numbered process input descriptor, | ||
| 1622 | so recompute the highest-numbered one now. */ | ||
| 1623 | max_process_desc = 0; | ||
| 1624 | for (i = 0; i < MAXDESC; i++) | ||
| 1625 | if (!NILP (chan_process[i])) | ||
| 1626 | max_process_desc = i; | ||
| 1627 | } | ||
| 1611 | } | 1628 | } |
| 1612 | } | 1629 | } |
| 1613 | 1630 | ||
| @@ -1984,7 +2001,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 1984 | /* Really FIRST_PROC_DESC should be 0 on Unix, | 2001 | /* Really FIRST_PROC_DESC should be 0 on Unix, |
| 1985 | but this is safer in the short run. */ | 2002 | but this is safer in the short run. */ |
| 1986 | for (channel = keyboard_descriptor == 0 ? FIRST_PROC_DESC : 0; | 2003 | for (channel = keyboard_descriptor == 0 ? FIRST_PROC_DESC : 0; |
| 1987 | channel < MAXDESC; channel++) | 2004 | channel <= max_process_desc; channel++) |
| 1988 | { | 2005 | { |
| 1989 | if (FD_ISSET (channel, &Available)) | 2006 | if (FD_ISSET (channel, &Available)) |
| 1990 | { | 2007 | { |
| @@ -3091,6 +3108,7 @@ init_process () | |||
| 3091 | #endif | 3108 | #endif |
| 3092 | 3109 | ||
| 3093 | FD_ZERO (&input_wait_mask); | 3110 | FD_ZERO (&input_wait_mask); |
| 3111 | max_process_desc = 0; | ||
| 3094 | 3112 | ||
| 3095 | keyboard_descriptor = 0; | 3113 | keyboard_descriptor = 0; |
| 3096 | FD_SET (keyboard_descriptor, &input_wait_mask); | 3114 | FD_SET (keyboard_descriptor, &input_wait_mask); |