comparison src/process.c @ 96303:ddedcecb18ef

* unexnext.c: * m/ews4800.h: * m/hp9000s300.h: * m/ibm370aix.h: * m/mips-siemens.h: * m/ncr386.h: * m/next.h: * m/pmax.h: * m/powerpcle.h: * m/tandem-s2.h: * s/386bsd.h: * s/bsd386.h: * s/bsd4-1.h: * s/bsd4-2.h: * s/bsdos2-1.h: * s/bsdos2.h: * s/bsdos3.h: * s/bsdos4.h: * s/nextstep.h: * s/ultrix4-3.h: * s/usg5-0.h: * s/usg5-2-2.h: * s/usg5-2.h: * s/usg5-4-3.h: * s/ux4800.h: * s/uxpds.h: * s/uxpv.h: Remove support for obsolete systems. * s/hpux.h, s/hpux10.h, s/hpux8.h, s/hpux9.h, s/hpux9shr.h: Remove, insert contents in s/hpux-10.20.h * s/aix3-1.h, s/aix3-2-5.h, s/aix3-2.h, s/aix4-1.h, s/aix4.h: Remove, insert contents in s/aix-4.2.h * s/usg5-3.h: Remove, insert contents in s/usg5-4.h. * s/bsd4-3.h: Rename to .. * s/bsd-common.h: ... this. * src/data.c: * src/doc.c: * src/ecrt0.c: * src/emacs.c: * src/fileio.c: * src/floatfns.c: * src/keyboard.c: * src/mem-limits.h: * src/print.c: * src/process.c: * src/sysdep.c: * src/syssignal.h: * src/systty.h: * src/syswait.h: * src/term.c: * src/unexec.c: * src/unexelf.c: * src/unexhp9k800.c: * src/m/hp800.h: * src/m/ibmrs6000.h: * src/m/mips.h: * src/m/vax.h: * src/s/darwin.h: * src/s/freebsd.h: * src/s/gnu.h: * src/s/ms-w32.h: * src/s/msdos.h: * src/s/netbsd.h: * src/s/template.h: Remove references to obsolete variables. * Makefile.in: Add dependencies for all unexec files. (admindir): Remove unused variable. (UNEXEC_SRC): Remove references. * config.nt: Remove reference to UNEXEC_SRC. * lwlib.c: Remove references to obsolete variables. * fakemail.c: Remove references to obsolete variables. * os.texi: Remove references to obsolete systems. * configure.in: * configure: Remove references to obsolete systems.
author Dan Nicolaescu <dann@ics.uci.edu>
date Thu, 26 Jun 2008 04:24:54 +0000
parents 99342636fa96
children a99299e4d2de
comparison
equal deleted inserted replaced
96302:b3db7e68c460 96303:ddedcecb18ef
77 #include <sys/ioctl.h> 77 #include <sys/ioctl.h>
78 #if !defined (O_NDELAY) && defined (HAVE_PTYS) && !defined(USG5) 78 #if !defined (O_NDELAY) && defined (HAVE_PTYS) && !defined(USG5)
79 #include <fcntl.h> 79 #include <fcntl.h>
80 #endif /* HAVE_PTYS and no O_NDELAY */ 80 #endif /* HAVE_PTYS and no O_NDELAY */
81 #endif /* BSD_SYSTEM */ 81 #endif /* BSD_SYSTEM */
82
83 #ifdef BROKEN_O_NONBLOCK
84 #undef O_NONBLOCK
85 #endif /* BROKEN_O_NONBLOCK */
86 82
87 #ifdef NEED_BSDTTY 83 #ifdef NEED_BSDTTY
88 #include <bsdtty.h> 84 #include <bsdtty.h>
89 #endif 85 #endif
90 86
2004 #endif 2000 #endif
2005 #endif /* HAVE_WORKING_VFORK */ 2001 #endif /* HAVE_WORKING_VFORK */
2006 sigprocmask (SIG_BLOCK, &blocked, &procmask); 2002 sigprocmask (SIG_BLOCK, &blocked, &procmask);
2007 #else /* !POSIX_SIGNALS */ 2003 #else /* !POSIX_SIGNALS */
2008 #ifdef SIGCHLD 2004 #ifdef SIGCHLD
2009 #ifdef BSD4_1
2010 sighold (SIGCHLD);
2011 #else /* not BSD4_1 */
2012 #if defined (BSD_SYSTEM) || defined (HPUX) 2005 #if defined (BSD_SYSTEM) || defined (HPUX)
2013 sigsetmask (sigmask (SIGCHLD)); 2006 sigsetmask (sigmask (SIGCHLD));
2014 #else /* ordinary USG */ 2007 #else /* ordinary USG */
2015 #if 0 2008 #if 0
2016 sigchld_deferred = 0; 2009 sigchld_deferred = 0;
2017 sigchld = signal (SIGCHLD, create_process_sigchld); 2010 sigchld = signal (SIGCHLD, create_process_sigchld);
2018 #endif 2011 #endif
2019 #endif /* ordinary USG */ 2012 #endif /* ordinary USG */
2020 #endif /* not BSD4_1 */
2021 #endif /* SIGCHLD */ 2013 #endif /* SIGCHLD */
2022 #endif /* !POSIX_SIGNALS */ 2014 #endif /* !POSIX_SIGNALS */
2023 2015
2024 FD_SET (inchannel, &input_wait_mask); 2016 FD_SET (inchannel, &input_wait_mask);
2025 FD_SET (inchannel, &non_keyboard_wait_mask); 2017 FD_SET (inchannel, &non_keyboard_wait_mask);
2132 both HAVE_SETSID and TIOCSCTTY are defined. */ 2124 both HAVE_SETSID and TIOCSCTTY are defined. */
2133 /* Now close the pty (if we had it open) and reopen it. 2125 /* Now close the pty (if we had it open) and reopen it.
2134 This makes the pty the controlling terminal of the subprocess. */ 2126 This makes the pty the controlling terminal of the subprocess. */
2135 if (pty_flag) 2127 if (pty_flag)
2136 { 2128 {
2137 #ifdef SET_CHILD_PTY_PGRP
2138 int pgrp = getpid ();
2139 #endif
2140 2129
2141 /* I wonder if emacs_close (emacs_open (pty_name, ...)) 2130 /* I wonder if emacs_close (emacs_open (pty_name, ...))
2142 would work? */ 2131 would work? */
2143 if (xforkin >= 0) 2132 if (xforkin >= 0)
2144 emacs_close (xforkin); 2133 emacs_close (xforkin);
2150 emacs_write (1, pty_name, strlen (pty_name)); 2139 emacs_write (1, pty_name, strlen (pty_name));
2151 emacs_write (1, "\n", 1); 2140 emacs_write (1, "\n", 1);
2152 _exit (1); 2141 _exit (1);
2153 } 2142 }
2154 2143
2155 #ifdef SET_CHILD_PTY_PGRP
2156 ioctl (xforkin, TIOCSPGRP, &pgrp);
2157 ioctl (xforkout, TIOCSPGRP, &pgrp);
2158 #endif
2159 } 2144 }
2160 #endif /* not DONT_REOPEN_PTY */ 2145 #endif /* not DONT_REOPEN_PTY */
2161 2146
2162 #ifdef SETUP_SLAVE_PTY 2147 #ifdef SETUP_SLAVE_PTY
2163 if (pty_flag) 2148 if (pty_flag)
2179 /* Stop blocking signals in the child. */ 2164 /* Stop blocking signals in the child. */
2180 #ifdef POSIX_SIGNALS 2165 #ifdef POSIX_SIGNALS
2181 sigprocmask (SIG_SETMASK, &procmask, 0); 2166 sigprocmask (SIG_SETMASK, &procmask, 0);
2182 #else /* !POSIX_SIGNALS */ 2167 #else /* !POSIX_SIGNALS */
2183 #ifdef SIGCHLD 2168 #ifdef SIGCHLD
2184 #ifdef BSD4_1
2185 sigrelse (SIGCHLD);
2186 #else /* not BSD4_1 */
2187 #if defined (BSD_SYSTEM) || defined (HPUX) 2169 #if defined (BSD_SYSTEM) || defined (HPUX)
2188 sigsetmask (SIGEMPTYMASK); 2170 sigsetmask (SIGEMPTYMASK);
2189 #else /* ordinary USG */ 2171 #else /* ordinary USG */
2190 #if 0 2172 #if 0
2191 signal (SIGCHLD, sigchld); 2173 signal (SIGCHLD, sigchld);
2192 #endif 2174 #endif
2193 #endif /* ordinary USG */ 2175 #endif /* ordinary USG */
2194 #endif /* not BSD4_1 */
2195 #endif /* SIGCHLD */ 2176 #endif /* SIGCHLD */
2196 #endif /* !POSIX_SIGNALS */ 2177 #endif /* !POSIX_SIGNALS */
2197 2178
2198 #if !defined (DONT_REOPEN_PTY) 2179 #if !defined (DONT_REOPEN_PTY)
2199 if (pty_flag) 2180 if (pty_flag)
2271 #endif /* HAVE_WORKING_VFORK */ 2252 #endif /* HAVE_WORKING_VFORK */
2272 /* Stop blocking signals in the parent. */ 2253 /* Stop blocking signals in the parent. */
2273 sigprocmask (SIG_SETMASK, &procmask, 0); 2254 sigprocmask (SIG_SETMASK, &procmask, 0);
2274 #else /* !POSIX_SIGNALS */ 2255 #else /* !POSIX_SIGNALS */
2275 #ifdef SIGCHLD 2256 #ifdef SIGCHLD
2276 #ifdef BSD4_1
2277 sigrelse (SIGCHLD);
2278 #else /* not BSD4_1 */
2279 #if defined (BSD_SYSTEM) || defined (HPUX) 2257 #if defined (BSD_SYSTEM) || defined (HPUX)
2280 sigsetmask (SIGEMPTYMASK); 2258 sigsetmask (SIGEMPTYMASK);
2281 #else /* ordinary USG */ 2259 #else /* ordinary USG */
2282 #if 0 2260 #if 0
2283 signal (SIGCHLD, sigchld); 2261 signal (SIGCHLD, sigchld);
2285 that came in during this function. */ 2263 that came in during this function. */
2286 if (sigchld_deferred) 2264 if (sigchld_deferred)
2287 kill (getpid (), SIGCHLD); 2265 kill (getpid (), SIGCHLD);
2288 #endif 2266 #endif
2289 #endif /* ordinary USG */ 2267 #endif /* ordinary USG */
2290 #endif /* not BSD4_1 */
2291 #endif /* SIGCHLD */ 2268 #endif /* SIGCHLD */
2292 #endif /* !POSIX_SIGNALS */ 2269 #endif /* !POSIX_SIGNALS */
2293 2270
2294 /* Now generate the error if vfork failed. */ 2271 /* Now generate the error if vfork failed. */
2295 if (pid < 0) 2272 if (pid < 0)
2698 2675
2699 return Qnil; 2676 return Qnil;
2700 } 2677 }
2701 2678
2702 2679
2703 /* A version of request_sigio suitable for a record_unwind_protect. */
2704
2705 #ifdef __ultrix__
2706 static Lisp_Object
2707 unwind_request_sigio (dummy)
2708 Lisp_Object dummy;
2709 {
2710 if (interrupt_input)
2711 request_sigio ();
2712 return Qnil;
2713 }
2714 #endif
2715
2716 #ifdef HAVE_SERIAL 2680 #ifdef HAVE_SERIAL
2717 DEFUN ("serial-process-configure", 2681 DEFUN ("serial-process-configure",
2718 Fserial_process_configure, 2682 Fserial_process_configure,
2719 Sserial_process_configure, 2683 Sserial_process_configure,
2720 0, MANY, 0, 2684 0, MANY, 0,
3499 ai.ai_family = family; 3463 ai.ai_family = family;
3500 ai.ai_addr = (struct sockaddr *) &address_in; 3464 ai.ai_addr = (struct sockaddr *) &address_in;
3501 ai.ai_addrlen = sizeof address_in; 3465 ai.ai_addrlen = sizeof address_in;
3502 3466
3503 open_socket: 3467 open_socket:
3504
3505 #ifdef __ultrix__
3506 /* Previously this was compiled unconditionally, but that seems
3507 unnecessary on modern systems, and `unrequest_sigio' was a noop
3508 under X anyway. --lorentey */
3509 /* Kernel bugs (on Ultrix at least) cause lossage (not just EINTR)
3510 when connect is interrupted. So let's not let it get interrupted.
3511 Note we do not turn off polling, because polling is only used
3512 when not interrupt_input, and thus not normally used on the systems
3513 which have this bug. On systems which use polling, there's no way
3514 to quit if polling is turned off. */
3515 if (interrupt_input
3516 && !is_server && socktype == SOCK_STREAM)
3517 {
3518 /* Comment from KFS: The original open-network-stream code
3519 didn't unwind protect this, but it seems like the proper
3520 thing to do. In any case, I don't see how it could harm to
3521 do this -- and it makes cleanup (using unbind_to) easier. */
3522 record_unwind_protect (unwind_request_sigio, Qnil);
3523 unrequest_sigio ();
3524 }
3525 #endif
3526 3468
3527 /* Do this in case we never enter the for-loop below. */ 3469 /* Do this in case we never enter the for-loop below. */
3528 count1 = SPECPDL_INDEX (); 3470 count1 = SPECPDL_INDEX ();
3529 s = -1; 3471 s = -1;
3530 3472
4649 { 4591 {
4650 EMACS_GET_TIME (end_time); 4592 EMACS_GET_TIME (end_time);
4651 EMACS_SET_SECS_USECS (timeout, time_limit, microsecs); 4593 EMACS_SET_SECS_USECS (timeout, time_limit, microsecs);
4652 EMACS_ADD_TIME (end_time, end_time, timeout); 4594 EMACS_ADD_TIME (end_time, end_time, timeout);
4653 } 4595 }
4654 #ifdef POLL_INTERRUPTED_SYS_CALL
4655 /* AlainF 5-Jul-1996
4656 HP-UX 10.10 seem to have problems with signals coming in
4657 Causes "poll: interrupted system call" messages when Emacs is run
4658 in an X window
4659 Turn off periodic alarms (in case they are in use),
4660 and then turn off any other atimers. */
4661 stop_polling ();
4662 turn_on_atimers (0);
4663 #endif /* POLL_INTERRUPTED_SYS_CALL */
4664 4596
4665 while (1) 4597 while (1)
4666 { 4598 {
4667 int timeout_reduced_for_timers = 0; 4599 int timeout_reduced_for_timers = 0;
4668 4600
4973 break; 4905 break;
4974 if (nfds < 0) 4906 if (nfds < 0)
4975 { 4907 {
4976 if (xerrno == EINTR) 4908 if (xerrno == EINTR)
4977 no_avail = 1; 4909 no_avail = 1;
4978 #ifdef ultrix
4979 /* Ultrix select seems to return ENOMEM when it is
4980 interrupted. Treat it just like EINTR. Bleah. Note
4981 that we want to test for the "ultrix" CPP symbol, not
4982 "__ultrix__"; the latter is only defined under GCC, but
4983 not by DEC's bundled CC. -JimB */
4984 else if (xerrno == ENOMEM)
4985 no_avail = 1;
4986 #endif
4987 else if (xerrno == EBADF) 4910 else if (xerrno == EBADF)
4988 { 4911 {
4989 #ifdef AIX 4912 #ifdef AIX
4990 /* AIX doesn't handle PTY closure the same way BSD does. On AIX, 4913 /* AIX doesn't handle PTY closure the same way BSD does. On AIX,
4991 the child's closure of the pts gives the parent a SIGHUP, and 4914 the child's closure of the pts gives the parent a SIGHUP, and
5293 { 5216 {
5294 /* Prevent input_pending from remaining set if we quit. */ 5217 /* Prevent input_pending from remaining set if we quit. */
5295 clear_input_pending (); 5218 clear_input_pending ();
5296 QUIT; 5219 QUIT;
5297 } 5220 }
5298 #ifdef POLL_INTERRUPTED_SYS_CALL
5299 /* AlainF 5-Jul-1996
5300 HP-UX 10.10 seems to have problems with signals coming in
5301 Causes "poll: interrupted system call" messages when Emacs is run
5302 in an X window
5303 Turn periodic alarms back on */
5304 start_polling ();
5305 #endif /* POLL_INTERRUPTED_SYS_CALL */
5306 5221
5307 return got_some_input; 5222 return got_some_input;
5308 } 5223 }
5309 5224
5310 /* Given a list (FUNCTION ARGS...), apply FUNCTION to the ARGS. */ 5225 /* Given a list (FUNCTION ARGS...), apply FUNCTION to the ARGS. */
5710 5625
5711 SIGTYPE 5626 SIGTYPE
5712 send_process_trap () 5627 send_process_trap ()
5713 { 5628 {
5714 SIGNAL_THREAD_CHECK (SIGPIPE); 5629 SIGNAL_THREAD_CHECK (SIGPIPE);
5715 #ifdef BSD4_1
5716 sigrelse (SIGPIPE);
5717 sigrelse (SIGALRM);
5718 #endif /* BSD4_1 */
5719 sigunblock (sigmask (SIGPIPE)); 5630 sigunblock (sigmask (SIGPIPE));
5720 longjmp (send_process_frame, 1); 5631 longjmp (send_process_frame, 1);
5721 } 5632 }
5722 5633
5723 /* Send some data to process PROC. 5634 /* Send some data to process PROC.
6782 register struct Lisp_Process *p; 6693 register struct Lisp_Process *p;
6783 extern EMACS_TIME *input_available_clear_time; 6694 extern EMACS_TIME *input_available_clear_time;
6784 6695
6785 SIGNAL_THREAD_CHECK (signo); 6696 SIGNAL_THREAD_CHECK (signo);
6786 6697
6787 #ifdef BSD4_1
6788 extern int sigheld;
6789 sigheld |= sigbit (SIGCHLD);
6790 #endif
6791
6792 while (1) 6698 while (1)
6793 { 6699 {
6794 pid_t pid; 6700 pid_t pid;
6795 WAITTYPE w; 6701 WAITTYPE w;
6796 Lisp_Object tail; 6702 Lisp_Object tail;
6814 6720
6815 /* USG systems forget handlers when they are used; 6721 /* USG systems forget handlers when they are used;
6816 must reestablish each time */ 6722 must reestablish each time */
6817 #if defined (USG) && !defined (POSIX_SIGNALS) 6723 #if defined (USG) && !defined (POSIX_SIGNALS)
6818 signal (signo, sigchld_handler); /* WARNING - must come after wait3() */ 6724 signal (signo, sigchld_handler); /* WARNING - must come after wait3() */
6819 #endif
6820 #ifdef BSD4_1
6821 sigheld &= ~sigbit (SIGCHLD);
6822 sigrelse (SIGCHLD);
6823 #endif 6725 #endif
6824 errno = old_errno; 6726 errno = old_errno;
6825 return; 6727 return;
6826 } 6728 }
6827 #else 6729 #else