aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert2013-08-27 12:36:28 -0700
committerPaul Eggert2013-08-27 12:36:28 -0700
commitd486344e6fd74e4769cc7b3d09a1ea87387c5a11 (patch)
treee9ff0c112e6dbec49258aabe30122b389f9b6f20 /src/process.c
parentb73517d9ecf5efeea0d6cbde56730132f5e1b611 (diff)
downloademacs-d486344e6fd74e4769cc7b3d09a1ea87387c5a11.tar.gz
emacs-d486344e6fd74e4769cc7b3d09a1ea87387c5a11.zip
Simplify SELECT_TYPE-related code.
Like EMACS_TIME, this portability layer is no longer needed, since Emacs has been using fd_set as a portability layer for some time. * sysselect.h (FD_SETSIZE): Rename from MAXDESC. All uses changed. (SELECT_TYPE): Remove. All uses changed to fd_set. (fd_set) [!FD_SET]: New typedef.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/process.c b/src/process.c
index 3b62f45bf0a..b52622ec1b6 100644
--- a/src/process.c
+++ b/src/process.c
@@ -132,7 +132,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
132#endif 132#endif
133 133
134#ifdef WINDOWSNT 134#ifdef WINDOWSNT
135extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, 135extern int sys_select (int, fd_set *, fd_set *, fd_set *,
136 struct timespec *, void *); 136 struct timespec *, void *);
137#endif 137#endif
138 138
@@ -280,7 +280,7 @@ static bool process_output_skip;
280 280
281static void create_process (Lisp_Object, char **, Lisp_Object); 281static void create_process (Lisp_Object, char **, Lisp_Object);
282#ifdef USABLE_SIGIO 282#ifdef USABLE_SIGIO
283static bool keyboard_bit_set (SELECT_TYPE *); 283static bool keyboard_bit_set (fd_set *);
284#endif 284#endif
285static void deactivate_process (Lisp_Object); 285static void deactivate_process (Lisp_Object);
286static void status_notify (struct Lisp_Process *); 286static void status_notify (struct Lisp_Process *);
@@ -299,26 +299,26 @@ static void exec_sentinel (Lisp_Object proc, Lisp_Object reason);
299 299
300/* Mask of bits indicating the descriptors that we wait for input on. */ 300/* Mask of bits indicating the descriptors that we wait for input on. */
301 301
302static SELECT_TYPE input_wait_mask; 302static fd_set input_wait_mask;
303 303
304/* Mask that excludes keyboard input descriptor(s). */ 304/* Mask that excludes keyboard input descriptor(s). */
305 305
306static SELECT_TYPE non_keyboard_wait_mask; 306static fd_set non_keyboard_wait_mask;
307 307
308/* Mask that excludes process input descriptor(s). */ 308/* Mask that excludes process input descriptor(s). */
309 309
310static SELECT_TYPE non_process_wait_mask; 310static fd_set non_process_wait_mask;
311 311
312/* Mask for selecting for write. */ 312/* Mask for selecting for write. */
313 313
314static SELECT_TYPE write_mask; 314static fd_set write_mask;
315 315
316#ifdef NON_BLOCKING_CONNECT 316#ifdef NON_BLOCKING_CONNECT
317/* Mask of bits indicating the descriptors that we wait for connect to 317/* Mask of bits indicating the descriptors that we wait for connect to
318 complete on. Once they complete, they are removed from this mask 318 complete on. Once they complete, they are removed from this mask
319 and added to the input_wait_mask and non_keyboard_wait_mask. */ 319 and added to the input_wait_mask and non_keyboard_wait_mask. */
320 320
321static SELECT_TYPE connect_wait_mask; 321static fd_set connect_wait_mask;
322 322
323/* Number of bits set in connect_wait_mask. */ 323/* Number of bits set in connect_wait_mask. */
324static int num_pending_connects; 324static int num_pending_connects;
@@ -331,7 +331,7 @@ static int max_process_desc;
331static int max_input_desc; 331static int max_input_desc;
332 332
333/* Indexed by descriptor, gives the process (if any) for that descriptor */ 333/* Indexed by descriptor, gives the process (if any) for that descriptor */
334static Lisp_Object chan_process[MAXDESC]; 334static Lisp_Object chan_process[FD_SETSIZE];
335 335
336/* Alist of elements (NAME . PROCESS) */ 336/* Alist of elements (NAME . PROCESS) */
337static Lisp_Object Vprocess_alist; 337static Lisp_Object Vprocess_alist;
@@ -342,18 +342,18 @@ static Lisp_Object Vprocess_alist;
342 output from the process is to read at least one char. 342 output from the process is to read at least one char.
343 Always -1 on systems that support FIONREAD. */ 343 Always -1 on systems that support FIONREAD. */
344 344
345static int proc_buffered_char[MAXDESC]; 345static int proc_buffered_char[FD_SETSIZE];
346 346
347/* Table of `struct coding-system' for each process. */ 347/* Table of `struct coding-system' for each process. */
348static struct coding_system *proc_decode_coding_system[MAXDESC]; 348static struct coding_system *proc_decode_coding_system[FD_SETSIZE];
349static struct coding_system *proc_encode_coding_system[MAXDESC]; 349static struct coding_system *proc_encode_coding_system[FD_SETSIZE];
350 350
351#ifdef DATAGRAM_SOCKETS 351#ifdef DATAGRAM_SOCKETS
352/* Table of `partner address' for datagram sockets. */ 352/* Table of `partner address' for datagram sockets. */
353static struct sockaddr_and_len { 353static struct sockaddr_and_len {
354 struct sockaddr *sa; 354 struct sockaddr *sa;
355 int len; 355 int len;
356} datagram_address[MAXDESC]; 356} datagram_address[FD_SETSIZE];
357#define DATAGRAM_CHAN_P(chan) (datagram_address[chan].sa != 0) 357#define DATAGRAM_CHAN_P(chan) (datagram_address[chan].sa != 0)
358#define DATAGRAM_CONN_P(proc) (PROCESSP (proc) && datagram_address[XPROCESS (proc)->infd].sa != 0) 358#define DATAGRAM_CONN_P(proc) (PROCESSP (proc) && datagram_address[XPROCESS (proc)->infd].sa != 0)
359#else 359#else
@@ -458,7 +458,7 @@ static struct fd_callback_data
458#define FOR_READ 1 458#define FOR_READ 1
459#define FOR_WRITE 2 459#define FOR_WRITE 2
460 int condition; /* mask of the defines above. */ 460 int condition; /* mask of the defines above. */
461} fd_callback_info[MAXDESC]; 461} fd_callback_info[FD_SETSIZE];
462 462
463 463
464/* Add a file descriptor FD to be monitored for when read is possible. 464/* Add a file descriptor FD to be monitored for when read is possible.
@@ -467,7 +467,7 @@ static struct fd_callback_data
467void 467void
468add_read_fd (int fd, fd_callback func, void *data) 468add_read_fd (int fd, fd_callback func, void *data)
469{ 469{
470 eassert (fd < MAXDESC); 470 eassert (fd < FD_SETSIZE);
471 add_keyboard_wait_descriptor (fd); 471 add_keyboard_wait_descriptor (fd);
472 472
473 fd_callback_info[fd].func = func; 473 fd_callback_info[fd].func = func;
@@ -480,7 +480,7 @@ add_read_fd (int fd, fd_callback func, void *data)
480void 480void
481delete_read_fd (int fd) 481delete_read_fd (int fd)
482{ 482{
483 eassert (fd < MAXDESC); 483 eassert (fd < FD_SETSIZE);
484 delete_keyboard_wait_descriptor (fd); 484 delete_keyboard_wait_descriptor (fd);
485 485
486 fd_callback_info[fd].condition &= ~FOR_READ; 486 fd_callback_info[fd].condition &= ~FOR_READ;
@@ -497,7 +497,7 @@ delete_read_fd (int fd)
497void 497void
498add_write_fd (int fd, fd_callback func, void *data) 498add_write_fd (int fd, fd_callback func, void *data)
499{ 499{
500 eassert (fd < MAXDESC); 500 eassert (fd < FD_SETSIZE);
501 FD_SET (fd, &write_mask); 501 FD_SET (fd, &write_mask);
502 if (fd > max_input_desc) 502 if (fd > max_input_desc)
503 max_input_desc = fd; 503 max_input_desc = fd;
@@ -528,7 +528,7 @@ delete_input_desc (int fd)
528void 528void
529delete_write_fd (int fd) 529delete_write_fd (int fd)
530{ 530{
531 eassert (fd < MAXDESC); 531 eassert (fd < FD_SETSIZE);
532 FD_CLR (fd, &write_mask); 532 FD_CLR (fd, &write_mask);
533 fd_callback_info[fd].condition &= ~FOR_WRITE; 533 fd_callback_info[fd].condition &= ~FOR_WRITE;
534 if (fd_callback_info[fd].condition == 0) 534 if (fd_callback_info[fd].condition == 0)
@@ -3232,7 +3232,7 @@ usage: (make-network-process &rest ARGS) */)
3232 wait for completion is pselect(). */ 3232 wait for completion is pselect(). */
3233 int sc; 3233 int sc;
3234 socklen_t len; 3234 socklen_t len;
3235 SELECT_TYPE fdset; 3235 fd_set fdset;
3236 retry_select: 3236 retry_select:
3237 FD_ZERO (&fdset); 3237 FD_ZERO (&fdset);
3238 FD_SET (s, &fdset); 3238 FD_SET (s, &fdset);
@@ -4232,8 +4232,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4232 struct Lisp_Process *wait_proc, int just_wait_proc) 4232 struct Lisp_Process *wait_proc, int just_wait_proc)
4233{ 4233{
4234 int channel, nfds; 4234 int channel, nfds;
4235 SELECT_TYPE Available; 4235 fd_set Available;
4236 SELECT_TYPE Writeok; 4236 fd_set Writeok;
4237 bool check_write; 4237 bool check_write;
4238 int check_delay; 4238 int check_delay;
4239 bool no_avail; 4239 bool no_avail;
@@ -4387,8 +4387,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4387 timeout to get our attention. */ 4387 timeout to get our attention. */
4388 if (update_tick != process_tick) 4388 if (update_tick != process_tick)
4389 { 4389 {
4390 SELECT_TYPE Atemp; 4390 fd_set Atemp;
4391 SELECT_TYPE Ctemp; 4391 fd_set Ctemp;
4392 4392
4393 if (kbd_on_hold_p ()) 4393 if (kbd_on_hold_p ())
4394 FD_ZERO (&Atemp); 4394 FD_ZERO (&Atemp);
@@ -4571,7 +4571,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4571 the gnutls library -- 2.12.14 has been confirmed 4571 the gnutls library -- 2.12.14 has been confirmed
4572 to need it. See 4572 to need it. See
4573 http://comments.gmane.org/gmane.emacs.devel/145074 */ 4573 http://comments.gmane.org/gmane.emacs.devel/145074 */
4574 for (channel = 0; channel < MAXDESC; ++channel) 4574 for (channel = 0; channel < FD_SETSIZE; ++channel)
4575 if (! NILP (chan_process[channel])) 4575 if (! NILP (chan_process[channel]))
4576 { 4576 {
4577 struct Lisp_Process *p = 4577 struct Lisp_Process *p =
@@ -6542,7 +6542,7 @@ keyboard_bit_set (fd_set *mask)
6542#else /* not subprocesses */ 6542#else /* not subprocesses */
6543 6543
6544/* Defined on msdos.c. */ 6544/* Defined on msdos.c. */
6545extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, 6545extern int sys_select (int, fd_set *, fd_set *, fd_set *,
6546 struct timespec *, void *); 6546 struct timespec *, void *);
6547 6547
6548/* Implementation of wait_reading_process_output, assuming that there 6548/* Implementation of wait_reading_process_output, assuming that there
@@ -6608,7 +6608,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
6608 while (1) 6608 while (1)
6609 { 6609 {
6610 bool timeout_reduced_for_timers = 0; 6610 bool timeout_reduced_for_timers = 0;
6611 SELECT_TYPE waitchannels; 6611 fd_set waitchannels;
6612 int xerrno; 6612 int xerrno;
6613 6613
6614 /* If calling from keyboard input, do not quit 6614 /* If calling from keyboard input, do not quit
@@ -7072,7 +7072,7 @@ init_process_emacs (void)
7072 7072
7073 Vprocess_alist = Qnil; 7073 Vprocess_alist = Qnil;
7074 deleted_pid_list = Qnil; 7074 deleted_pid_list = Qnil;
7075 for (i = 0; i < MAXDESC; i++) 7075 for (i = 0; i < FD_SETSIZE; i++)
7076 { 7076 {
7077 chan_process[i] = Qnil; 7077 chan_process[i] = Qnil;
7078 proc_buffered_char[i] = -1; 7078 proc_buffered_char[i] = -1;