aboutsummaryrefslogtreecommitdiffstats
path: root/src/sysdep.c
diff options
context:
space:
mode:
authorEli Zaretskii2010-05-01 21:38:33 +0300
committerEli Zaretskii2010-05-01 21:38:33 +0300
commit197daef4ab65cbb5d5add8bbc8e258aa26992d4f (patch)
tree1208d8d484a666748c4b940dfa696acfffd66021 /src/sysdep.c
parentaf7c7572ce8d87f51817d0f518d1b0aced074a41 (diff)
parentd6dae14b946a4bda5ba4dda7a625ec04511b16f4 (diff)
downloademacs-197daef4ab65cbb5d5add8bbc8e258aa26992d4f.tar.gz
emacs-197daef4ab65cbb5d5add8bbc8e258aa26992d4f.zip
Emulate POSIX_SIGNALS on MS-Windows.
s/ms-w32.h (POSIX_SIGNALS, struct sigaction, SIG_BLOCK) (SIG_SETMASK, SIG_UNBLOCK): Define. sysdep.c (sys_signal) [WINDOWSNT]: #ifdef away. (wait_for_termination) [WINDOWSNT]: Move MS-Windows specific code from non-POSIX_SIGNALS section to POSIX_SIGNALS section. w32.c (sigemptyset, sigaddset, sigfillset, sigprocmask): New stubs.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r--src/sysdep.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index aebf6e7a2d1..08c2bd48e59 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -420,6 +420,10 @@ wait_for_termination (pid)
420 sigpause (SIGEMPTYMASK); 420 sigpause (SIGEMPTYMASK);
421#else /* not BSD_SYSTEM, and not HPUX version >= 6 */ 421#else /* not BSD_SYSTEM, and not HPUX version >= 6 */
422#ifdef POSIX_SIGNALS /* would this work for GNU/Linux as well? */ 422#ifdef POSIX_SIGNALS /* would this work for GNU/Linux as well? */
423#ifdef WINDOWSNT
424 wait (0);
425 break;
426#else /* not WINDOWSNT */
423 sigblock (sigmask (SIGCHLD)); 427 sigblock (sigmask (SIGCHLD));
424 errno = 0; 428 errno = 0;
425 if (kill (pid, 0) == -1 && errno == ESRCH) 429 if (kill (pid, 0) == -1 && errno == ESRCH)
@@ -429,6 +433,7 @@ wait_for_termination (pid)
429 } 433 }
430 434
431 sigsuspend (&empty_mask); 435 sigsuspend (&empty_mask);
436#endif /* not WINDOWSNT */
432#else /* not POSIX_SIGNALS */ 437#else /* not POSIX_SIGNALS */
433#ifdef HAVE_SYSV_SIGPAUSE 438#ifdef HAVE_SYSV_SIGPAUSE
434 sighold (SIGCHLD); 439 sighold (SIGCHLD);
@@ -439,17 +444,12 @@ wait_for_termination (pid)
439 } 444 }
440 sigpause (SIGCHLD); 445 sigpause (SIGCHLD);
441#else /* not HAVE_SYSV_SIGPAUSE */ 446#else /* not HAVE_SYSV_SIGPAUSE */
442#ifdef WINDOWSNT
443 wait (0);
444 break;
445#else /* not WINDOWSNT */
446 if (0 > kill (pid, 0)) 447 if (0 > kill (pid, 0))
447 break; 448 break;
448 /* Using sleep instead of pause avoids timing error. 449 /* Using sleep instead of pause avoids timing error.
449 If the inferior dies just before the sleep, 450 If the inferior dies just before the sleep,
450 we lose just one second. */ 451 we lose just one second. */
451 sleep (1); 452 sleep (1);
452#endif /* not WINDOWSNT */
453#endif /* not HAVE_SYSV_SIGPAUSE */ 453#endif /* not HAVE_SYSV_SIGPAUSE */
454#endif /* not POSIX_SIGNALS */ 454#endif /* not POSIX_SIGNALS */
455#endif /* not BSD_SYSTEM, and not HPUX version >= 6 */ 455#endif /* not BSD_SYSTEM, and not HPUX version >= 6 */
@@ -2105,6 +2105,8 @@ read_input_waiting ()
2105 2105
2106sigset_t empty_mask, full_mask; 2106sigset_t empty_mask, full_mask;
2107 2107
2108#ifndef WINDOWSNT
2109
2108signal_handler_t 2110signal_handler_t
2109sys_signal (int signal_number, signal_handler_t action) 2111sys_signal (int signal_number, signal_handler_t action)
2110{ 2112{
@@ -2133,6 +2135,8 @@ sys_signal (int signal_number, signal_handler_t action)
2133 return (old_action.sa_handler); 2135 return (old_action.sa_handler);
2134} 2136}
2135 2137
2138#endif /* WINDOWSNT */
2139
2136#ifndef __GNUC__ 2140#ifndef __GNUC__
2137/* If we're compiling with GCC, we don't need this function, since it 2141/* If we're compiling with GCC, we don't need this function, since it
2138 can be written as a macro. */ 2142 can be written as a macro. */