diff options
| author | Bill Wohler | 2012-11-24 19:43:02 -0800 |
|---|---|---|
| committer | Bill Wohler | 2012-11-24 19:43:02 -0800 |
| commit | 5244bc019bf7376caff3bb198ff674e0ad9fb0e6 (patch) | |
| tree | 02ee1615e904771f692ec2957c79a08ae029a13d /src/process.h | |
| parent | 9f7e719509474e92f85955e22e57ffeebd4e96f3 (diff) | |
| parent | c07a6ded1df2f4156badc9add2953579622c3722 (diff) | |
| download | emacs-5244bc019bf7376caff3bb198ff674e0ad9fb0e6.tar.gz emacs-5244bc019bf7376caff3bb198ff674e0ad9fb0e6.zip | |
Merge from trunk.
Diffstat (limited to 'src/process.h')
| -rw-r--r-- | src/process.h | 72 |
1 files changed, 55 insertions, 17 deletions
diff --git a/src/process.h b/src/process.h index aff9e970f63..74d1a124060 100644 --- a/src/process.h +++ b/src/process.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Definitions for asynchronous process control in GNU Emacs. | 1 | /* Definitions for asynchronous process control in GNU Emacs. |
| 2 | Copyright (C) 1985, 1994, 2001-2011 Free Software Foundation, Inc. | 2 | Copyright (C) 1985, 1994, 2001-2012 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -26,11 +26,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | #include "gnutls.h" | 26 | #include "gnutls.h" |
| 27 | #endif | 27 | #endif |
| 28 | 28 | ||
| 29 | /* This structure records information about a subprocess | 29 | INLINE_HEADER_BEGIN |
| 30 | or network connection. | 30 | #ifndef PROCESS_INLINE |
| 31 | # define PROCESS_INLINE INLINE | ||
| 32 | #endif | ||
| 31 | 33 | ||
| 32 | Every field in this structure except for the header | 34 | /* This structure records information about a subprocess |
| 33 | must be a Lisp_Object, for GC's sake. */ | 35 | or network connection. */ |
| 34 | 36 | ||
| 35 | struct Lisp_Process | 37 | struct Lisp_Process |
| 36 | { | 38 | { |
| @@ -38,46 +40,65 @@ struct Lisp_Process | |||
| 38 | 40 | ||
| 39 | /* Name of subprocess terminal. */ | 41 | /* Name of subprocess terminal. */ |
| 40 | Lisp_Object tty_name; | 42 | Lisp_Object tty_name; |
| 43 | |||
| 41 | /* Name of this process */ | 44 | /* Name of this process */ |
| 42 | Lisp_Object name; | 45 | Lisp_Object name; |
| 46 | |||
| 43 | /* List of command arguments that this process was run with. | 47 | /* List of command arguments that this process was run with. |
| 44 | Is set to t for a stopped network process; nil otherwise. */ | 48 | Is set to t for a stopped network process; nil otherwise. */ |
| 45 | Lisp_Object command; | 49 | Lisp_Object command; |
| 50 | |||
| 46 | /* (funcall FILTER PROC STRING) (if FILTER is non-nil) | 51 | /* (funcall FILTER PROC STRING) (if FILTER is non-nil) |
| 47 | to dispose of a bunch of chars from the process all at once */ | 52 | to dispose of a bunch of chars from the process all at once */ |
| 48 | Lisp_Object filter; | 53 | Lisp_Object filter; |
| 54 | |||
| 49 | /* (funcall SENTINEL PROCESS) when process state changes */ | 55 | /* (funcall SENTINEL PROCESS) when process state changes */ |
| 50 | Lisp_Object sentinel; | 56 | Lisp_Object sentinel; |
| 57 | |||
| 51 | /* (funcall LOG SERVER CLIENT MESSAGE) when a server process | 58 | /* (funcall LOG SERVER CLIENT MESSAGE) when a server process |
| 52 | accepts a connection from a client. */ | 59 | accepts a connection from a client. */ |
| 53 | Lisp_Object log; | 60 | Lisp_Object log; |
| 61 | |||
| 54 | /* Buffer that output is going to */ | 62 | /* Buffer that output is going to */ |
| 55 | Lisp_Object buffer; | 63 | Lisp_Object buffer; |
| 64 | |||
| 56 | /* t if this is a real child process. For a network or serial | 65 | /* t if this is a real child process. For a network or serial |
| 57 | connection, it is a plist based on the arguments to | 66 | connection, it is a plist based on the arguments to |
| 58 | make-network-process or make-serial-process. */ | 67 | make-network-process or make-serial-process. */ |
| 68 | |||
| 59 | Lisp_Object childp; | 69 | Lisp_Object childp; |
| 70 | |||
| 60 | /* Plist for programs to keep per-process state information, parameters, etc. */ | 71 | /* Plist for programs to keep per-process state information, parameters, etc. */ |
| 61 | Lisp_Object plist; | 72 | Lisp_Object plist; |
| 73 | |||
| 62 | /* Symbol indicating the type of process: real, network, serial */ | 74 | /* Symbol indicating the type of process: real, network, serial */ |
| 63 | Lisp_Object type; | 75 | Lisp_Object type; |
| 76 | |||
| 64 | /* Marker set to end of last buffer-inserted output from this process */ | 77 | /* Marker set to end of last buffer-inserted output from this process */ |
| 65 | Lisp_Object mark; | 78 | Lisp_Object mark; |
| 79 | |||
| 66 | /* Symbol indicating status of process. | 80 | /* Symbol indicating status of process. |
| 67 | This may be a symbol: run, open, or closed. | 81 | This may be a symbol: run, open, or closed. |
| 68 | Or it may be a list, whose car is stop, exit or signal | 82 | Or it may be a list, whose car is stop, exit or signal |
| 69 | and whose cdr is a pair (EXIT_CODE . COREDUMP_FLAG) | 83 | and whose cdr is a pair (EXIT_CODE . COREDUMP_FLAG) |
| 70 | or (SIGNAL_NUMBER . COREDUMP_FLAG). */ | 84 | or (SIGNAL_NUMBER . COREDUMP_FLAG). */ |
| 71 | Lisp_Object status; | 85 | Lisp_Object status; |
| 86 | |||
| 72 | /* Coding-system for decoding the input from this process. */ | 87 | /* Coding-system for decoding the input from this process. */ |
| 73 | Lisp_Object decode_coding_system; | 88 | Lisp_Object decode_coding_system; |
| 89 | |||
| 74 | /* Working buffer for decoding. */ | 90 | /* Working buffer for decoding. */ |
| 75 | Lisp_Object decoding_buf; | 91 | Lisp_Object decoding_buf; |
| 92 | |||
| 76 | /* Coding-system for encoding the output to this process. */ | 93 | /* Coding-system for encoding the output to this process. */ |
| 77 | Lisp_Object encode_coding_system; | 94 | Lisp_Object encode_coding_system; |
| 95 | |||
| 78 | /* Working buffer for encoding. */ | 96 | /* Working buffer for encoding. */ |
| 79 | Lisp_Object encoding_buf; | 97 | Lisp_Object encoding_buf; |
| 80 | 98 | ||
| 99 | /* Queue for storing waiting writes */ | ||
| 100 | Lisp_Object write_queue; | ||
| 101 | |||
| 81 | #ifdef HAVE_GNUTLS | 102 | #ifdef HAVE_GNUTLS |
| 82 | Lisp_Object gnutls_cred_type; | 103 | Lisp_Object gnutls_cred_type; |
| 83 | #endif | 104 | #endif |
| @@ -95,17 +116,17 @@ struct Lisp_Process | |||
| 95 | /* Descriptor by which we write to this process */ | 116 | /* Descriptor by which we write to this process */ |
| 96 | int outfd; | 117 | int outfd; |
| 97 | /* Event-count of last event in which this process changed status. */ | 118 | /* Event-count of last event in which this process changed status. */ |
| 98 | int tick; | 119 | EMACS_INT tick; |
| 99 | /* Event-count of last such event reported. */ | 120 | /* Event-count of last such event reported. */ |
| 100 | int update_tick; | 121 | EMACS_INT update_tick; |
| 101 | /* Size of carryover in decoding. */ | 122 | /* Size of carryover in decoding. */ |
| 102 | int decoding_carryover; | 123 | int decoding_carryover; |
| 103 | /* Hysteresis to try to read process output in larger blocks. | 124 | /* Hysteresis to try to read process output in larger blocks. |
| 104 | On some systems, e.g. GNU/Linux, Emacs is seen as | 125 | On some systems, e.g. GNU/Linux, Emacs is seen as |
| 105 | an interactive app also when reading process output, meaning | 126 | an interactive app also when reading process output, meaning |
| 106 | that process output can be read in as little as 1 byte at a | 127 | that process output can be read in as little as 1 byte at a |
| 107 | time. Value is micro-seconds to delay reading output from | 128 | time. Value is nanoseconds to delay reading output from |
| 108 | this process. Range is 0 .. 50000. */ | 129 | this process. Range is 0 .. 50 * 1000 * 1000. */ |
| 109 | int read_output_delay; | 130 | int read_output_delay; |
| 110 | /* Should we delay reading output from this process. | 131 | /* Should we delay reading output from this process. |
| 111 | Initialized from `Vprocess_adaptive_read_buffering'. | 132 | Initialized from `Vprocess_adaptive_read_buffering'. |
| @@ -121,6 +142,9 @@ struct Lisp_Process | |||
| 121 | /* Flag to set coding-system of the process buffer from the | 142 | /* Flag to set coding-system of the process buffer from the |
| 122 | coding_system used to decode process output. */ | 143 | coding_system used to decode process output. */ |
| 123 | unsigned int inherit_coding_system_flag : 1; | 144 | unsigned int inherit_coding_system_flag : 1; |
| 145 | /* Whether the process is alive, i.e., can be waited for. Running | ||
| 146 | processes can be waited for, but exited and fake processes cannot. */ | ||
| 147 | unsigned int alive : 1; | ||
| 124 | /* Record the process status in the raw form in which it comes from `wait'. | 148 | /* Record the process status in the raw form in which it comes from `wait'. |
| 125 | This is to avoid consing in a signal handler. The `raw_status_new' | 149 | This is to avoid consing in a signal handler. The `raw_status_new' |
| 126 | flag indicates that `raw_status' contains a new status that still | 150 | flag indicates that `raw_status' contains a new status that still |
| @@ -134,6 +158,7 @@ struct Lisp_Process | |||
| 134 | gnutls_certificate_client_credentials gnutls_x509_cred; | 158 | gnutls_certificate_client_credentials gnutls_x509_cred; |
| 135 | gnutls_anon_client_credentials_t gnutls_anon_cred; | 159 | gnutls_anon_client_credentials_t gnutls_anon_cred; |
| 136 | int gnutls_log_level; | 160 | int gnutls_log_level; |
| 161 | int gnutls_handshakes_tried; | ||
| 137 | int gnutls_p; | 162 | int gnutls_p; |
| 138 | #endif | 163 | #endif |
| 139 | }; | 164 | }; |
| @@ -143,9 +168,26 @@ struct Lisp_Process | |||
| 143 | 168 | ||
| 144 | #define ChannelMask(n) (1 << (n)) | 169 | #define ChannelMask(n) (1 << (n)) |
| 145 | 170 | ||
| 171 | /* Most code should use these functions to set Lisp fields in struct | ||
| 172 | process. */ | ||
| 173 | |||
| 174 | PROCESS_INLINE void | ||
| 175 | pset_childp (struct Lisp_Process *p, Lisp_Object val) | ||
| 176 | { | ||
| 177 | p->childp = val; | ||
| 178 | } | ||
| 179 | |||
| 180 | #ifdef HAVE_GNUTLS | ||
| 181 | PROCESS_INLINE void | ||
| 182 | pset_gnutls_cred_type (struct Lisp_Process *p, Lisp_Object val) | ||
| 183 | { | ||
| 184 | p->gnutls_cred_type = val; | ||
| 185 | } | ||
| 186 | #endif | ||
| 187 | |||
| 146 | /* True if we are about to fork off a synchronous process or if we | 188 | /* True if we are about to fork off a synchronous process or if we |
| 147 | are waiting for it. */ | 189 | are waiting for it. */ |
| 148 | extern int synch_process_alive; | 190 | extern bool synch_process_alive; |
| 149 | 191 | ||
| 150 | /* Communicate exit status of sync process to from sigchld_handler | 192 | /* Communicate exit status of sync process to from sigchld_handler |
| 151 | to Fcall_process. */ | 193 | to Fcall_process. */ |
| @@ -160,12 +202,6 @@ extern int synch_process_termsig; | |||
| 160 | this is exit code of synchronous subprocess. */ | 202 | this is exit code of synchronous subprocess. */ |
| 161 | extern int synch_process_retcode; | 203 | extern int synch_process_retcode; |
| 162 | 204 | ||
| 163 | /* The name of the file open to get a null file, or a data sink. | ||
| 164 | MS-DOS, and OS/2 redefine this. */ | ||
| 165 | #ifndef NULL_DEVICE | ||
| 166 | #define NULL_DEVICE "/dev/null" | ||
| 167 | #endif | ||
| 168 | |||
| 169 | /* Nonzero means don't run process sentinels. This is used | 205 | /* Nonzero means don't run process sentinels. This is used |
| 170 | when exiting. */ | 206 | when exiting. */ |
| 171 | extern int inhibit_sentinels; | 207 | extern int inhibit_sentinels; |
| @@ -186,9 +222,11 @@ extern void hold_keyboard_input (void); | |||
| 186 | extern void unhold_keyboard_input (void); | 222 | extern void unhold_keyboard_input (void); |
| 187 | extern int kbd_on_hold_p (void); | 223 | extern int kbd_on_hold_p (void); |
| 188 | 224 | ||
| 189 | typedef void (*fd_callback)(int fd, void *data, int for_read); | 225 | typedef void (*fd_callback) (int fd, void *data); |
| 190 | 226 | ||
| 191 | extern void add_read_fd (int fd, fd_callback func, void *data); | 227 | extern void add_read_fd (int fd, fd_callback func, void *data); |
| 192 | extern void delete_read_fd (int fd); | 228 | extern void delete_read_fd (int fd); |
| 193 | extern void add_write_fd (int fd, fd_callback func, void *data); | 229 | extern void add_write_fd (int fd, fd_callback func, void *data); |
| 194 | extern void delete_write_fd (int fd); | 230 | extern void delete_write_fd (int fd); |
| 231 | |||
| 232 | INLINE_HEADER_END | ||