Mercurial > hg > xemacs-beta
comparison src/process-unix.c @ 4759:aa5ed11f473b
Remove support for obsolete systems. See xemacs-patches message with ID
<870180fe0911101613m6b8efa4bpf083fd9013950807@mail.gmail.com>.
author | Jerry James <james@xemacs.org> |
---|---|
date | Wed, 18 Nov 2009 08:49:14 -0700 |
parents | 5333f383efbd |
children | b3ea9c582280 |
comparison
equal
deleted
inserted
replaced
4758:75975fd0b7fc | 4759:aa5ed11f473b |
---|---|
29 | 29 |
30 /* The IPv6 support is derived from the code for GNU Emacs-20.3 | 30 /* The IPv6 support is derived from the code for GNU Emacs-20.3 |
31 written by Wolfgang S. Rupprecht */ | 31 written by Wolfgang S. Rupprecht */ |
32 | 32 |
33 #include <config.h> | 33 #include <config.h> |
34 | |
35 #if !defined (NO_SUBPROCESSES) | |
36 | |
37 /* The entire file is within this conditional */ | |
38 | 34 |
39 #include "lisp.h" | 35 #include "lisp.h" |
40 | 36 |
41 #include "buffer.h" | 37 #include "buffer.h" |
42 #include "events.h" | 38 #include "events.h" |
427 create_bidirectional_pipe (EMACS_INT *inchannel, EMACS_INT *outchannel, | 423 create_bidirectional_pipe (EMACS_INT *inchannel, EMACS_INT *outchannel, |
428 volatile EMACS_INT *forkin, volatile EMACS_INT *forkout) | 424 volatile EMACS_INT *forkin, volatile EMACS_INT *forkout) |
429 { | 425 { |
430 int sv[2]; | 426 int sv[2]; |
431 | 427 |
432 #ifdef SKTPAIR | 428 if (pipe (sv) < 0) return -1; |
433 if (socketpair (AF_UNIX, SOCK_STREAM, 0, sv) < 0) | |
434 return -1; | |
435 *outchannel = *inchannel = sv[0]; | |
436 *forkout = *forkin = sv[1]; | |
437 #else /* not SKTPAIR */ | |
438 int temp; | |
439 temp = pipe (sv); | |
440 if (temp < 0) return -1; | |
441 *inchannel = sv[0]; | 429 *inchannel = sv[0]; |
442 *forkout = sv[1]; | 430 *forkout = sv[1]; |
443 temp = pipe (sv); | 431 if (pipe (sv) < 0) return -1; |
444 if (temp < 0) return -1; | |
445 *outchannel = sv[1]; | 432 *outchannel = sv[1]; |
446 *forkin = sv[0]; | 433 *forkin = sv[0]; |
447 #endif /* not SKTPAIR */ | |
448 return 0; | 434 return 0; |
449 } | 435 } |
450 | 436 |
451 | 437 |
452 #ifdef HAVE_SOCKETS | 438 #ifdef HAVE_SOCKETS |
900 #ifdef SET_EMACS_PRIORITY | 886 #ifdef SET_EMACS_PRIORITY |
901 if (emacs_priority != 0) | 887 if (emacs_priority != 0) |
902 nice (- emacs_priority); | 888 nice (- emacs_priority); |
903 #endif | 889 #endif |
904 | 890 |
905 #if !defined (NO_SUBPROCESSES) | |
906 /* Close Emacs's descriptors that this process should not have. */ | 891 /* Close Emacs's descriptors that this process should not have. */ |
907 close_process_descs (); | 892 close_process_descs (); |
908 #endif /* not NO_SUBPROCESSES */ | |
909 close_load_descs (); | 893 close_load_descs (); |
910 | 894 |
911 /* [[Note that use of alloca is always safe here. It's obvious for systems | 895 /* [[Note that use of alloca is always safe here. It's obvious for systems |
912 that do not have true vfork or that have true (stack) alloca. | 896 that do not have true vfork or that have true (stack) alloca. |
913 If using vfork and C_ALLOCA it is safe because that changes | 897 If using vfork and C_ALLOCA it is safe because that changes |
1169 in the parent process, but doing it that way | 1153 in the parent process, but doing it that way |
1170 makes it possible to trap error conditions. | 1154 makes it possible to trap error conditions. |
1171 It's harder to convey an error from the child | 1155 It's harder to convey an error from the child |
1172 process, and I don't feel like messing with | 1156 process, and I don't feel like messing with |
1173 this now. */ | 1157 this now. */ |
1174 | |
1175 /* There was some weirdo, probably wrong, | |
1176 conditionalization on RTU and UNIPLUS here. | |
1177 I deleted it. So sue me. */ | |
1178 | 1158 |
1179 /* SunOS has TIOCSCTTY but the close/open method | 1159 /* SunOS has TIOCSCTTY but the close/open method |
1180 also works. */ | 1160 also works. */ |
1181 | 1161 |
1182 #if defined (USG) || !defined (TIOCSCTTY) | 1162 #if defined (USG) || !defined (TIOCSCTTY) |
1996 xerrno = errno; | 1976 xerrno = errno; |
1997 failed_connect = 0; | 1977 failed_connect = 0; |
1998 continue; | 1978 continue; |
1999 } | 1979 } |
2000 | 1980 |
2001 #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS | |
2002 /* Slow down polling. Some kernels have a bug which causes retrying | |
2003 connect to fail after a connect. (Note that the entire purpose | |
2004 for this code is a very old comment concerning an Ultrix bug that | |
2005 requires this code. We used to do this ALWAYS despite this! | |
2006 This messes up C-g out of connect() in a big way. So instead we | |
2007 just assume that anyone who sees such a kernel bug will define | |
2008 this constant, which for now is only defined under Ultrix.) --ben | |
2009 */ | |
2010 slow_down_interrupts (); | |
2011 #endif | |
2012 | |
2013 loop: | 1981 loop: |
2014 | 1982 |
2015 /* A system call interrupted with a SIGALRM or SIGIO comes back | 1983 /* A system call interrupted with a SIGALRM or SIGIO comes back |
2016 here, with can_break_system_calls reset to 0. */ | 1984 here, with can_break_system_calls reset to 0. */ |
2017 SETJMP (break_system_call_jump); | 1985 SETJMP (break_system_call_jump); |
2018 if (QUITP) | 1986 if (QUITP) |
2019 { | 1987 { |
2020 #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS | |
2021 speed_up_interrupts (); | |
2022 #endif | |
2023 QUIT; | 1988 QUIT; |
2024 /* In case something really weird happens ... */ | 1989 /* In case something really weird happens ... */ |
2025 #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS | |
2026 slow_down_interrupts (); | |
2027 #endif | |
2028 } | 1990 } |
2029 | 1991 |
2030 /* Break out of connect with a signal (it isn't otherwise possible). | 1992 /* Break out of connect with a signal (it isn't otherwise possible). |
2031 Thus you don't get screwed with a hung network. */ | 1993 Thus you don't get screwed with a hung network. */ |
2032 can_break_system_calls = 1; | 1994 can_break_system_calls = 1; |
2064 } | 2026 } |
2065 | 2027 |
2066 failed_connect = 1; | 2028 failed_connect = 1; |
2067 retry_close (s); | 2029 retry_close (s); |
2068 s = -1; | 2030 s = -1; |
2069 | |
2070 #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS | |
2071 speed_up_interrupts (); | |
2072 #endif | |
2073 | |
2074 continue; | 2031 continue; |
2075 } | 2032 } |
2076 | 2033 |
2077 #ifdef USE_GETADDRINFO | 2034 #ifdef USE_GETADDRINFO |
2078 if (port == 0) | 2035 if (port == 0) |
2094 } | 2051 } |
2095 | 2052 |
2096 break; | 2053 break; |
2097 #endif /* USE_GETADDRINFO */ | 2054 #endif /* USE_GETADDRINFO */ |
2098 } /* address loop */ | 2055 } /* address loop */ |
2099 | |
2100 #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS | |
2101 speed_up_interrupts (); | |
2102 #endif | |
2103 | 2056 |
2104 #ifdef USE_GETADDRINFO | 2057 #ifdef USE_GETADDRINFO |
2105 freeaddrinfo (res); | 2058 freeaddrinfo (res); |
2106 #endif | 2059 #endif |
2107 | 2060 |
2237 'sendto' and 'recvfrom'. However, in order to handle this connection in | 2190 'sendto' and 'recvfrom'. However, in order to handle this connection in |
2238 the process-like way it is done for TCP, we must be able to use 'write' | 2191 the process-like way it is done for TCP, we must be able to use 'write' |
2239 instead of 'sendto'. Consequently, we 'connect' this socket. */ | 2192 instead of 'sendto'. Consequently, we 'connect' this socket. */ |
2240 | 2193 |
2241 /* See open-network-stream-internal for comments on this part of the code */ | 2194 /* See open-network-stream-internal for comments on this part of the code */ |
2242 #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS | |
2243 slow_down_interrupts (); | |
2244 #endif | |
2245 | |
2246 loop: | 2195 loop: |
2247 | 2196 |
2248 /* A system call interrupted with a SIGALRM or SIGIO comes back | 2197 /* A system call interrupted with a SIGALRM or SIGIO comes back |
2249 here, with can_break_system_calls reset to 0. */ | 2198 here, with can_break_system_calls reset to 0. */ |
2250 SETJMP (break_system_call_jump); | 2199 SETJMP (break_system_call_jump); |
2251 if (QUITP) | 2200 if (QUITP) |
2252 { | 2201 { |
2253 #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS | |
2254 speed_up_interrupts (); | |
2255 #endif | |
2256 QUIT; | 2202 QUIT; |
2257 /* In case something really weird happens ... */ | 2203 /* In case something really weird happens ... */ |
2258 #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS | |
2259 slow_down_interrupts (); | |
2260 #endif | |
2261 } | 2204 } |
2262 | 2205 |
2263 /* Break out of connect with a signal (it isn't otherwise possible). | 2206 /* Break out of connect with a signal (it isn't otherwise possible). |
2264 Thus you don't get screwed with a hung network. */ | 2207 Thus you don't get screwed with a hung network. */ |
2265 can_break_system_calls = 1; | 2208 can_break_system_calls = 1; |
2286 goto loop; | 2229 goto loop; |
2287 } | 2230 } |
2288 | 2231 |
2289 retry_close (rs); | 2232 retry_close (rs); |
2290 retry_close (ws); | 2233 retry_close (ws); |
2291 #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS | |
2292 speed_up_interrupts (); | |
2293 #endif | |
2294 | 2234 |
2295 errno = xerrno; | 2235 errno = xerrno; |
2296 report_network_error ("error connecting socket", list3 (Qunbound, name, | 2236 report_network_error ("error connecting socket", list3 (Qunbound, name, |
2297 port)); | 2237 port)); |
2298 } | 2238 } |
2299 | |
2300 #ifdef CONNECT_NEEDS_SLOWED_INTERRUPTS | |
2301 speed_up_interrupts (); | |
2302 #endif | |
2303 | 2239 |
2304 /* scope */ | 2240 /* scope */ |
2305 if (setsockopt (ws, IPPROTO_IP, IP_MULTICAST_TTL, | 2241 if (setsockopt (ws, IPPROTO_IP, IP_MULTICAST_TTL, |
2306 &thettl, sizeof (thettl)) < 0) | 2242 &thettl, sizeof (thettl)) < 0) |
2307 { | 2243 { |
2359 void | 2295 void |
2360 vars_of_process_unix (void) | 2296 vars_of_process_unix (void) |
2361 { | 2297 { |
2362 Fprovide (intern ("unix-processes")); | 2298 Fprovide (intern ("unix-processes")); |
2363 } | 2299 } |
2364 | |
2365 #endif /* !defined (NO_SUBPROCESSES) */ |