I use strsignal in man-db, and would like a Gnulib module to cope with its portability problems. Here's one which seems to be doing the right thing for me so far. This is my first attempt at writing a Gnulib module from scratch, so I'd appreciate any comments, style or otherwise.
The main practical problem I have so far is that this implementation uses snprintf, which drags in rather a lot of dependencies (importing strsignal into man-db, which was already using quite a bit of Gnulib, adds 40 new files). I'd rather use something lighter if possible. Unfortunately strsignal can't really use asprintf because the glibc version writes into a static buffer and I'd like to behave the same way. Does anyone have any suggestions? This implementation is based on glibc's. I've attached the diff against current CVS for the files in question. Thanks, -- Colin Watson [EMAIL PROTECTED]
diff --git a/lib/siglist.h b/lib/siglist.h new file mode 100644 index 0000000..1c59ffd --- /dev/null +++ b/lib/siglist.h @@ -0,0 +1,131 @@ +/* Canonical list of all signal names. + Copyright (C) 1996,97,98,99 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file should be usable for any platform, since it just associates + the SIG* macros with text names and descriptions. The actual values + come from <bits/signum.h> (via <signal.h>). For any signal macros do not + exist on every platform, we can use #ifdef tests here and still use + this single common file for all platforms. */ + +/* This file is included multiple times. */ + +/* Standard signals */ +#ifdef SIGHUP + init_sig (SIGHUP, "HUP", N_("Hangup")) +#endif +#ifdef SIGINT + init_sig (SIGINT, "INT", N_("Interrupt")) +#endif +#ifdef SIGQUIT + init_sig (SIGQUIT, "QUIT", N_("Quit")) +#endif +#ifdef SIGILL + init_sig (SIGILL, "ILL", N_("Illegal instruction")) +#endif +#ifdef SIGTRAP + init_sig (SIGTRAP, "TRAP", N_("Trace/breakpoint trap")) +#endif +#ifdef SIGABRT + init_sig (SIGABRT, "ABRT", N_("Aborted")) +#endif +#ifdef SIGFPE + init_sig (SIGFPE, "FPE", N_("Floating point exception")) +#endif +#ifdef SIGKILL + init_sig (SIGKILL, "KILL", N_("Killed")) +#endif +#ifdef SIGBUS + init_sig (SIGBUS, "BUS", N_("Bus error")) +#endif +#ifdef SIGSEGV + init_sig (SIGSEGV, "SEGV", N_("Segmentation fault")) +#endif +#ifdef SIGPIPE + init_sig (SIGPIPE, "PIPE", N_("Broken pipe")) +#endif +#ifdef SIGALRM + init_sig (SIGALRM, "ALRM", N_("Alarm clock")) +#endif +#ifdef SIGTERM + init_sig (SIGTERM, "TERM", N_("Terminated")) +#endif +#ifdef SIGURG + init_sig (SIGURG, "URG", N_("Urgent I/O condition")) +#endif +#ifdef SIGSTOP + init_sig (SIGSTOP, "STOP", N_("Stopped (signal)")) +#endif +#ifdef SIGTSTP + init_sig (SIGTSTP, "TSTP", N_("Stopped")) +#endif +#ifdef SIGCONT + init_sig (SIGCONT, "CONT", N_("Continued")) +#endif +#ifdef SIGCHLD + init_sig (SIGCHLD, "CHLD", N_("Child exited")) +#endif +#ifdef SIGTTIN + init_sig (SIGTTIN, "TTIN", N_("Stopped (tty input)")) +#endif +#ifdef SIGTTOU + init_sig (SIGTTOU, "TTOU", N_("Stopped (tty output)")) +#endif +#ifdef SIGIO + init_sig (SIGIO, "IO", N_("I/O possible")) +#endif +#ifdef SIGXCPU + init_sig (SIGXCPU, "XCPU", N_("CPU time limit exceeded")) +#endif +#ifdef SIGXFSZ + init_sig (SIGXFSZ, "XFSZ", N_("File size limit exceeded")) +#endif +#ifdef SIGVTALRM + init_sig (SIGVTALRM, "VTALRM", N_("Virtual timer expired")) +#endif +#ifdef SIGPROF + init_sig (SIGPROF, "PROF", N_("Profiling timer expired")) +#endif +#ifdef SIGWINCH + init_sig (SIGWINCH, "WINCH", N_("Window changed")) +#endif +#ifdef SIGUSR1 + init_sig (SIGUSR1, "USR1", N_("User defined signal 1")) +#endif +#ifdef SIGUSR2 + init_sig (SIGUSR2, "USR2", N_("User defined signal 2")) +#endif + +/* Variations */ +#ifdef SIGEMT + init_sig (SIGEMT, "EMT", N_("EMT trap")) +#endif +#ifdef SIGSYS + init_sig (SIGSYS, "SYS", N_("Bad system call")) +#endif +#ifdef SIGSTKFLT + init_sig (SIGSTKFLT, "STKFLT", N_("Stack fault")) +#endif +#ifdef SIGINFO + init_sig (SIGINFO, "INFO", N_("Information request")) +#elif defined(SIGPWR) && (!defined(SIGLOST) || (SIGPWR != SIGLOST)) + init_sig (SIGPWR, "PWR", N_("Power failure")) +#endif +#ifdef SIGLOST + init_sig (SIGLOST, "LOST", N_("Resource lost")) +#endif diff --git a/lib/string.in.h b/lib/string.in.h index 09205e7..9c5edbf 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -514,6 +514,18 @@ extern char *strerror (int); strerror (e)) #endif +#if @GNULIB_STRSIGNAL@ +# if ! @HAVE_DECL_STRSIGNAL@ +extern char *strsignal (int __sig); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strsignal +# define strsignal(a) \ + (GL_LINK_WARNING ("strsignal is unportable - " \ + "use gnulib module strsignal for portability"), \ + strsignal (a)) +#endif + #ifdef __cplusplus } diff --git a/lib/strsignal.c b/lib/strsignal.c new file mode 100644 index 0000000..6fba705 --- /dev/null +++ b/lib/strsignal.c @@ -0,0 +1,156 @@ +/* Copyright (C) 1991, 1994-2002, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <config.h> + +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +/* NetBSD declares sys_siglist in unistd.h. */ +#include <unistd.h> + +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) gettext_noop (msgid) +#include "lock.h" +#include "tls.h" + + +#if !HAVE_DECL_SYS_SIGLIST +# ifndef NSIG +# define NSIG 32 +# endif /* NSIG */ +static const char *sys_siglist[NSIG]; +#endif /* !HAVE_DECL_SYS_SIGLIST */ + +static gl_tls_key_t key; + +/* If nonzero the key allocation failed and we should better use a + static buffer than fail. */ +#define BUFFERSIZ 100 +static char local_buf[BUFFERSIZ]; +static char *static_buf; + +/* Destructor for the thread-specific data. */ +static void init (void); +static void free_key_mem (void *mem); +static char *getbuffer (void); + + +/* Return a string describing the meaning of the signal number SIGNUM. */ +char * +strsignal (int signum) +{ + gl_once_define (static, once); + const char *desc; + + /* If we have not yet initialized the buffer do it now. */ + gl_once (once, init); + + if ( +#ifdef SIGRTMIN + (signum >= SIGRTMIN && signum <= SIGRTMAX) || +#endif + signum < 0 || signum >= NSIG + || (desc = sys_siglist[signum]) == NULL) + { + char *buffer = getbuffer (); + int len; +#ifdef SIGRTMIN + if (signum >= SIGRTMIN && signum <= SIGRTMAX) + len = snprintf (buffer, BUFFERSIZ - 1, _("Real-time signal %d"), + signum - SIGRTMIN); + else +#endif + len = snprintf (buffer, BUFFERSIZ - 1, _("Unknown signal %d"), + signum); + if (len >= BUFFERSIZ) + buffer = NULL; + else + buffer[len] = '\0'; + + return buffer; + } + + return (char *) _(desc); +} + + +/* Initialize buffer. */ +static void +init (void) +{ +#if !HAVE_DECL_SYS_SIGLIST + memset (sys_siglist, 0, NSIG * sizeof *sys_siglist); + + /* The trailing semicolon is because siglist.h is really designed for + array initializers, but we don't want that here because the signal + numbers might exceed NSIG. */ +# define init_sig(sig, abbrev, desc) do { \ + if (sig >= 0 && sig < NSIG) \ + sys_siglist[sig] = desc; \ +} while (0); + +# include "siglist.h" + +# undef init_sig + +#endif /* !HAVE_DECL_SYS_SIGLIST */ + + gl_tls_key_init (key, free_key_mem); +} + + +/* Free the thread specific data, this is done if a thread terminates. */ +static void +free_key_mem (void *mem) +{ + free (mem); + gl_tls_set (key, NULL); +} + + +/* Return the buffer to be used. */ +static char * +getbuffer (void) +{ + char *result; + + if (static_buf != NULL) + result = static_buf; + else + { + /* We don't use the static buffer and so we have a key. Use it + to get the thread-specific buffer. */ + result = gl_tls_get (key); + if (result == NULL) + { + /* No buffer allocated so far. */ + result = malloc (BUFFERSIZ); + if (result == NULL) + /* No more memory available. We use the static buffer. */ + result = local_buf; + else + gl_tls_set (key, result); + } + } + + return result; +} diff --git a/m4/string_h.m4 b/m4/string_h.m4 index 99a0dab..2cbb26c 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -60,6 +60,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) + GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) @@ -76,6 +77,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR]) + HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) ]) diff --git a/m4/strsignal.m4 b/m4/strsignal.m4 new file mode 100644 index 0000000..9bcd374 --- /dev/null +++ b/m4/strsignal.m4 @@ -0,0 +1,24 @@ +# strsignal.m4 serial 1 +dnl Copyright (C) 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STRSIGNAL], +[ + dnl Persuade glibc <string.h> to declare strsignal(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([AC_DECL_SYS_SIGLIST]) + + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REPLACE_FUNCS([strsignal]) + AC_CHECK_DECLS_ONCE([strsignal]) + if test $ac_cv_have_decl_strsignal = no; then + HAVE_DECL_STRSIGNAL=0 + gl_PREREQ_STRSIGNAL + fi +]) + +# Prerequisites of lib/strsignal.c. +AC_DEFUN([gl_PREREQ_STRSIGNAL], [:]) diff --git a/modules/string b/modules/string index 6f3226d..226b0e0 100644 --- a/modules/string +++ b/modules/string @@ -51,6 +51,7 @@ string.h: string.in.h -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ + -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ @@ -66,6 +67,7 @@ string.h: string.in.h -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \ + -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ diff --git a/modules/strsignal b/modules/strsignal new file mode 100644 index 0000000..1a6580b --- /dev/null +++ b/modules/strsignal @@ -0,0 +1,30 @@ +Description: +strsignal() function: return string describing signal. + +Files: +lib/strsignal.c +lib/siglist.h +m4/strsignal.m4 + +Depends-on: +string +gettext-h +lock +tls +snprintf-posix +memset + +configure.ac: +gl_FUNC_STRSIGNAL +gl_STRING_MODULE_INDICATOR([strsignal]) + +Makefile.am: + +Include: +"strsignal.h" + +License: +LGPLv2+ + +Maintainer: +Colin Watson, glibc diff --git a/modules/strsignal-tests b/modules/strsignal-tests new file mode 100644 index 0000000..d0e50bf --- /dev/null +++ b/modules/strsignal-tests @@ -0,0 +1,10 @@ +Files: +tests/test-strsignal.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-strsignal +check_PROGRAMS += test-strsignal diff --git a/tests/test-strsignal.c b/tests/test-strsignal.c new file mode 100644 index 0000000..0448995 --- /dev/null +++ b/tests/test-strsignal.c @@ -0,0 +1,57 @@ +/* Test of strsignal() function. + Copyright (C) 2008 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Colin Watson <[EMAIL PROTECTED]>, 2008. */ + +#include <config.h> + +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +int +main (int argc, char **argv) +{ + char *str; + str = strsignal (SIGHUP); + ASSERT (str); + ASSERT (*str); + +#if !HAVE_DECL_SYS_SIGLIST + /* In this case, we can guarantee some signal descriptions. */ + ASSERT (!strcmp (str, "Hangup")); + + str = strsignal (SIGINT); + ASSERT (str); + ASSERT (*str); + ASSERT (!strcmp (str, "Interrupt")); +#endif + + return 0; +}
--- /home/cjwatson/src/gnu/libc/string/strsignal.c 2005-11-06 02:05:17.000000000 +0000 +++ lib/strsignal.c 2008-01-06 09:31:27.000000000 +0000 @@ -16,18 +16,31 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <config.h> + #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <libintl.h> -#include <bits/libc-lock.h> +/* NetBSD declares sys_siglist in unistd.h. */ +#include <unistd.h> + +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) gettext_noop (msgid) +#include "lock.h" +#include "tls.h" + + +#if !HAVE_DECL_SYS_SIGLIST +# ifndef NSIG +# define NSIG 32 +# endif /* NSIG */ +static const char *sys_siglist[NSIG]; +#endif /* !HAVE_DECL_SYS_SIGLIST */ -/* Defined in siglist.c. */ -extern const char *const _sys_siglist[]; -extern const char *const _sys_siglist_internal[] attribute_hidden; -static __libc_key_t key; +static gl_tls_key_t key; /* If nonzero the key allocation failed and we should better use a static buffer than fail. */ @@ -45,29 +58,29 @@ char * strsignal (int signum) { - __libc_once_define (static, once); + gl_once_define (static, once); const char *desc; /* If we have not yet initialized the buffer do it now. */ - __libc_once (once, init); + gl_once (once, init); if ( #ifdef SIGRTMIN (signum >= SIGRTMIN && signum <= SIGRTMAX) || #endif signum < 0 || signum >= NSIG - || (desc = INTUSE(_sys_siglist)[signum]) == NULL) + || (desc = sys_siglist[signum]) == NULL) { char *buffer = getbuffer (); int len; #ifdef SIGRTMIN if (signum >= SIGRTMIN && signum <= SIGRTMAX) - len = __snprintf (buffer, BUFFERSIZ - 1, _("Real-time signal %d"), - signum - SIGRTMIN); + len = snprintf (buffer, BUFFERSIZ - 1, _("Real-time signal %d"), + signum - SIGRTMIN); else #endif - len = __snprintf (buffer, BUFFERSIZ - 1, _("Unknown signal %d"), - signum); + len = snprintf (buffer, BUFFERSIZ - 1, _("Unknown signal %d"), + signum); if (len >= BUFFERSIZ) buffer = NULL; else @@ -84,11 +97,24 @@ static void init (void) { - if (__libc_key_create (&key, free_key_mem)) - /* Creating the key failed. This means something really went - wrong. In any case use a static buffer which is better than - nothing. */ - static_buf = local_buf; +#if !HAVE_DECL_SYS_SIGLIST + memset (sys_siglist, 0, NSIG * sizeof *sys_siglist); + + /* The trailing semicolon is because siglist.h is really designed for + array initializers, but we don't want that here because the signal + numbers might exceed NSIG. */ +# define init_sig(sig, abbrev, desc) do { \ + if (sig >= 0 && sig < NSIG) \ + sys_siglist[sig] = desc; \ +} while (0); + +# include "siglist.h" + +# undef init_sig + +#endif /* !HAVE_DECL_SYS_SIGLIST */ + + gl_tls_key_init (key, free_key_mem); } @@ -97,7 +123,7 @@ free_key_mem (void *mem) { free (mem); - __libc_setspecific (key, NULL); + gl_tls_set (key, NULL); } @@ -113,7 +139,7 @@ { /* We don't use the static buffer and so we have a key. Use it to get the thread-specific buffer. */ - result = __libc_getspecific (key); + result = gl_tls_get (key); if (result == NULL) { /* No buffer allocated so far. */ @@ -122,7 +148,7 @@ /* No more memory available. We use the static buffer. */ result = local_buf; else - __libc_setspecific (key, result); + gl_tls_set (key, result); } } --- /home/cjwatson/src/gnu/libc/sysdeps/generic/siglist.h 2001-07-06 05:55:50.000000000 +0100 +++ lib/siglist.h 2008-01-06 00:14:26.000000000 +0000 @@ -26,34 +26,90 @@ /* This file is included multiple times. */ /* Standard signals */ +#ifdef SIGHUP init_sig (SIGHUP, "HUP", N_("Hangup")) +#endif +#ifdef SIGINT init_sig (SIGINT, "INT", N_("Interrupt")) +#endif +#ifdef SIGQUIT init_sig (SIGQUIT, "QUIT", N_("Quit")) +#endif +#ifdef SIGILL init_sig (SIGILL, "ILL", N_("Illegal instruction")) +#endif +#ifdef SIGTRAP init_sig (SIGTRAP, "TRAP", N_("Trace/breakpoint trap")) +#endif +#ifdef SIGABRT init_sig (SIGABRT, "ABRT", N_("Aborted")) +#endif +#ifdef SIGFPE init_sig (SIGFPE, "FPE", N_("Floating point exception")) +#endif +#ifdef SIGKILL init_sig (SIGKILL, "KILL", N_("Killed")) +#endif +#ifdef SIGBUS init_sig (SIGBUS, "BUS", N_("Bus error")) +#endif +#ifdef SIGSEGV init_sig (SIGSEGV, "SEGV", N_("Segmentation fault")) +#endif +#ifdef SIGPIPE init_sig (SIGPIPE, "PIPE", N_("Broken pipe")) +#endif +#ifdef SIGALRM init_sig (SIGALRM, "ALRM", N_("Alarm clock")) +#endif +#ifdef SIGTERM init_sig (SIGTERM, "TERM", N_("Terminated")) +#endif +#ifdef SIGURG init_sig (SIGURG, "URG", N_("Urgent I/O condition")) +#endif +#ifdef SIGSTOP init_sig (SIGSTOP, "STOP", N_("Stopped (signal)")) +#endif +#ifdef SIGTSTP init_sig (SIGTSTP, "TSTP", N_("Stopped")) +#endif +#ifdef SIGCONT init_sig (SIGCONT, "CONT", N_("Continued")) +#endif +#ifdef SIGCHLD init_sig (SIGCHLD, "CHLD", N_("Child exited")) +#endif +#ifdef SIGTTIN init_sig (SIGTTIN, "TTIN", N_("Stopped (tty input)")) +#endif +#ifdef SIGTTOU init_sig (SIGTTOU, "TTOU", N_("Stopped (tty output)")) +#endif +#ifdef SIGIO init_sig (SIGIO, "IO", N_("I/O possible")) +#endif +#ifdef SIGXCPU init_sig (SIGXCPU, "XCPU", N_("CPU time limit exceeded")) +#endif +#ifdef SIGXFSZ init_sig (SIGXFSZ, "XFSZ", N_("File size limit exceeded")) +#endif +#ifdef SIGVTALRM init_sig (SIGVTALRM, "VTALRM", N_("Virtual timer expired")) +#endif +#ifdef SIGPROF init_sig (SIGPROF, "PROF", N_("Profiling timer expired")) +#endif +#ifdef SIGWINCH init_sig (SIGWINCH, "WINCH", N_("Window changed")) +#endif +#ifdef SIGUSR1 init_sig (SIGUSR1, "USR1", N_("User defined signal 1")) +#endif +#ifdef SIGUSR2 init_sig (SIGUSR2, "USR2", N_("User defined signal 2")) +#endif /* Variations */ #ifdef SIGEMT