1/* $NetBSD: linux32_siginfo.h,v 1.2 2021/11/25 03:08:04 ryo Exp $ */ 2 3/*- 4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Eric Haszlakiewicz. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32#ifndef _LINUX32_SIGINFO_H 33#define _LINUX32_SIGINFO_H 34 35#if defined(__aarch64__) 36#include <compat/linux32/arch/aarch64/linux32_siginfo.h> 37#elif defined(__amd64__) 38#include <compat/linux32/arch/amd64/linux32_siginfo.h> 39#else 40#error Undefined linux32_siginfo.h machine type. 41#endif 42 43/* si_code values for non signal */ 44#define LINUX32_SI_USER 0 45#define LINUX32_SI_KERNEL 0x80 46#define LINUX32_SI_QUEUE -1 47#ifndef LINUX32_SI_TIMER /* all except mips */ 48#define LINUX32_SI_TIMER -2 49#define LINUX32_SI_MESGQ -3 50#define LINUX32_SI_ASYNCIO -4 51#endif /* LINUX32_SI_TIMER */ 52#define LINUX32_SI_SIGIO -5 53#define LINUX32_SI_TKILL -6 54#define LINUX32_SI_DETHREAD -7 55 56/* si_code values for SIGILL */ 57#define LINUX32_ILL_ILLOPC 1 58#define LINUX32_ILL_ILLOPN 2 59#define LINUX32_ILL_ILLADR 3 60#define LINUX32_ILL_ILLTRP 4 61#define LINUX32_ILL_PRVOPC 5 62#define LINUX32_ILL_PRVREG 6 63#define LINUX32_ILL_COPROC 7 64#define LINUX32_ILL_BADSTK 8 65 66/* si_code values for SIGFPE */ 67#define LINUX32_FPE_INTDIV 1 68#define LINUX32_FPE_INTOVF 2 69#define LINUX32_FPE_FLTDIV 3 70#define LINUX32_FPE_FLTOVF 4 71#define LINUX32_FPE_FLTUND 5 72#define LINUX32_FPE_FLTRES 6 73#define LINUX32_FPE_FLTINV 7 74#define LINUX32_FPE_FLTSUB 8 75 76/* si_code values for SIGSEGV */ 77#define LINUX32_SEGV_MAPERR 1 78#define LINUX32_SEGV_ACCERR 2 79 80/* si_code values for SIGBUS */ 81#define LINUX32_BUS_ADRALN 1 82#define LINUX32_BUS_ADRERR 2 83#define LINUX32_BUS_OBJERR 3 84 85/* si_code values for SIGTRAP */ 86#define LINUX32_TRAP_BRKPT 1 87#define LINUX32_TRAP_TRACE 2 88 89/* si_code values for SIGCHLD */ 90#define LINUX32_CLD_EXITED 1 91#define LINUX32_CLD_KILLED 2 92#define LINUX32_CLD_DUMPED 3 93#define LINUX32_CLD_TRAPPED 4 94#define LINUX32_CLD_STOPPED 5 95#define LINUX32_CLD_CONTINUED 6 96 97/* si_code values for SIGPOLL */ 98#define LINUX32_POLL_IN 1 99#define LINUX32_POLL_OUT 2 100#define LINUX32_POLL_MSG 3 101#define LINUX32_POLL_ERR 4 102#define LINUX32_POLL_PRI 5 103#define LINUX32_POLL_HUP 6 104 105#define LINUX32_SI_FROMUSER(sp) ((sp)->si_code <= 0) 106#define LINUX32_SI_FROMKERNEL(sp) ((sp)->si_code > 0) 107 108#define lsi_pid _sidata._kill._pid 109#define lsi_uid _sidata._kill._uid 110#define lsi_status _sidata._sigchld._status 111#define lsi_utime _sidata._sigchld._utime 112#define lsi_stime _sidata._sigchld._stime 113#define lsi_value _sidata._rt._sigval 114#define lsi_sival_int _sidata._rt._sigval.sival_int 115#define lsi_sival_ptr _sidata._rt._sigval.sival_ptr 116#define lsi_addr _sidata._sigfault._addr 117#define lsi_band _sidata._sigpoll._band 118#define lsi_fd _sidata._sigpoll._fd 119 120void native_to_linux32_siginfo(linux32_siginfo_t *, const struct _ksiginfo *); 121 122#endif /* !_LINUX32_SIGINFO_H */ 123