GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
if (VECTORP (address)) /* AF_INET or AF_INET6 */
{
register struct Lisp_Vector *p = XVECTOR (address);
- Lisp_Object args[6];
+ Lisp_Object args[10];
int nargs, i;
if (p->size == 4 || (p->size == 5 && !NILP (omit_port)))
return Qnil;
for (i = 0; i < nargs; i++)
- args[i+1] = p->contents[i];
+ {
+ EMACS_INT element = XINT (p->contents[i]);
+
+ if (element < 0 || element > 65535)
+ return Qnil;
+
+ if (nargs <= 5 /* IPv4 */
+ && i < 4 /* host, not port */
+ && element > 255)
+ return Qnil;
+
+ args[i+1] = p->contents[i];
+ }
+
return Fformat (nargs+1, args);
}
args[0] = build_string ("<Family %d>");
args[1] = Fcar (address);
return Fformat (2, args);
-
}
return Qnil;
if (CONSP (p->status))
symbol = XCAR (p->status);
-
if (EQ (symbol, Qsignal))
{
Lisp_Object tem;
doc: /* Start a program in a subprocess. Return the process object for it.
NAME is name for process. It is modified if necessary to make it unique.
BUFFER is the buffer (or buffer name) to associate with the process.
- Process output goes at end of that buffer, unless you specify
- an output stream or filter function to handle the output.
- BUFFER may be also nil, meaning that this process is not associated
- with any buffer.
+
+Process output (both standard output and standard error streams) goes
+at end of BUFFER, unless you specify an output stream or filter
+function to handle the output. BUFFER may also be nil, meaning that
+this process is not associated with any buffer.
+
PROGRAM is the program file name. It is searched for in PATH.
Remaining arguments are strings to give program as arguments.
+If you want to separate standard output from standard error, invoke
+the command through a shell and redirect one of them using the shell
+syntax.
+
usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
(nargs, args)
int nargs;
:service SERVICE -- SERVICE is name of the service desired, or an
integer specifying a port number to connect to. If SERVICE is t,
-a random port number is selected for the server.
+a random port number is selected for the server. (If Emacs was
+compiled with getaddrinfo, a port number can also be specified as a
+string, e.g. "80", as well as an integer. This is not portable.)
:type TYPE -- TYPE is the type of connection. The default (nil) is a
stream type connection, `datagram' creates a datagram type connection.
:filter-multibyte BOOL -- If BOOL is non-nil, strings given to the
process filter are multibyte, otherwise they are unibyte.
-If this keyword is not specified, the strings are multibyte iff
+If this keyword is not specified, the strings are multibyte if
`default-enable-multibyte-characters' is non-nil.
:sentinel SENTINEL -- Install SENTINEL as the process sentinel.
#endif
}
+ immediate_quit = 0;
+
#ifdef HAVE_GETADDRINFO
if (res != &ai)
- freeaddrinfo (res);
+ {
+ BLOCK_INPUT;
+ freeaddrinfo (res);
+ UNBLOCK_INPUT;
+ }
#endif
- immediate_quit = 0;
-
/* Discard the unwind protect for closing S, if any. */
specpdl_ptr = specpdl + count1;
If optional fourth arg JUST-THIS-ONE is non-nil, only accept output
from PROCESS, suspending reading output from other processes.
If JUST-THIS-ONE is an integer, don't run any timers either.
-Return non-nil iff we received any output before the timeout expired. */)
+Return non-nil if we received any output before the timeout expired. */)
(process, seconds, millisec, just_this_one)
register Lisp_Object process, seconds, millisec, just_this_one;
{
(and gobble terminal input into the buffer if any arrives).
If WAIT_PROC is specified, wait until something arrives from that
- process. The return value is true iff we read some input from
+ process. The return value is true if we read some input from
that process.
If JUST_WAIT_PROC is non-nil, handle only output from WAIT_PROC
(suspending output from other processes). A negative value
means don't run any timers either.
- If WAIT_PROC is specified, then the function returns true iff we
+ If WAIT_PROC is specified, then the function returns true if we
received input from that process before the timeout elapsed.
- Otherwise, return true iff we received input from any process. */
+ Otherwise, return true if we received input from any process. */
int
wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
subprocess termination and SIGCHLD. */
else if (nread == 0 && !NETCONN_P (proc))
;
-#endif /* O_NDELAY */
-#endif /* O_NONBLOCK */
+#endif /* O_NDELAY */
+#endif /* O_NONBLOCK */
#ifdef HAVE_PTYS
/* On some OSs with ptys, when the process on one end of
a pty exits, the other end gets an error reading with
get a SIGCHLD).
However, it has been known to happen that the SIGCHLD
- got lost. So raise the signl again just in case.
+ got lost. So raise the signal again just in case.
It can't hurt. */
else if (nread == -1 && errno == EIO)
- kill (getpid (), SIGCHLD);
-#endif /* HAVE_PTYS */
+ {
+ /* Clear the descriptor now, so we only raise the signal once. */
+ FD_CLR (channel, &input_wait_mask);
+ FD_CLR (channel, &non_keyboard_wait_mask);
+
+ kill (getpid (), SIGCHLD);
+ }
+#endif /* HAVE_PTYS */
/* If we can detect process termination, don't consider the process
gone just because its pipe is closed. */
#ifdef SIGCHLD
#define WUNTRACED 0
#endif /* no WUNTRACED */
/* Keep trying to get a status until we get a definitive result. */
- while (1)
- {
+ do
+ {
errno = 0;
pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
- if (! (pid < 0 && errno == EINTR))
- break;
- /* Avoid a busyloop: wait3 is a system call, so we do not want
- to prevent the kernel from actually sending SIGCHLD to emacs
- by asking for it all the time. */
- sleep (1);
}
+ while (pid < 0 && errno == EINTR);
if (pid <= 0)
{
do_display != 0 means redisplay should be done to show subprocess
output that arrives.
- Return true iff we received input from any process. */
+ Return true if we received input from any process. */
int
wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,