diff options
| author | Joakim Verona | 2012-10-16 17:14:35 +0200 |
|---|---|---|
| committer | Joakim Verona | 2012-10-16 17:14:35 +0200 |
| commit | 017a270078be5ae39301e3205afad80d23facbbc (patch) | |
| tree | 5c85d8c3890f3a0cead231e87823b621a8f28e16 /src/sysdep.c | |
| parent | 5fcc7035c884b4419a1619551222b5f28ad9906f (diff) | |
| parent | 2b794d6940aa7dc58e297b3649b7799190d71f64 (diff) | |
| download | emacs-017a270078be5ae39301e3205afad80d23facbbc.tar.gz emacs-017a270078be5ae39301e3205afad80d23facbbc.zip | |
upstream
Diffstat (limited to 'src/sysdep.c')
| -rw-r--r-- | src/sysdep.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index f4e055c31a0..74617fcaf0f 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -54,6 +54,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 54 | #ifdef WINDOWSNT | 54 | #ifdef WINDOWSNT |
| 55 | #define read sys_read | 55 | #define read sys_read |
| 56 | #define write sys_write | 56 | #define write sys_write |
| 57 | #ifndef STDERR_FILENO | ||
| 58 | #define STDERR_FILENO fileno(GetStdHandle(STD_ERROR_HANDLE)) | ||
| 59 | #endif | ||
| 57 | #include <windows.h> | 60 | #include <windows.h> |
| 58 | #endif /* not WINDOWSNT */ | 61 | #endif /* not WINDOWSNT */ |
| 59 | 62 | ||
| @@ -1447,6 +1450,9 @@ emacs_sigaction_init (struct sigaction *action, signal_handler_t handler) | |||
| 1447 | #ifdef SIGDANGER | 1450 | #ifdef SIGDANGER |
| 1448 | sigaddset (&action->sa_mask, SIGDANGER); | 1451 | sigaddset (&action->sa_mask, SIGDANGER); |
| 1449 | #endif | 1452 | #endif |
| 1453 | #ifdef PROFILER_CPU_SUPPORT | ||
| 1454 | sigaddset (&action->sa_mask, SIGPROF); | ||
| 1455 | #endif | ||
| 1450 | #ifdef SIGWINCH | 1456 | #ifdef SIGWINCH |
| 1451 | sigaddset (&action->sa_mask, SIGWINCH); | 1457 | sigaddset (&action->sa_mask, SIGWINCH); |
| 1452 | #endif | 1458 | #endif |
| @@ -1537,19 +1543,17 @@ deliver_thread_signal (int sig, signal_handler_t handler) | |||
| 1537 | errno = old_errno; | 1543 | errno = old_errno; |
| 1538 | } | 1544 | } |
| 1539 | 1545 | ||
| 1540 | #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST | 1546 | #if !HAVE_DECL_SYS_SIGLIST |
| 1541 | static char *my_sys_siglist[NSIG]; | 1547 | # undef sys_siglist |
| 1542 | # ifdef sys_siglist | ||
| 1543 | # undef sys_siglist | ||
| 1544 | # endif | ||
| 1545 | # define sys_siglist my_sys_siglist | 1548 | # define sys_siglist my_sys_siglist |
| 1549 | static char const *sys_siglist[NSIG]; | ||
| 1546 | #endif | 1550 | #endif |
| 1547 | 1551 | ||
| 1548 | /* Handle bus errors, invalid instruction, etc. */ | 1552 | /* Handle bus errors, invalid instruction, etc. */ |
| 1549 | static void | 1553 | static void |
| 1550 | handle_fatal_signal (int sig) | 1554 | handle_fatal_signal (int sig) |
| 1551 | { | 1555 | { |
| 1552 | terminate_due_to_signal (sig, 10); | 1556 | terminate_due_to_signal (sig, 40); |
| 1553 | } | 1557 | } |
| 1554 | 1558 | ||
| 1555 | static void | 1559 | static void |
| @@ -1605,7 +1609,7 @@ init_signals (bool dumping) | |||
| 1605 | main_thread = pthread_self (); | 1609 | main_thread = pthread_self (); |
| 1606 | #endif | 1610 | #endif |
| 1607 | 1611 | ||
| 1608 | #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST | 1612 | #if !HAVE_DECL_SYS_SIGLIST |
| 1609 | if (! initialized) | 1613 | if (! initialized) |
| 1610 | { | 1614 | { |
| 1611 | sys_siglist[SIGABRT] = "Aborted"; | 1615 | sys_siglist[SIGABRT] = "Aborted"; |
| @@ -1753,7 +1757,7 @@ init_signals (bool dumping) | |||
| 1753 | sys_siglist[SIGXFSZ] = "File size limit exceeded"; | 1757 | sys_siglist[SIGXFSZ] = "File size limit exceeded"; |
| 1754 | # endif | 1758 | # endif |
| 1755 | } | 1759 | } |
| 1756 | #endif /* !defined HAVE_STRSIGNAL && !defined HAVE_DECL_SYS_SIGLIST */ | 1760 | #endif /* !HAVE_DECL_SYS_SIGLIST */ |
| 1757 | 1761 | ||
| 1758 | /* Don't alter signal handlers if dumping. On some machines, | 1762 | /* Don't alter signal handlers if dumping. On some machines, |
| 1759 | changing signal handlers sets static data that would make signals | 1763 | changing signal handlers sets static data that would make signals |
| @@ -1837,7 +1841,7 @@ init_signals (bool dumping) | |||
| 1837 | #endif | 1841 | #endif |
| 1838 | sigaction (SIGTERM, &process_fatal_action, 0); | 1842 | sigaction (SIGTERM, &process_fatal_action, 0); |
| 1839 | #ifdef SIGPROF | 1843 | #ifdef SIGPROF |
| 1840 | sigaction (SIGPROF, &process_fatal_action, 0); | 1844 | signal (SIGPROF, SIG_IGN); |
| 1841 | #endif | 1845 | #endif |
| 1842 | #ifdef SIGVTALRM | 1846 | #ifdef SIGVTALRM |
| 1843 | sigaction (SIGVTALRM, &process_fatal_action, 0); | 1847 | sigaction (SIGVTALRM, &process_fatal_action, 0); |
| @@ -2274,21 +2278,20 @@ set_file_times (int fd, const char *filename, | |||
| 2274 | return fdutimens (fd, filename, timespec); | 2278 | return fdutimens (fd, filename, timespec); |
| 2275 | } | 2279 | } |
| 2276 | 2280 | ||
| 2277 | #ifndef HAVE_STRSIGNAL | 2281 | /* Like strsignal, except async-signal-safe, and this function typically |
| 2278 | char * | 2282 | returns a string in the C locale rather than the current locale. */ |
| 2279 | strsignal (int code) | 2283 | char const * |
| 2284 | safe_strsignal (int code) | ||
| 2280 | { | 2285 | { |
| 2281 | char *signame = 0; | 2286 | char const *signame = 0; |
| 2282 | 2287 | ||
| 2283 | if (0 <= code && code < NSIG) | 2288 | if (0 <= code && code < NSIG) |
| 2284 | { | 2289 | signame = sys_siglist[code]; |
| 2285 | /* Cast to suppress warning if the table has const char *. */ | 2290 | if (! signame) |
| 2286 | signame = (char *) sys_siglist[code]; | 2291 | signame = "Unknown signal"; |
| 2287 | } | ||
| 2288 | 2292 | ||
| 2289 | return signame; | 2293 | return signame; |
| 2290 | } | 2294 | } |
| 2291 | #endif /* HAVE_STRSIGNAL */ | ||
| 2292 | 2295 | ||
| 2293 | #ifndef DOS_NT | 2296 | #ifndef DOS_NT |
| 2294 | /* For make-serial-process */ | 2297 | /* For make-serial-process */ |