aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorStefan Monnier2014-12-08 15:02:26 -0500
committerStefan Monnier2014-12-08 15:02:26 -0500
commitb76bea4c2639ee78b345d50a0f6ce5d10e2253ac (patch)
treed962f149c41ebad82fc819c818cb084619e30433 /src/process.c
parente0e2f363e86f8581191640324296fdebd2520d7c (diff)
downloademacs-b76bea4c2639ee78b345d50a0f6ce5d10e2253ac.tar.gz
emacs-b76bea4c2639ee78b345d50a0f6ce5d10e2253ac.zip
Various minor details accumulated over time
* lisp/info.el (Info-mode-map): Remove left-over binding. * lisp/net/tramp.el (tramp-handle-make-symbolic-link): Mark unused arg. * lisp/obsolete/gulp.el (gulp-create-m-p-alist): Remove unused var `mnt-tm'. * lisp/progmodes/gud.el (gud-gdb-completions): Remove unused var `start'. * lisp/url/url-http.el (url-http-activate-callback): Make debug more verbose. * src/process.c: Whitespace and line-break nitpicks.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/src/process.c b/src/process.c
index 6eae5166465..7283df4147b 100644
--- a/src/process.c
+++ b/src/process.c
@@ -326,10 +326,10 @@ static int max_process_desc;
326/* The largest descriptor currently in use for input; -1 if none. */ 326/* The largest descriptor currently in use for input; -1 if none. */
327static int max_input_desc; 327static int max_input_desc;
328 328
329/* Indexed by descriptor, gives the process (if any) for that descriptor */ 329/* Indexed by descriptor, gives the process (if any) for that descriptor. */
330static Lisp_Object chan_process[FD_SETSIZE]; 330static Lisp_Object chan_process[FD_SETSIZE];
331 331
332/* Alist of elements (NAME . PROCESS) */ 332/* Alist of elements (NAME . PROCESS). */
333static Lisp_Object Vprocess_alist; 333static Lisp_Object Vprocess_alist;
334 334
335/* Buffered-ahead input char from process, indexed by channel. 335/* Buffered-ahead input char from process, indexed by channel.
@@ -456,7 +456,7 @@ static struct fd_callback_data
456 void *data; 456 void *data;
457#define FOR_READ 1 457#define FOR_READ 1
458#define FOR_WRITE 2 458#define FOR_WRITE 2
459 int condition; /* mask of the defines above. */ 459 int condition; /* Mask of the defines above. */
460} fd_callback_info[FD_SETSIZE]; 460} fd_callback_info[FD_SETSIZE];
461 461
462 462
@@ -691,8 +691,8 @@ allocate_pty (char pty_name[PTY_NAME_SIZE])
691 have a race condition between the PTY_OPEN and here. */ 691 have a race condition between the PTY_OPEN and here. */
692 fcntl (fd, F_SETFD, FD_CLOEXEC); 692 fcntl (fd, F_SETFD, FD_CLOEXEC);
693#endif 693#endif
694 /* check to make certain that both sides are available 694 /* Check to make certain that both sides are available
695 this avoids a nasty yet stupid bug in rlogins */ 695 this avoids a nasty yet stupid bug in rlogins. */
696#ifdef PTY_TTY_NAME_SPRINTF 696#ifdef PTY_TTY_NAME_SPRINTF
697 PTY_TTY_NAME_SPRINTF 697 PTY_TTY_NAME_SPRINTF
698#else 698#else
@@ -1343,7 +1343,7 @@ Returns nil if format of ADDRESS is invalid. */)
1343 && XINT (p->contents[i]) > 255) 1343 && XINT (p->contents[i]) > 255)
1344 return Qnil; 1344 return Qnil;
1345 1345
1346 args[i+1] = p->contents[i]; 1346 args[i + 1] = p->contents[i];
1347 } 1347 }
1348 1348
1349 return Fformat (nargs + 1, args); 1349 return Fformat (nargs + 1, args);
@@ -1723,7 +1723,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1723 if (inchannel > max_process_desc) 1723 if (inchannel > max_process_desc)
1724 max_process_desc = inchannel; 1724 max_process_desc = inchannel;
1725 1725
1726 /* This may signal an error. */ 1726 /* This may signal an error. */
1727 setup_process_coding_systems (process); 1727 setup_process_coding_systems (process);
1728 1728
1729 block_input (); 1729 block_input ();
@@ -1996,7 +1996,7 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, int len)
1996 { 1996 {
1997 struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa; 1997 struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa;
1998 uint16_t *ip6 = (uint16_t *) &sin6->sin6_addr; 1998 uint16_t *ip6 = (uint16_t *) &sin6->sin6_addr;
1999 len = sizeof (sin6->sin6_addr)/2 + 1; 1999 len = sizeof (sin6->sin6_addr) / 2 + 1;
2000 address = Fmake_vector (make_number (len), Qnil); 2000 address = Fmake_vector (make_number (len), Qnil);
2001 p = XVECTOR (address); 2001 p = XVECTOR (address);
2002 p->contents[--len] = make_number (ntohs (sin6->sin6_port)); 2002 p->contents[--len] = make_number (ntohs (sin6->sin6_port));
@@ -2207,14 +2207,14 @@ Returns nil upon error setting address, ADDRESS otherwise. */)
2207 2207
2208static const struct socket_options { 2208static const struct socket_options {
2209 /* The name of this option. Should be lowercase version of option 2209 /* The name of this option. Should be lowercase version of option
2210 name without SO_ prefix. */ 2210 name without SO_ prefix. */
2211 const char *name; 2211 const char *name;
2212 /* Option level SOL_... */ 2212 /* Option level SOL_... */
2213 int optlevel; 2213 int optlevel;
2214 /* Option number SO_... */ 2214 /* Option number SO_... */
2215 int optnum; 2215 int optnum;
2216 enum { SOPT_UNKNOWN, SOPT_BOOL, SOPT_INT, SOPT_IFNAME, SOPT_LINGER } opttype; 2216 enum { SOPT_UNKNOWN, SOPT_BOOL, SOPT_INT, SOPT_IFNAME, SOPT_LINGER } opttype;
2217 enum { OPIX_NONE=0, OPIX_MISC=1, OPIX_REUSEADDR=2 } optbit; 2217 enum { OPIX_NONE = 0, OPIX_MISC = 1, OPIX_REUSEADDR = 2 } optbit;
2218} socket_options[] = 2218} socket_options[] =
2219 { 2219 {
2220#ifdef SO_BINDTODEVICE 2220#ifdef SO_BINDTODEVICE
@@ -2290,7 +2290,7 @@ set_socket_option (int s, Lisp_Object opt, Lisp_Object val)
2290#ifdef SO_BINDTODEVICE 2290#ifdef SO_BINDTODEVICE
2291 case SOPT_IFNAME: 2291 case SOPT_IFNAME:
2292 { 2292 {
2293 char devname[IFNAMSIZ+1]; 2293 char devname[IFNAMSIZ + 1];
2294 2294
2295 /* This is broken, at least in the Linux 2.4 kernel. 2295 /* This is broken, at least in the Linux 2.4 kernel.
2296 To unbind, the arg must be a zero integer, not the empty string. 2296 To unbind, the arg must be a zero integer, not the empty string.
@@ -2667,7 +2667,7 @@ usage: (make-serial-process &rest ARGS) */)
2667 exactly like a normal process when reading and writing. Primary 2667 exactly like a normal process when reading and writing. Primary
2668 differences are in status display and process deletion. A network 2668 differences are in status display and process deletion. A network
2669 connection has no PID; you cannot signal it. All you can do is 2669 connection has no PID; you cannot signal it. All you can do is
2670 stop/continue it and deactivate/close it via delete-process */ 2670 stop/continue it and deactivate/close it via delete-process. */
2671 2671
2672DEFUN ("make-network-process", Fmake_network_process, Smake_network_process, 2672DEFUN ("make-network-process", Fmake_network_process, Smake_network_process,
2673 0, MANY, 0, 2673 0, MANY, 0,
@@ -2871,7 +2871,7 @@ usage: (make-network-process &rest ARGS) */)
2871 GCPRO1 (contact); 2871 GCPRO1 (contact);
2872 2872
2873#ifdef WINDOWSNT 2873#ifdef WINDOWSNT
2874 /* Ensure socket support is loaded if available. */ 2874 /* Ensure socket support is loaded if available. */
2875 init_winsock (TRUE); 2875 init_winsock (TRUE);
2876#endif 2876#endif
2877 2877
@@ -2978,7 +2978,7 @@ usage: (make-network-process &rest ARGS) */)
2978 { 2978 {
2979 if (EQ (host, Qlocal)) 2979 if (EQ (host, Qlocal))
2980 /* Depending on setup, "localhost" may map to different IPv4 and/or 2980 /* Depending on setup, "localhost" may map to different IPv4 and/or
2981 IPv6 addresses, so it's better to be explicit. (Bug#6781) */ 2981 IPv6 addresses, so it's better to be explicit (Bug#6781). */
2982 host = build_string ("127.0.0.1"); 2982 host = build_string ("127.0.0.1");
2983 CHECK_STRING (host); 2983 CHECK_STRING (host);
2984 } 2984 }
@@ -3110,7 +3110,7 @@ usage: (make-network-process &rest ARGS) */)
3110 address_in.sin_family = family; 3110 address_in.sin_family = family;
3111 } 3111 }
3112 else 3112 else
3113 /* Attempt to interpret host as numeric inet address */ 3113 /* Attempt to interpret host as numeric inet address. */
3114 { 3114 {
3115 unsigned long numeric_addr; 3115 unsigned long numeric_addr;
3116 numeric_addr = inet_addr (SSDATA (host)); 3116 numeric_addr = inet_addr (SSDATA (host));
@@ -3176,8 +3176,8 @@ usage: (make-network-process &rest ARGS) */)
3176 /* Parse network options in the arg list. 3176 /* Parse network options in the arg list.
3177 We simply ignore anything which isn't a known option (including other keywords). 3177 We simply ignore anything which isn't a known option (including other keywords).
3178 An error is signaled if setting a known option fails. */ 3178 An error is signaled if setting a known option fails. */
3179 for (optn = optbits = 0; optn < nargs-1; optn += 2) 3179 for (optn = optbits = 0; optn < nargs - 1; optn += 2)
3180 optbits |= set_socket_option (s, args[optn], args[optn+1]); 3180 optbits |= set_socket_option (s, args[optn], args[optn + 1]);
3181 3181
3182 if (is_server) 3182 if (is_server)
3183 { 3183 {
@@ -3248,7 +3248,7 @@ usage: (make-network-process &rest ARGS) */)
3248 { 3248 {
3249 /* Unlike most other syscalls connect() cannot be called 3249 /* Unlike most other syscalls connect() cannot be called
3250 again. (That would return EALREADY.) The proper way to 3250 again. (That would return EALREADY.) The proper way to
3251 wait for completion is pselect(). */ 3251 wait for completion is pselect(). */
3252 int sc; 3252 int sc;
3253 socklen_t len; 3253 socklen_t len;
3254 fd_set fdset; 3254 fd_set fdset;
@@ -3626,7 +3626,7 @@ static const struct ifflag_def ifflag_table[] = {
3626#endif 3626#endif
3627#ifdef IFF_NOTRAILERS 3627#ifdef IFF_NOTRAILERS
3628#ifdef NS_IMPL_COCOA 3628#ifdef NS_IMPL_COCOA
3629 /* Really means smart, notrailers is obsolete */ 3629 /* Really means smart, notrailers is obsolete. */
3630 { IFF_NOTRAILERS, "smart" }, 3630 { IFF_NOTRAILERS, "smart" },
3631#else 3631#else
3632 { IFF_NOTRAILERS, "notrailers" }, 3632 { IFF_NOTRAILERS, "notrailers" },
@@ -3654,19 +3654,19 @@ static const struct ifflag_def ifflag_table[] = {
3654 { IFF_DYNAMIC, "dynamic" }, 3654 { IFF_DYNAMIC, "dynamic" },
3655#endif 3655#endif
3656#ifdef IFF_OACTIVE 3656#ifdef IFF_OACTIVE
3657 { IFF_OACTIVE, "oactive" }, /* OpenBSD: transmission in progress */ 3657 { IFF_OACTIVE, "oactive" }, /* OpenBSD: transmission in progress. */
3658#endif 3658#endif
3659#ifdef IFF_SIMPLEX 3659#ifdef IFF_SIMPLEX
3660 { IFF_SIMPLEX, "simplex" }, /* OpenBSD: can't hear own transmissions */ 3660 { IFF_SIMPLEX, "simplex" }, /* OpenBSD: can't hear own transmissions. */
3661#endif 3661#endif
3662#ifdef IFF_LINK0 3662#ifdef IFF_LINK0
3663 { IFF_LINK0, "link0" }, /* OpenBSD: per link layer defined bit */ 3663 { IFF_LINK0, "link0" }, /* OpenBSD: per link layer defined bit. */
3664#endif 3664#endif
3665#ifdef IFF_LINK1 3665#ifdef IFF_LINK1
3666 { IFF_LINK1, "link1" }, /* OpenBSD: per link layer defined bit */ 3666 { IFF_LINK1, "link1" }, /* OpenBSD: per link layer defined bit. */
3667#endif 3667#endif
3668#ifdef IFF_LINK2 3668#ifdef IFF_LINK2
3669 { IFF_LINK2, "link2" }, /* OpenBSD: per link layer defined bit */ 3669 { IFF_LINK2, "link2" }, /* OpenBSD: per link layer defined bit. */
3670#endif 3670#endif
3671 { 0, 0 } 3671 { 0, 0 }
3672}; 3672};
@@ -3882,7 +3882,7 @@ deactivate_process (Lisp_Object proc)
3882 } 3882 }
3883#endif 3883#endif
3884 3884
3885 /* Beware SIGCHLD hereabouts. */ 3885 /* Beware SIGCHLD hereabouts. */
3886 3886
3887 for (i = 0; i < PROCESS_OPEN_FDS; i++) 3887 for (i = 0; i < PROCESS_OPEN_FDS; i++)
3888 close_process_fd (&p->open_fd[i]); 3888 close_process_fd (&p->open_fd[i]);
@@ -3997,10 +3997,10 @@ is nil, from any process) before the timeout expired. */)
3997 3997
3998 return 3998 return
3999 ((wait_reading_process_output (secs, nsecs, 0, 0, 3999 ((wait_reading_process_output (secs, nsecs, 0, 0,
4000 Qnil, 4000 Qnil,
4001 !NILP (process) ? XPROCESS (process) : NULL, 4001 !NILP (process) ? XPROCESS (process) : NULL,
4002 NILP (just_this_one) ? 0 : 4002 (NILP (just_this_one) ? 0
4003 !INTEGERP (just_this_one) ? 1 : -1) 4003 : !INTEGERP (just_this_one) ? 1 : -1))
4004 <= 0) 4004 <= 0)
4005 ? Qnil : Qt); 4005 ? Qnil : Qt);
4006} 4006}
@@ -4014,7 +4014,7 @@ server_accept_connection (Lisp_Object server, int channel)
4014{ 4014{
4015 Lisp_Object proc, caller, name, buffer; 4015 Lisp_Object proc, caller, name, buffer;
4016 Lisp_Object contact, host, service; 4016 Lisp_Object contact, host, service;
4017 struct Lisp_Process *ps= XPROCESS (server); 4017 struct Lisp_Process *ps = XPROCESS (server);
4018 struct Lisp_Process *p; 4018 struct Lisp_Process *p;
4019 int s; 4019 int s;
4020 union u_sockaddr { 4020 union u_sockaddr {
@@ -4347,7 +4347,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4347 { 4347 {
4348 /* A negative timeout means 4348 /* A negative timeout means
4349 gobble output available now 4349 gobble output available now
4350 but don't wait at all. */ 4350 but don't wait at all. */
4351 4351
4352 timeout = make_timespec (0, 0); 4352 timeout = make_timespec (0, 0);
4353 } 4353 }
@@ -4506,11 +4506,11 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4506 break; 4506 break;
4507 } 4507 }
4508 4508
4509 /* Wait till there is something to do */ 4509 /* Wait till there is something to do. */
4510 4510
4511 if (wait_proc && just_wait_proc) 4511 if (wait_proc && just_wait_proc)
4512 { 4512 {
4513 if (wait_proc->infd < 0) /* Terminated */ 4513 if (wait_proc->infd < 0) /* Terminated. */
4514 break; 4514 break;
4515 FD_SET (wait_proc->infd, &Available); 4515 FD_SET (wait_proc->infd, &Available);
4516 check_delay = 0; 4516 check_delay = 0;
@@ -4641,7 +4641,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4641 } 4641 }
4642 else 4642 else
4643 { 4643 {
4644 /* Check this specific channel. */ 4644 /* Check this specific channel. */
4645 if (wait_proc->gnutls_p /* Check for valid process. */ 4645 if (wait_proc->gnutls_p /* Check for valid process. */
4646 && wait_proc->gnutls_state 4646 && wait_proc->gnutls_state
4647 /* Do we have pending data? */ 4647 /* Do we have pending data? */
@@ -4661,7 +4661,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4661 4661
4662 xerrno = errno; 4662 xerrno = errno;
4663 4663
4664 /* Make C-g and alarm signals set flags again */ 4664 /* Make C-g and alarm signals set flags again. */
4665 clear_waiting_for_input (); 4665 clear_waiting_for_input ();
4666 4666
4667 /* If we woke up due to SIGWINCH, actually change size now. */ 4667 /* If we woke up due to SIGWINCH, actually change size now. */
@@ -4680,9 +4680,9 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4680 report_file_errno ("Failed select", Qnil, xerrno); 4680 report_file_errno ("Failed select", Qnil, xerrno);
4681 } 4681 }
4682 4682
4683 /* Check for keyboard input */ 4683 /* Check for keyboard input. */
4684 /* If there is any, return immediately 4684 /* If there is any, return immediately
4685 to give it higher priority than subprocesses */ 4685 to give it higher priority than subprocesses. */
4686 4686
4687 if (read_kbd != 0) 4687 if (read_kbd != 0)
4688 { 4688 {
@@ -5691,7 +5691,7 @@ return t unconditionally. */)
5691 return Qt; 5691 return Qt;
5692} 5692}
5693 5693
5694/* send a signal number SIGNO to PROCESS. 5694/* Send a signal number SIGNO to PROCESS.
5695 If CURRENT_GROUP is t, that means send to the process group 5695 If CURRENT_GROUP is t, that means send to the process group
5696 that currently owns the terminal being used to communicate with PROCESS. 5696 that currently owns the terminal being used to communicate with PROCESS.
5697 This is used for various commands in shell mode. 5697 This is used for various commands in shell mode.
@@ -5794,11 +5794,11 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
5794 Or perhaps this is vestigial. */ 5794 Or perhaps this is vestigial. */
5795 if (gid == -1) 5795 if (gid == -1)
5796 no_pgrp = 1; 5796 no_pgrp = 1;
5797#else /* ! defined (TIOCGPGRP ) */ 5797#else /* ! defined (TIOCGPGRP) */
5798 /* Can't select pgrps on this system, so we know that 5798 /* Can't select pgrps on this system, so we know that
5799 the child itself heads the pgrp. */ 5799 the child itself heads the pgrp. */
5800 gid = p->pid; 5800 gid = p->pid;
5801#endif /* ! defined (TIOCGPGRP ) */ 5801#endif /* ! defined (TIOCGPGRP) */
5802 5802
5803 /* If current_group is lambda, and the shell owns the terminal, 5803 /* If current_group is lambda, and the shell owns the terminal,
5804 don't send any signal. */ 5804 don't send any signal. */
@@ -5980,8 +5980,8 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
5980 Lisp_Object tem = Fget_process (process); 5980 Lisp_Object tem = Fget_process (process);
5981 if (NILP (tem)) 5981 if (NILP (tem))
5982 { 5982 {
5983 Lisp_Object process_number = 5983 Lisp_Object process_number
5984 string_to_number (SSDATA (process), 10, 1); 5984 = string_to_number (SSDATA (process), 10, 1);
5985 if (INTEGERP (process_number) || FLOATP (process_number)) 5985 if (INTEGERP (process_number) || FLOATP (process_number))
5986 tem = process_number; 5986 tem = process_number;
5987 } 5987 }
@@ -6164,7 +6164,7 @@ static signal_handler_t volatile lib_child_handler;
6164 Inc. 6164 Inc.
6165 6165
6166 ** Malloc WARNING: This should never call malloc either directly or 6166 ** Malloc WARNING: This should never call malloc either directly or
6167 indirectly; if it does, that is a bug */ 6167 indirectly; if it does, that is a bug. */
6168 6168
6169static void 6169static void
6170handle_child_signal (int sig) 6170handle_child_signal (int sig)
@@ -6237,7 +6237,7 @@ handle_child_signal (int sig)
6237#ifdef NS_IMPL_GNUSTEP 6237#ifdef NS_IMPL_GNUSTEP
6238 /* NSTask in GNUstep sets its child handler each time it is called. 6238 /* NSTask in GNUstep sets its child handler each time it is called.
6239 So we must re-set ours. */ 6239 So we must re-set ours. */
6240 catch_child_signal(); 6240 catch_child_signal ();
6241#endif 6241#endif
6242} 6242}
6243 6243
@@ -6769,7 +6769,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
6769 6769
6770 xerrno = errno; 6770 xerrno = errno;
6771 6771
6772 /* Make C-g and alarm signals set flags again */ 6772 /* Make C-g and alarm signals set flags again. */
6773 clear_waiting_for_input (); 6773 clear_waiting_for_input ();
6774 6774
6775 /* If we woke up due to SIGWINCH, actually change size now. */ 6775 /* If we woke up due to SIGWINCH, actually change size now. */
@@ -6789,7 +6789,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
6789 report_file_errno ("Failed select", Qnil, xerrno); 6789 report_file_errno ("Failed select", Qnil, xerrno);
6790 } 6790 }
6791 6791
6792 /* Check for keyboard input */ 6792 /* Check for keyboard input. */
6793 6793
6794 if (read_kbd 6794 if (read_kbd
6795 && detect_input_pending_run_timers (do_display)) 6795 && detect_input_pending_run_timers (do_display))
@@ -6858,7 +6858,7 @@ add_timer_wait_descriptor (int fd)
6858void 6858void
6859add_keyboard_wait_descriptor (int desc) 6859add_keyboard_wait_descriptor (int desc)
6860{ 6860{
6861#ifdef subprocesses /* actually means "not MSDOS" */ 6861#ifdef subprocesses /* Actually means "not MSDOS". */
6862 FD_SET (desc, &input_wait_mask); 6862 FD_SET (desc, &input_wait_mask);
6863 FD_SET (desc, &non_process_wait_mask); 6863 FD_SET (desc, &non_process_wait_mask);
6864 if (desc > max_input_desc) 6864 if (desc > max_input_desc)
@@ -6949,7 +6949,7 @@ the process output. */)
6949} 6949}
6950 6950
6951/* Kill all processes associated with `buffer'. 6951/* Kill all processes associated with `buffer'.
6952 If `buffer' is nil, kill all processes */ 6952 If `buffer' is nil, kill all processes. */
6953 6953
6954void 6954void
6955kill_buffer_processes (Lisp_Object buffer) 6955kill_buffer_processes (Lisp_Object buffer)