294 |
|
|
295 |
#include "sysselect.h" |
#include "sysselect.h" |
296 |
|
|
297 |
extern int keyboard_bit_set P_ ((SELECT_TYPE *)); |
static int keyboard_bit_set P_ ((SELECT_TYPE *)); |
298 |
|
static void deactivate_process P_ ((Lisp_Object)); |
299 |
|
static void status_notify P_ ((struct Lisp_Process *)); |
300 |
|
static int read_process_output P_ ((Lisp_Object, int)); |
301 |
|
|
302 |
/* If we support a window system, turn on the code to poll periodically |
/* If we support a window system, turn on the code to poll periodically |
303 |
to detect C-g. It isn't actually used when doing interrupt input. */ |
to detect C-g. It isn't actually used when doing interrupt input. */ |
394 |
/* Compute the Lisp form of the process status, p->status, from |
/* Compute the Lisp form of the process status, p->status, from |
395 |
the numeric status that was returned by `wait'. */ |
the numeric status that was returned by `wait'. */ |
396 |
|
|
397 |
Lisp_Object status_convert (); |
static Lisp_Object status_convert (); |
398 |
|
|
399 |
void |
static void |
400 |
update_status (p) |
update_status (p) |
401 |
struct Lisp_Process *p; |
struct Lisp_Process *p; |
402 |
{ |
{ |
410 |
/* Convert a process status word in Unix format to |
/* Convert a process status word in Unix format to |
411 |
the list that we use internally. */ |
the list that we use internally. */ |
412 |
|
|
413 |
Lisp_Object |
static Lisp_Object |
414 |
status_convert (w) |
status_convert (w) |
415 |
WAITTYPE w; |
WAITTYPE w; |
416 |
{ |
{ |
429 |
/* Given a status-list, extract the three pieces of information |
/* Given a status-list, extract the three pieces of information |
430 |
and store them individually through the three pointers. */ |
and store them individually through the three pointers. */ |
431 |
|
|
432 |
void |
static void |
433 |
decode_status (l, symbol, code, coredump) |
decode_status (l, symbol, code, coredump) |
434 |
Lisp_Object l; |
Lisp_Object l; |
435 |
Lisp_Object *symbol; |
Lisp_Object *symbol; |
508 |
The file name of the terminal corresponding to the pty |
The file name of the terminal corresponding to the pty |
509 |
is left in the variable pty_name. */ |
is left in the variable pty_name. */ |
510 |
|
|
511 |
int |
static int |
512 |
allocate_pty () |
allocate_pty () |
513 |
{ |
{ |
514 |
register int c, i; |
register int c, i; |
593 |
} |
} |
594 |
#endif /* HAVE_PTYS */ |
#endif /* HAVE_PTYS */ |
595 |
|
|
596 |
Lisp_Object |
static Lisp_Object |
597 |
make_process (name) |
make_process (name) |
598 |
Lisp_Object name; |
Lisp_Object name; |
599 |
{ |
{ |
637 |
return val; |
return val; |
638 |
} |
} |
639 |
|
|
640 |
void |
static void |
641 |
remove_process (proc) |
remove_process (proc) |
642 |
register Lisp_Object proc; |
register Lisp_Object proc; |
643 |
{ |
{ |
771 |
(process) |
(process) |
772 |
register Lisp_Object process; |
register Lisp_Object process; |
773 |
{ |
{ |
774 |
|
register struct Lisp_Process *p; |
775 |
|
|
776 |
process = get_process (process); |
process = get_process (process); |
777 |
XPROCESS (process)->raw_status_low = Qnil; |
p = XPROCESS (process); |
778 |
XPROCESS (process)->raw_status_high = Qnil; |
|
779 |
if (NETCONN_P (process)) |
p->raw_status_low = Qnil; |
780 |
{ |
p->raw_status_high = Qnil; |
781 |
XPROCESS (process)->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); |
if (NETCONN1_P (p)) |
782 |
XSETINT (XPROCESS (process)->tick, ++process_tick); |
{ |
783 |
status_notify (); |
p->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); |
784 |
|
XSETINT (p->tick, ++process_tick); |
785 |
|
status_notify (p); |
786 |
} |
} |
787 |
else if (XINT (XPROCESS (process)->infd) >= 0) |
else if (XINT (p->infd) >= 0) |
788 |
{ |
{ |
789 |
Fkill_process (process, Qnil); |
Fkill_process (process, Qnil); |
790 |
/* Do this now, since remove_process will make sigchld_handler do nothing. */ |
/* Do this now, since remove_process will make sigchld_handler do nothing. */ |
791 |
XPROCESS (process)->status |
p->status |
792 |
= Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); |
= Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)); |
793 |
XSETINT (XPROCESS (process)->tick, ++process_tick); |
XSETINT (p->tick, ++process_tick); |
794 |
status_notify (); |
status_notify (p); |
795 |
} |
} |
796 |
remove_process (process); |
remove_process (process); |
797 |
return Qnil; |
return Qnil; |
1245 |
} |
} |
1246 |
#endif |
#endif |
1247 |
|
|
1248 |
Lisp_Object |
static Lisp_Object |
1249 |
list_processes_1 (query_only) |
list_processes_1 (query_only) |
1250 |
Lisp_Object query_only; |
Lisp_Object query_only; |
1251 |
{ |
{ |
1715 |
return Qnil; |
return Qnil; |
1716 |
} |
} |
1717 |
|
|
1718 |
void |
static void |
1719 |
create_process_1 (timer) |
create_process_1 (timer) |
1720 |
struct atimer *timer; |
struct atimer *timer; |
1721 |
{ |
{ |
2538 |
|
|
2539 |
/* A version of request_sigio suitable for a record_unwind_protect. */ |
/* A version of request_sigio suitable for a record_unwind_protect. */ |
2540 |
|
|
2541 |
Lisp_Object |
static Lisp_Object |
2542 |
unwind_request_sigio (dummy) |
unwind_request_sigio (dummy) |
2543 |
Lisp_Object dummy; |
Lisp_Object dummy; |
2544 |
{ |
{ |
4229 |
/* It's okay for us to do this and then continue with |
/* It's okay for us to do this and then continue with |
4230 |
the loop, since timeout has already been zeroed out. */ |
the loop, since timeout has already been zeroed out. */ |
4231 |
clear_waiting_for_input (); |
clear_waiting_for_input (); |
4232 |
status_notify (); |
status_notify (NULL); |
4233 |
} |
} |
4234 |
} |
} |
4235 |
|
|
4747 |
The characters read are decoded according to PROC's coding-system |
The characters read are decoded according to PROC's coding-system |
4748 |
for decoding. */ |
for decoding. */ |
4749 |
|
|
4750 |
int |
static int |
4751 |
read_process_output (proc, channel) |
read_process_output (proc, channel) |
4752 |
Lisp_Object proc; |
Lisp_Object proc; |
4753 |
register int channel; |
register int channel; |
5138 |
|
|
5139 |
This function can evaluate Lisp code and can garbage collect. */ |
This function can evaluate Lisp code and can garbage collect. */ |
5140 |
|
|
5141 |
void |
static void |
5142 |
send_process (proc, buf, len, object) |
send_process (proc, buf, len, object) |
5143 |
volatile Lisp_Object proc; |
volatile Lisp_Object proc; |
5144 |
unsigned char *volatile buf; |
unsigned char *volatile buf; |
5732 |
p->status = Qrun; |
p->status = Qrun; |
5733 |
XSETINT (p->tick, ++process_tick); |
XSETINT (p->tick, ++process_tick); |
5734 |
if (!nomsg) |
if (!nomsg) |
5735 |
status_notify (); |
status_notify (NULL); |
5736 |
break; |
break; |
5737 |
#endif /* ! defined (SIGCONT) */ |
#endif /* ! defined (SIGCONT) */ |
5738 |
case SIGINT: |
case SIGINT: |
6400 |
This is usually done while Emacs is waiting for keyboard input |
This is usually done while Emacs is waiting for keyboard input |
6401 |
but can be done at other times. */ |
but can be done at other times. */ |
6402 |
|
|
6403 |
void |
static void |
6404 |
status_notify () |
status_notify (deleting_process) |
6405 |
|
struct Lisp_Process *deleting_process; |
6406 |
{ |
{ |
6407 |
register Lisp_Object proc, buffer; |
register Lisp_Object proc, buffer; |
6408 |
Lisp_Object tail, msg; |
Lisp_Object tail, msg; |
6438 |
&& ! EQ (p->status, Qlisten) |
&& ! EQ (p->status, Qlisten) |
6439 |
&& ! EQ (p->command, Qt) /* Network process not stopped. */ |
&& ! EQ (p->command, Qt) /* Network process not stopped. */ |
6440 |
&& XINT (p->infd) >= 0 |
&& XINT (p->infd) >= 0 |
6441 |
|
&& p != deleting_process |
6442 |
&& read_process_output (proc, XINT (p->infd)) > 0); |
&& read_process_output (proc, XINT (p->infd)) > 0); |
6443 |
|
|
6444 |
buffer = p->buffer; |
buffer = p->buffer; |
6642 |
/* Return nonzero if *MASK has a bit set |
/* Return nonzero if *MASK has a bit set |
6643 |
that corresponds to one of the keyboard input descriptors. */ |
that corresponds to one of the keyboard input descriptors. */ |
6644 |
|
|
6645 |
int |
static int |
6646 |
keyboard_bit_set (mask) |
keyboard_bit_set (mask) |
6647 |
SELECT_TYPE *mask; |
SELECT_TYPE *mask; |
6648 |
{ |
{ |