151705ff7SMarcel Moolenaar /*- 251705ff7SMarcel Moolenaar * Copyright (c) 2000 Marcel Moolenaar 351705ff7SMarcel Moolenaar * All rights reserved. 451705ff7SMarcel Moolenaar * 551705ff7SMarcel Moolenaar * Redistribution and use in source and binary forms, with or without 651705ff7SMarcel Moolenaar * modification, are permitted provided that the following conditions 751705ff7SMarcel Moolenaar * are met: 851705ff7SMarcel Moolenaar * 1. Redistributions of source code must retain the above copyright 951705ff7SMarcel Moolenaar * notice, this list of conditions and the following disclaimer 1051705ff7SMarcel Moolenaar * in this position and unchanged. 1151705ff7SMarcel Moolenaar * 2. Redistributions in binary form must reproduce the above copyright 1251705ff7SMarcel Moolenaar * notice, this list of conditions and the following disclaimer in the 1351705ff7SMarcel Moolenaar * documentation and/or other materials provided with the distribution. 1451705ff7SMarcel Moolenaar * 3. The name of the author may not be used to endorse or promote products 15bc34729cSMarcel Moolenaar * derived from this software without specific prior written permission. 1651705ff7SMarcel Moolenaar * 1751705ff7SMarcel Moolenaar * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1851705ff7SMarcel Moolenaar * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1951705ff7SMarcel Moolenaar * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2051705ff7SMarcel Moolenaar * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2151705ff7SMarcel Moolenaar * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2251705ff7SMarcel Moolenaar * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2351705ff7SMarcel Moolenaar * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2451705ff7SMarcel Moolenaar * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2551705ff7SMarcel Moolenaar * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2651705ff7SMarcel Moolenaar * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2751705ff7SMarcel Moolenaar * 2851705ff7SMarcel Moolenaar * $FreeBSD$ 2951705ff7SMarcel Moolenaar */ 3051705ff7SMarcel Moolenaar 3151705ff7SMarcel Moolenaar #ifndef _LINUX_SIGNAL_H_ 3251705ff7SMarcel Moolenaar #define _LINUX_SIGNAL_H_ 3351705ff7SMarcel Moolenaar 34*fe4ed1e7SDmitry Chagin /* 35*fe4ed1e7SDmitry Chagin * si_code values 36*fe4ed1e7SDmitry Chagin */ 37*fe4ed1e7SDmitry Chagin #define LINUX_SI_USER 0 /* sent by kill, sigsend, raise */ 38*fe4ed1e7SDmitry Chagin #define LINUX_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 39*fe4ed1e7SDmitry Chagin #define LINUX_SI_QUEUE -1 /* sent by sigqueue */ 40*fe4ed1e7SDmitry Chagin #define LINUX_SI_TIMER -2 /* sent by timer expiration */ 41*fe4ed1e7SDmitry Chagin #define LINUX_SI_MESGQ -3 /* sent by real time mesq state change */ 42*fe4ed1e7SDmitry Chagin #define LINUX_SI_ASYNCIO -4 /* sent by AIO completion */ 43*fe4ed1e7SDmitry Chagin #define LINUX_SI_SIGIO -5 /* sent by queued SIGIO */ 44*fe4ed1e7SDmitry Chagin #define LINUX_SI_TKILL -6 /* sent by tkill system call */ 45aa8b2011SKonstantin Belousov 46d825ce0aSJohn Baldwin extern int bsd_to_linux_signal[]; 47d825ce0aSJohn Baldwin extern int linux_to_bsd_signal[]; 48d825ce0aSJohn Baldwin 49b63dc6adSAlfred Perlstein void linux_to_bsd_sigset(l_sigset_t *, sigset_t *); 50b63dc6adSAlfred Perlstein void bsd_to_linux_sigset(sigset_t *, l_sigset_t *); 51b63dc6adSAlfred Perlstein int linux_do_sigaction(struct thread *, int, l_sigaction_t *, l_sigaction_t *); 52*fe4ed1e7SDmitry Chagin void ksiginfo_to_lsiginfo(const ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig); 53*fe4ed1e7SDmitry Chagin void siginfo_to_lsiginfo(const siginfo_t *si, l_siginfo_t *lsi, l_int sig); 5451705ff7SMarcel Moolenaar 55687c23beSAlexander Leidinger #define LINUX_SIG_VALID(sig) ((sig) <= LINUX_NSIG && (sig) > 0) 56687c23beSAlexander Leidinger 57d207e753SDmitry Chagin #define BSD_TO_LINUX_SIGNAL(sig) \ 58d207e753SDmitry Chagin (((sig) <= LINUX_SIGTBLSZ) ? bsd_to_linux_signal[_SIG_IDX(sig)] : sig) 59d207e753SDmitry Chagin 6051705ff7SMarcel Moolenaar #endif /* _LINUX_SIGNAL_H_ */ 61