diff options
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 63 |
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 | ||
| 130 | Lisp_Object Qprocessp; | 130 | Lisp_Object Qprocessp; |
| 131 | Lisp_Object Qrun, Qstop, Qsignal; | 131 | static Lisp_Object Qrun, Qstop, Qsignal; |
| 132 | Lisp_Object Qopen, Qclosed, Qconnect, Qfailed, Qlisten; | 132 | static Lisp_Object Qopen, Qclosed, Qconnect, Qfailed, Qlisten; |
| 133 | Lisp_Object Qlocal, Qipv4, Qdatagram, Qseqpacket; | 133 | Lisp_Object Qlocal; |
| 134 | Lisp_Object Qreal, Qnetwork, Qserial; | 134 | static Lisp_Object Qipv4, Qdatagram, Qseqpacket; |
| 135 | static Lisp_Object Qreal, Qnetwork, Qserial; | ||
| 135 | #ifdef AF_INET6 | 136 | #ifdef AF_INET6 |
| 136 | Lisp_Object Qipv6; | 137 | static Lisp_Object Qipv6; |
| 137 | #endif | 138 | #endif |
| 138 | Lisp_Object QCport, QCspeed, QCprocess; | 139 | static Lisp_Object QCport, QCprocess; |
| 140 | Lisp_Object QCspeed; | ||
| 139 | Lisp_Object QCbytesize, QCstopbits, QCparity, Qodd, Qeven; | 141 | Lisp_Object QCbytesize, QCstopbits, QCparity, Qodd, Qeven; |
| 140 | Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary; | 142 | Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary; |
| 141 | Lisp_Object QCbuffer, QChost, QCservice; | 143 | static Lisp_Object QCbuffer, QChost, QCservice; |
| 142 | Lisp_Object QClocal, QCremote, QCcoding; | 144 | static Lisp_Object QClocal, QCremote, QCcoding; |
| 143 | Lisp_Object QCserver, QCnowait, QCnoquery, QCstop; | 145 | static Lisp_Object QCserver, QCnowait, QCnoquery, QCstop; |
| 144 | Lisp_Object QCsentinel, QClog, QCoptions, QCplist; | 146 | static Lisp_Object QCsentinel, QClog, QCoptions, QCplist; |
| 145 | Lisp_Object Qlast_nonmenu_event; | 147 | static 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. */ |
| 148 | extern Lisp_Object QCfamily, QCfilter; | 150 | extern Lisp_Object QCfamily, QCfilter; |
| @@ -163,12 +165,10 @@ extern Lisp_Object QCfilter; | |||
| 163 | extern int h_errno; | 165 | extern 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. */ |
| 169 | int process_tick; | 169 | static 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. */ |
| 171 | int update_tick; | 171 | static 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 | ||
| 238 | static Lisp_Object Fget_process (Lisp_Object); | ||
| 239 | static void create_process (Lisp_Object, char **, Lisp_Object); | ||
| 238 | static int keyboard_bit_set (SELECT_TYPE *); | 240 | static int keyboard_bit_set (SELECT_TYPE *); |
| 239 | static void deactivate_process (Lisp_Object); | 241 | static void deactivate_process (Lisp_Object); |
| 240 | static void status_notify (struct Lisp_Process *); | 242 | static void status_notify (struct Lisp_Process *); |
| @@ -284,10 +286,10 @@ static int max_process_desc; | |||
| 284 | static int max_input_desc; | 286 | static 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 */ |
| 287 | Lisp_Object chan_process[MAXDESC]; | 289 | static Lisp_Object chan_process[MAXDESC]; |
| 288 | 290 | ||
| 289 | /* Alist of elements (NAME . PROCESS) */ | 291 | /* Alist of elements (NAME . PROCESS) */ |
| 290 | Lisp_Object Vprocess_alist; | 292 | static 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. */ | 300 | static int proc_buffered_char[MAXDESC]; |
| 299 | int proc_buffered_char[MAXDESC]; | ||
| 300 | 301 | ||
| 301 | /* Table of `struct coding-system' for each process. */ | 302 | /* Table of `struct coding-system' for each process. */ |
| 302 | static struct coding_system *proc_decode_coding_system[MAXDESC]; | 303 | static 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. */ |
| 307 | struct sockaddr_and_len { | 308 | static 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 | ||
| 323 | struct fd_callback_data | 324 | static 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 |
| 1086 | Lisp_Object Fprocess_datagram_address (Lisp_Object process); | 1087 | static Lisp_Object Fprocess_datagram_address (Lisp_Object); |
| 1087 | #endif | 1088 | #endif |
| 1088 | 1089 | ||
| 1089 | DEFUN ("process-contact", Fprocess_contact, Sprocess_contact, | 1090 | DEFUN ("process-contact", Fprocess_contact, Sprocess_contact, |
| @@ -1518,7 +1519,7 @@ create_process_1 (struct atimer *timer) | |||
| 1518 | } | 1519 | } |
| 1519 | 1520 | ||
| 1520 | 1521 | ||
| 1521 | void | 1522 | static void |
| 1522 | create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | 1523 | create_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 | ||
| 3793 | void | 3794 | static void |
| 3794 | deactivate_process (Lisp_Object proc) | 3795 | deactivate_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 | ||
| 5219 | jmp_buf send_process_frame; | 5220 | static jmp_buf send_process_frame; |
| 5220 | Lisp_Object process_sent_to; | 5221 | static Lisp_Object process_sent_to; |
| 5221 | 5222 | ||
| 5222 | static void | 5223 | static void |
| 5223 | send_process_trap (int ignore) | 5224 | send_process_trap (int ignore) |
| @@ -6984,8 +6985,8 @@ kill_buffer_processes (Lisp_Object buffer) | |||
| 6984 | #endif /* subprocesses */ | 6985 | #endif /* subprocesses */ |
| 6985 | } | 6986 | } |
| 6986 | 6987 | ||
| 6987 | DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p, | 6988 | DEFUN ("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. |
| 6990 | This is intended for use by asynchronous process output filters and sentinels. */) | 6991 | This 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; |