aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert2013-03-07 18:32:21 -0800
committerPaul Eggert2013-03-07 18:32:21 -0800
commit0bce5d9eb88ed1020385874ca8b3367ad6ee4359 (patch)
tree27b8a950e134236b42e0ce055cabd94f9c1d1684 /src/process.c
parent6d7ebb726dd39b5e5e9f12e0341a4bb350caf637 (diff)
downloademacs-0bce5d9eb88ed1020385874ca8b3367ad6ee4359.tar.gz
emacs-0bce5d9eb88ed1020385874ca8b3367ad6ee4359.zip
print.c, process.c: Use bool for booleans.
* lisp.h (wait_reading_process_output): * print.c (print_output_debug_flag, PRINTDECLARE, printchar) (strout, debug_output_compilation_hack, float_to_string, print) (print_object): * process.c (kbd_is_on_hold, inhibit_sentinels, process_output_skip) (decode_status, status_message, create_process, create_pty) (Fmake_network_process, Fnetwork_interface_info) (wait_reading_process_output, read_process_output) (write_queue_push, write_queue_pop, process_send_signal) (handle_child_signal, keyboard_bit_set, kbd_on_hold_p): * process.h (struct Lisp_Process, inhibit_sentinels, kbd_on_hold_p): Use bool for booleans. * process.c (Fnetwork_interface_list): Remove unused local. (connect_counter): Now EMACS_INT, not int.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c82
1 files changed, 42 insertions, 40 deletions
diff --git a/src/process.c b/src/process.c
index 5b15ade1122..bafdca9bd63 100644
--- a/src/process.c
+++ b/src/process.c
@@ -146,13 +146,13 @@ Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs;
146Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime; 146Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime;
147Lisp_Object QCname, QCtype; 147Lisp_Object QCname, QCtype;
148 148
149/* Non-zero if keyboard input is on hold, zero otherwise. */ 149/* True if keyboard input is on hold, zero otherwise. */
150 150
151static int kbd_is_on_hold; 151static bool kbd_is_on_hold;
152 152
153/* Nonzero means don't run process sentinels. This is used 153/* Nonzero means don't run process sentinels. This is used
154 when exiting. */ 154 when exiting. */
155int inhibit_sentinels; 155bool inhibit_sentinels;
156 156
157#ifdef subprocesses 157#ifdef subprocesses
158 158
@@ -234,9 +234,9 @@ static EMACS_INT update_tick;
234 234
235static int process_output_delay_count; 235static int process_output_delay_count;
236 236
237/* Non-zero if any process has non-nil read_output_skip. */ 237/* True if any process has non-nil read_output_skip. */
238 238
239static int process_output_skip; 239static bool process_output_skip;
240 240
241#else 241#else
242#define process_output_delay_count 0 242#define process_output_delay_count 0
@@ -244,7 +244,7 @@ static int process_output_skip;
244 244
245static void create_process (Lisp_Object, char **, Lisp_Object); 245static void create_process (Lisp_Object, char **, Lisp_Object);
246#ifdef USABLE_SIGIO 246#ifdef USABLE_SIGIO
247static int keyboard_bit_set (SELECT_TYPE *); 247static bool keyboard_bit_set (SELECT_TYPE *);
248#endif 248#endif
249static void deactivate_process (Lisp_Object); 249static void deactivate_process (Lisp_Object);
250static void status_notify (struct Lisp_Process *); 250static void status_notify (struct Lisp_Process *);
@@ -527,7 +527,7 @@ status_convert (int w)
527 and store them individually through the three pointers. */ 527 and store them individually through the three pointers. */
528 528
529static void 529static void
530decode_status (Lisp_Object l, Lisp_Object *symbol, int *code, int *coredump) 530decode_status (Lisp_Object l, Lisp_Object *symbol, int *code, bool *coredump)
531{ 531{
532 Lisp_Object tem; 532 Lisp_Object tem;
533 533
@@ -554,7 +554,8 @@ status_message (struct Lisp_Process *p)
554{ 554{
555 Lisp_Object status = p->status; 555 Lisp_Object status = p->status;
556 Lisp_Object symbol; 556 Lisp_Object symbol;
557 int code, coredump; 557 int code;
558 bool coredump;
558 Lisp_Object string, string2; 559 Lisp_Object string, string2;
559 560
560 decode_status (status, &symbol, &code, &coredump); 561 decode_status (status, &symbol, &code, &coredump);
@@ -1579,7 +1580,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1579 sigset_t blocked; 1580 sigset_t blocked;
1580 /* Use volatile to protect variables from being clobbered by vfork. */ 1581 /* Use volatile to protect variables from being clobbered by vfork. */
1581 volatile int forkin, forkout; 1582 volatile int forkin, forkout;
1582 volatile int pty_flag = 0; 1583 volatile bool pty_flag = 0;
1583 volatile Lisp_Object lisp_pty_name = Qnil; 1584 volatile Lisp_Object lisp_pty_name = Qnil;
1584 volatile Lisp_Object encoded_current_dir; 1585 volatile Lisp_Object encoded_current_dir;
1585 1586
@@ -1871,7 +1872,7 @@ void
1871create_pty (Lisp_Object process) 1872create_pty (Lisp_Object process)
1872{ 1873{
1873 int inchannel, outchannel; 1874 int inchannel, outchannel;
1874 int pty_flag = 0; 1875 bool pty_flag = 0;
1875 1876
1876 inchannel = outchannel = -1; 1877 inchannel = outchannel = -1;
1877 1878
@@ -2819,8 +2820,9 @@ usage: (make-network-process &rest ARGS) */)
2819 Lisp_Object tem; 2820 Lisp_Object tem;
2820 Lisp_Object name, buffer, host, service, address; 2821 Lisp_Object name, buffer, host, service, address;
2821 Lisp_Object filter, sentinel; 2822 Lisp_Object filter, sentinel;
2822 int is_non_blocking_client = 0; 2823 bool is_non_blocking_client = 0;
2823 int is_server = 0, backlog = 5; 2824 bool is_server = 0;
2825 int backlog = 5;
2824 int socktype; 2826 int socktype;
2825 int family = -1; 2827 int family = -1;
2826 2828
@@ -3497,7 +3499,7 @@ format; see the description of ADDRESS in `make-network-process'. */)
3497 struct ifreq *ifreq; 3499 struct ifreq *ifreq;
3498 void *buf = NULL; 3500 void *buf = NULL;
3499 ptrdiff_t buf_size = 512; 3501 ptrdiff_t buf_size = 512;
3500 int s, i; 3502 int s;
3501 Lisp_Object res; 3503 Lisp_Object res;
3502 3504
3503 s = socket (AF_INET, SOCK_STREAM, 0); 3505 s = socket (AF_INET, SOCK_STREAM, 0);
@@ -3535,7 +3537,6 @@ format; see the description of ADDRESS in `make-network-process'. */)
3535 int len = sizeof (*ifreq); 3537 int len = sizeof (*ifreq);
3536#endif 3538#endif
3537 char namebuf[sizeof (ifq->ifr_name) + 1]; 3539 char namebuf[sizeof (ifq->ifr_name) + 1];
3538 i += len;
3539 ifreq = (struct ifreq *) ((char *) ifreq + len); 3540 ifreq = (struct ifreq *) ((char *) ifreq + len);
3540 3541
3541 if (ifq->ifr_addr.sa_family != AF_INET) 3542 if (ifq->ifr_addr.sa_family != AF_INET)
@@ -3645,7 +3646,7 @@ FLAGS is the current flags of the interface. */)
3645 Lisp_Object res = Qnil; 3646 Lisp_Object res = Qnil;
3646 Lisp_Object elt; 3647 Lisp_Object elt;
3647 int s; 3648 int s;
3648 int any = 0; 3649 bool any = 0;
3649#if (! (defined SIOCGIFHWADDR && defined HAVE_STRUCT_IFREQ_IFR_HWADDR) \ 3650#if (! (defined SIOCGIFHWADDR && defined HAVE_STRUCT_IFREQ_IFR_HWADDR) \
3650 && defined HAVE_GETIFADDRS && defined LLADDR) 3651 && defined HAVE_GETIFADDRS && defined LLADDR)
3651 struct ifaddrs *ifap; 3652 struct ifaddrs *ifap;
@@ -3931,7 +3932,7 @@ Return non-nil if we received any output before the timeout expired. */)
3931 3932
3932/* Accept a connection for server process SERVER on CHANNEL. */ 3933/* Accept a connection for server process SERVER on CHANNEL. */
3933 3934
3934static int connect_counter = 0; 3935static EMACS_INT connect_counter = 0;
3935 3936
3936static void 3937static void
3937server_accept_connection (Lisp_Object server, int channel) 3938server_accept_connection (Lisp_Object server, int channel)
@@ -4186,7 +4187,7 @@ wait_reading_process_output_1 (void)
4186 process. The return value is true if we read some input from 4187 process. The return value is true if we read some input from
4187 that process. 4188 that process.
4188 4189
4189 If JUST_WAIT_PROC is non-nil, handle only output from WAIT_PROC 4190 If JUST_WAIT_PROC is nonzero, handle only output from WAIT_PROC
4190 (suspending output from other processes). A negative value 4191 (suspending output from other processes). A negative value
4191 means don't run any timers either. 4192 means don't run any timers either.
4192 4193
@@ -4194,22 +4195,23 @@ wait_reading_process_output_1 (void)
4194 received input from that process before the timeout elapsed. 4195 received input from that process before the timeout elapsed.
4195 Otherwise, return true if we received input from any process. */ 4196 Otherwise, return true if we received input from any process. */
4196 4197
4197int 4198bool
4198wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, 4199wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4199 bool do_display, 4200 bool do_display,
4200 Lisp_Object wait_for_cell, 4201 Lisp_Object wait_for_cell,
4201 struct Lisp_Process *wait_proc, int just_wait_proc) 4202 struct Lisp_Process *wait_proc, int just_wait_proc)
4202{ 4203{
4203 register int channel, nfds; 4204 int channel, nfds;
4204 SELECT_TYPE Available; 4205 SELECT_TYPE Available;
4205 SELECT_TYPE Writeok; 4206 SELECT_TYPE Writeok;
4206 int check_write; 4207 bool check_write;
4207 int check_delay, no_avail; 4208 int check_delay;
4209 bool no_avail;
4208 int xerrno; 4210 int xerrno;
4209 Lisp_Object proc; 4211 Lisp_Object proc;
4210 EMACS_TIME timeout, end_time; 4212 EMACS_TIME timeout, end_time;
4211 int wait_channel = -1; 4213 int wait_channel = -1;
4212 int got_some_input = 0; 4214 bool got_some_input = 0;
4213 ptrdiff_t count = SPECPDL_INDEX (); 4215 ptrdiff_t count = SPECPDL_INDEX ();
4214 4216
4215 FD_ZERO (&Available); 4217 FD_ZERO (&Available);
@@ -4246,7 +4248,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4246 4248
4247 while (1) 4249 while (1)
4248 { 4250 {
4249 int timeout_reduced_for_timers = 0; 4251 bool timeout_reduced_for_timers = 0;
4250 4252
4251 /* If calling from keyboard input, do not quit 4253 /* If calling from keyboard input, do not quit
4252 since we want to return C-g as an input character. 4254 since we want to return C-g as an input character.
@@ -4624,7 +4626,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4624 unsigned old_timers_run = timers_run; 4626 unsigned old_timers_run = timers_run;
4625 struct buffer *old_buffer = current_buffer; 4627 struct buffer *old_buffer = current_buffer;
4626 Lisp_Object old_window = selected_window; 4628 Lisp_Object old_window = selected_window;
4627 int leave = 0; 4629 bool leave = 0;
4628 4630
4629 if (detect_input_pending_run_timers (do_display)) 4631 if (detect_input_pending_run_timers (do_display))
4630 { 4632 {
@@ -4945,7 +4947,7 @@ read_process_output (Lisp_Object proc, register int channel)
4945 else 4947 else
4946#endif 4948#endif
4947 { 4949 {
4948 int buffered = 0 <= proc_buffered_char[channel]; 4950 bool buffered = 0 <= proc_buffered_char[channel];
4949 if (buffered) 4951 if (buffered)
4950 { 4952 {
4951 chars[carryover] = proc_buffered_char[channel]; 4953 chars[carryover] = proc_buffered_char[channel];
@@ -5261,7 +5263,7 @@ read_process_output (Lisp_Object proc, register int channel)
5261 5263
5262static void 5264static void
5263write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj, 5265write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
5264 const char *buf, ptrdiff_t len, int front) 5266 const char *buf, ptrdiff_t len, bool front)
5265{ 5267{
5266 ptrdiff_t offset; 5268 ptrdiff_t offset;
5267 Lisp_Object entry, obj; 5269 Lisp_Object entry, obj;
@@ -5286,10 +5288,10 @@ write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
5286} 5288}
5287 5289
5288/* Remove the first element in the write_queue of process P, put its 5290/* Remove the first element in the write_queue of process P, put its
5289 contents in OBJ, BUF and LEN, and return non-zero. If the 5291 contents in OBJ, BUF and LEN, and return true. If the
5290 write_queue is empty, return zero. */ 5292 write_queue is empty, return false. */
5291 5293
5292static int 5294static bool
5293write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj, 5295write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj,
5294 const char **buf, ptrdiff_t *len) 5296 const char **buf, ptrdiff_t *len)
5295{ 5297{
@@ -5650,7 +5652,7 @@ return t unconditionally. */)
5650 If CURRENT_GROUP is lambda, that means send to the process group 5652 If CURRENT_GROUP is lambda, that means send to the process group
5651 that currently owns the terminal, but only if it is NOT the shell itself. 5653 that currently owns the terminal, but only if it is NOT the shell itself.
5652 5654
5653 If NOMSG is zero, insert signal-announcements into process's buffers 5655 If NOMSG is false, insert signal-announcements into process's buffers
5654 right away. 5656 right away.
5655 5657
5656 If we can, we try to signal PROCESS by sending control characters 5658 If we can, we try to signal PROCESS by sending control characters
@@ -5659,12 +5661,12 @@ return t unconditionally. */)
5659 5661
5660static void 5662static void
5661process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group, 5663process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
5662 int nomsg) 5664 bool nomsg)
5663{ 5665{
5664 Lisp_Object proc; 5666 Lisp_Object proc;
5665 register struct Lisp_Process *p; 5667 struct Lisp_Process *p;
5666 pid_t gid; 5668 pid_t gid;
5667 int no_pgrp = 0; 5669 bool no_pgrp = 0;
5668 5670
5669 proc = get_process (process); 5671 proc = get_process (process);
5670 p = XPROCESS (proc); 5672 p = XPROCESS (proc);
@@ -6161,7 +6163,7 @@ handle_child_signal (int sig)
6161 /* If process has terminated, stop waiting for its output. */ 6163 /* If process has terminated, stop waiting for its output. */
6162 if (WIFSIGNALED (status) || WIFEXITED (status)) 6164 if (WIFSIGNALED (status) || WIFEXITED (status))
6163 { 6165 {
6164 int clear_desc_flag = 0; 6166 bool clear_desc_flag = 0;
6165 p->alive = 0; 6167 p->alive = 0;
6166 if (p->infd >= 0) 6168 if (p->infd >= 0)
6167 clear_desc_flag = 1; 6169 clear_desc_flag = 1;
@@ -6504,10 +6506,10 @@ delete_gpm_wait_descriptor (int desc)
6504 6506
6505# ifdef USABLE_SIGIO 6507# ifdef USABLE_SIGIO
6506 6508
6507/* Return nonzero if *MASK has a bit set 6509/* Return true if *MASK has a bit set
6508 that corresponds to one of the keyboard input descriptors. */ 6510 that corresponds to one of the keyboard input descriptors. */
6509 6511
6510static int 6512static bool
6511keyboard_bit_set (fd_set *mask) 6513keyboard_bit_set (fd_set *mask)
6512{ 6514{
6513 int fd; 6515 int fd;
@@ -6557,7 +6559,7 @@ extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
6557 6559
6558 Return true if we received input from any process. */ 6560 Return true if we received input from any process. */
6559 6561
6560int 6562bool
6561wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, 6563wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
6562 bool do_display, 6564 bool do_display,
6563 Lisp_Object wait_for_cell, 6565 Lisp_Object wait_for_cell,
@@ -6589,7 +6591,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
6589 6591
6590 while (1) 6592 while (1)
6591 { 6593 {
6592 int timeout_reduced_for_timers = 0; 6594 bool timeout_reduced_for_timers = 0;
6593 SELECT_TYPE waitchannels; 6595 SELECT_TYPE waitchannels;
6594 int xerrno; 6596 int xerrno;
6595 6597
@@ -6940,9 +6942,9 @@ unhold_keyboard_input (void)
6940 kbd_is_on_hold = 0; 6942 kbd_is_on_hold = 0;
6941} 6943}
6942 6944
6943/* Return non-zero if keyboard input is on hold, zero otherwise. */ 6945/* Return true if keyboard input is on hold, zero otherwise. */
6944 6946
6945int 6947bool
6946kbd_on_hold_p (void) 6948kbd_on_hold_p (void)
6947{ 6949{
6948 return kbd_is_on_hold; 6950 return kbd_is_on_hold;