aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/ChangeLog15
-rw-r--r--src/s/ms-w32.h12
-rw-r--r--src/sysdep.c14
-rw-r--r--src/w32.c24
4 files changed, 58 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0b4baf64cf4..6f925be2a52 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,9 +1,20 @@
12010-05-01 Eli Zaretskii <eliz@gnu.org> 12010-05-01 Eli Zaretskii <eliz@gnu.org>
2 2
3 Emulate POSIX_SIGNALS on MS-Windows.
4
5 * s/ms-w32.h (POSIX_SIGNALS, struct sigaction, SIG_BLOCK)
6 (SIG_SETMASK, SIG_UNBLOCK): Define.
7
8 * sysdep.c (sys_signal) [WINDOWSNT]: #ifdef away.
9 (wait_for_termination) [WINDOWSNT]: Move MS-Windows specific code
10 from non-POSIX_SIGNALS section to POSIX_SIGNALS section.
11
12 * w32.c (sigemptyset, sigaddset, sigfillset, sigprocmask): New
13 stubs.
14
3 Miscellaneous fixes of bidi display. 15 Miscellaneous fixes of bidi display.
4 16
5 * xdisp.c (find_row_end): New function, refactored from 17 * xdisp.c (find_row_end): New function, refactored from display_line.
6 display_line.
7 (display_line): Use it. 18 (display_line): Use it.
8 (extend_face_to_end_of_line): In almost-filled rows, extend only 19 (extend_face_to_end_of_line): In almost-filled rows, extend only
9 if the row is R2L and not continued. 20 if the row is R2L and not continued.
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/>. */
123#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\') 123#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
124#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_)) 124#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
125 125
126/* Do we have POSIX signals? (We don't, but we don't care, either.) */
127#define POSIX_SIGNALS 1
128#include <sys/types.h>
129struct sigaction {
130 int sa_flags;
131 void (*sa_handler)(int);
132 sigset_t sa_mask;
133};
134#define SIG_BLOCK 1
135#define SIG_SETMASK 2
136#define SIG_UNBLOCK 3
137
126/* The null device on Windows NT. */ 138/* The null device on Windows NT. */
127#define NULL_DEVICE "NUL:" 139#define NULL_DEVICE "NUL:"
128 140
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. */
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)
1482} 1482}
1483 1483
1484int 1484int
1485sigemptyset (sigset_t *set)
1486{
1487 return 0;
1488}
1489
1490int
1491sigaddset (sigset_t *set, int signo)
1492{
1493 return 0;
1494}
1495
1496int
1497sigfillset (sigset_t *set)
1498{
1499 return 0;
1500}
1501
1502int
1503sigprocmask (int how, const sigset_t *set, sigset_t *oset)
1504{
1505 return 0;
1506}
1507
1508int
1485setpgrp (int pid, int gid) 1509setpgrp (int pid, int gid)
1486{ 1510{
1487 return 0; 1511 return 0;