Mercurial > emacs
comparison src/process.c @ 7044:7032d07f5ad9
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 23 Apr 1994 05:18:09 +0000 |
parents | 89f37ab7b781 |
children | 1855e568a9b8 |
comparison
equal
deleted
inserted
replaced
7043:acf840ff5c1c | 7044:7032d07f5ad9 |
---|---|
213 | 213 |
214 /* Mask of bits indicating the descriptors that we wait for input on */ | 214 /* Mask of bits indicating the descriptors that we wait for input on */ |
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 |
221 /* Nonzero means delete a process right away if it exits. */ | 224 /* Nonzero means delete a process right away if it exits. */ |
222 static int delete_exited_processes; | 225 static int delete_exited_processes; |
1381 report_file_error ("Doing vfork", Qnil); | 1384 report_file_error ("Doing vfork", Qnil); |
1382 | 1385 |
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. |
1389 So have an interrupt jar it loose. */ | 1394 So have an interrupt jar it loose. */ |
1390 stop_polling (); | 1395 stop_polling (); |
1569 XPROCESS (proc)->pid = Qnil; | 1574 XPROCESS (proc)->pid = Qnil; |
1570 XSET (XPROCESS (proc)->infd, Lisp_Int, s); | 1575 XSET (XPROCESS (proc)->infd, Lisp_Int, s); |
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; |
1577 } | 1584 } |
1578 #endif /* HAVE_SOCKETS */ | 1585 #endif /* HAVE_SOCKETS */ |
1606 | 1613 |
1607 XSET (p->infd, Lisp_Int, -1); | 1614 XSET (p->infd, Lisp_Int, -1); |
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 |
1614 /* Close all descriptors currently in use for communication | 1631 /* Close all descriptors currently in use for communication |
1615 with subprocess. This is used in a newly-forked subprocess | 1632 with subprocess. This is used in a newly-forked subprocess |
1982 | 1999 |
1983 /* Check for data from a process. */ | 2000 /* Check for data from a process. */ |
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 { |
1991 int nread; | 2008 int nread; |
1992 | 2009 |
3089 #endif | 3106 #endif |
3090 signal (SIGCHLD, sigchld_handler); | 3107 signal (SIGCHLD, sigchld_handler); |
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); |
3097 | 3115 |
3098 Vprocess_alist = Qnil; | 3116 Vprocess_alist = Qnil; |