summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2010-05-01 21:28:00 +0300
committerEli Zaretskii <eliz@gnu.org>2010-05-01 21:28:00 +0300
commitd6dae14b946a4bda5ba4dda7a625ec04511b16f4 (patch)
treedcaaf3a6610f7cdf68c4894e345d6bbde925061d /src
parentb47e0dcf2db5d0f754342f0eb13e53974bfbefbe (diff)
downloademacs-d6dae14b946a4bda5ba4dda7a625ec04511b16f4.tar.gz
emacs-d6dae14b946a4bda5ba4dda7a625ec04511b16f4.tar.bz2
emacs-d6dae14b946a4bda5ba4dda7a625ec04511b16f4.zip
Emulate POSIX_SIGNALS on MS-Windows.
w32.c (sigemptyset, sigaddset, sigfillset, sigprocmask): New stubs. 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. s/ms-w32.h (POSIX_SIGNALS, struct sigaction, SIG_BLOCK) (SIG_SETMASK, SIG_UNBLOCK): Define.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/s/ms-w32.h12
-rw-r--r--src/sysdep.c14
-rw-r--r--src/w32.c24
4 files changed, 55 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4de1618f4d6..98a2ae33339 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,15 @@
2010-05-01 Eli Zaretskii <eliz@gnu.org>
+ * w32.c (sigemptyset, sigaddset, sigfillset, sigprocmask): New
+ stubs.
+
+ * 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.
+
+ * s/ms-w32.h (POSIX_SIGNALS, struct sigaction, SIG_BLOCK)
+ (SIG_SETMASK, SIG_UNBLOCK): Define.
+
* xdisp.c (find_row_end): New function, refactored from display_line.
(display_line): Use it.
(extend_face_to_end_of_line): In almost-filled rows, extend only
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 66aae334b3f..74e91c1e816 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -123,6 +123,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
+/* Do we have POSIX signals? (We don't, but we don't care, either.) */
+#define POSIX_SIGNALS 1
+#include <sys/types.h>
+struct sigaction {
+ int sa_flags;
+ void (*sa_handler)(int);
+ sigset_t sa_mask;
+};
+#define SIG_BLOCK 1
+#define SIG_SETMASK 2
+#define SIG_UNBLOCK 3
+
/* The null device on Windows NT. */
#define NULL_DEVICE "NUL:"
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)
sigpause (SIGEMPTYMASK);
#else /* not BSD_SYSTEM, and not HPUX version >= 6 */
#ifdef POSIX_SIGNALS /* would this work for GNU/Linux as well? */
+#ifdef WINDOWSNT
+ wait (0);
+ break;
+#else /* not WINDOWSNT */
sigblock (sigmask (SIGCHLD));
errno = 0;
if (kill (pid, 0) == -1 && errno == ESRCH)
@@ -429,6 +433,7 @@ wait_for_termination (pid)
}
sigsuspend (&empty_mask);
+#endif /* not WINDOWSNT */
#else /* not POSIX_SIGNALS */
#ifdef HAVE_SYSV_SIGPAUSE
sighold (SIGCHLD);
@@ -439,17 +444,12 @@ wait_for_termination (pid)
}
sigpause (SIGCHLD);
#else /* not HAVE_SYSV_SIGPAUSE */
-#ifdef WINDOWSNT
- wait (0);
- break;
-#else /* not WINDOWSNT */
if (0 > kill (pid, 0))
break;
/* Using sleep instead of pause avoids timing error.
If the inferior dies just before the sleep,
we lose just one second. */
sleep (1);
-#endif /* not WINDOWSNT */
#endif /* not HAVE_SYSV_SIGPAUSE */
#endif /* not POSIX_SIGNALS */
#endif /* not BSD_SYSTEM, and not HPUX version >= 6 */
@@ -2105,6 +2105,8 @@ read_input_waiting ()
sigset_t empty_mask, full_mask;
+#ifndef WINDOWSNT
+
signal_handler_t
sys_signal (int signal_number, signal_handler_t action)
{
@@ -2133,6 +2135,8 @@ sys_signal (int signal_number, signal_handler_t action)
return (old_action.sa_handler);
}
+#endif /* WINDOWSNT */
+
#ifndef __GNUC__
/* If we're compiling with GCC, we don't need this function, since it
can be written as a macro. */
diff --git a/src/w32.c b/src/w32.c
index 2ff344abd65..0f2d8b54e6b 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1482,6 +1482,30 @@ sigunblock (int sig)
}
int
+sigemptyset (sigset_t *set)
+{
+ return 0;
+}
+
+int
+sigaddset (sigset_t *set, int signo)
+{
+ return 0;
+}
+
+int
+sigfillset (sigset_t *set)
+{
+ return 0;
+}
+
+int
+sigprocmask (int how, const sigset_t *set, sigset_t *oset)
+{
+ return 0;
+}
+
+int
setpgrp (int pid, int gid)
{
return 0;