Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-02-04 00:59:27 +0300
committerChristopher Faylor <me@cgf.cx>2004-02-04 00:59:27 +0300
commitc571716c6406baaab8a831eca54756e7ac8f9554 (patch)
tree8e100bb8cea2397de8fcb1e8ddbe984beda856ce /winsup/cygwin/strsig.cc
parent50be1d78d9c6ab81a269669fbc49a3ef36587078 (diff)
* Makefile.in (DLL_OFILES): Add strsig.o.
* cygtls.h (_local_storage::signamebuf) New element. * sysconf.cc (sysconf): Implement _SC_RTSIG_MAX. * tlsoffset.h: Regenerate. * include/limits.h (_POSIX_RTSIG_MAX): New define. (RTSIG_MAX): Ditto. * include/cygwin/signal.h (SIGRTMIN): New define. (SIGRTMAX): Ditto. (NSIG): Bump. * strsig.cc: New file.
Diffstat (limited to 'winsup/cygwin/strsig.cc')
-rw-r--r--winsup/cygwin/strsig.cc84
1 files changed, 84 insertions, 0 deletions
diff --git a/winsup/cygwin/strsig.cc b/winsup/cygwin/strsig.cc
new file mode 100644
index 000000000..6d3c479ec
--- /dev/null
+++ b/winsup/cygwin/strsig.cc
@@ -0,0 +1,84 @@
+/* strsig.cc
+
+ Copyright 2004 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#include "winsup.h"
+#include "thread.h"
+#include <time.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <cygtls.h>
+
+struct sigdesc
+{
+ int n;
+ const char *name;
+ const char *str;
+};
+
+#define _s(n, s) {n, #n, s}
+static const sigdesc siglist[] =
+{
+ _s(SIGHUP, "Hangup"),
+ _s(SIGINT, "Interrupt"),
+ _s(SIGQUIT, "Quit"),
+ _s(SIGILL, "Illegal instruction"),
+ _s(SIGTRAP, "Trace/breakpoint trap"),
+ _s(SIGABRT, "Aborted"),
+ _s(SIGEMT, "EMT instruction"),
+ _s(SIGFPE, "Floating point exception"),
+ _s(SIGKILL, "Killed"),
+ _s(SIGBUS, "Bus error"),
+ _s(SIGSEGV, "Segmentation fault"),
+ _s(SIGSYS, "Bad system call"),
+ _s(SIGPIPE, "Broken pipe"),
+ _s(SIGALRM, "Alarm clock"),
+ _s(SIGTERM, "Terminated"),
+ _s(SIGURG, "Urgent I/O condition"),
+ _s(SIGSTOP, "Stopped (signal)"),
+ _s(SIGTSTP, "Stopped"),
+ _s(SIGCONT, "Continued"),
+ _s(SIGCHLD, "Child exited"),
+ _s(SIGCLD, "Child exited"),
+ _s(SIGTTIN, "Stopped (tty input)"),
+ _s(SIGTTOU, "Stopped (tty output)"),
+ _s(SIGIO, "I/O possible"),
+ _s(SIGPOLL, "I/O possible"),
+ _s(SIGXCPU, "CPU time limit exceeded"),
+ _s(SIGXFSZ, "File size limit exceeded"),
+ _s(SIGVTALRM, "Virtual timer expired"),
+ _s(SIGPROF, "Profiling timer expired"),
+ _s(SIGWINCH, "Window changed"),
+ _s(SIGLOST, "Resource lost"),
+ _s(SIGUSR1, "User defined signal 1"),
+ _s(SIGUSR2, "User defined signal 2"),
+ _s(SIGRTMIN, "Real-time signal 0"),
+ _s(SIGRTMAX, "Real-time signal 0"),
+ {0, NULL, NULL}
+};
+
+extern "C" const char *
+strsignal (int signo)
+{
+ for (int i = 0; siglist[i].n; i++)
+ if (siglist[i].n == signo)
+ return siglist[i].str;
+ __small_sprintf (_my_tls.locals.signamebuf, "Unknown signal %d", signo);
+ return _my_tls.locals.signamebuf;
+}
+
+extern "C" int
+strtosigno (const char *name)
+{
+ for (int i = 0; siglist[i].n; i++)
+ if (strcmp (siglist[i].name, name) == 0)
+ return siglist[i].n;
+ return 0;
+}