aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert2011-04-15 00:48:51 -0700
committerPaul Eggert2011-04-15 00:48:51 -0700
commit4170f62f39edf1ff1e99aec9bfbfe7bbf10e7fc9 (patch)
treee993b231bb5555c9c961f5d0b20d90ac76f77bbd /src/process.c
parent1963a2e0bb07cc8dee6d27f972f93d9cfd7c6b2d (diff)
parent49093f601b69d91126aefd328ee8f6bfeb797407 (diff)
downloademacs-4170f62f39edf1ff1e99aec9bfbfe7bbf10e7fc9.tar.gz
emacs-4170f62f39edf1ff1e99aec9bfbfe7bbf10e7fc9.zip
Merge from mainline.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c63
1 files changed, 33 insertions, 30 deletions
diff --git a/src/process.c b/src/process.c
index 2c3124f429c..f41cdbe5c71 100644
--- a/src/process.c
+++ b/src/process.c
@@ -24,7 +24,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
24#include <stdio.h> 24#include <stdio.h>
25#include <errno.h> 25#include <errno.h>
26#include <setjmp.h> 26#include <setjmp.h>
27#include <sys/types.h> /* some typedefs are used in sys/file.h */ 27#include <sys/types.h> /* Some typedefs are used in sys/file.h. */
28#include <sys/file.h> 28#include <sys/file.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <setjmp.h> 30#include <setjmp.h>
@@ -128,21 +128,23 @@ int inhibit_sentinels;
128#ifdef subprocesses 128#ifdef subprocesses
129 129
130Lisp_Object Qprocessp; 130Lisp_Object Qprocessp;
131Lisp_Object Qrun, Qstop, Qsignal; 131static Lisp_Object Qrun, Qstop, Qsignal;
132Lisp_Object Qopen, Qclosed, Qconnect, Qfailed, Qlisten; 132static Lisp_Object Qopen, Qclosed, Qconnect, Qfailed, Qlisten;
133Lisp_Object Qlocal, Qipv4, Qdatagram, Qseqpacket; 133Lisp_Object Qlocal;
134Lisp_Object Qreal, Qnetwork, Qserial; 134static Lisp_Object Qipv4, Qdatagram, Qseqpacket;
135static Lisp_Object Qreal, Qnetwork, Qserial;
135#ifdef AF_INET6 136#ifdef AF_INET6
136Lisp_Object Qipv6; 137static Lisp_Object Qipv6;
137#endif 138#endif
138Lisp_Object QCport, QCspeed, QCprocess; 139static Lisp_Object QCport, QCprocess;
140Lisp_Object QCspeed;
139Lisp_Object QCbytesize, QCstopbits, QCparity, Qodd, Qeven; 141Lisp_Object QCbytesize, QCstopbits, QCparity, Qodd, Qeven;
140Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary; 142Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary;
141Lisp_Object QCbuffer, QChost, QCservice; 143static Lisp_Object QCbuffer, QChost, QCservice;
142Lisp_Object QClocal, QCremote, QCcoding; 144static Lisp_Object QClocal, QCremote, QCcoding;
143Lisp_Object QCserver, QCnowait, QCnoquery, QCstop; 145static Lisp_Object QCserver, QCnowait, QCnoquery, QCstop;
144Lisp_Object QCsentinel, QClog, QCoptions, QCplist; 146static Lisp_Object QCsentinel, QClog, QCoptions, QCplist;
145Lisp_Object Qlast_nonmenu_event; 147static Lisp_Object Qlast_nonmenu_event;
146/* QCfamily is declared and initialized in xfaces.c, 148/* QCfamily is declared and initialized in xfaces.c,
147 QCfilter in keyboard.c. */ 149 QCfilter in keyboard.c. */
148extern Lisp_Object QCfamily, QCfilter; 150extern Lisp_Object QCfamily, QCfilter;
@@ -163,12 +165,10 @@ extern Lisp_Object QCfilter;
163extern int h_errno; 165extern int h_errno;
164#endif 166#endif
165 167
166/* These next two vars are non-static since sysdep.c uses them in the
167 emulation of `select'. */
168/* Number of events of change of status of a process. */ 168/* Number of events of change of status of a process. */
169int process_tick; 169static int process_tick;
170/* Number of events for which the user or sentinel has been notified. */ 170/* Number of events for which the user or sentinel has been notified. */
171int update_tick; 171static int update_tick;
172 172
173/* Define NON_BLOCKING_CONNECT if we can support non-blocking connects. */ 173/* Define NON_BLOCKING_CONNECT if we can support non-blocking connects. */
174 174
@@ -235,6 +235,8 @@ static int process_output_skip;
235#define process_output_delay_count 0 235#define process_output_delay_count 0
236#endif 236#endif
237 237
238static Lisp_Object Fget_process (Lisp_Object);
239static void create_process (Lisp_Object, char **, Lisp_Object);
238static int keyboard_bit_set (SELECT_TYPE *); 240static int keyboard_bit_set (SELECT_TYPE *);
239static void deactivate_process (Lisp_Object); 241static void deactivate_process (Lisp_Object);
240static void status_notify (struct Lisp_Process *); 242static void status_notify (struct Lisp_Process *);
@@ -284,10 +286,10 @@ static int max_process_desc;
284static int max_input_desc; 286static int max_input_desc;
285 287
286/* Indexed by descriptor, gives the process (if any) for that descriptor */ 288/* Indexed by descriptor, gives the process (if any) for that descriptor */
287Lisp_Object chan_process[MAXDESC]; 289static Lisp_Object chan_process[MAXDESC];
288 290
289/* Alist of elements (NAME . PROCESS) */ 291/* Alist of elements (NAME . PROCESS) */
290Lisp_Object Vprocess_alist; 292static Lisp_Object Vprocess_alist;
291 293
292/* Buffered-ahead input char from process, indexed by channel. 294/* Buffered-ahead input char from process, indexed by channel.
293 -1 means empty (no char is buffered). 295 -1 means empty (no char is buffered).
@@ -295,8 +297,7 @@ Lisp_Object Vprocess_alist;
295 output from the process is to read at least one char. 297 output from the process is to read at least one char.
296 Always -1 on systems that support FIONREAD. */ 298 Always -1 on systems that support FIONREAD. */
297 299
298/* Don't make static; need to access externally. */ 300static int proc_buffered_char[MAXDESC];
299int proc_buffered_char[MAXDESC];
300 301
301/* Table of `struct coding-system' for each process. */ 302/* Table of `struct coding-system' for each process. */
302static struct coding_system *proc_decode_coding_system[MAXDESC]; 303static struct coding_system *proc_decode_coding_system[MAXDESC];
@@ -304,7 +305,7 @@ static struct coding_system *proc_encode_coding_system[MAXDESC];
304 305
305#ifdef DATAGRAM_SOCKETS 306#ifdef DATAGRAM_SOCKETS
306/* Table of `partner address' for datagram sockets. */ 307/* Table of `partner address' for datagram sockets. */
307struct sockaddr_and_len { 308static struct sockaddr_and_len {
308 struct sockaddr *sa; 309 struct sockaddr *sa;
309 int len; 310 int len;
310} datagram_address[MAXDESC]; 311} datagram_address[MAXDESC];
@@ -320,7 +321,7 @@ static int pty_max_bytes;
320 321
321 322
322 323
323struct fd_callback_data 324static struct fd_callback_data
324{ 325{
325 fd_callback func; 326 fd_callback func;
326 void *data; 327 void *data;
@@ -1083,7 +1084,7 @@ DEFUN ("process-query-on-exit-flag",
1083} 1084}
1084 1085
1085#ifdef DATAGRAM_SOCKETS 1086#ifdef DATAGRAM_SOCKETS
1086Lisp_Object Fprocess_datagram_address (Lisp_Object process); 1087static Lisp_Object Fprocess_datagram_address (Lisp_Object);
1087#endif 1088#endif
1088 1089
1089DEFUN ("process-contact", Fprocess_contact, Sprocess_contact, 1090DEFUN ("process-contact", Fprocess_contact, Sprocess_contact,
@@ -1518,7 +1519,7 @@ create_process_1 (struct atimer *timer)
1518} 1519}
1519 1520
1520 1521
1521void 1522static void
1522create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) 1523create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1523{ 1524{
1524 int inchannel, outchannel; 1525 int inchannel, outchannel;
@@ -3790,7 +3791,7 @@ FLAGS is the current flags of the interface. */)
3790 3791
3791/* Turn off input and output for process PROC. */ 3792/* Turn off input and output for process PROC. */
3792 3793
3793void 3794static void
3794deactivate_process (Lisp_Object proc) 3795deactivate_process (Lisp_Object proc)
3795{ 3796{
3796 register int inchannel, outchannel; 3797 register int inchannel, outchannel;
@@ -5216,8 +5217,8 @@ read_process_output (Lisp_Object proc, register int channel)
5216 5217
5217/* Sending data to subprocess */ 5218/* Sending data to subprocess */
5218 5219
5219jmp_buf send_process_frame; 5220static jmp_buf send_process_frame;
5220Lisp_Object process_sent_to; 5221static Lisp_Object process_sent_to;
5221 5222
5222static void 5223static void
5223send_process_trap (int ignore) 5224send_process_trap (int ignore)
@@ -6984,8 +6985,8 @@ kill_buffer_processes (Lisp_Object buffer)
6984#endif /* subprocesses */ 6985#endif /* subprocesses */
6985} 6986}
6986 6987
6987DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p, 6988DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p,
6988 0, 0, 0, 6989 Swaiting_for_user_input_p, 0, 0, 0,
6989 doc: /* Returns non-nil if Emacs is waiting for input from the user. 6990 doc: /* Returns non-nil if Emacs is waiting for input from the user.
6990This is intended for use by asynchronous process output filters and sentinels. */) 6991This is intended for use by asynchronous process output filters and sentinels. */)
6991 (void) 6992 (void)
@@ -7187,7 +7188,9 @@ init_process (void)
7187 processes. As such, we only change the default value. */ 7188 processes. As such, we only change the default value. */
7188 if (initialized) 7189 if (initialized)
7189 { 7190 {
7190 const char *release = get_operating_system_release (); 7191 char const *release = (STRINGP (Voperating_system_release)
7192 ? SSDATA (Voperating_system_release)
7193 : 0);
7191 if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION 7194 if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION
7192 && release[1] == '.')) { 7195 && release[1] == '.')) {
7193 Vprocess_connection_type = Qnil; 7196 Vprocess_connection_type = Qnil;