0
|
1 /* Asynchronous subprocess control for XEmacs.
|
|
2 Copyright (C) 1985, 1986, 1987, 1988, 1992, 1993, 1994, 1995
|
|
3 Free Software Foundation, Inc.
|
|
4 Copyright (C) 1995 Sun Microsystems, Inc.
|
|
5 Copyright (C) 1995, 1996 Ben Wing.
|
|
6
|
|
7 This file is part of XEmacs.
|
|
8
|
|
9 XEmacs is free software; you can redistribute it and/or modify it
|
|
10 under the terms of the GNU General Public License as published by the
|
|
11 Free Software Foundation; either version 2, or (at your option) any
|
|
12 later version.
|
|
13
|
|
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
17 for more details.
|
|
18
|
|
19 You should have received a copy of the GNU General Public License
|
|
20 along with XEmacs; see the file COPYING. If not, write to
|
|
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
22 Boston, MA 02111-1307, USA. */
|
|
23
|
259
|
24 /* This file has been Mule-ized except for `start-process-internal',
|
|
25 `open-network-stream-internal' and `open-multicast-group-internal'. */
|
0
|
26
|
263
|
27 /* This file has been split into process.c and process-unix.c by
|
|
28 Kirill M. Katsnelson <kkm@kis.ru>, so please bash him and not
|
|
29 the original author(s) */
|
|
30
|
0
|
31 #include <config.h>
|
|
32
|
|
33 #if !defined (NO_SUBPROCESSES)
|
|
34
|
|
35 /* The entire file is within this conditional */
|
|
36
|
|
37 #include "lisp.h"
|
|
38
|
|
39 #include "buffer.h"
|
|
40 #include "commands.h"
|
|
41 #include "events.h"
|
|
42 #include "frame.h"
|
263
|
43 #include "hash.h"
|
0
|
44 #include "insdel.h"
|
|
45 #include "lstream.h"
|
|
46 #include "opaque.h"
|
|
47 #include "process.h"
|
263
|
48 #include "procimpl.h"
|
0
|
49 #include "window.h"
|
259
|
50 #ifdef FILE_CODING
|
|
51 #include "file-coding.h"
|
70
|
52 #endif
|
0
|
53
|
|
54 #include "sysfile.h"
|
|
55 #include "sysproc.h"
|
|
56 #include "systime.h"
|
|
57 #include "syssignal.h" /* Always include before systty.h */
|
|
58 #include "systty.h"
|
|
59 #include "syswait.h"
|
|
60
|
398
|
61 Lisp_Object Qprocessp, Qprocess_live_p;
|
263
|
62
|
|
63 /* Process methods */
|
|
64 struct process_methods the_process_methods;
|
|
65
|
0
|
66 /* a process object is a network connection when its pid field a cons
|
|
67 (name of name of port we are connected to . foreign host name) */
|
|
68
|
|
69 /* Valid values of process->status_symbol */
|
272
|
70 Lisp_Object Qrun, Qstop;
|
0
|
71 /* Qrun => Qopen, Qexit => Qclosed for "network connection" processes */
|
|
72 Lisp_Object Qopen, Qclosed;
|
263
|
73 /* Protocol families */
|
398
|
74 Lisp_Object Qtcp, Qudp;
|
0
|
75
|
259
|
76 #ifdef HAVE_MULTICAST
|
|
77 Lisp_Object Qmulticast; /* Will be used for occasional warnings */
|
|
78 #endif
|
|
79
|
0
|
80 /* t means use pty, nil means use a pipe,
|
|
81 maybe other values to come. */
|
263
|
82 Lisp_Object Vprocess_connection_type;
|
0
|
83
|
278
|
84 /* Read comments to DEFVAR of this */
|
|
85 int windowed_process_io;
|
|
86
|
153
|
87 #ifdef PROCESS_IO_BLOCKING
|
|
88 /* List of port numbers or port names to set a blocking I/O mode.
|
|
89 Nil means set a non-blocking I/O mode [default]. */
|
263
|
90 Lisp_Object network_stream_blocking_port_list;
|
153
|
91 #endif /* PROCESS_IO_BLOCKING */
|
|
92
|
0
|
93 /* Number of events of change of status of a process. */
|
263
|
94 volatile int process_tick;
|
0
|
95
|
|
96 /* Number of events for which the user or sentinel has been notified. */
|
|
97 static int update_tick;
|
|
98
|
|
99 /* Nonzero means delete a process right away if it exits. */
|
|
100 int delete_exited_processes;
|
|
101
|
380
|
102 /* Hash table which maps USIDs as returned by create_stream_pair_cb to
|
263
|
103 process objects. Processes are not GC-protected through this! */
|
380
|
104 struct hash_table *usid_to_process;
|
0
|
105
|
|
106 /* List of process objects. */
|
|
107 Lisp_Object Vprocess_list;
|
|
108
|
398
|
109 extern Lisp_Object Vlisp_EXEC_SUFFIXES;
|
|
110
|
0
|
111
|
|
112
|
|
113 static Lisp_Object
|
398
|
114 mark_process (Lisp_Object obj)
|
0
|
115 {
|
398
|
116 Lisp_Process *proc = XPROCESS (obj);
|
|
117 MAYBE_PROCMETH (mark_process_data, (proc));
|
|
118 mark_object (proc->name);
|
|
119 mark_object (proc->command);
|
|
120 mark_object (proc->filter);
|
|
121 mark_object (proc->sentinel);
|
|
122 mark_object (proc->buffer);
|
|
123 mark_object (proc->mark);
|
|
124 mark_object (proc->pid);
|
|
125 mark_object (proc->pipe_instream);
|
|
126 mark_object (proc->pipe_outstream);
|
263
|
127 #ifdef FILE_CODING
|
398
|
128 mark_object (proc->coding_instream);
|
|
129 mark_object (proc->coding_outstream);
|
263
|
130 #endif
|
173
|
131 return proc->status_symbol;
|
0
|
132 }
|
|
133
|
|
134 static void
|
|
135 print_process (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
136 {
|
398
|
137 Lisp_Process *proc = XPROCESS (obj);
|
185
|
138
|
0
|
139 if (print_readably)
|
|
140 error ("printing unreadable object #<process %s>",
|
16
|
141 XSTRING_DATA (proc->name));
|
185
|
142
|
0
|
143 if (!escapeflag)
|
|
144 {
|
|
145 print_internal (proc->name, printcharfun, 0);
|
|
146 }
|
|
147 else
|
|
148 {
|
|
149 int netp = network_connection_p (obj);
|
398
|
150 write_c_string ((netp ? GETTEXT ("#<network connection ") :
|
0
|
151 GETTEXT ("#<process ")), printcharfun);
|
|
152 print_internal (proc->name, printcharfun, 1);
|
398
|
153 write_c_string ((netp ? " " : " pid "), printcharfun);
|
0
|
154 print_internal (proc->pid, printcharfun, 1);
|
|
155 write_c_string (" state:", printcharfun);
|
|
156 print_internal (proc->status_symbol, printcharfun, 1);
|
263
|
157 MAYBE_PROCMETH (print_process_data, (proc, printcharfun));
|
0
|
158 write_c_string (">", printcharfun);
|
|
159 }
|
|
160 }
|
|
161
|
|
162 #ifdef HAVE_WINDOW_SYSTEM
|
398
|
163 extern void debug_process_finalization (Lisp_Process *p);
|
0
|
164 #endif /* HAVE_WINDOW_SYSTEM */
|
|
165
|
|
166 static void
|
|
167 finalize_process (void *header, int for_disksave)
|
|
168 {
|
|
169 /* #### this probably needs to be tied into the tty event loop */
|
|
170 /* #### when there is one */
|
398
|
171 Lisp_Process *p = (Lisp_Process *) header;
|
0
|
172 #ifdef HAVE_WINDOW_SYSTEM
|
263
|
173 if (!for_disksave)
|
|
174 {
|
|
175 debug_process_finalization (p);
|
|
176 }
|
0
|
177 #endif /* HAVE_WINDOW_SYSTEM */
|
263
|
178
|
|
179 if (p->process_data)
|
|
180 {
|
|
181 MAYBE_PROCMETH (finalize_process_data, (p, for_disksave));
|
|
182 if (!for_disksave)
|
|
183 xfree (p->process_data);
|
|
184 }
|
0
|
185 }
|
|
186
|
272
|
187 DEFINE_LRECORD_IMPLEMENTATION ("process", process,
|
|
188 mark_process, print_process, finalize_process,
|
398
|
189 0, 0, 0, Lisp_Process);
|
0
|
190
|
|
191 /************************************************************************/
|
|
192 /* basic process accessors */
|
|
193 /************************************************************************/
|
|
194
|
263
|
195 /* Under FILE_CODING, this function returns low-level streams, connected
|
380
|
196 directly to the child process, rather than en/decoding FILE_CODING
|
263
|
197 streams */
|
|
198 void
|
398
|
199 get_process_streams (Lisp_Process *p, Lisp_Object *instr, Lisp_Object *outstr)
|
0
|
200 {
|
263
|
201 assert (p);
|
|
202 assert (NILP (p->pipe_instream) || LSTREAMP(p->pipe_instream));
|
|
203 assert (NILP (p->pipe_outstream) || LSTREAMP(p->pipe_outstream));
|
|
204 *instr = p->pipe_instream;
|
|
205 *outstr = p->pipe_outstream;
|
0
|
206 }
|
|
207
|
398
|
208 Lisp_Process *
|
263
|
209 get_process_from_usid (USID usid)
|
0
|
210 {
|
398
|
211 const void *vval;
|
263
|
212
|
|
213 assert (usid != USID_ERROR && usid != USID_DONTHASH);
|
0
|
214
|
398
|
215 if (gethash ((const void*)usid, usid_to_process, &vval))
|
263
|
216 {
|
|
217 Lisp_Object proc;
|
|
218 CVOID_TO_LISP (proc, vval);
|
|
219 return XPROCESS (proc);
|
|
220 }
|
|
221 else
|
0
|
222 return 0;
|
|
223 }
|
|
224
|
|
225 int
|
398
|
226 get_process_selected_p (Lisp_Process *p)
|
0
|
227 {
|
|
228 return p->selected;
|
|
229 }
|
|
230
|
|
231 void
|
398
|
232 set_process_selected_p (Lisp_Process *p, int selected_p)
|
0
|
233 {
|
|
234 p->selected = !!selected_p;
|
|
235 }
|
|
236
|
263
|
237 int
|
398
|
238 connected_via_filedesc_p (Lisp_Process *p)
|
263
|
239 {
|
|
240 return MAYBE_INT_PROCMETH (tooltalk_connection_p, (p));
|
|
241 }
|
|
242
|
0
|
243 #ifdef HAVE_SOCKETS
|
|
244 int
|
|
245 network_connection_p (Lisp_Object process)
|
|
246 {
|
398
|
247 return CONSP (XPROCESS (process)->pid);
|
0
|
248 }
|
|
249 #endif
|
|
250
|
20
|
251 DEFUN ("processp", Fprocessp, 1, 1, 0, /*
|
0
|
252 Return t if OBJECT is a process.
|
20
|
253 */
|
|
254 (obj))
|
0
|
255 {
|
173
|
256 return PROCESSP (obj) ? Qt : Qnil;
|
0
|
257 }
|
|
258
|
398
|
259 DEFUN ("process-live-p", Fprocess_live_p, 1, 1, 0, /*
|
|
260 Return t if OBJECT is a process that is alive.
|
|
261 */
|
|
262 (obj))
|
|
263 {
|
|
264 return PROCESSP (obj) && PROCESS_LIVE_P (XPROCESS (obj)) ? Qt : Qnil;
|
|
265 }
|
|
266
|
20
|
267 DEFUN ("process-list", Fprocess_list, 0, 0, 0, /*
|
0
|
268 Return a list of all processes.
|
20
|
269 */
|
|
270 ())
|
0
|
271 {
|
|
272 return Fcopy_sequence (Vprocess_list);
|
|
273 }
|
|
274
|
20
|
275 DEFUN ("get-process", Fget_process, 1, 1, 0, /*
|
0
|
276 Return the process named NAME, or nil if there is none.
|
20
|
277 */
|
|
278 (name))
|
0
|
279 {
|
|
280 Lisp_Object tail;
|
|
281
|
398
|
282 if (PROCESSP (name))
|
173
|
283 return name;
|
0
|
284
|
|
285 if (!gc_in_progress)
|
|
286 /* this only gets called during GC when emacs is going away as a result
|
|
287 of a signal or crash. */
|
|
288 CHECK_STRING (name);
|
|
289
|
398
|
290 for (tail = Vprocess_list; CONSP (tail); tail = XCDR (tail))
|
0
|
291 {
|
|
292 Lisp_Object proc = XCAR (tail);
|
|
293 QUIT;
|
195
|
294 if (internal_equal (name, XPROCESS (proc)->name, 0))
|
173
|
295 return XCAR (tail);
|
0
|
296 }
|
|
297 return Qnil;
|
|
298 }
|
|
299
|
20
|
300 DEFUN ("get-buffer-process", Fget_buffer_process, 1, 1, 0, /*
|
0
|
301 Return the (or, a) process associated with BUFFER.
|
|
302 BUFFER may be a buffer or the name of one.
|
20
|
303 */
|
|
304 (name))
|
0
|
305 {
|
|
306 Lisp_Object buf, tail, proc;
|
|
307
|
398
|
308 if (NILP (name)) return Qnil;
|
0
|
309 buf = Fget_buffer (name);
|
398
|
310 if (NILP (buf)) return Qnil;
|
0
|
311
|
398
|
312 for (tail = Vprocess_list; CONSP (tail); tail = XCDR (tail))
|
0
|
313 {
|
|
314 /* jwz: do not quit here - it isn't necessary, as there is no way for
|
|
315 Vprocess_list to get circular or overwhelmingly long, and this
|
|
316 function is called from layout_mode_element under redisplay. */
|
|
317 /* QUIT; */
|
|
318 proc = XCAR (tail);
|
398
|
319 if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf))
|
0
|
320 return proc;
|
|
321 }
|
|
322 return Qnil;
|
|
323 }
|
|
324
|
|
325 /* This is how commands for the user decode process arguments. It
|
|
326 accepts a process, a process name, a buffer, a buffer name, or nil.
|
|
327 Buffers denote the first process in the buffer, and nil denotes the
|
|
328 current buffer. */
|
|
329
|
|
330 static Lisp_Object
|
|
331 get_process (Lisp_Object name)
|
|
332 {
|
136
|
333 Lisp_Object proc, obj;
|
0
|
334
|
|
335 #ifdef I18N3
|
|
336 /* #### Look more closely into translating process names. */
|
|
337 #endif
|
|
338
|
|
339 /* This may be called during a GC from process_send_signal() from
|
|
340 kill_buffer_processes() if emacs decides to abort(). */
|
398
|
341 if (PROCESSP (name))
|
0
|
342 return name;
|
|
343
|
398
|
344 if (STRINGP (name))
|
136
|
345 {
|
|
346 obj = Fget_process (name);
|
398
|
347 if (NILP (obj))
|
136
|
348 obj = Fget_buffer (name);
|
398
|
349 if (NILP (obj))
|
136
|
350 error ("Process %s does not exist", XSTRING_DATA (name));
|
|
351 }
|
398
|
352 else if (NILP (name))
|
136
|
353 obj = Fcurrent_buffer ();
|
|
354 else
|
|
355 obj = name;
|
|
356
|
|
357 /* Now obj should be either a buffer object or a process object.
|
|
358 */
|
398
|
359 if (BUFFERP (obj))
|
136
|
360 {
|
|
361 proc = Fget_buffer_process (obj);
|
398
|
362 if (NILP (proc))
|
136
|
363 error ("Buffer %s has no process", XSTRING_DATA (XBUFFER(obj)->name));
|
|
364 }
|
0
|
365 else
|
|
366 {
|
263
|
367 /* #### This was commented out. Although, simple
|
380
|
368 (kill-process 7 "qqq") resulted in a fatal error. - kkm */
|
263
|
369 CHECK_PROCESS (obj);
|
136
|
370 proc = obj;
|
0
|
371 }
|
136
|
372 return proc;
|
0
|
373 }
|
|
374
|
20
|
375 DEFUN ("process-id", Fprocess_id, 1, 1, 0, /*
|
0
|
376 Return the process id of PROCESS.
|
|
377 This is the pid of the Unix process which PROCESS uses or talks to.
|
|
378 For a network connection, this value is a cons of
|
|
379 (foreign-network-port . foreign-host-name).
|
20
|
380 */
|
|
381 (proc))
|
0
|
382 {
|
|
383 Lisp_Object pid;
|
|
384 CHECK_PROCESS (proc);
|
|
385
|
|
386 pid = XPROCESS (proc)->pid;
|
|
387 if (network_connection_p (proc))
|
173
|
388 /* return Qnil; */
|
|
389 return Fcons (Fcar (pid), Fcdr (pid));
|
0
|
390 else
|
173
|
391 return pid;
|
0
|
392 }
|
|
393
|
20
|
394 DEFUN ("process-name", Fprocess_name, 1, 1, 0, /*
|
0
|
395 Return the name of PROCESS, as a string.
|
|
396 This is the name of the program invoked in PROCESS,
|
|
397 possibly modified to make it unique among process names.
|
20
|
398 */
|
|
399 (proc))
|
0
|
400 {
|
|
401 CHECK_PROCESS (proc);
|
|
402 return XPROCESS (proc)->name;
|
|
403 }
|
|
404
|
20
|
405 DEFUN ("process-command", Fprocess_command, 1, 1, 0, /*
|
0
|
406 Return the command that was executed to start PROCESS.
|
|
407 This is a list of strings, the first string being the program executed
|
|
408 and the rest of the strings being the arguments given to it.
|
20
|
409 */
|
|
410 (proc))
|
0
|
411 {
|
|
412 CHECK_PROCESS (proc);
|
|
413 return XPROCESS (proc)->command;
|
|
414 }
|
|
415
|
|
416
|
|
417 /************************************************************************/
|
|
418 /* creating a process */
|
|
419 /************************************************************************/
|
|
420
|
263
|
421 Lisp_Object
|
0
|
422 make_process_internal (Lisp_Object name)
|
|
423 {
|
|
424 Lisp_Object val, name1;
|
|
425 int i;
|
398
|
426 Lisp_Process *p = alloc_lcrecord_type (Lisp_Process, &lrecord_process);
|
0
|
427
|
|
428 /* If name is already in use, modify it until it is unused. */
|
|
429 name1 = name;
|
|
430 for (i = 1; ; i++)
|
|
431 {
|
|
432 char suffix[10];
|
|
433 Lisp_Object tem = Fget_process (name1);
|
185
|
434 if (NILP (tem))
|
0
|
435 break;
|
|
436 sprintf (suffix, "<%d>", i);
|
|
437 name1 = concat2 (name, build_string (suffix));
|
|
438 }
|
|
439 name = name1;
|
|
440 p->name = name;
|
|
441
|
|
442 p->command = Qnil;
|
|
443 p->filter = Qnil;
|
|
444 p->sentinel = Qnil;
|
|
445 p->buffer = Qnil;
|
|
446 p->mark = Fmake_marker ();
|
|
447 p->pid = Qnil;
|
|
448 p->status_symbol = Qrun;
|
|
449 p->exit_code = 0;
|
|
450 p->core_dumped = 0;
|
|
451 p->filter_does_read = 0;
|
|
452 p->kill_without_query = 0;
|
|
453 p->selected = 0;
|
|
454 p->tick = 0;
|
|
455 p->update_tick = 0;
|
263
|
456 p->pipe_instream = Qnil;
|
|
457 p->pipe_outstream = Qnil;
|
|
458 #ifdef FILE_CODING
|
|
459 p->coding_instream = Qnil;
|
|
460 p->coding_outstream = Qnil;
|
|
461 #endif
|
|
462
|
|
463 p->process_data = 0;
|
|
464 MAYBE_PROCMETH (alloc_process_data, (p));
|
0
|
465
|
|
466 XSETPROCESS (val, p);
|
|
467
|
|
468 Vprocess_list = Fcons (val, Vprocess_list);
|
173
|
469 return val;
|
0
|
470 }
|
|
471
|
263
|
472 void
|
398
|
473 init_process_io_handles (Lisp_Process *p, void* in, void* out, int flags)
|
0
|
474 {
|
263
|
475 USID usid = event_stream_create_stream_pair (in, out,
|
|
476 &p->pipe_instream, &p->pipe_outstream,
|
|
477 flags);
|
0
|
478
|
263
|
479 if (usid == USID_ERROR)
|
|
480 report_file_error ("Setting up communication with subprocess", Qnil);
|
272
|
481
|
263
|
482 if (usid != USID_DONTHASH)
|
0
|
483 {
|
263
|
484 Lisp_Object proc = Qnil;
|
|
485 XSETPROCESS (proc, p);
|
398
|
486 puthash ((const void*)usid, LISP_TO_VOID (proc), usid_to_process);
|
0
|
487 }
|
259
|
488
|
263
|
489 MAYBE_PROCMETH (init_process_io_handles, (p, in, out, flags));
|
259
|
490
|
263
|
491 #ifdef FILE_CODING
|
|
492 p->coding_instream = make_decoding_input_stream
|
|
493 (XLSTREAM (p->pipe_instream),
|
120
|
494 Fget_coding_system (Vcoding_system_for_read));
|
263
|
495 Lstream_set_character_mode (XLSTREAM (p->coding_instream));
|
|
496 p->coding_outstream = make_encoding_output_stream
|
|
497 (XLSTREAM (p->pipe_outstream),
|
120
|
498 Fget_coding_system (Vcoding_system_for_write));
|
70
|
499 /* CODE_CNTL (&out_state[outchannel]) |= CC_END; !!####
|
|
500 What's going on here? */
|
263
|
501 #endif /* FILE_CODING */
|
0
|
502 }
|
|
503
|
|
504 static void
|
288
|
505 create_process (Lisp_Object process, Lisp_Object *argv, int nargv,
|
|
506 Lisp_Object program, Lisp_Object cur_dir)
|
0
|
507 {
|
398
|
508 Lisp_Process *p = XPROCESS (process);
|
263
|
509 int pid;
|
0
|
510
|
263
|
511 /* *_create_process may change status_symbol, if the process
|
|
512 is a kind of "fire-and-forget" (no I/O, unwaitable) */
|
0
|
513 p->status_symbol = Qrun;
|
|
514 p->exit_code = 0;
|
|
515
|
288
|
516 pid = PROCMETH (create_process, (p, argv, nargv, program, cur_dir));
|
0
|
517
|
|
518 p->pid = make_int (pid);
|
398
|
519 if (PROCESS_LIVE_P (p))
|
263
|
520 event_stream_select_process (p);
|
0
|
521 }
|
|
522
|
|
523 /* This function is the unwind_protect form for Fstart_process_internal. If
|
|
524 PROC doesn't have its pid set, then we know someone has signalled
|
|
525 an error and the process wasn't started successfully, so we should
|
|
526 remove it from the process list. */
|
|
527 static void remove_process (Lisp_Object proc);
|
|
528 static Lisp_Object
|
|
529 start_process_unwind (Lisp_Object proc)
|
|
530 {
|
|
531 /* Was PROC started successfully? */
|
|
532 if (EQ (XPROCESS (proc)->pid, Qnil))
|
|
533 remove_process (proc);
|
|
534 return Qnil;
|
|
535 }
|
|
536
|
20
|
537 DEFUN ("start-process-internal", Fstart_process_internal, 3, MANY, 0, /*
|
0
|
538 Start a program in a subprocess. Return the process object for it.
|
|
539 Args are NAME BUFFER PROGRAM &rest PROGRAM-ARGS
|
|
540 NAME is name for process. It is modified if necessary to make it unique.
|
|
541 BUFFER is the buffer or (buffer-name) to associate with the process.
|
|
542 Process output goes at end of that buffer, unless you specify
|
|
543 an output stream or filter function to handle the output.
|
|
544 BUFFER may be also nil, meaning that this process is not associated
|
|
545 with any buffer
|
|
546 Third arg is program file name. It is searched for as in the shell.
|
|
547 Remaining arguments are strings to give program as arguments.
|
|
548 INCODE and OUTCODE specify the coding-system objects used in input/output
|
|
549 from/to the process.
|
20
|
550 */
|
|
551 (int nargs, Lisp_Object *args))
|
0
|
552 {
|
120
|
553 /* This function can call lisp */
|
0
|
554 /* !!#### This function has not been Mule-ized */
|
|
555 Lisp_Object buffer, name, program, proc, current_dir;
|
|
556 Lisp_Object tem;
|
|
557 int speccount = specpdl_depth ();
|
120
|
558 struct gcpro gcpro1, gcpro2, gcpro3;
|
0
|
559
|
120
|
560 name = args[0];
|
0
|
561 buffer = args[1];
|
120
|
562 program = args[2];
|
|
563 current_dir = Qnil;
|
|
564
|
|
565 /* Protect against various file handlers doing GCs below. */
|
|
566 GCPRO3 (buffer, program, current_dir);
|
|
567
|
0
|
568 if (!NILP (buffer))
|
|
569 buffer = Fget_buffer_create (buffer);
|
|
570
|
120
|
571 CHECK_STRING (name);
|
|
572 CHECK_STRING (program);
|
0
|
573
|
|
574 /* Make sure that the child will be able to chdir to the current
|
|
575 buffer's current directory, or its unhandled equivalent. We
|
|
576 can't just have the child check for an error when it does the
|
|
577 chdir, since it's in a vfork.
|
|
578
|
120
|
579 Note: these assignments and calls are like this in order to insure
|
|
580 "caller protects args" GC semantics. */
|
|
581 current_dir = current_buffer->directory;
|
|
582 current_dir = Funhandled_file_name_directory (current_dir);
|
|
583 current_dir = expand_and_dir_to_file (current_dir, Qnil);
|
|
584
|
0
|
585 #if 0 /* This loser breaks ange-ftp */
|
120
|
586 /* dmoore - if you re-enable this code, you have to gcprotect
|
|
587 current_buffer through the above calls. */
|
|
588 if (NILP (Ffile_accessible_directory_p (current_dir)))
|
|
589 report_file_error ("Setting current directory",
|
|
590 list1 (current_buffer->directory));
|
0
|
591 #endif /* 0 */
|
|
592
|
|
593 /* If program file name is not absolute, search our path for it */
|
82
|
594 if (!IS_DIRECTORY_SEP (XSTRING_BYTE (program, 0))
|
16
|
595 && !(XSTRING_LENGTH (program) > 1
|
82
|
596 && IS_DEVICE_SEP (XSTRING_BYTE (program, 1))))
|
0
|
597 {
|
120
|
598 struct gcpro ngcpro1;
|
70
|
599
|
0
|
600 tem = Qnil;
|
120
|
601 NGCPRO1 (tem);
|
398
|
602 locate_file (Vexec_path, program, Vlisp_EXEC_SUFFIXES, &tem, X_OK);
|
0
|
603 if (NILP (tem))
|
|
604 report_file_error ("Searching for program", list1 (program));
|
120
|
605 program = Fexpand_file_name (tem, Qnil);
|
|
606 NUNGCPRO;
|
0
|
607 }
|
|
608 else
|
|
609 {
|
|
610 if (!NILP (Ffile_directory_p (program)))
|
|
611 error ("Specified program for new process is a directory");
|
|
612 }
|
|
613
|
|
614 proc = make_process_internal (name);
|
|
615
|
|
616 XPROCESS (proc)->buffer = buffer;
|
|
617 XPROCESS (proc)->command = Flist (nargs - 2,
|
|
618 args + 2);
|
|
619
|
|
620 /* Make the process marker point into the process buffer (if any). */
|
|
621 if (!NILP (buffer))
|
|
622 Fset_marker (XPROCESS (proc)->mark,
|
|
623 make_int (BUF_ZV (XBUFFER (buffer))), buffer);
|
|
624
|
|
625 /* If an error occurs and we can't start the process, we want to
|
|
626 remove it from the process list. This means that each error
|
|
627 check in create_process doesn't need to call remove_process
|
|
628 itself; it's all taken care of here. */
|
|
629 record_unwind_protect (start_process_unwind, proc);
|
|
630
|
288
|
631 create_process (proc, args + 3, nargs - 3, program, current_dir);
|
0
|
632
|
120
|
633 UNGCPRO;
|
0
|
634 return unbind_to (speccount, proc);
|
|
635 }
|
|
636
|
|
637
|
|
638 #ifdef HAVE_SOCKETS
|
|
639
|
|
640
|
263
|
641 /* #### The network support is fairly synthetical. What we actually
|
|
642 need is a single function, which supports all datagram, stream and
|
|
643 packet stream connections, arbitrary protocol families should they
|
|
644 be supported by the target system, multicast groups, in both data
|
|
645 and control rooted/nonrooted flavors, service quality etc whatever
|
|
646 is supported by the underlying network.
|
0
|
647
|
263
|
648 It must accept a property list describing the connection. The current
|
|
649 functions must then go to lisp and provide a suitable list for the
|
|
650 generalized connection function.
|
0
|
651
|
380
|
652 Both UNIX and Win32 support BSD sockets, and there are many extensions
|
|
653 available (Sockets 2 spec).
|
0
|
654
|
263
|
655 A todo is define a consistent set of properties abstracting a
|
|
656 network connection. -kkm
|
|
657 */
|
|
658
|
0
|
659
|
|
660 /* open a TCP network connection to a given HOST/SERVICE. Treated
|
|
661 exactly like a normal process when reading and writing. Only
|
|
662 differences are in status display and process deletion. A network
|
|
663 connection has no PID; you cannot signal it. All you can do is
|
|
664 deactivate and close it via delete-process */
|
|
665
|
263
|
666 DEFUN ("open-network-stream-internal", Fopen_network_stream_internal, 4, 5, 0, /*
|
0
|
667 Open a TCP connection for a service to a host.
|
398
|
668 Return a subprocess-object to represent the connection.
|
0
|
669 Input and output work as for subprocesses; `delete-process' closes it.
|
70
|
670
|
0
|
671 NAME is name for process. It is modified if necessary to make it unique.
|
|
672 BUFFER is the buffer (or buffer-name) to associate with the process.
|
|
673 Process output goes at end of that buffer, unless you specify
|
|
674 an output stream or filter function to handle the output.
|
70
|
675 BUFFER may also be nil, meaning that this process is not associated
|
|
676 with any buffer.
|
0
|
677 Third arg is name of the host to connect to, or its IP address.
|
|
678 Fourth arg SERVICE is name of the service desired, or an integer
|
|
679 specifying a port number to connect to.
|
398
|
680 Fifth argument PROTOCOL is a network protocol. Currently 'tcp
|
|
681 (Transmission Control Protocol) and 'udp (User Datagram Protocol) are
|
|
682 supported. When omitted, 'tcp is assumed.
|
|
683
|
|
684 Ouput via `process-send-string' and input via buffer or filter (see
|
|
685 `set-process-filter') are stream-oriented. That means UDP datagrams are
|
|
686 not guaranteed to be sent and received in discrete packets. (But small
|
|
687 datagrams around 500 bytes that are not truncated by `process-send-string'
|
|
688 are usually fine.) Note further that UDP protocol does not guard against
|
|
689 lost packets.
|
20
|
690 */
|
398
|
691 (name, buffer, host, service, protocol))
|
0
|
692 {
|
|
693 /* !!#### This function has not been Mule-ized */
|
|
694 /* This function can GC */
|
263
|
695 Lisp_Object proc = Qnil;
|
|
696 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, ngcpro1;
|
|
697 void *inch, *outch;
|
0
|
698
|
398
|
699 GCPRO5 (name, buffer, host, service, protocol);
|
0
|
700 CHECK_STRING (name);
|
|
701
|
398
|
702 if (NILP(protocol))
|
|
703 protocol = Qtcp;
|
263
|
704 else
|
398
|
705 CHECK_SYMBOL (protocol);
|
0
|
706
|
263
|
707 /* Since this code is inside HAVE_SOCKETS, existence of
|
|
708 open_network_stream is mandatory */
|
398
|
709 PROCMETH (open_network_stream, (name, host, service, protocol,
|
263
|
710 &inch, &outch));
|
272
|
711
|
0
|
712 if (!NILP (buffer))
|
|
713 buffer = Fget_buffer_create (buffer);
|
|
714 proc = make_process_internal (name);
|
263
|
715 NGCPRO1 (proc);
|
0
|
716
|
|
717 XPROCESS (proc)->pid = Fcons (service, host);
|
|
718 XPROCESS (proc)->buffer = buffer;
|
282
|
719 init_process_io_handles (XPROCESS (proc), (void*)inch, (void*)outch,
|
|
720 STREAM_NETWORK_CONNECTION);
|
0
|
721
|
|
722 event_stream_select_process (XPROCESS (proc));
|
|
723
|
|
724 UNGCPRO;
|
263
|
725 NUNGCPRO;
|
0
|
726 return proc;
|
|
727 }
|
|
728
|
259
|
729 #ifdef HAVE_MULTICAST
|
|
730
|
|
731 DEFUN ("open-multicast-group-internal", Fopen_multicast_group_internal, 5, 5, 0, /*
|
|
732 Open a multicast connection on the specified dest/port/ttl.
|
398
|
733 Return a subprocess-object to represent the connection.
|
259
|
734 Input and output work as for subprocesses; `delete-process' closes it.
|
|
735
|
|
736 NAME is name for process. It is modified if necessary to make it unique.
|
|
737 BUFFER is the buffer (or buffer-name) to associate with the process.
|
|
738 Process output goes at end of that buffer, unless you specify
|
|
739 an output stream or filter function to handle the output.
|
|
740 BUFFER may also be nil, meaning that this process is not associated
|
|
741 with any buffer.
|
|
742 Third, fourth and fifth args are the multicast destination group, port and ttl.
|
|
743 dest must be an internet address between 224.0.0.0 and 239.255.255.255
|
|
744 port is a communication port like in traditional unicast
|
|
745 ttl is the time-to-live (15 for site, 63 for region and 127 for world)
|
|
746 */
|
|
747 (name, buffer, dest, port, ttl))
|
|
748 {
|
|
749 /* !!#### This function has not been Mule-ized */
|
|
750 /* This function can GC */
|
263
|
751 Lisp_Object proc = Qnil;
|
259
|
752 struct gcpro gcpro1;
|
263
|
753 void *inch, *outch;
|
259
|
754
|
263
|
755 CHECK_STRING (name);
|
|
756
|
|
757 /* Since this code is inside HAVE_MULTICAST, existence of
|
|
758 open_network_stream is mandatory */
|
|
759 PROCMETH (open_multicast_group, (name, dest, port, ttl,
|
|
760 &inch, &outch));
|
272
|
761
|
259
|
762 if (!NILP (buffer))
|
|
763 buffer = Fget_buffer_create (buffer);
|
|
764
|
|
765 proc = make_process_internal (name);
|
|
766 GCPRO1 (proc);
|
|
767
|
|
768 XPROCESS (proc)->pid = Fcons (port, dest);
|
|
769 XPROCESS (proc)->buffer = buffer;
|
282
|
770 init_process_io_handles (XPROCESS (proc), (void*)inch, (void*)outch,
|
|
771 STREAM_NETWORK_CONNECTION);
|
272
|
772
|
259
|
773 event_stream_select_process (XPROCESS (proc));
|
272
|
774
|
259
|
775 UNGCPRO;
|
|
776 return proc;
|
|
777 }
|
|
778 #endif /* HAVE_MULTICAST */
|
|
779
|
0
|
780 #endif /* HAVE_SOCKETS */
|
|
781
|
|
782 Lisp_Object
|
|
783 canonicalize_host_name (Lisp_Object host)
|
|
784 {
|
263
|
785 return PROCMETH_OR_GIVEN (canonicalize_host_name, (host), host);
|
0
|
786 }
|
|
787
|
|
788
|
20
|
789 DEFUN ("set-process-window-size", Fset_process_window_size, 3, 3, 0, /*
|
0
|
790 Tell PROCESS that it has logical window size HEIGHT and WIDTH.
|
20
|
791 */
|
|
792 (proc, height, width))
|
0
|
793 {
|
|
794 CHECK_PROCESS (proc);
|
|
795 CHECK_NATNUM (height);
|
|
796 CHECK_NATNUM (width);
|
263
|
797 return
|
|
798 MAYBE_INT_PROCMETH (set_window_size, (XPROCESS (proc), XINT (height), XINT (width))) <= 0
|
|
799 ? Qnil : Qt;
|
0
|
800 }
|
|
801
|
|
802
|
|
803 /************************************************************************/
|
|
804 /* Process I/O */
|
|
805 /************************************************************************/
|
|
806
|
|
807 /* Read pending output from the process channel,
|
|
808 starting with our buffered-ahead character if we have one.
|
|
809 Yield number of characters read.
|
|
810
|
|
811 This function reads at most 1024 bytes.
|
|
812 If you want to read all available subprocess output,
|
|
813 you must call it repeatedly until it returns zero. */
|
|
814
|
|
815 Charcount
|
|
816 read_process_output (Lisp_Object proc)
|
|
817 {
|
|
818 /* This function can GC */
|
|
819 Bytecount nbytes, nchars;
|
|
820 Bufbyte chars[1024];
|
|
821 Lisp_Object outstream;
|
398
|
822 Lisp_Process *p = XPROCESS (proc);
|
0
|
823
|
|
824 /* If there is a lot of output from the subprocess, the loop in
|
|
825 execute_internal_event() might call read_process_output() more
|
|
826 than once. If the filter that was executed from one of these
|
|
827 calls set the filter to t, we have to stop now. Return -1 rather
|
|
828 than 0 so execute_internal_event() doesn't close the process.
|
|
829 Really, the loop in execute_internal_event() should check itself
|
|
830 for a process-filter change, like in status_notify(); but the
|
|
831 struct Lisp_Process is not exported outside of this file. */
|
398
|
832 if (!PROCESS_LIVE_P (p))
|
0
|
833 return -1; /* already closed */
|
|
834
|
|
835 if (!NILP (p->filter) && (p->filter_does_read))
|
|
836 {
|
|
837 Lisp_Object filter_result;
|
|
838
|
|
839 /* Some weird FSFmacs crap here with
|
|
840 Vdeactivate_mark and current_buffer->keymap */
|
|
841 running_asynch_code = 1;
|
|
842 filter_result = call2_trapping_errors ("Error in process filter",
|
|
843 p->filter, proc, Qnil);
|
|
844 running_asynch_code = 0;
|
|
845 restore_match_data ();
|
|
846 CHECK_INT (filter_result);
|
|
847 return XINT (filter_result);
|
|
848 }
|
|
849
|
263
|
850 nbytes = Lstream_read (XLSTREAM (DATA_INSTREAM(p)), chars, sizeof (chars));
|
0
|
851 if (nbytes <= 0) return nbytes;
|
|
852
|
|
853 nchars = bytecount_to_charcount (chars, nbytes);
|
|
854 outstream = p->filter;
|
|
855 if (!NILP (outstream))
|
|
856 {
|
|
857 /* We used to bind inhibit-quit to t here, but
|
|
858 call2_trapping_errors() does that for us. */
|
|
859 running_asynch_code = 1;
|
|
860 call2_trapping_errors ("Error in process filter",
|
|
861 outstream, proc, make_string (chars, nbytes));
|
|
862 running_asynch_code = 0;
|
|
863 restore_match_data ();
|
173
|
864 return nchars;
|
0
|
865 }
|
|
866
|
|
867 /* If no filter, write into buffer if it isn't dead. */
|
|
868 if (!NILP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer)))
|
|
869 {
|
|
870 Lisp_Object old_read_only = Qnil;
|
|
871 Bufpos old_point;
|
|
872 Bufpos old_begv;
|
|
873 Bufpos old_zv;
|
|
874 int old_zmacs_region_stays = zmacs_region_stays;
|
|
875 struct gcpro gcpro1, gcpro2;
|
|
876 struct buffer *buf = XBUFFER (p->buffer);
|
|
877
|
|
878 GCPRO2 (proc, old_read_only);
|
|
879
|
|
880 old_point = BUF_PT (buf);
|
|
881 old_begv = BUF_BEGV (buf);
|
|
882 old_zv = BUF_ZV (buf);
|
|
883 old_read_only = buf->read_only;
|
|
884 buf->read_only = Qnil;
|
|
885
|
|
886 /* Insert new output into buffer
|
|
887 at the current end-of-output marker,
|
|
888 thus preserving logical ordering of input and output. */
|
|
889 if (XMARKER (p->mark)->buffer)
|
|
890 BUF_SET_PT (buf,
|
|
891 bufpos_clip_to_bounds (old_begv, marker_position (p->mark),
|
|
892 old_zv));
|
|
893 else
|
|
894 BUF_SET_PT (buf, old_zv);
|
|
895
|
|
896 /* If the output marker is outside of the visible region, save
|
|
897 the restriction and widen. */
|
|
898 if (! (BUF_BEGV (buf) <= BUF_PT (buf) &&
|
|
899 BUF_PT (buf) <= BUF_ZV (buf)))
|
|
900 Fwiden (p->buffer);
|
|
901
|
|
902 /* Make sure opoint floats ahead of any new text, just as point
|
|
903 would. */
|
|
904 if (BUF_PT (buf) <= old_point)
|
|
905 old_point += nchars;
|
|
906
|
|
907 /* Insert after old_begv, but before old_zv. */
|
|
908 if (BUF_PT (buf) < old_begv)
|
|
909 old_begv += nchars;
|
|
910 if (BUF_PT (buf) <= old_zv)
|
|
911 old_zv += nchars;
|
|
912
|
|
913 #if 0
|
380
|
914 /* This screws up initial display of the window. jla */
|
0
|
915
|
|
916 /* Insert before markers in case we are inserting where
|
|
917 the buffer's mark is, and the user's next command is Meta-y. */
|
|
918 buffer_insert_raw_string_1 (buf, -1, chars,
|
|
919 nbytes, INSDEL_BEFORE_MARKERS);
|
|
920 #else
|
|
921 buffer_insert_raw_string (buf, chars, nbytes);
|
|
922 #endif
|
|
923
|
|
924 Fset_marker (p->mark, make_int (BUF_PT (buf)), p->buffer);
|
|
925
|
|
926 MARK_MODELINE_CHANGED;
|
|
927
|
|
928 /* If the restriction isn't what it should be, set it. */
|
|
929 if (old_begv != BUF_BEGV (buf) || old_zv != BUF_ZV (buf))
|
161
|
930 {
|
|
931 Fwiden(p->buffer);
|
|
932 old_begv = bufpos_clip_to_bounds (BUF_BEG (buf),
|
|
933 old_begv,
|
|
934 BUF_Z (buf));
|
|
935 old_zv = bufpos_clip_to_bounds (BUF_BEG (buf),
|
|
936 old_zv,
|
|
937 BUF_Z (buf));
|
|
938 Fnarrow_to_region (make_int (old_begv), make_int (old_zv),
|
|
939 p->buffer);
|
|
940 }
|
0
|
941
|
|
942 /* Handling the process output should not deactivate the mark. */
|
|
943 zmacs_region_stays = old_zmacs_region_stays;
|
|
944 buf->read_only = old_read_only;
|
161
|
945 old_point = bufpos_clip_to_bounds (BUF_BEGV (buf),
|
|
946 old_point,
|
|
947 BUF_ZV (buf));
|
0
|
948 BUF_SET_PT (buf, old_point);
|
|
949
|
|
950 UNGCPRO;
|
|
951 }
|
173
|
952 return nchars;
|
0
|
953 }
|
263
|
954
|
0
|
955 /* Sending data to subprocess */
|
|
956
|
|
957 /* send some data to process PROC. If NONRELOCATABLE is non-NULL, it
|
|
958 specifies the address of the data. Otherwise, the data comes from the
|
|
959 object RELOCATABLE (either a string or a buffer). START and LEN
|
|
960 specify the offset and length of the data to send.
|
|
961
|
|
962 Note that START and LEN are in Bufpos's if RELOCATABLE is a buffer,
|
|
963 and in Bytecounts otherwise. */
|
|
964
|
263
|
965 void
|
|
966 send_process (Lisp_Object proc,
|
398
|
967 Lisp_Object relocatable, const Bufbyte *nonrelocatable,
|
0
|
968 int start, int len)
|
|
969 {
|
|
970 /* This function can GC */
|
|
971 struct gcpro gcpro1, gcpro2;
|
|
972 Lisp_Object lstream = Qnil;
|
|
973
|
263
|
974 GCPRO2 (proc, lstream);
|
0
|
975
|
263
|
976 if (NILP (DATA_OUTSTREAM (XPROCESS (proc))))
|
0
|
977 signal_simple_error ("Process not open for writing", proc);
|
|
978
|
|
979 if (nonrelocatable)
|
|
980 lstream =
|
|
981 make_fixed_buffer_input_stream (nonrelocatable + start, len);
|
398
|
982 else if (BUFFERP (relocatable))
|
0
|
983 lstream = make_lisp_buffer_input_stream (XBUFFER (relocatable),
|
|
984 start, start + len, 0);
|
|
985 else
|
|
986 lstream = make_lisp_string_input_stream (relocatable, start, len);
|
|
987
|
263
|
988 PROCMETH (send_process, (proc, XLSTREAM (lstream)));
|
0
|
989
|
|
990 UNGCPRO;
|
185
|
991 Lstream_delete (XLSTREAM (lstream));
|
0
|
992 }
|
|
993
|
20
|
994 DEFUN ("process-tty-name", Fprocess_tty_name, 1, 1, 0, /*
|
0
|
995 Return the name of the terminal PROCESS uses, or nil if none.
|
|
996 This is the terminal that the process itself reads and writes on,
|
|
997 not the name of the pty that Emacs uses to talk with that terminal.
|
20
|
998 */
|
|
999 (proc))
|
0
|
1000 {
|
|
1001 CHECK_PROCESS (proc);
|
263
|
1002 return MAYBE_LISP_PROCMETH (get_tty_name, (XPROCESS (proc)));
|
0
|
1003 }
|
|
1004
|
20
|
1005 DEFUN ("set-process-buffer", Fset_process_buffer, 2, 2, 0, /*
|
0
|
1006 Set buffer associated with PROCESS to BUFFER (a buffer, or nil).
|
20
|
1007 */
|
|
1008 (proc, buffer))
|
0
|
1009 {
|
|
1010 CHECK_PROCESS (proc);
|
|
1011 if (!NILP (buffer))
|
|
1012 CHECK_BUFFER (buffer);
|
|
1013 XPROCESS (proc)->buffer = buffer;
|
|
1014 return buffer;
|
|
1015 }
|
|
1016
|
20
|
1017 DEFUN ("process-buffer", Fprocess_buffer, 1, 1, 0, /*
|
0
|
1018 Return the buffer PROCESS is associated with.
|
|
1019 Output from PROCESS is inserted in this buffer
|
|
1020 unless PROCESS has a filter.
|
20
|
1021 */
|
|
1022 (proc))
|
0
|
1023 {
|
|
1024 CHECK_PROCESS (proc);
|
|
1025 return XPROCESS (proc)->buffer;
|
|
1026 }
|
|
1027
|
20
|
1028 DEFUN ("process-mark", Fprocess_mark, 1, 1, 0, /*
|
0
|
1029 Return the marker for the end of the last output from PROCESS.
|
20
|
1030 */
|
|
1031 (proc))
|
0
|
1032 {
|
|
1033 CHECK_PROCESS (proc);
|
|
1034 return XPROCESS (proc)->mark;
|
|
1035 }
|
|
1036
|
|
1037 void
|
|
1038 set_process_filter (Lisp_Object proc, Lisp_Object filter, int filter_does_read)
|
|
1039 {
|
|
1040 CHECK_PROCESS (proc);
|
398
|
1041 if (PROCESS_LIVE_P (XPROCESS (proc))) {
|
0
|
1042 if (EQ (filter, Qt))
|
|
1043 event_stream_unselect_process (XPROCESS (proc));
|
|
1044 else
|
|
1045 event_stream_select_process (XPROCESS (proc));
|
233
|
1046 }
|
0
|
1047
|
|
1048 XPROCESS (proc)->filter = filter;
|
|
1049 XPROCESS (proc)->filter_does_read = filter_does_read;
|
|
1050 }
|
|
1051
|
20
|
1052 DEFUN ("set-process-filter", Fset_process_filter, 2, 2, 0, /*
|
0
|
1053 Give PROCESS the filter function FILTER; nil means no filter.
|
|
1054 t means stop accepting output from the process.
|
|
1055 When a process has a filter, each time it does output
|
|
1056 the entire string of output is passed to the filter.
|
|
1057 The filter gets two arguments: the process and the string of output.
|
|
1058 If the process has a filter, its buffer is not used for output.
|
20
|
1059 */
|
|
1060 (proc, filter))
|
0
|
1061 {
|
|
1062 set_process_filter (proc, filter, 0);
|
|
1063 return filter;
|
|
1064 }
|
|
1065
|
20
|
1066 DEFUN ("process-filter", Fprocess_filter, 1, 1, 0, /*
|
0
|
1067 Return the filter function of PROCESS; nil if none.
|
|
1068 See `set-process-filter' for more info on filter functions.
|
20
|
1069 */
|
|
1070 (proc))
|
0
|
1071 {
|
|
1072 CHECK_PROCESS (proc);
|
|
1073 return XPROCESS (proc)->filter;
|
|
1074 }
|
|
1075
|
20
|
1076 DEFUN ("process-send-region", Fprocess_send_region, 3, 3, 0, /*
|
0
|
1077 Send current contents of region as input to PROCESS.
|
|
1078 PROCESS may be a process name or an actual process.
|
|
1079 Called from program, takes three arguments, PROCESS, START and END.
|
|
1080 If the region is more than 500 or so characters long,
|
|
1081 it is sent in several bunches. This may happen even for shorter regions.
|
|
1082 Output from processes can arrive in between bunches.
|
20
|
1083 */
|
|
1084 (process, start, end))
|
0
|
1085 {
|
|
1086 /* This function can GC */
|
|
1087 Lisp_Object proc = get_process (process);
|
|
1088 Bufpos st, en;
|
|
1089
|
|
1090 get_buffer_range_char (current_buffer, start, end, &st, &en, 0);
|
|
1091
|
|
1092 send_process (proc, Fcurrent_buffer (), 0,
|
|
1093 st, en - st);
|
173
|
1094 return Qnil;
|
0
|
1095 }
|
|
1096
|
20
|
1097 DEFUN ("process-send-string", Fprocess_send_string, 2, 4, 0, /*
|
0
|
1098 Send PROCESS the contents of STRING as input.
|
|
1099 PROCESS may be a process name or an actual process.
|
|
1100 Optional arguments FROM and TO specify part of STRING, see `substring'.
|
|
1101 If STRING is more than 500 or so characters long,
|
|
1102 it is sent in several bunches. This may happen even for shorter strings.
|
|
1103 Output from processes can arrive in between bunches.
|
20
|
1104 */
|
|
1105 (process, string, from, to))
|
0
|
1106 {
|
|
1107 /* This function can GC */
|
|
1108 Lisp_Object proc;
|
|
1109 Bytecount len;
|
|
1110 Bytecount bfr, bto;
|
|
1111
|
|
1112 proc = get_process (process);
|
|
1113 CHECK_STRING (string);
|
|
1114 get_string_range_byte (string, from, to, &bfr, &bto,
|
|
1115 GB_HISTORICAL_STRING_BEHAVIOR);
|
|
1116 len = bto - bfr;
|
|
1117
|
|
1118 send_process (proc, string, 0, bfr, len);
|
173
|
1119 return Qnil;
|
0
|
1120 }
|
|
1121
|
259
|
1122 #ifdef FILE_CODING
|
70
|
1123
|
|
1124 DEFUN ("process-input-coding-system", Fprocess_input_coding_system, 1, 1, 0, /*
|
|
1125 Return PROCESS's input coding system.
|
|
1126 */
|
|
1127 (process))
|
|
1128 {
|
|
1129 process = get_process (process);
|
398
|
1130 CHECK_LIVE_PROCESS (process);
|
263
|
1131 return decoding_stream_coding_system (XLSTREAM (XPROCESS (process)->coding_instream) );
|
70
|
1132 }
|
|
1133
|
|
1134 DEFUN ("process-output-coding-system", Fprocess_output_coding_system, 1, 1, 0, /*
|
|
1135 Return PROCESS's output coding system.
|
|
1136 */
|
|
1137 (process))
|
|
1138 {
|
|
1139 process = get_process (process);
|
398
|
1140 CHECK_LIVE_PROCESS (process);
|
263
|
1141 return encoding_stream_coding_system (XLSTREAM (XPROCESS (process)->coding_outstream));
|
70
|
1142 }
|
|
1143
|
120
|
1144 DEFUN ("process-coding-system", Fprocess_coding_system, 1, 1, 0, /*
|
|
1145 Return a pair of coding-system for decoding and encoding of PROCESS.
|
|
1146 */
|
|
1147 (process))
|
|
1148 {
|
|
1149 process = get_process (process);
|
398
|
1150 CHECK_LIVE_PROCESS (process);
|
175
|
1151 return Fcons (decoding_stream_coding_system
|
263
|
1152 (XLSTREAM (XPROCESS (process)->coding_instream)),
|
175
|
1153 encoding_stream_coding_system
|
263
|
1154 (XLSTREAM (XPROCESS (process)->coding_outstream)));
|
120
|
1155 }
|
|
1156
|
280
|
1157 DEFUN ("set-process-input-coding-system", Fset_process_input_coding_system,
|
|
1158 2, 2, 0, /*
|
70
|
1159 Set PROCESS's input coding system to CODESYS.
|
|
1160 */
|
|
1161 (process, codesys))
|
|
1162 {
|
|
1163 codesys = Fget_coding_system (codesys);
|
|
1164 process = get_process (process);
|
398
|
1165 CHECK_LIVE_PROCESS (process);
|
|
1166
|
280
|
1167 set_decoding_stream_coding_system
|
|
1168 (XLSTREAM (XPROCESS (process)->coding_instream), codesys);
|
70
|
1169 return Qnil;
|
|
1170 }
|
|
1171
|
280
|
1172 DEFUN ("set-process-output-coding-system", Fset_process_output_coding_system,
|
|
1173 2, 2, 0, /*
|
70
|
1174 Set PROCESS's output coding system to CODESYS.
|
|
1175 */
|
|
1176 (process, codesys))
|
|
1177 {
|
|
1178 codesys = Fget_coding_system (codesys);
|
|
1179 process = get_process (process);
|
398
|
1180 CHECK_LIVE_PROCESS (process);
|
|
1181
|
70
|
1182 set_encoding_stream_coding_system
|
280
|
1183 (XLSTREAM (XPROCESS (process)->coding_outstream), codesys);
|
70
|
1184 return Qnil;
|
|
1185 }
|
|
1186
|
280
|
1187 DEFUN ("set-process-coding-system", Fset_process_coding_system,
|
|
1188 1, 3, 0, /*
|
120
|
1189 Set coding-systems of PROCESS to DECODING and ENCODING.
|
398
|
1190 DECODING will be used to decode subprocess output and ENCODING to
|
|
1191 encode subprocess input.
|
120
|
1192 */
|
|
1193 (process, decoding, encoding))
|
|
1194 {
|
280
|
1195 if (!NILP (decoding))
|
|
1196 Fset_process_input_coding_system (process, decoding);
|
|
1197
|
|
1198 if (!NILP (encoding))
|
|
1199 Fset_process_output_coding_system (process, encoding);
|
|
1200
|
120
|
1201 return Qnil;
|
|
1202 }
|
|
1203
|
263
|
1204 #endif /* FILE_CODING */
|
0
|
1205
|
|
1206 /************************************************************************/
|
|
1207 /* process status */
|
|
1208 /************************************************************************/
|
|
1209
|
|
1210 static Lisp_Object
|
|
1211 exec_sentinel_unwind (Lisp_Object datum)
|
|
1212 {
|
398
|
1213 Lisp_Cons *d = XCONS (datum);
|
0
|
1214 XPROCESS (d->car)->sentinel = d->cdr;
|
|
1215 free_cons (d);
|
|
1216 return Qnil;
|
|
1217 }
|
|
1218
|
|
1219 static void
|
|
1220 exec_sentinel (Lisp_Object proc, Lisp_Object reason)
|
|
1221 {
|
|
1222 /* This function can GC */
|
175
|
1223 int speccount = specpdl_depth ();
|
398
|
1224 Lisp_Process *p = XPROCESS (proc);
|
175
|
1225 Lisp_Object sentinel = p->sentinel;
|
|
1226
|
0
|
1227 if (NILP (sentinel))
|
|
1228 return;
|
|
1229
|
|
1230 /* Some weird FSFmacs crap here with
|
|
1231 Vdeactivate_mark and current_buffer->keymap */
|
|
1232
|
|
1233 /* Zilch the sentinel while it's running, to avoid recursive invocations;
|
|
1234 assure that it gets restored no matter how the sentinel exits. */
|
|
1235 p->sentinel = Qnil;
|
|
1236 record_unwind_protect (exec_sentinel_unwind, noseeum_cons (proc, sentinel));
|
|
1237 /* We used to bind inhibit-quit to t here, but call2_trapping_errors()
|
|
1238 does that for us. */
|
|
1239 running_asynch_code = 1;
|
175
|
1240 call2_trapping_errors ("Error in process sentinel", sentinel, proc, reason);
|
0
|
1241 running_asynch_code = 0;
|
|
1242 restore_match_data ();
|
|
1243 unbind_to (speccount, Qnil);
|
|
1244 }
|
|
1245
|
20
|
1246 DEFUN ("set-process-sentinel", Fset_process_sentinel, 2, 2, 0, /*
|
0
|
1247 Give PROCESS the sentinel SENTINEL; nil for none.
|
|
1248 The sentinel is called as a function when the process changes state.
|
|
1249 It gets two arguments: the process, and a string describing the change.
|
20
|
1250 */
|
|
1251 (proc, sentinel))
|
0
|
1252 {
|
|
1253 CHECK_PROCESS (proc);
|
|
1254 XPROCESS (proc)->sentinel = sentinel;
|
|
1255 return sentinel;
|
|
1256 }
|
|
1257
|
20
|
1258 DEFUN ("process-sentinel", Fprocess_sentinel, 1, 1, 0, /*
|
0
|
1259 Return the sentinel of PROCESS; nil if none.
|
|
1260 See `set-process-sentinel' for more info on sentinels.
|
20
|
1261 */
|
|
1262 (proc))
|
0
|
1263 {
|
|
1264 CHECK_PROCESS (proc);
|
|
1265 return XPROCESS (proc)->sentinel;
|
|
1266 }
|
|
1267
|
|
1268
|
398
|
1269 const char *
|
0
|
1270 signal_name (int signum)
|
|
1271 {
|
|
1272 if (signum >= 0 && signum < NSIG)
|
398
|
1273 return (const char *) sys_siglist[signum];
|
209
|
1274
|
398
|
1275 return (const char *) GETTEXT ("unknown signal");
|
0
|
1276 }
|
|
1277
|
|
1278 void
|
|
1279 update_process_status (Lisp_Object p,
|
|
1280 Lisp_Object status_symbol,
|
|
1281 int exit_code,
|
|
1282 int core_dumped)
|
|
1283 {
|
|
1284 XPROCESS (p)->tick++;
|
|
1285 process_tick++;
|
|
1286 XPROCESS (p)->status_symbol = status_symbol;
|
|
1287 XPROCESS (p)->exit_code = exit_code;
|
|
1288 XPROCESS (p)->core_dumped = core_dumped;
|
|
1289 }
|
|
1290
|
|
1291 /* Return a string describing a process status list. */
|
|
1292
|
185
|
1293 static Lisp_Object
|
398
|
1294 status_message (Lisp_Process *p)
|
0
|
1295 {
|
|
1296 Lisp_Object symbol = p->status_symbol;
|
|
1297 int code = p->exit_code;
|
|
1298 int coredump = p->core_dumped;
|
|
1299 Lisp_Object string, string2;
|
|
1300
|
|
1301 if (EQ (symbol, Qsignal) || EQ (symbol, Qstop))
|
|
1302 {
|
|
1303 string = build_string (signal_name (code));
|
|
1304 if (coredump)
|
|
1305 string2 = build_translated_string (" (core dumped)\n");
|
|
1306 else
|
|
1307 string2 = build_string ("\n");
|
|
1308 set_string_char (XSTRING (string), 0,
|
|
1309 DOWNCASE (current_buffer,
|
|
1310 string_char (XSTRING (string), 0)));
|
|
1311 return concat2 (string, string2);
|
|
1312 }
|
|
1313 else if (EQ (symbol, Qexit))
|
|
1314 {
|
|
1315 if (code == 0)
|
|
1316 return build_translated_string ("finished\n");
|
|
1317 string = Fnumber_to_string (make_int (code));
|
|
1318 if (coredump)
|
|
1319 string2 = build_translated_string (" (core dumped)\n");
|
|
1320 else
|
|
1321 string2 = build_string ("\n");
|
|
1322 return concat2 (build_translated_string ("exited abnormally with code "),
|
|
1323 concat2 (string, string2));
|
|
1324 }
|
|
1325 else
|
|
1326 return Fcopy_sequence (Fsymbol_name (symbol));
|
|
1327 }
|
|
1328
|
|
1329 /* Tell status_notify() to check for terminated processes. We do this
|
|
1330 because on some systems we sometimes miss SIGCHLD calls. (Not sure
|
|
1331 why.) */
|
|
1332
|
|
1333 void
|
|
1334 kick_status_notify (void)
|
|
1335 {
|
|
1336 process_tick++;
|
|
1337 }
|
|
1338
|
263
|
1339
|
0
|
1340 /* Report all recent events of a change in process status
|
|
1341 (either run the sentinel or output a message).
|
|
1342 This is done while Emacs is waiting for keyboard input. */
|
|
1343
|
|
1344 void
|
|
1345 status_notify (void)
|
|
1346 {
|
|
1347 /* This function can GC */
|
|
1348 Lisp_Object tail = Qnil;
|
|
1349 Lisp_Object symbol = Qnil;
|
|
1350 Lisp_Object msg = Qnil;
|
|
1351 struct gcpro gcpro1, gcpro2, gcpro3;
|
|
1352 /* process_tick is volatile, so we have to remember it now.
|
|
1353 Otherwise, we get a race condition is SIGCHLD happens during
|
|
1354 this function.
|
|
1355
|
|
1356 (Actually, this is not the case anymore. The code to
|
|
1357 update the process structures has been moved out of the
|
|
1358 SIGCHLD handler. But for the moment I'm leaving this
|
|
1359 stuff in -- it can't hurt.) */
|
|
1360 int temp_process_tick;
|
|
1361
|
263
|
1362 MAYBE_PROCMETH (reap_exited_processes, ());
|
0
|
1363
|
|
1364 temp_process_tick = process_tick;
|
|
1365
|
|
1366 if (update_tick == temp_process_tick)
|
|
1367 return;
|
|
1368
|
|
1369 /* We need to gcpro tail; if read_process_output calls a filter
|
|
1370 which deletes a process and removes the cons to which tail points
|
|
1371 from Vprocess_alist, and then causes a GC, tail is an unprotected
|
|
1372 reference. */
|
|
1373 GCPRO3 (tail, symbol, msg);
|
|
1374
|
|
1375 for (tail = Vprocess_list; CONSP (tail); tail = XCDR (tail))
|
|
1376 {
|
|
1377 Lisp_Object proc = XCAR (tail);
|
398
|
1378 Lisp_Process *p = XPROCESS (proc);
|
0
|
1379 /* p->tick is also volatile. Same thing as above applies. */
|
|
1380 int this_process_tick;
|
|
1381
|
|
1382 /* #### extra check for terminated processes, in case a SIGCHLD
|
|
1383 got missed (this seems to happen sometimes, I'm not sure why).
|
|
1384 */
|
263
|
1385 if (INTP (p->pid))
|
|
1386 MAYBE_PROCMETH (update_status_if_terminated, (p));
|
|
1387
|
0
|
1388 this_process_tick = p->tick;
|
|
1389 if (this_process_tick != p->update_tick)
|
|
1390 {
|
|
1391 p->update_tick = this_process_tick;
|
|
1392
|
|
1393 /* If process is still active, read any output that remains. */
|
|
1394 while (!EQ (p->filter, Qt)
|
|
1395 && read_process_output (proc) > 0)
|
|
1396 ;
|
|
1397
|
|
1398 /* Get the text to use for the message. */
|
|
1399 msg = status_message (p);
|
|
1400
|
|
1401 /* If process is terminated, deactivate it or delete it. */
|
|
1402 symbol = p->status_symbol;
|
|
1403
|
185
|
1404 if (EQ (symbol, Qsignal)
|
0
|
1405 || EQ (symbol, Qexit))
|
|
1406 {
|
|
1407 if (delete_exited_processes)
|
|
1408 remove_process (proc);
|
|
1409 else
|
|
1410 deactivate_process (proc);
|
|
1411 }
|
|
1412
|
|
1413 /* Now output the message suitably. */
|
|
1414 if (!NILP (p->sentinel))
|
|
1415 exec_sentinel (proc, msg);
|
|
1416 /* Don't bother with a message in the buffer
|
|
1417 when a process becomes runnable. */
|
|
1418 else if (!EQ (symbol, Qrun) && !NILP (p->buffer))
|
|
1419 {
|
161
|
1420 Lisp_Object old_read_only = Qnil;
|
|
1421 Lisp_Object old = Fcurrent_buffer ();
|
|
1422 Bufpos opoint;
|
|
1423 struct gcpro ngcpro1, ngcpro2;
|
0
|
1424
|
|
1425 /* Avoid error if buffer is deleted
|
|
1426 (probably that's why the process is dead, too) */
|
|
1427 if (!BUFFER_LIVE_P (XBUFFER (p->buffer)))
|
|
1428 continue;
|
|
1429
|
161
|
1430 NGCPRO2 (old, old_read_only);
|
0
|
1431 Fset_buffer (p->buffer);
|
161
|
1432 opoint = BUF_PT (current_buffer);
|
0
|
1433 /* Insert new output into buffer
|
|
1434 at the current end-of-output marker,
|
|
1435 thus preserving logical ordering of input and output. */
|
|
1436 if (XMARKER (p->mark)->buffer)
|
|
1437 BUF_SET_PT (current_buffer, marker_position (p->mark));
|
|
1438 else
|
|
1439 BUF_SET_PT (current_buffer, BUF_ZV (current_buffer));
|
161
|
1440 if (BUF_PT (current_buffer) <= opoint)
|
|
1441 opoint += (string_char_length (XSTRING (msg))
|
|
1442 + string_char_length (XSTRING (p->name))
|
|
1443 + 10);
|
|
1444
|
|
1445 old_read_only = current_buffer->read_only;
|
|
1446 current_buffer->read_only = Qnil;
|
0
|
1447 buffer_insert_c_string (current_buffer, "\nProcess ");
|
|
1448 Finsert (1, &p->name);
|
|
1449 buffer_insert_c_string (current_buffer, " ");
|
|
1450 Finsert (1, &msg);
|
161
|
1451 current_buffer->read_only = old_read_only;
|
0
|
1452 Fset_marker (p->mark, make_int (BUF_PT (current_buffer)),
|
|
1453 p->buffer);
|
161
|
1454
|
|
1455 opoint = bufpos_clip_to_bounds(BUF_BEGV (XBUFFER (p->buffer)),
|
|
1456 opoint,
|
|
1457 BUF_ZV (XBUFFER (p->buffer)));
|
|
1458 BUF_SET_PT (current_buffer, opoint);
|
|
1459 Fset_buffer (old);
|
|
1460 NUNGCPRO;
|
0
|
1461 }
|
|
1462 }
|
|
1463 } /* end for */
|
|
1464
|
|
1465 /* in case buffers use %s in modeline-format */
|
|
1466 MARK_MODELINE_CHANGED;
|
|
1467 redisplay ();
|
|
1468
|
|
1469 update_tick = temp_process_tick;
|
|
1470
|
|
1471 UNGCPRO;
|
|
1472 }
|
|
1473
|
20
|
1474 DEFUN ("process-status", Fprocess_status, 1, 1, 0, /*
|
0
|
1475 Return the status of PROCESS.
|
|
1476 This is a symbol, one of these:
|
|
1477
|
175
|
1478 run -- for a process that is running.
|
|
1479 stop -- for a process stopped but continuable.
|
|
1480 exit -- for a process that has exited.
|
0
|
1481 signal -- for a process that has got a fatal signal.
|
175
|
1482 open -- for a network stream connection that is open.
|
0
|
1483 closed -- for a network stream connection that is closed.
|
175
|
1484 nil -- if arg is a process name and no such process exists.
|
|
1485
|
0
|
1486 PROCESS may be a process, a buffer, the name of a process or buffer, or
|
|
1487 nil, indicating the current buffer's process.
|
20
|
1488 */
|
|
1489 (proc))
|
0
|
1490 {
|
175
|
1491 Lisp_Object status_symbol;
|
0
|
1492
|
|
1493 if (STRINGP (proc))
|
|
1494 proc = Fget_process (proc);
|
|
1495 else
|
|
1496 proc = get_process (proc);
|
|
1497
|
|
1498 if (NILP (proc))
|
175
|
1499 return Qnil;
|
|
1500
|
|
1501 status_symbol = XPROCESS (proc)->status_symbol;
|
0
|
1502 if (network_connection_p (proc))
|
|
1503 {
|
175
|
1504 if (EQ (status_symbol, Qrun))
|
|
1505 status_symbol = Qopen;
|
|
1506 else if (EQ (status_symbol, Qexit))
|
|
1507 status_symbol = Qclosed;
|
0
|
1508 }
|
175
|
1509 return status_symbol;
|
0
|
1510 }
|
|
1511
|
20
|
1512 DEFUN ("process-exit-status", Fprocess_exit_status, 1, 1, 0, /*
|
0
|
1513 Return the exit status of PROCESS or the signal number that killed it.
|
|
1514 If PROCESS has not yet exited or died, return 0.
|
20
|
1515 */
|
|
1516 (proc))
|
0
|
1517 {
|
|
1518 CHECK_PROCESS (proc);
|
173
|
1519 return make_int (XPROCESS (proc)->exit_code);
|
0
|
1520 }
|
|
1521
|
|
1522
|
|
1523
|
|
1524 /* send a signal number SIGNO to PROCESS.
|
|
1525 CURRENT_GROUP means send to the process group that currently owns
|
|
1526 the terminal being used to communicate with PROCESS.
|
|
1527 This is used for various commands in shell mode.
|
|
1528 If NOMSG is zero, insert signal-announcements into process's buffers
|
|
1529 right away.
|
|
1530
|
|
1531 If we can, we try to signal PROCESS by sending control characters
|
|
1532 down the pty. This allows us to signal inferiors who have changed
|
|
1533 their uid, for which killpg would return an EPERM error. */
|
|
1534
|
|
1535 static void
|
263
|
1536 process_send_signal (Lisp_Object process, int signo,
|
0
|
1537 int current_group, int nomsg)
|
|
1538 {
|
|
1539 /* This function can GC */
|
263
|
1540 Lisp_Object proc = get_process (process);
|
0
|
1541
|
|
1542 if (network_connection_p (proc))
|
|
1543 error ("Network connection %s is not a subprocess",
|
263
|
1544 XSTRING_DATA (XPROCESS(proc)->name));
|
398
|
1545 CHECK_LIVE_PROCESS (proc);
|
0
|
1546
|
263
|
1547 MAYBE_PROCMETH (kill_child_process, (proc, signo, current_group, nomsg));
|
0
|
1548 }
|
|
1549
|
20
|
1550 DEFUN ("interrupt-process", Finterrupt_process, 0, 2, 0, /*
|
0
|
1551 Interrupt process PROCESS. May be process or name of one.
|
|
1552 Nil or no arg means current buffer's process.
|
|
1553 Second arg CURRENT-GROUP non-nil means send signal to
|
|
1554 the current process-group of the process's controlling terminal
|
|
1555 rather than to the process's own process group.
|
|
1556 If the process is a shell, this means interrupt current subjob
|
|
1557 rather than the shell.
|
20
|
1558 */
|
|
1559 (process, current_group))
|
0
|
1560 {
|
|
1561 /* This function can GC */
|
|
1562 process_send_signal (process, SIGINT, !NILP (current_group), 0);
|
|
1563 return process;
|
|
1564 }
|
|
1565
|
20
|
1566 DEFUN ("kill-process", Fkill_process, 0, 2, 0, /*
|
0
|
1567 Kill process PROCESS. May be process or name of one.
|
|
1568 See function `interrupt-process' for more details on usage.
|
20
|
1569 */
|
|
1570 (process, current_group))
|
0
|
1571 {
|
|
1572 /* This function can GC */
|
280
|
1573 #ifdef SIGKILL
|
263
|
1574 process_send_signal (process, SIGKILL, !NILP (current_group), 0);
|
280
|
1575 #else
|
|
1576 error ("kill-process: Not supported on this system");
|
|
1577 #endif
|
0
|
1578 return process;
|
|
1579 }
|
|
1580
|
20
|
1581 DEFUN ("quit-process", Fquit_process, 0, 2, 0, /*
|
0
|
1582 Send QUIT signal to process PROCESS. May be process or name of one.
|
|
1583 See function `interrupt-process' for more details on usage.
|
20
|
1584 */
|
|
1585 (process, current_group))
|
0
|
1586 {
|
|
1587 /* This function can GC */
|
280
|
1588 #ifdef SIGQUIT
|
263
|
1589 process_send_signal (process, SIGQUIT, !NILP (current_group), 0);
|
280
|
1590 #else
|
|
1591 error ("quit-process: Not supported on this system");
|
|
1592 #endif
|
0
|
1593 return process;
|
|
1594 }
|
|
1595
|
20
|
1596 DEFUN ("stop-process", Fstop_process, 0, 2, 0, /*
|
0
|
1597 Stop process PROCESS. May be process or name of one.
|
|
1598 See function `interrupt-process' for more details on usage.
|
20
|
1599 */
|
|
1600 (process, current_group))
|
0
|
1601 {
|
|
1602 /* This function can GC */
|
263
|
1603 #ifdef SIGTSTP
|
|
1604 process_send_signal (process, SIGTSTP, !NILP (current_group), 0);
|
0
|
1605 #else
|
263
|
1606 error ("stop-process: Not supported on this system");
|
0
|
1607 #endif
|
|
1608 return process;
|
|
1609 }
|
|
1610
|
20
|
1611 DEFUN ("continue-process", Fcontinue_process, 0, 2, 0, /*
|
0
|
1612 Continue process PROCESS. May be process or name of one.
|
|
1613 See function `interrupt-process' for more details on usage.
|
20
|
1614 */
|
|
1615 (process, current_group))
|
0
|
1616 {
|
|
1617 /* This function can GC */
|
|
1618 #ifdef SIGCONT
|
263
|
1619 process_send_signal (process, SIGCONT, !NILP (current_group), 0);
|
0
|
1620 #else
|
263
|
1621 error ("continue-process: Not supported on this system");
|
0
|
1622 #endif
|
|
1623 return process;
|
|
1624 }
|
|
1625
|
20
|
1626 DEFUN ("signal-process", Fsignal_process, 2, 2,
|
|
1627 "nProcess number: \nnSignal code: ", /*
|
0
|
1628 Send the process with process id PID the signal with code SIGCODE.
|
|
1629 PID must be an integer. The process need not be a child of this Emacs.
|
|
1630 SIGCODE may be an integer, or a symbol whose name is a signal name.
|
20
|
1631 */
|
|
1632 (pid, sigcode))
|
0
|
1633 {
|
|
1634 CHECK_INT (pid);
|
|
1635
|
|
1636 if (INTP (sigcode))
|
|
1637 ;
|
|
1638 else
|
|
1639 {
|
|
1640 Bufbyte *name;
|
|
1641
|
|
1642 CHECK_SYMBOL (sigcode);
|
|
1643 name = string_data (XSYMBOL (sigcode)->name);
|
|
1644
|
280
|
1645 #define handle_signal(signal) \
|
398
|
1646 else if (!strcmp ((const char *) name, #signal)) \
|
280
|
1647 XSETINT (sigcode, signal)
|
|
1648
|
0
|
1649 if (0)
|
|
1650 ;
|
280
|
1651 handle_signal (SIGINT); /* ANSI */
|
|
1652 handle_signal (SIGILL); /* ANSI */
|
|
1653 handle_signal (SIGABRT); /* ANSI */
|
|
1654 handle_signal (SIGFPE); /* ANSI */
|
|
1655 handle_signal (SIGSEGV); /* ANSI */
|
|
1656 handle_signal (SIGTERM); /* ANSI */
|
|
1657
|
0
|
1658 #ifdef SIGHUP
|
280
|
1659 handle_signal (SIGHUP); /* POSIX */
|
0
|
1660 #endif
|
|
1661 #ifdef SIGQUIT
|
280
|
1662 handle_signal (SIGQUIT); /* POSIX */
|
0
|
1663 #endif
|
280
|
1664 #ifdef SIGTRAP
|
|
1665 handle_signal (SIGTRAP); /* POSIX */
|
0
|
1666 #endif
|
|
1667 #ifdef SIGKILL
|
280
|
1668 handle_signal (SIGKILL); /* POSIX */
|
|
1669 #endif
|
|
1670 #ifdef SIGUSR1
|
|
1671 handle_signal (SIGUSR1); /* POSIX */
|
|
1672 #endif
|
|
1673 #ifdef SIGUSR2
|
|
1674 handle_signal (SIGUSR2); /* POSIX */
|
0
|
1675 #endif
|
280
|
1676 #ifdef SIGPIPE
|
|
1677 handle_signal (SIGPIPE); /* POSIX */
|
|
1678 #endif
|
|
1679 #ifdef SIGALRM
|
|
1680 handle_signal (SIGALRM); /* POSIX */
|
|
1681 #endif
|
|
1682 #ifdef SIGCHLD
|
|
1683 handle_signal (SIGCHLD); /* POSIX */
|
|
1684 #endif
|
|
1685 #ifdef SIGCONT
|
|
1686 handle_signal (SIGCONT); /* POSIX */
|
0
|
1687 #endif
|
280
|
1688 #ifdef SIGSTOP
|
|
1689 handle_signal (SIGSTOP); /* POSIX */
|
|
1690 #endif
|
|
1691 #ifdef SIGTSTP
|
|
1692 handle_signal (SIGTSTP); /* POSIX */
|
|
1693 #endif
|
|
1694 #ifdef SIGTTIN
|
|
1695 handle_signal (SIGTTIN); /* POSIX */
|
0
|
1696 #endif
|
280
|
1697 #ifdef SIGTTOU
|
|
1698 handle_signal (SIGTTOU); /* POSIX */
|
|
1699 #endif
|
|
1700
|
|
1701 #ifdef SIGBUS
|
|
1702 handle_signal (SIGBUS); /* XPG5 */
|
|
1703 #endif
|
|
1704 #ifdef SIGPOLL
|
|
1705 handle_signal (SIGPOLL); /* XPG5 */
|
|
1706 #endif
|
|
1707 #ifdef SIGPROF
|
|
1708 handle_signal (SIGPROF); /* XPG5 */
|
0
|
1709 #endif
|
|
1710 #ifdef SIGSYS
|
280
|
1711 handle_signal (SIGSYS); /* XPG5 */
|
0
|
1712 #endif
|
|
1713 #ifdef SIGURG
|
280
|
1714 handle_signal (SIGURG); /* XPG5 */
|
0
|
1715 #endif
|
|
1716 #ifdef SIGXCPU
|
280
|
1717 handle_signal (SIGXCPU); /* XPG5 */
|
0
|
1718 #endif
|
|
1719 #ifdef SIGXFSZ
|
280
|
1720 handle_signal (SIGXFSZ); /* XPG5 */
|
0
|
1721 #endif
|
|
1722 #ifdef SIGVTALRM
|
280
|
1723 handle_signal (SIGVTALRM); /* XPG5 */
|
0
|
1724 #endif
|
280
|
1725
|
|
1726 #ifdef SIGIO
|
|
1727 handle_signal (SIGIO); /* BSD 4.2 */
|
0
|
1728 #endif
|
|
1729 #ifdef SIGWINCH
|
280
|
1730 handle_signal (SIGWINCH); /* BSD 4.3 */
|
|
1731 #endif
|
|
1732
|
|
1733 #ifdef SIGEMT
|
|
1734 handle_signal (SIGEMT);
|
0
|
1735 #endif
|
|
1736 #ifdef SIGINFO
|
280
|
1737 handle_signal (SIGINFO);
|
|
1738 #endif
|
|
1739 #ifdef SIGHWE
|
|
1740 handle_signal (SIGHWE);
|
|
1741 #endif
|
|
1742 #ifdef SIGPRE
|
|
1743 handle_signal (SIGPRE);
|
|
1744 #endif
|
|
1745 #ifdef SIGUME
|
|
1746 handle_signal (SIGUME);
|
|
1747 #endif
|
|
1748 #ifdef SIGDLK
|
|
1749 handle_signal (SIGDLK);
|
|
1750 #endif
|
|
1751 #ifdef SIGCPULIM
|
|
1752 handle_signal (SIGCPULIM);
|
|
1753 #endif
|
|
1754 #ifdef SIGIOT
|
|
1755 handle_signal (SIGIOT);
|
|
1756 #endif
|
|
1757 #ifdef SIGLOST
|
|
1758 handle_signal (SIGLOST);
|
0
|
1759 #endif
|
280
|
1760 #ifdef SIGSTKFLT
|
|
1761 handle_signal (SIGSTKFLT);
|
|
1762 #endif
|
|
1763 #ifdef SIGUNUSED
|
|
1764 handle_signal (SIGUNUSED);
|
|
1765 #endif
|
|
1766 #ifdef SIGDANGER
|
380
|
1767 handle_signal (SIGDANGER); /* AIX */
|
280
|
1768 #endif
|
|
1769 #ifdef SIGMSG
|
|
1770 handle_signal (SIGMSG);
|
0
|
1771 #endif
|
280
|
1772 #ifdef SIGSOUND
|
|
1773 handle_signal (SIGSOUND);
|
|
1774 #endif
|
|
1775 #ifdef SIGRETRACT
|
|
1776 handle_signal (SIGRETRACT);
|
|
1777 #endif
|
|
1778 #ifdef SIGGRANT
|
|
1779 handle_signal (SIGGRANT);
|
|
1780 #endif
|
|
1781 #ifdef SIGPWR
|
|
1782 handle_signal (SIGPWR);
|
0
|
1783 #endif
|
|
1784 else
|
|
1785 error ("Undefined signal name %s", name);
|
|
1786 }
|
|
1787
|
|
1788 #undef handle_signal
|
|
1789
|
263
|
1790 return make_int (PROCMETH_OR_GIVEN (kill_process_by_pid,
|
|
1791 (XINT (pid), XINT (sigcode)), -1));
|
0
|
1792 }
|
|
1793
|
20
|
1794 DEFUN ("process-send-eof", Fprocess_send_eof, 0, 1, 0, /*
|
0
|
1795 Make PROCESS see end-of-file in its input.
|
|
1796 PROCESS may be a process, a buffer, the name of a process or buffer, or
|
|
1797 nil, indicating the current buffer's process.
|
|
1798 If PROCESS is a network connection, or is a process communicating
|
|
1799 through a pipe (as opposed to a pty), then you cannot send any more
|
|
1800 text to PROCESS after you call this function.
|
20
|
1801 */
|
|
1802 (process))
|
0
|
1803 {
|
|
1804 /* This function can GC */
|
280
|
1805 Lisp_Object proc = get_process (process);
|
0
|
1806
|
|
1807 /* Make sure the process is really alive. */
|
|
1808 if (! EQ (XPROCESS (proc)->status_symbol, Qrun))
|
16
|
1809 error ("Process %s not running", XSTRING_DATA (XPROCESS (proc)->name));
|
0
|
1810
|
263
|
1811 if (!MAYBE_INT_PROCMETH (process_send_eof, (proc)))
|
0
|
1812 {
|
267
|
1813 if (!NILP (DATA_OUTSTREAM (XPROCESS (proc))))
|
|
1814 {
|
|
1815 Lstream_close (XLSTREAM (DATA_OUTSTREAM (XPROCESS (proc))));
|
|
1816 event_stream_delete_stream_pair (Qnil, XPROCESS (proc)->pipe_outstream);
|
|
1817 XPROCESS (proc)->pipe_outstream = Qnil;
|
263
|
1818 #ifdef FILE_CODING
|
267
|
1819 XPROCESS (proc)->coding_outstream = Qnil;
|
0
|
1820 #endif
|
267
|
1821 }
|
0
|
1822 }
|
209
|
1823
|
0
|
1824 return process;
|
|
1825 }
|
|
1826
|
|
1827
|
|
1828 /************************************************************************/
|
|
1829 /* deleting a process */
|
|
1830 /************************************************************************/
|
|
1831
|
|
1832 void
|
|
1833 deactivate_process (Lisp_Object proc)
|
|
1834 {
|
398
|
1835 Lisp_Process *p = XPROCESS (proc);
|
263
|
1836 USID usid;
|
0
|
1837
|
263
|
1838 /* It's possible that we got as far in the process-creation
|
|
1839 process as creating the descriptors but didn't get so
|
|
1840 far as selecting the process for input. In this
|
|
1841 case, p->pid is nil: p->pid is set at the same time that
|
|
1842 the process is selected for input. */
|
|
1843 /* #### The comment does not look correct. event_stream_unselect_process
|
|
1844 is guarded by process->selected, so this is not a problem. - kkm*/
|
|
1845 /* Must call this before setting the streams to nil */
|
|
1846 event_stream_unselect_process (p);
|
0
|
1847
|
267
|
1848 if (!NILP (DATA_OUTSTREAM (p)))
|
|
1849 Lstream_close (XLSTREAM (DATA_OUTSTREAM (p)));
|
|
1850 if (!NILP (DATA_INSTREAM (p)))
|
|
1851 Lstream_close (XLSTREAM (DATA_INSTREAM (p)));
|
|
1852
|
263
|
1853 /* Provide minimal implementation for deactivate_process
|
|
1854 if there's no process-specific one */
|
|
1855 if (HAS_PROCMETH_P (deactivate_process))
|
|
1856 usid = PROCMETH (deactivate_process, (p));
|
|
1857 else
|
|
1858 usid = event_stream_delete_stream_pair (p->pipe_instream,
|
|
1859 p->pipe_outstream);
|
0
|
1860
|
263
|
1861 if (usid != USID_DONTHASH)
|
398
|
1862 remhash ((const void*)usid, usid_to_process);
|
263
|
1863
|
|
1864 p->pipe_instream = Qnil;
|
|
1865 p->pipe_outstream = Qnil;
|
|
1866 #ifdef FILE_CODING
|
|
1867 p->coding_instream = Qnil;
|
|
1868 p->coding_outstream = Qnil;
|
|
1869 #endif
|
0
|
1870 }
|
|
1871
|
|
1872 static void
|
|
1873 remove_process (Lisp_Object proc)
|
|
1874 {
|
|
1875 Vprocess_list = delq_no_quit (proc, Vprocess_list);
|
|
1876 Fset_marker (XPROCESS (proc)->mark, Qnil, Qnil);
|
|
1877
|
|
1878 deactivate_process (proc);
|
|
1879 }
|
|
1880
|
20
|
1881 DEFUN ("delete-process", Fdelete_process, 1, 1, 0, /*
|
0
|
1882 Delete PROCESS: kill it and forget about it immediately.
|
|
1883 PROCESS may be a process or the name of one, or a buffer name.
|
20
|
1884 */
|
|
1885 (proc))
|
0
|
1886 {
|
|
1887 /* This function can GC */
|
398
|
1888 Lisp_Process *p;
|
0
|
1889 proc = get_process (proc);
|
|
1890 p = XPROCESS (proc);
|
|
1891 if (network_connection_p (proc))
|
|
1892 {
|
|
1893 p->status_symbol = Qexit;
|
|
1894 p->exit_code = 0;
|
|
1895 p->core_dumped = 0;
|
|
1896 p->tick++;
|
|
1897 process_tick++;
|
|
1898 }
|
398
|
1899 else if (PROCESS_LIVE_P (p))
|
0
|
1900 {
|
|
1901 Fkill_process (proc, Qnil);
|
|
1902 /* Do this now, since remove_process will make sigchld_handler do nothing. */
|
|
1903 p->status_symbol = Qsignal;
|
|
1904 p->exit_code = SIGKILL;
|
|
1905 p->core_dumped = 0;
|
|
1906 p->tick++;
|
|
1907 process_tick++;
|
|
1908 status_notify ();
|
|
1909 }
|
|
1910 remove_process (proc);
|
|
1911 return Qnil;
|
|
1912 }
|
|
1913
|
|
1914 /* Kill all processes associated with `buffer'.
|
|
1915 If `buffer' is nil, kill all processes */
|
|
1916
|
|
1917 void
|
|
1918 kill_buffer_processes (Lisp_Object buffer)
|
|
1919 {
|
|
1920 Lisp_Object tail;
|
|
1921
|
398
|
1922 for (tail = Vprocess_list; CONSP (tail);
|
0
|
1923 tail = XCDR (tail))
|
|
1924 {
|
|
1925 Lisp_Object proc = XCAR (tail);
|
398
|
1926 if (PROCESSP (proc)
|
|
1927 && (NILP (buffer) || EQ (XPROCESS (proc)->buffer, buffer)))
|
0
|
1928 {
|
|
1929 if (network_connection_p (proc))
|
|
1930 Fdelete_process (proc);
|
398
|
1931 else if (PROCESS_LIVE_P (XPROCESS (proc)))
|
0
|
1932 process_send_signal (proc, SIGHUP, 0, 1);
|
|
1933 }
|
|
1934 }
|
|
1935 }
|
|
1936
|
20
|
1937 DEFUN ("process-kill-without-query", Fprocess_kill_without_query, 1, 2, 0, /*
|
0
|
1938 Say no query needed if PROCESS is running when Emacs is exited.
|
|
1939 Optional second argument if non-nil says to require a query.
|
|
1940 Value is t if a query was formerly required.
|
20
|
1941 */
|
|
1942 (proc, require_query_p))
|
0
|
1943 {
|
|
1944 int tem;
|
|
1945
|
|
1946 CHECK_PROCESS (proc);
|
|
1947 tem = XPROCESS (proc)->kill_without_query;
|
|
1948 XPROCESS (proc)->kill_without_query = NILP (require_query_p);
|
|
1949
|
173
|
1950 return tem ? Qnil : Qt;
|
0
|
1951 }
|
|
1952
|
20
|
1953 DEFUN ("process-kill-without-query-p", Fprocess_kill_without_query_p, 1, 1, 0, /*
|
0
|
1954 Whether PROC will be killed without query if running when emacs is exited.
|
20
|
1955 */
|
|
1956 (proc))
|
0
|
1957 {
|
|
1958 CHECK_PROCESS (proc);
|
173
|
1959 return XPROCESS (proc)->kill_without_query ? Qt : Qnil;
|
0
|
1960 }
|
|
1961
|
|
1962
|
|
1963 /* This is not named init_process in order to avoid a conflict with NS 3.3 */
|
|
1964 void
|
|
1965 init_xemacs_process (void)
|
|
1966 {
|
263
|
1967 MAYBE_PROCMETH (init_process, ());
|
0
|
1968
|
|
1969 Vprocess_list = Qnil;
|
380
|
1970
|
|
1971 if (usid_to_process)
|
|
1972 clrhash (usid_to_process);
|
|
1973 else
|
|
1974 usid_to_process = make_hash_table (32);
|
0
|
1975 }
|
149
|
1976
|
0
|
1977 #if 0
|
|
1978
|
149
|
1979 xxDEFUN ("process-connection", Fprocess_connection, 0, 1, 0, /*
|
0
|
1980 Return the connection type of `PROCESS'. This can be nil (pipe),
|
|
1981 t or pty (pty) or stream (socket connection).
|
149
|
1982 */
|
|
1983 (process))
|
0
|
1984 {
|
|
1985 return XPROCESS (process)->type;
|
|
1986 }
|
|
1987
|
|
1988 #endif /* 0 */
|
|
1989
|
|
1990 void
|
|
1991 syms_of_process (void)
|
|
1992 {
|
|
1993 defsymbol (&Qprocessp, "processp");
|
398
|
1994 defsymbol (&Qprocess_live_p, "process-live-p");
|
0
|
1995 defsymbol (&Qrun, "run");
|
|
1996 defsymbol (&Qstop, "stop");
|
|
1997 defsymbol (&Qopen, "open");
|
|
1998 defsymbol (&Qclosed, "closed");
|
|
1999
|
398
|
2000 defsymbol (&Qtcp, "tcp");
|
|
2001 defsymbol (&Qudp, "udp");
|
263
|
2002
|
259
|
2003 #ifdef HAVE_MULTICAST
|
|
2004 defsymbol(&Qmulticast, "multicast"); /* Used for occasional warnings */
|
|
2005 #endif
|
|
2006
|
20
|
2007 DEFSUBR (Fprocessp);
|
398
|
2008 DEFSUBR (Fprocess_live_p);
|
20
|
2009 DEFSUBR (Fget_process);
|
|
2010 DEFSUBR (Fget_buffer_process);
|
|
2011 DEFSUBR (Fdelete_process);
|
|
2012 DEFSUBR (Fprocess_status);
|
|
2013 DEFSUBR (Fprocess_exit_status);
|
|
2014 DEFSUBR (Fprocess_id);
|
|
2015 DEFSUBR (Fprocess_name);
|
|
2016 DEFSUBR (Fprocess_tty_name);
|
|
2017 DEFSUBR (Fprocess_command);
|
|
2018 DEFSUBR (Fset_process_buffer);
|
|
2019 DEFSUBR (Fprocess_buffer);
|
|
2020 DEFSUBR (Fprocess_mark);
|
|
2021 DEFSUBR (Fset_process_filter);
|
|
2022 DEFSUBR (Fprocess_filter);
|
|
2023 DEFSUBR (Fset_process_window_size);
|
|
2024 DEFSUBR (Fset_process_sentinel);
|
|
2025 DEFSUBR (Fprocess_sentinel);
|
|
2026 DEFSUBR (Fprocess_kill_without_query);
|
|
2027 DEFSUBR (Fprocess_kill_without_query_p);
|
|
2028 DEFSUBR (Fprocess_list);
|
|
2029 DEFSUBR (Fstart_process_internal);
|
0
|
2030 #ifdef HAVE_SOCKETS
|
20
|
2031 DEFSUBR (Fopen_network_stream_internal);
|
259
|
2032 #ifdef HAVE_MULTICAST
|
|
2033 DEFSUBR (Fopen_multicast_group_internal);
|
|
2034 #endif /* HAVE_MULTICAST */
|
0
|
2035 #endif /* HAVE_SOCKETS */
|
20
|
2036 DEFSUBR (Fprocess_send_region);
|
|
2037 DEFSUBR (Fprocess_send_string);
|
|
2038 DEFSUBR (Finterrupt_process);
|
|
2039 DEFSUBR (Fkill_process);
|
|
2040 DEFSUBR (Fquit_process);
|
|
2041 DEFSUBR (Fstop_process);
|
|
2042 DEFSUBR (Fcontinue_process);
|
|
2043 DEFSUBR (Fprocess_send_eof);
|
|
2044 DEFSUBR (Fsignal_process);
|
|
2045 /* DEFSUBR (Fprocess_connection); */
|
259
|
2046 #ifdef FILE_CODING
|
70
|
2047 DEFSUBR (Fprocess_input_coding_system);
|
|
2048 DEFSUBR (Fprocess_output_coding_system);
|
|
2049 DEFSUBR (Fset_process_input_coding_system);
|
|
2050 DEFSUBR (Fset_process_output_coding_system);
|
120
|
2051 DEFSUBR (Fprocess_coding_system);
|
|
2052 DEFSUBR (Fset_process_coding_system);
|
263
|
2053 #endif /* FILE_CODING */
|
0
|
2054 }
|
|
2055
|
|
2056 void
|
|
2057 vars_of_process (void)
|
|
2058 {
|
|
2059 Fprovide (intern ("subprocesses"));
|
|
2060 #ifdef HAVE_SOCKETS
|
|
2061 Fprovide (intern ("network-streams"));
|
259
|
2062 #ifdef HAVE_MULTICAST
|
|
2063 Fprovide (intern ("multicast"));
|
|
2064 #endif /* HAVE_MULTICAST */
|
|
2065 #endif /* HAVE_SOCKETS */
|
0
|
2066 staticpro (&Vprocess_list);
|
|
2067
|
|
2068 DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes /*
|
|
2069 *Non-nil means delete processes immediately when they exit.
|
|
2070 nil means don't delete them until `list-processes' is run.
|
|
2071 */ );
|
|
2072
|
|
2073 delete_exited_processes = 1;
|
|
2074
|
|
2075 DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type /*
|
|
2076 Control type of device used to communicate with subprocesses.
|
|
2077 Values are nil to use a pipe, or t or `pty' to use a pty.
|
|
2078 The value has no effect if the system has no ptys or if all ptys are busy:
|
|
2079 then a pipe is used in any case.
|
|
2080 The value takes effect when `start-process' is called.
|
|
2081 */ );
|
|
2082 Vprocess_connection_type = Qt;
|
153
|
2083
|
278
|
2084 DEFVAR_BOOL ("windowed-process-io", &windowed_process_io /*
|
380
|
2085 Enables input/output on standard handles of a windowed process.
|
278
|
2086 When this variable is nil (the default), XEmacs does not attempt to read
|
|
2087 standard output handle of a windowed process. Instead, the process is
|
|
2088 immediately marked as exited immediately upon successful launching. This is
|
380
|
2089 done because normal windowed processes do not use standard I/O, as they are
|
278
|
2090 not connected to any console.
|
|
2091
|
|
2092 When launching a specially crafted windowed process, which expects to be
|
|
2093 launched by XEmacs, or by other program which pipes its standard input and
|
|
2094 output, this variable must be set to non-nil, in which case XEmacs will
|
|
2095 treat this process just like a console process.
|
|
2096
|
|
2097 NOTE: You should never set this variable, only bind it.
|
|
2098
|
|
2099 Only Windows processes can be "windowed" or "console". This variable has no
|
|
2100 effect on UNIX processes, because all UNIX processes are "console".
|
|
2101 */ );
|
|
2102 windowed_process_io = 0;
|
|
2103
|
153
|
2104 #ifdef PROCESS_IO_BLOCKING
|
|
2105 DEFVAR_LISP ("network-stream-blocking-port-list", &network_stream_blocking_port_list /*
|
|
2106 List of port numbers or port names to set a blocking I/O mode with connection.
|
|
2107 Nil value means to set a default(non-blocking) I/O mode.
|
|
2108 The value takes effect when `open-network-stream-internal' is called.
|
|
2109 */ );
|
|
2110 network_stream_blocking_port_list = Qnil;
|
|
2111 #endif /* PROCESS_IO_BLOCKING */
|
0
|
2112 }
|
|
2113
|
|
2114 #endif /* not NO_SUBPROCESSES */
|