Translate signal numbers between rump kernel and (POSIX) host.diff -r1.55 -r1.56 src/lib/librumpclient/rumpclient.c
(pooka)
--- src/lib/librumpclient/rumpclient.c 2013/09/10 16:53:06 1.55
+++ src/lib/librumpclient/rumpclient.c 2014/02/20 00:42:27 1.56
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: rumpclient.c,v 1.55 2013/09/10 16:53:06 pooka Exp $ */ | 1 | /* $NetBSD: rumpclient.c,v 1.56 2014/02/20 00:42:27 pooka Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved. | 4 | * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
@@ -38,27 +38,27 @@ | @@ -38,27 +38,27 @@ | |||
38 | * notifications but defer their handling to a stage where we do not | 38 | * notifications but defer their handling to a stage where we do not | |
39 | * hold the communication lock. Taking a signal while holding on to | 39 | * hold the communication lock. Taking a signal while holding on to | |
40 | * that lock may cause a deadlock. Therefore, block signals throughout | 40 | * that lock may cause a deadlock. Therefore, block signals throughout | |
41 | * the RPC when using poll. This unfortunately means that the normal | 41 | * the RPC when using poll. This unfortunately means that the normal | |
42 | * SIGINT way of stopping a process while it is undergoing rump kernel | 42 | * SIGINT way of stopping a process while it is undergoing rump kernel | |
43 | * RPC will not work. If anyone know which Linux system call handles | 43 | * RPC will not work. If anyone know which Linux system call handles | |
44 | * the above scenario correctly, I'm all ears. | 44 | * the above scenario correctly, I'm all ears. | |
45 | */ | 45 | */ | |
46 | 46 | |||
47 | #ifdef __NetBSD__ | 47 | #ifdef __NetBSD__ | |
48 | #define USE_KQUEUE | 48 | #define USE_KQUEUE | |
49 | #endif | 49 | #endif | |
50 | 50 | |||
51 | __RCSID("$NetBSD: rumpclient.c,v 1.55 2013/09/10 16:53:06 pooka Exp $"); | 51 | __RCSID("$NetBSD: rumpclient.c,v 1.56 2014/02/20 00:42:27 pooka Exp $"); | |
52 | 52 | |||
53 | #include <sys/param.h> | 53 | #include <sys/param.h> | |
54 | #include <sys/mman.h> | 54 | #include <sys/mman.h> | |
55 | #include <sys/socket.h> | 55 | #include <sys/socket.h> | |
56 | #include <sys/time.h> | 56 | #include <sys/time.h> | |
57 | 57 | |||
58 | #ifdef USE_KQUEUE | 58 | #ifdef USE_KQUEUE | |
59 | #include <sys/event.h> | 59 | #include <sys/event.h> | |
60 | #endif | 60 | #endif | |
61 | 61 | |||
62 | #include <arpa/inet.h> | 62 | #include <arpa/inet.h> | |
63 | #include <netinet/in.h> | 63 | #include <netinet/in.h> | |
64 | #include <netinet/tcp.h> | 64 | #include <netinet/tcp.h> | |
@@ -89,26 +89,27 @@ ssize_t (*host_read)(int, void *, size_t | @@ -89,26 +89,27 @@ ssize_t (*host_read)(int, void *, size_t | |||
89 | ssize_t (*host_sendmsg)(int, const struct msghdr *, int); | 89 | ssize_t (*host_sendmsg)(int, const struct msghdr *, int); | |
90 | int (*host_setsockopt)(int, int, int, const void *, socklen_t); | 90 | int (*host_setsockopt)(int, int, int, const void *, socklen_t); | |
91 | int (*host_dup)(int); | 91 | int (*host_dup)(int); | |
92 | 92 | |||
93 | #ifdef USE_KQUEUE | 93 | #ifdef USE_KQUEUE | |
94 | int (*host_kqueue)(void); | 94 | int (*host_kqueue)(void); | |
95 | int (*host_kevent)(int, const struct kevent *, size_t, | 95 | int (*host_kevent)(int, const struct kevent *, size_t, | |
96 | struct kevent *, size_t, const struct timespec *); | 96 | struct kevent *, size_t, const struct timespec *); | |
97 | #endif | 97 | #endif | |
98 | 98 | |||
99 | int (*host_execve)(const char *, char *const[], char *const[]); | 99 | int (*host_execve)(const char *, char *const[], char *const[]); | |
100 | 100 | |||
101 | #include "sp_common.c" | 101 | #include "sp_common.c" | |
102 | #include "rumpuser_sigtrans.c" | |||
102 | 103 | |||
103 | static struct spclient clispc = { | 104 | static struct spclient clispc = { | |
104 | .spc_fd = -1, | 105 | .spc_fd = -1, | |
105 | }; | 106 | }; | |
106 | 107 | |||
107 | static int kq = -1; | 108 | static int kq = -1; | |
108 | static sigset_t fullset; | 109 | static sigset_t fullset; | |
109 | 110 | |||
110 | static int doconnect(void); | 111 | static int doconnect(void); | |
111 | static int handshake_req(struct spclient *, int, void *, int, bool); | 112 | static int handshake_req(struct spclient *, int, void *, int, bool); | |
112 | 113 | |||
113 | /* | 114 | /* | |
114 | * Default: don't retry. Most clients can't handle it | 115 | * Default: don't retry. Most clients can't handle it | |
@@ -580,26 +581,27 @@ rumpclient_syscall(int sysnum, const voi | @@ -580,26 +581,27 @@ rumpclient_syscall(int sysnum, const voi | |||
580 | out: | 581 | out: | |
581 | pthread_sigmask(SIG_SETMASK, &omask, NULL); | 582 | pthread_sigmask(SIG_SETMASK, &omask, NULL); | |
582 | return rv; | 583 | return rv; | |
583 | } | 584 | } | |
584 | 585 | |||
585 | static void | 586 | static void | |
586 | handlereq(struct spclient *spc) | 587 | handlereq(struct spclient *spc) | |
587 | { | 588 | { | |
588 | struct rsp_copydata *copydata; | 589 | struct rsp_copydata *copydata; | |
589 | struct rsp_hdr *rhdr = &spc->spc_hdr; | 590 | struct rsp_hdr *rhdr = &spc->spc_hdr; | |
590 | void *mapaddr; | 591 | void *mapaddr; | |
591 | size_t maplen; | 592 | size_t maplen; | |
592 | int reqtype = spc->spc_hdr.rsp_type; | 593 | int reqtype = spc->spc_hdr.rsp_type; | |
594 | int sig; | |||
593 | 595 | |||
594 | switch (reqtype) { | 596 | switch (reqtype) { | |
595 | case RUMPSP_COPYIN: | 597 | case RUMPSP_COPYIN: | |
596 | case RUMPSP_COPYINSTR: | 598 | case RUMPSP_COPYINSTR: | |
597 | /*LINTED*/ | 599 | /*LINTED*/ | |
598 | copydata = (struct rsp_copydata *)spc->spc_buf; | 600 | copydata = (struct rsp_copydata *)spc->spc_buf; | |
599 | DPRINTF(("rump_sp handlereq: copyin request: %p/%zu\n", | 601 | DPRINTF(("rump_sp handlereq: copyin request: %p/%zu\n", | |
600 | copydata->rcp_addr, copydata->rcp_len)); | 602 | copydata->rcp_addr, copydata->rcp_len)); | |
601 | send_copyin_resp(spc, spc->spc_hdr.rsp_reqno, | 603 | send_copyin_resp(spc, spc->spc_hdr.rsp_reqno, | |
602 | copydata->rcp_addr, copydata->rcp_len, | 604 | copydata->rcp_addr, copydata->rcp_len, | |
603 | reqtype == RUMPSP_COPYINSTR); | 605 | reqtype == RUMPSP_COPYINSTR); | |
604 | break; | 606 | break; | |
605 | case RUMPSP_COPYOUT: | 607 | case RUMPSP_COPYOUT: | |
@@ -613,28 +615,29 @@ handlereq(struct spclient *spc) | @@ -613,28 +615,29 @@ handlereq(struct spclient *spc) | |||
613 | copydata->rcp_len); | 615 | copydata->rcp_len); | |
614 | break; | 616 | break; | |
615 | case RUMPSP_ANONMMAP: | 617 | case RUMPSP_ANONMMAP: | |
616 | /*LINTED*/ | 618 | /*LINTED*/ | |
617 | maplen = *(size_t *)spc->spc_buf; | 619 | maplen = *(size_t *)spc->spc_buf; | |
618 | mapaddr = mmap(NULL, maplen, PROT_READ|PROT_WRITE, | 620 | mapaddr = mmap(NULL, maplen, PROT_READ|PROT_WRITE, | |
619 | MAP_ANON, -1, 0); | 621 | MAP_ANON, -1, 0); | |
620 | if (mapaddr == MAP_FAILED) | 622 | if (mapaddr == MAP_FAILED) | |
621 | mapaddr = NULL; | 623 | mapaddr = NULL; | |
622 | DPRINTF(("rump_sp handlereq: anonmmap: %p\n", mapaddr)); | 624 | DPRINTF(("rump_sp handlereq: anonmmap: %p\n", mapaddr)); | |
623 | send_anonmmap_resp(spc, spc->spc_hdr.rsp_reqno, mapaddr); | 625 | send_anonmmap_resp(spc, spc->spc_hdr.rsp_reqno, mapaddr); | |
624 | break; | 626 | break; | |
625 | case RUMPSP_RAISE: | 627 | case RUMPSP_RAISE: | |
626 | DPRINTF(("rump_sp handlereq: raise sig %d\n", rhdr->rsp_signo)); | 628 | sig = rumpuser__sig_rump2host(rhdr->rsp_signo); | |
627 | raise((int)rhdr->rsp_signo); | 629 | DPRINTF(("rump_sp handlereq: raise sig %d\n", sig)); | |
630 | raise(sig); | |||
628 | /* | 631 | /* | |
629 | * We most likely have signals blocked, but the signal | 632 | * We most likely have signals blocked, but the signal | |
630 | * will be handled soon enough when we return. | 633 | * will be handled soon enough when we return. | |
631 | */ | 634 | */ | |
632 | break; | 635 | break; | |
633 | default: | 636 | default: | |
634 | printf("PANIC: INVALID TYPE %d\n", reqtype); | 637 | printf("PANIC: INVALID TYPE %d\n", reqtype); | |
635 | abort(); | 638 | abort(); | |
636 | break; | 639 | break; | |
637 | } | 640 | } | |
638 | 641 | |||
639 | spcfreebuf(spc); | 642 | spcfreebuf(spc); | |
640 | } | 643 | } |
--- src/lib/librumpuser/Makefile 2013/09/10 16:51:24 1.15
+++ src/lib/librumpuser/Makefile 2014/02/20 00:42:27 1.16
@@ -1,35 +1,37 @@ | @@ -1,35 +1,37 @@ | |||
1 | # $NetBSD: Makefile,v 1.15 2013/09/10 16:51:24 pooka Exp $ | 1 | # $NetBSD: Makefile,v 1.16 2014/02/20 00:42:27 pooka Exp $ | |
2 | # | 2 | # | |
3 | 3 | |||
4 | .include <bsd.own.mk> | 4 | .include <bsd.own.mk> | |
5 | 5 | |||
6 | WARNS?= 5 | 6 | WARNS?= 5 | |
7 | 7 | |||
8 | # rumpuser.h is in sys/rump for inclusion by kernel components | 8 | # rumpuser.h is in sys/rump for inclusion by kernel components | |
9 | .PATH: ${.CURDIR}/../../sys/rump/include/rump | 9 | .PATH: ${.CURDIR}/../../sys/rump/include/rump | |
10 | 10 | |||
11 | LIB= rumpuser | 11 | LIB= rumpuser | |
12 | LIBDPLIBS+= pthread ${.CURDIR}/../libpthread | 12 | LIBDPLIBS+= pthread ${.CURDIR}/../libpthread | |
13 | .for lib in ${RUMPUSER_EXTERNAL_DPLIBS} | 13 | .for lib in ${RUMPUSER_EXTERNAL_DPLIBS} | |
14 | LIBDO.${lib}= _external | 14 | LIBDO.${lib}= _external | |
15 | LIBDPLIBS+= ${lib} lib | 15 | LIBDPLIBS+= ${lib} lib | |
16 | .endfor | 16 | .endfor | |
17 | CPPFLAGS+= -DLIBRUMPUSER | 17 | CPPFLAGS+= -DLIBRUMPUSER | |
18 | #CPPFLAGS+= -D_DIAGNOSTIC | 18 | #CPPFLAGS+= -D_DIAGNOSTIC | |
19 | 19 | |||
20 | SRCS= rumpuser.c | 20 | SRCS= rumpuser.c | |
21 | SRCS+= rumpuser_pth.c | 21 | SRCS+= rumpuser_pth.c | |
22 | SRCS+= rumpuser_component.c rumpuser_errtrans.c rumpuser_bio.c | 22 | SRCS+= rumpuser_component.c rumpuser_bio.c | |
23 | ||||
24 | SRCS+= rumpuser_errtrans.c rumpuser_sigtrans.c | |||
23 | 25 | |||
24 | # optional | 26 | # optional | |
25 | SRCS+= rumpuser_dl.c rumpuser_sp.c rumpuser_daemonize.c | 27 | SRCS+= rumpuser_dl.c rumpuser_sp.c rumpuser_daemonize.c | |
26 | 28 | |||
27 | INCSDIR= /usr/include/rump | 29 | INCSDIR= /usr/include/rump | |
28 | INCS= rumpuser.h rumpuser_component.h rumpuser_port.h | 30 | INCS= rumpuser.h rumpuser_component.h rumpuser_port.h | |
29 | 31 | |||
30 | MAN= rumpuser.3 | 32 | MAN= rumpuser.3 | |
31 | 33 | |||
32 | CPPFLAGS+= -D_REENTRANT | 34 | CPPFLAGS+= -D_REENTRANT | |
33 | 35 | |||
34 | 36 | |||
35 | .include <bsd.lib.mk> | 37 | .include <bsd.lib.mk> |
--- src/lib/librumpuser/rumpuser.c 2013/10/27 16:39:46 1.55
+++ src/lib/librumpuser/rumpuser.c 2014/02/20 00:42:27 1.56
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: rumpuser.c,v 1.55 2013/10/27 16:39:46 rmind Exp $ */ | 1 | /* $NetBSD: rumpuser.c,v 1.56 2014/02/20 00:42:27 pooka Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. | 4 | * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
@@ -18,27 +18,27 @@ | @@ -18,27 +18,27 @@ | |||
18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
25 | * SUCH DAMAGE. | 25 | * SUCH DAMAGE. | |
26 | */ | 26 | */ | |
27 | 27 | |||
28 | #include "rumpuser_port.h" | 28 | #include "rumpuser_port.h" | |
29 | 29 | |||
30 | #if !defined(lint) | 30 | #if !defined(lint) | |
31 | __RCSID("$NetBSD: rumpuser.c,v 1.55 2013/10/27 16:39:46 rmind Exp $"); | 31 | __RCSID("$NetBSD: rumpuser.c,v 1.56 2014/02/20 00:42:27 pooka Exp $"); | |
32 | #endif /* !lint */ | 32 | #endif /* !lint */ | |
33 | 33 | |||
34 | #include <sys/ioctl.h> | 34 | #include <sys/ioctl.h> | |
35 | #include <sys/mman.h> | 35 | #include <sys/mman.h> | |
36 | #include <sys/uio.h> | 36 | #include <sys/uio.h> | |
37 | #include <sys/stat.h> | 37 | #include <sys/stat.h> | |
38 | #include <sys/time.h> | 38 | #include <sys/time.h> | |
39 | 39 | |||
40 | #ifdef __NetBSD__ | 40 | #ifdef __NetBSD__ | |
41 | #include <sys/disk.h> | 41 | #include <sys/disk.h> | |
42 | #include <sys/disklabel.h> | 42 | #include <sys/disklabel.h> | |
43 | #include <sys/dkio.h> | 43 | #include <sys/dkio.h> | |
44 | #endif | 44 | #endif | |
@@ -633,46 +633,41 @@ rumpuser_seterrno(int error) | @@ -633,46 +633,41 @@ rumpuser_seterrno(int error) | |||
633 | * This is meant for safe debugging prints from the kernel. | 633 | * This is meant for safe debugging prints from the kernel. | |
634 | */ | 634 | */ | |
635 | void | 635 | void | |
636 | rumpuser_dprintf(const char *format, ...) | 636 | rumpuser_dprintf(const char *format, ...) | |
637 | { | 637 | { | |
638 | va_list ap; | 638 | va_list ap; | |
639 | 639 | |||
640 | va_start(ap, format); | 640 | va_start(ap, format); | |
641 | vfprintf(stderr, format, ap); | 641 | vfprintf(stderr, format, ap); | |
642 | va_end(ap); | 642 | va_end(ap); | |
643 | } | 643 | } | |
644 | 644 | |||
645 | int | 645 | int | |
646 | rumpuser_kill(int64_t pid, int sig) | 646 | rumpuser_kill(int64_t pid, int rumpsig) | |
647 | { | 647 | { | |
648 | int rv; | 648 | int rv, sig; | |
649 | ||||
650 | #ifdef __NetBSD__ | |||
651 | int error; | 649 | int error; | |
652 | 650 | |||
651 | sig = rumpuser__sig_rump2host(rumpsig); | |||
653 | if (pid == RUMPUSER_PID_SELF) { | 652 | if (pid == RUMPUSER_PID_SELF) { | |
654 | error = raise(sig); | 653 | error = raise(sig); | |
655 | } else { | 654 | } else { | |
656 | error = kill((pid_t)pid, sig); | 655 | error = kill((pid_t)pid, sig); | |
657 | } | 656 | } | |
658 | if (error == -1) | 657 | if (error == -1) | |
659 | rv = errno; | 658 | rv = errno; | |
660 | else | 659 | else | |
661 | rv = 0; | 660 | rv = 0; | |
662 | #else | |||
663 | /* XXXfixme: signal numbers may not match on non-NetBSD */ | |||
664 | rv = EOPNOTSUPP; | |||
665 | #endif | |||
666 | 661 | |||
667 | ET(rv); | 662 | ET(rv); | |
668 | } | 663 | } | |
669 | 664 | |||
670 | int | 665 | int | |
671 | rumpuser_getrandom(void *buf, size_t buflen, int flags, size_t *retp) | 666 | rumpuser_getrandom(void *buf, size_t buflen, int flags, size_t *retp) | |
672 | { | 667 | { | |
673 | size_t origlen = buflen; | 668 | size_t origlen = buflen; | |
674 | uint32_t *p = buf; | 669 | uint32_t *p = buf; | |
675 | uint32_t tmp; | 670 | uint32_t tmp; | |
676 | int chunk; | 671 | int chunk; | |
677 | 672 | |||
678 | do { | 673 | do { |
/* $NetBSD: rumpuser_sigtrans.c,v 1.1 2014/02/20 00:42:27 pooka Exp $ */
/*
* pseudo-automatically generated. PLEASE DO EDIT (e.g. in case there
* are errnos which are defined to be the same value)
*
* The body of the switch statement was generated using:
*
* awk '/^#define/ && $2 ~ "^SIG[A-Z]" \
* {printf "#ifdef %s\n\tcase %d\t: return %s;\n#endif\n", $2, $3, $2}' \
* signal.h
*/
#include <signal.h>
/*
* Translate rump kernel signal number to host signal number
*/
int rumpuser__sig_rump2host(int); /* a naughty decouple */
int
rumpuser__sig_rump2host(int rumpsig)
{
switch(rumpsig) {
case 0 : return 0;
#ifdef SIGHUP
case 1 : return SIGHUP;
#endif
#ifdef SIGINT
case 2 : return SIGINT;
#endif
#ifdef SIGQUIT
case 3 : return SIGQUIT;
#endif
#ifdef SIGILL
case 4 : return SIGILL;
#endif
#ifdef SIGTRAP
case 5 : return SIGTRAP;
#endif
#ifdef SIGABRT
case 6 : return SIGABRT;
#endif
#ifdef SIGEMT
case 7 : return SIGEMT;
#endif
#ifdef SIGFPE
case 8 : return SIGFPE;
#endif
#ifdef SIGKILL
case 9 : return SIGKILL;
#endif
#ifdef SIGBUS
case 10 : return SIGBUS;
#endif
#ifdef SIGSEGV
case 11 : return SIGSEGV;
#endif
#ifdef SIGSYS
case 12 : return SIGSYS;
#endif
#ifdef SIGPIPE
case 13 : return SIGPIPE;
#endif
#ifdef SIGALRM
case 14 : return SIGALRM;
#endif
#ifdef SIGTERM
case 15 : return SIGTERM;
#endif
#ifdef SIGURG
case 16 : return SIGURG;
#endif
#ifdef SIGSTOP
case 17 : return SIGSTOP;
#endif
#ifdef SIGTSTP
case 18 : return SIGTSTP;
#endif
#ifdef SIGCONT
case 19 : return SIGCONT;
#endif
#ifdef SIGCHLD
case 20 : return SIGCHLD;
#elif defined(SIGCLD)
case 20 : return SIGCLD;
#endif
#ifdef SIGTTIN
case 21 : return SIGTTIN;
#endif
#ifdef SIGTTOU
case 22 : return SIGTTOU;
#endif
#ifdef SIGIO
case 23 : return SIGIO;
#endif
#ifdef SIGXCPU
case 24 : return SIGXCPU;
#endif
#ifdef SIGXFSZ
case 25 : return SIGXFSZ;
#endif
#ifdef SIGVTALRM
case 26 : return SIGVTALRM;
#endif
#ifdef SIGPROF
case 27 : return SIGPROF;
#endif
#ifdef SIGWINCH
case 28 : return SIGWINCH;
#endif
#ifdef SIGINFO
case 29 : return SIGINFO;
#endif
#ifdef SIGUSR1
case 30 : return SIGUSR1;
#endif
#ifdef SIGUSR2
case 31 : return SIGUSR2;
#endif
#ifdef SIGPWR
case 32 : return SIGPWR;
#endif
default: return -1;
}
}