diff options
| author | Dan Nicolaescu | 2010-08-05 17:36:12 -0700 |
|---|---|---|
| committer | Dan Nicolaescu | 2010-08-05 17:36:12 -0700 |
| commit | fce70521a62cbcc56ec41659e35c3ca94ce53f7f (patch) | |
| tree | 304608dd65cc660211a28163c8919769532bd120 /src/process.c | |
| parent | a11889abf9abb4ef7e454cf970247c9a1b88b78b (diff) | |
| download | emacs-fce70521a62cbcc56ec41659e35c3ca94ce53f7f.tar.gz emacs-fce70521a62cbcc56ec41659e35c3ca94ce53f7f.zip | |
Cleanup process.c.
* src/process.c: Remove HAVE_SOCKETS #ifdefs inside #ifdef
subprocesses, only MSDOS does not define HAVE_SOCKETS.
(socket_options): Use const char* for name.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 57 |
1 files changed, 5 insertions, 52 deletions
diff --git a/src/process.c b/src/process.c index 6597da4b22b..cccf7f75fe0 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -43,7 +43,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 43 | /* Only MS-DOS does not define `subprocesses'. */ | 43 | /* Only MS-DOS does not define `subprocesses'. */ |
| 44 | #ifdef subprocesses | 44 | #ifdef subprocesses |
| 45 | 45 | ||
| 46 | #ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */ | ||
| 47 | #include <sys/socket.h> | 46 | #include <sys/socket.h> |
| 48 | #include <netdb.h> | 47 | #include <netdb.h> |
| 49 | #include <netinet/in.h> | 48 | #include <netinet/in.h> |
| @@ -59,7 +58,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 59 | #include <sys/un.h> | 58 | #include <sys/un.h> |
| 60 | #endif | 59 | #endif |
| 61 | #endif | 60 | #endif |
| 62 | #endif /* HAVE_SOCKETS */ | ||
| 63 | 61 | ||
| 64 | #if defined(HAVE_SYS_IOCTL_H) | 62 | #if defined(HAVE_SYS_IOCTL_H) |
| 65 | #include <sys/ioctl.h> | 63 | #include <sys/ioctl.h> |
| @@ -73,7 +71,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 73 | #endif | 71 | #endif |
| 74 | 72 | ||
| 75 | /* Can we use SIOCGIFCONF and/or SIOCGIFADDR */ | 73 | /* Can we use SIOCGIFCONF and/or SIOCGIFADDR */ |
| 76 | #ifdef HAVE_SOCKETS | ||
| 77 | #if defined(HAVE_SYS_IOCTL_H) && defined(HAVE_NET_IF_H) | 74 | #if defined(HAVE_SYS_IOCTL_H) && defined(HAVE_NET_IF_H) |
| 78 | /* sys/ioctl.h may have been included already */ | 75 | /* sys/ioctl.h may have been included already */ |
| 79 | #ifndef SIOCGIFADDR | 76 | #ifndef SIOCGIFADDR |
| @@ -81,7 +78,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 81 | #endif | 78 | #endif |
| 82 | #include <net/if.h> | 79 | #include <net/if.h> |
| 83 | #endif | 80 | #endif |
| 84 | #endif | ||
| 85 | 81 | ||
| 86 | #ifdef HAVE_SYS_WAIT | 82 | #ifdef HAVE_SYS_WAIT |
| 87 | #include <sys/wait.h> | 83 | #include <sys/wait.h> |
| @@ -169,17 +165,10 @@ extern Lisp_Object QCfamily; | |||
| 169 | /* QCfilter is defined in keyboard.c. */ | 165 | /* QCfilter is defined in keyboard.c. */ |
| 170 | extern Lisp_Object QCfilter; | 166 | extern Lisp_Object QCfilter; |
| 171 | 167 | ||
| 172 | #ifdef HAVE_SOCKETS | ||
| 173 | #define NETCONN_P(p) (EQ (XPROCESS (p)->type, Qnetwork)) | 168 | #define NETCONN_P(p) (EQ (XPROCESS (p)->type, Qnetwork)) |
| 174 | #define NETCONN1_P(p) (EQ ((p)->type, Qnetwork)) | 169 | #define NETCONN1_P(p) (EQ ((p)->type, Qnetwork)) |
| 175 | #define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial)) | 170 | #define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial)) |
| 176 | #define SERIALCONN1_P(p) (EQ ((p)->type, Qserial)) | 171 | #define SERIALCONN1_P(p) (EQ ((p)->type, Qserial)) |
| 177 | #else | ||
| 178 | #define NETCONN_P(p) 0 | ||
| 179 | #define NETCONN1_P(p) 0 | ||
| 180 | #define SERIALCONN_P(p) 0 | ||
| 181 | #define SERIALCONN1_P(p) 0 | ||
| 182 | #endif /* HAVE_SOCKETS */ | ||
| 183 | 172 | ||
| 184 | /* Define first descriptor number available for subprocesses. */ | 173 | /* Define first descriptor number available for subprocesses. */ |
| 185 | #define FIRST_PROC_DESC 3 | 174 | #define FIRST_PROC_DESC 3 |
| @@ -225,7 +214,6 @@ int update_tick; | |||
| 225 | #undef NON_BLOCKING_CONNECT | 214 | #undef NON_BLOCKING_CONNECT |
| 226 | #else | 215 | #else |
| 227 | #ifndef NON_BLOCKING_CONNECT | 216 | #ifndef NON_BLOCKING_CONNECT |
| 228 | #ifdef HAVE_SOCKETS | ||
| 229 | #ifdef HAVE_SELECT | 217 | #ifdef HAVE_SELECT |
| 230 | #if defined (HAVE_GETPEERNAME) || defined (GNU_LINUX) | 218 | #if defined (HAVE_GETPEERNAME) || defined (GNU_LINUX) |
| 231 | #if defined (O_NONBLOCK) || defined (O_NDELAY) | 219 | #if defined (O_NONBLOCK) || defined (O_NDELAY) |
| @@ -235,7 +223,6 @@ int update_tick; | |||
| 235 | #endif /* O_NONBLOCK || O_NDELAY */ | 223 | #endif /* O_NONBLOCK || O_NDELAY */ |
| 236 | #endif /* HAVE_GETPEERNAME || GNU_LINUX */ | 224 | #endif /* HAVE_GETPEERNAME || GNU_LINUX */ |
| 237 | #endif /* HAVE_SELECT */ | 225 | #endif /* HAVE_SELECT */ |
| 238 | #endif /* HAVE_SOCKETS */ | ||
| 239 | #endif /* NON_BLOCKING_CONNECT */ | 226 | #endif /* NON_BLOCKING_CONNECT */ |
| 240 | #endif /* BROKEN_NON_BLOCKING_CONNECT */ | 227 | #endif /* BROKEN_NON_BLOCKING_CONNECT */ |
| 241 | 228 | ||
| @@ -248,13 +235,11 @@ int update_tick; | |||
| 248 | #undef DATAGRAM_SOCKETS | 235 | #undef DATAGRAM_SOCKETS |
| 249 | #else | 236 | #else |
| 250 | #ifndef DATAGRAM_SOCKETS | 237 | #ifndef DATAGRAM_SOCKETS |
| 251 | #ifdef HAVE_SOCKETS | ||
| 252 | #if defined (HAVE_SELECT) || defined (FIONREAD) | 238 | #if defined (HAVE_SELECT) || defined (FIONREAD) |
| 253 | #if defined (HAVE_SENDTO) && defined (HAVE_RECVFROM) && defined (EMSGSIZE) | 239 | #if defined (HAVE_SENDTO) && defined (HAVE_RECVFROM) && defined (EMSGSIZE) |
| 254 | #define DATAGRAM_SOCKETS | 240 | #define DATAGRAM_SOCKETS |
| 255 | #endif /* HAVE_SENDTO && HAVE_RECVFROM && EMSGSIZE */ | 241 | #endif /* HAVE_SENDTO && HAVE_RECVFROM && EMSGSIZE */ |
| 256 | #endif /* HAVE_SELECT || FIONREAD */ | 242 | #endif /* HAVE_SELECT || FIONREAD */ |
| 257 | #endif /* HAVE_SOCKETS */ | ||
| 258 | #endif /* DATAGRAM_SOCKETS */ | 243 | #endif /* DATAGRAM_SOCKETS */ |
| 259 | #endif /* BROKEN_DATAGRAM_SOCKETS */ | 244 | #endif /* BROKEN_DATAGRAM_SOCKETS */ |
| 260 | 245 | ||
| @@ -1144,7 +1129,6 @@ nil, indicating the current buffer's process. */) | |||
| 1144 | return XPROCESS (proc)->type; | 1129 | return XPROCESS (proc)->type; |
| 1145 | } | 1130 | } |
| 1146 | 1131 | ||
| 1147 | #ifdef HAVE_SOCKETS | ||
| 1148 | DEFUN ("format-network-address", Fformat_network_address, Sformat_network_address, | 1132 | DEFUN ("format-network-address", Fformat_network_address, Sformat_network_address, |
| 1149 | 1, 2, 0, | 1133 | 1, 2, 0, |
| 1150 | doc: /* Convert network ADDRESS from internal format to a string. | 1134 | doc: /* Convert network ADDRESS from internal format to a string. |
| @@ -1218,7 +1202,6 @@ Returns nil if format of ADDRESS is invalid. */) | |||
| 1218 | 1202 | ||
| 1219 | return Qnil; | 1203 | return Qnil; |
| 1220 | } | 1204 | } |
| 1221 | #endif | ||
| 1222 | 1205 | ||
| 1223 | static Lisp_Object | 1206 | static Lisp_Object |
| 1224 | list_processes_1 (Lisp_Object query_only) | 1207 | list_processes_1 (Lisp_Object query_only) |
| @@ -1723,25 +1706,6 @@ create_process_1 (struct atimer *timer) | |||
| 1723 | } | 1706 | } |
| 1724 | 1707 | ||
| 1725 | 1708 | ||
| 1726 | #if 0 /* This doesn't work; see the note before sigchld_handler. */ | ||
| 1727 | #ifdef USG | ||
| 1728 | #ifdef SIGCHLD | ||
| 1729 | /* Mimic blocking of signals on system V, which doesn't really have it. */ | ||
| 1730 | |||
| 1731 | /* Nonzero means we got a SIGCHLD when it was supposed to be blocked. */ | ||
| 1732 | int sigchld_deferred; | ||
| 1733 | |||
| 1734 | SIGTYPE | ||
| 1735 | create_process_sigchld () | ||
| 1736 | { | ||
| 1737 | signal (SIGCHLD, create_process_sigchld); | ||
| 1738 | |||
| 1739 | sigchld_deferred = 1; | ||
| 1740 | } | ||
| 1741 | #endif | ||
| 1742 | #endif | ||
| 1743 | #endif | ||
| 1744 | |||
| 1745 | void | 1709 | void |
| 1746 | create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | 1710 | create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) |
| 1747 | { | 1711 | { |
| @@ -2211,8 +2175,6 @@ create_pty (Lisp_Object process) | |||
| 2211 | } | 2175 | } |
| 2212 | 2176 | ||
| 2213 | 2177 | ||
| 2214 | #ifdef HAVE_SOCKETS | ||
| 2215 | |||
| 2216 | /* Convert an internal struct sockaddr to a lisp object (vector or string). | 2178 | /* Convert an internal struct sockaddr to a lisp object (vector or string). |
| 2217 | The address family of sa is not included in the result. */ | 2179 | The address family of sa is not included in the result. */ |
| 2218 | 2180 | ||
| @@ -2443,7 +2405,7 @@ Returns nil upon error setting address, ADDRESS otherwise. */) | |||
| 2443 | static const struct socket_options { | 2405 | static const struct socket_options { |
| 2444 | /* The name of this option. Should be lowercase version of option | 2406 | /* The name of this option. Should be lowercase version of option |
| 2445 | name without SO_ prefix. */ | 2407 | name without SO_ prefix. */ |
| 2446 | char *name; | 2408 | const char *name; |
| 2447 | /* Option level SOL_... */ | 2409 | /* Option level SOL_... */ |
| 2448 | int optlevel; | 2410 | int optlevel; |
| 2449 | /* Option number SO_... */ | 2411 | /* Option number SO_... */ |
| @@ -3766,10 +3728,9 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3766 | UNGCPRO; | 3728 | UNGCPRO; |
| 3767 | return proc; | 3729 | return proc; |
| 3768 | } | 3730 | } |
| 3769 | #endif /* HAVE_SOCKETS */ | ||
| 3770 | 3731 | ||
| 3771 | 3732 | ||
| 3772 | #if defined(HAVE_SOCKETS) && defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) | 3733 | #if defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) |
| 3773 | 3734 | ||
| 3774 | #ifdef SIOCGIFCONF | 3735 | #ifdef SIOCGIFCONF |
| 3775 | DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0, | 3736 | DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0, |
| @@ -4012,7 +3973,7 @@ FLAGS is the current flags of the interface. */) | |||
| 4012 | return any ? res : Qnil; | 3973 | return any ? res : Qnil; |
| 4013 | } | 3974 | } |
| 4014 | #endif | 3975 | #endif |
| 4015 | #endif /* HAVE_SOCKETS */ | 3976 | #endif /* defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) */ |
| 4016 | 3977 | ||
| 4017 | /* Turn off input and output for process PROC. */ | 3978 | /* Turn off input and output for process PROC. */ |
| 4018 | 3979 | ||
| @@ -6060,7 +6021,6 @@ If PROCESS is a network or serial process, inhibit handling of incoming | |||
| 6060 | traffic. */) | 6021 | traffic. */) |
| 6061 | (Lisp_Object process, Lisp_Object current_group) | 6022 | (Lisp_Object process, Lisp_Object current_group) |
| 6062 | { | 6023 | { |
| 6063 | #ifdef HAVE_SOCKETS | ||
| 6064 | if (PROCESSP (process) && (NETCONN_P (process) || SERIALCONN_P (process))) | 6024 | if (PROCESSP (process) && (NETCONN_P (process) || SERIALCONN_P (process))) |
| 6065 | { | 6025 | { |
| 6066 | struct Lisp_Process *p; | 6026 | struct Lisp_Process *p; |
| @@ -6075,7 +6035,6 @@ traffic. */) | |||
| 6075 | p->command = Qt; | 6035 | p->command = Qt; |
| 6076 | return process; | 6036 | return process; |
| 6077 | } | 6037 | } |
| 6078 | #endif | ||
| 6079 | #ifndef SIGTSTP | 6038 | #ifndef SIGTSTP |
| 6080 | error ("No SIGTSTP support"); | 6039 | error ("No SIGTSTP support"); |
| 6081 | #else | 6040 | #else |
| @@ -6091,7 +6050,6 @@ If PROCESS is a network or serial process, resume handling of incoming | |||
| 6091 | traffic. */) | 6050 | traffic. */) |
| 6092 | (Lisp_Object process, Lisp_Object current_group) | 6051 | (Lisp_Object process, Lisp_Object current_group) |
| 6093 | { | 6052 | { |
| 6094 | #ifdef HAVE_SOCKETS | ||
| 6095 | if (PROCESSP (process) && (NETCONN_P (process) || SERIALCONN_P (process))) | 6053 | if (PROCESSP (process) && (NETCONN_P (process) || SERIALCONN_P (process))) |
| 6096 | { | 6054 | { |
| 6097 | struct Lisp_Process *p; | 6055 | struct Lisp_Process *p; |
| @@ -6114,7 +6072,6 @@ traffic. */) | |||
| 6114 | p->command = Qnil; | 6072 | p->command = Qnil; |
| 6115 | return process; | 6073 | return process; |
| 6116 | } | 6074 | } |
| 6117 | #endif | ||
| 6118 | #ifdef SIGCONT | 6075 | #ifdef SIGCONT |
| 6119 | process_send_signal (process, SIGCONT, current_group, 0); | 6076 | process_send_signal (process, SIGCONT, current_group, 0); |
| 6120 | #else | 6077 | #else |
| @@ -7426,7 +7383,6 @@ init_process (void) | |||
| 7426 | memset (datagram_address, 0, sizeof datagram_address); | 7383 | memset (datagram_address, 0, sizeof datagram_address); |
| 7427 | #endif | 7384 | #endif |
| 7428 | 7385 | ||
| 7429 | #ifdef HAVE_SOCKETS | ||
| 7430 | { | 7386 | { |
| 7431 | Lisp_Object subfeatures = Qnil; | 7387 | Lisp_Object subfeatures = Qnil; |
| 7432 | const struct socket_options *sopt; | 7388 | const struct socket_options *sopt; |
| @@ -7462,7 +7418,6 @@ init_process (void) | |||
| 7462 | 7418 | ||
| 7463 | Fprovide (intern_c_string ("make-network-process"), subfeatures); | 7419 | Fprovide (intern_c_string ("make-network-process"), subfeatures); |
| 7464 | } | 7420 | } |
| 7465 | #endif /* HAVE_SOCKETS */ | ||
| 7466 | 7421 | ||
| 7467 | #if defined (DARWIN_OS) | 7422 | #if defined (DARWIN_OS) |
| 7468 | /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive | 7423 | /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive |
| @@ -7721,19 +7676,17 @@ The variable takes effect when `start-process' is called. */); | |||
| 7721 | defsubr (&Sserial_process_configure); | 7676 | defsubr (&Sserial_process_configure); |
| 7722 | defsubr (&Smake_serial_process); | 7677 | defsubr (&Smake_serial_process); |
| 7723 | #endif /* HAVE_SERIAL */ | 7678 | #endif /* HAVE_SERIAL */ |
| 7724 | #ifdef HAVE_SOCKETS | ||
| 7725 | defsubr (&Sset_network_process_option); | 7679 | defsubr (&Sset_network_process_option); |
| 7726 | defsubr (&Smake_network_process); | 7680 | defsubr (&Smake_network_process); |
| 7727 | defsubr (&Sformat_network_address); | 7681 | defsubr (&Sformat_network_address); |
| 7728 | #endif /* HAVE_SOCKETS */ | 7682 | #if defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) |
| 7729 | #if defined(HAVE_SOCKETS) && defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) | ||
| 7730 | #ifdef SIOCGIFCONF | 7683 | #ifdef SIOCGIFCONF |
| 7731 | defsubr (&Snetwork_interface_list); | 7684 | defsubr (&Snetwork_interface_list); |
| 7732 | #endif | 7685 | #endif |
| 7733 | #if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS) | 7686 | #if defined(SIOCGIFADDR) || defined(SIOCGIFHWADDR) || defined(SIOCGIFFLAGS) |
| 7734 | defsubr (&Snetwork_interface_info); | 7687 | defsubr (&Snetwork_interface_info); |
| 7735 | #endif | 7688 | #endif |
| 7736 | #endif /* HAVE_SOCKETS ... */ | 7689 | #endif /* defined(HAVE_NET_IF_H) && defined(HAVE_SYS_IOCTL_H) */ |
| 7737 | #ifdef DATAGRAM_SOCKETS | 7690 | #ifdef DATAGRAM_SOCKETS |
| 7738 | defsubr (&Sprocess_datagram_address); | 7691 | defsubr (&Sprocess_datagram_address); |
| 7739 | defsubr (&Sset_process_datagram_address); | 7692 | defsubr (&Sset_process_datagram_address); |