aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-03-08 22:41:27 +0100
committerDuncaen <mail@duncano.de>2017-03-08 22:41:27 +0100
commit11a2f5ec63d119c70ad1f583cfa34efd0431e20c (patch)
tree2d29b507375b90b7b2716b98fc97a508d16768c9
parent7ed3f9875d3728f29bbd6fe82041d79db5da53ce (diff)
downloadlobase-11a2f5ec63d119c70ad1f583cfa34efd0431e20c.tar.gz
lib/libopenbsd: import sys_signame
-rw-r--r--include/signal.h17
-rw-r--r--lib/libopenbsd/gen/Makefile.inc4
-rw-r--r--lib/libopenbsd/gen/signame.c71
3 files changed, 77 insertions, 15 deletions
diff --git a/include/signal.h b/include/signal.h
index 98052f8..31fc26e 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -1,19 +1,10 @@
+#include_next <signal.h>
+
#ifndef _COMPAT_SIGNAL_H_
#define _COMPAT_SIGNAL_H_
#define SIGINFO SIGUSR1
-static const char *sys_signame[] = {
- "0",
- "HUP","INT","QUIT","ILL","TRAP","ABRT","BUS","FPE",
- "KILL","USR1","SEGV","USR2","PIPE","ALRM","TERM","STKFLT",
- "CHLD","CONT","STOP","TSTP","TTIN","TTOU","URG","XCPU",
- "XFSZ","VTALRM","PROF","WINCH","POLL","PWR","SYS","32",
- "33","34","35","36","37","38","39","40",
- "41","42","43","44","45","46","47","48",
- "49","50","51","52","53","54","55","56",
- "57","58","59","60","61","62","63","64"
-};
-#endif /* _COMPAT_SIGNAL_H_ */
+extern const char *const sys_signame[_NSIG];
-#include_next <signal.h>
+#endif /* _COMPAT_SIGNAL_H_ */
diff --git a/lib/libopenbsd/gen/Makefile.inc b/lib/libopenbsd/gen/Makefile.inc
index ccc9ab4..249bdbe 100644
--- a/lib/libopenbsd/gen/Makefile.inc
+++ b/lib/libopenbsd/gen/Makefile.inc
@@ -3,8 +3,8 @@
# stdio sources
VPATH+= ${LIBCSRCDIR}/gen
-SRCS+= basename.c dirname.c errc.c fts.c getmntinfo.c glob.c setmode.c unvis.c\
- verrc.c vis.c vwarnc.c warnc.c
+SRCS+= basename.c dirname.c errc.c fts.c getmntinfo.c glob.c setmode.c \
+ signame.c unvis.c verrc.c vis.c vwarnc.c warnc.c
MAN+= basename.3 dirname.3 fts.3 getmntinfo.3 glob.3 setmode.3 unvis.3 vis.3
diff --git a/lib/libopenbsd/gen/signame.c b/lib/libopenbsd/gen/signame.c
new file mode 100644
index 0000000..ce3c755
--- /dev/null
+++ b/lib/libopenbsd/gen/signame.c
@@ -0,0 +1,71 @@
+/* $OpenBSD: signame.c,v 1.7 2015/09/19 04:02:21 guenther Exp $ */
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <signal.h>
+#include <unistd.h>
+
+const char *const sys_signame[NSIG] = {
+ "Signal 0",
+ "HUP", /* SIGHUP */
+ "INT", /* SIGINT */
+ "QUIT", /* SIGQUIT */
+ "ILL", /* SIGILL */
+ "TRAP", /* SIGTRAP */
+ "ABRT", /* SIGABRT */
+ "EMT", /* SIGEMT */
+ "FPE", /* SIGFPE */
+ "KILL", /* SIGKILL */
+ "BUS", /* SIGBUS */
+ "SEGV", /* SIGSEGV */
+ "SYS", /* SIGSYS */
+ "PIPE", /* SIGPIPE */
+ "ALRM", /* SIGALRM */
+ "TERM", /* SIGTERM */
+ "URG", /* SIGURG */
+ "STOP", /* SIGSTOP */
+ "TSTP", /* SIGTSTP */
+ "CONT", /* SIGCONT */
+ "CHLD", /* SIGCHLD */
+ "TTIN", /* SIGTTIN */
+ "TTOU", /* SIGTTOU */
+ "IO", /* SIGIO */
+ "XCPU", /* SIGXCPU */
+ "XFSZ", /* SIGXFSZ */
+ "VTALRM", /* SIGVTALRM */
+ "PROF", /* SIGPROF */
+ "WINCH", /* SIGWINCH */
+ "INFO", /* SIGINFO */
+ "USR1", /* SIGUSR1 */
+ "USR2", /* SIGUSR2 */
+ "THR", /* SIGTHR */
+};
+#if 0
+DEF_WEAK(sys_signame);
+#endif