The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/siginfo.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: siginfo.h,v 1.11.2.1 2004/04/05 20:37:56 tron Exp $     */
    2 
    3 /*-
    4  * Copyright (c) 2002 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Christos Zoulas.
    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  * 3. All advertising materials mentioning features or use of this software
   19  *    must display the following acknowledgement:
   20  *        This product includes software developed by the NetBSD
   21  *        Foundation, Inc. and its contributors.
   22  * 4. Neither the name of The NetBSD Foundation nor the names of its
   23  *    contributors may be used to endorse or promote products derived
   24  *    from this software without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   36  * POSSIBILITY OF SUCH DAMAGE.
   37  */
   38 
   39 #ifndef _SYS_SIGINFO_H_
   40 #define _SYS_SIGINFO_H_
   41 
   42 #if defined(_KERNEL_OPT)
   43 #include "opt_compat_netbsd32.h"
   44 #endif
   45 
   46 #include <machine/signal.h>     /* XXX: __HAVE_SIGINFO */
   47 #ifdef _KERNEL
   48 #include <sys/queue.h>
   49 #endif
   50 
   51 typedef union sigval {
   52         int     sival_int;
   53         void    *sival_ptr;
   54 } sigval_t;
   55 
   56 struct _ksiginfo {
   57         int     _signo;
   58         int     _code;
   59         int     _errno;
   60 #ifdef _LP64
   61         /* In _LP64 the union starts on an 8-byte boundary. */
   62         int     _pad;
   63 #endif
   64         union {
   65                 struct {
   66                         pid_t   _pid;
   67                         uid_t   _uid;
   68                         sigval_t        _sigval;
   69                 } _rt;
   70 
   71                 struct {
   72                         pid_t   _pid;
   73                         uid_t   _uid;
   74                         int     _status;
   75                         clock_t _utime;
   76                         clock_t _stime;
   77                 } _child;
   78 
   79                 struct {
   80                         void   *_addr;
   81                         int     _trap;
   82                 } _fault;
   83 
   84                 struct {
   85                         long    _band;
   86                         int     _fd;
   87                 } _poll;
   88         } _reason;
   89 };
   90 
   91 #ifdef _KERNEL
   92 typedef struct ksiginfo {
   93         u_long          ksi_flags;      /* 4 or 8 bytes, depending on LP64 */
   94         CIRCLEQ_ENTRY(ksiginfo) ksi_list;
   95         struct _ksiginfo ksi_info;
   96 } ksiginfo_t;
   97 
   98 #define KSI_TRAP        0x01    /* signal caused by trap */
   99 #define KSI_EMPTY       0x02    /* no additional information */
  100 
  101 /* Macros to initialize a ksiginfo_t. */
  102 #define KSI_INIT(ksi)                                                   \
  103 do {                                                                    \
  104         memset((ksi), 0, sizeof(*(ksi)));                               \
  105 } while (/*CONSTCOND*/0)
  106 
  107 #define KSI_INIT_EMPTY(ksi)                                             \
  108 do {                                                                    \
  109         KSI_INIT((ksi));                                                \
  110         (ksi)->ksi_flags = KSI_EMPTY;                                   \
  111 } while (/*CONSTCOND*/0)
  112 
  113 #define KSI_INIT_TRAP(ksi)                                              \
  114 do {                                                                    \
  115         KSI_INIT((ksi));                                                \
  116         (ksi)->ksi_flags = KSI_TRAP;                                    \
  117 } while (/*CONSTCOND*/0)
  118 
  119 /* Copy the part of ksiginfo_t without the queue pointers */
  120 #define KSI_COPY(fksi, tksi)                                            \
  121 do {                                                                    \
  122         (tksi)->ksi_info = (fksi)->ksi_info;                            \
  123         (tksi)->ksi_flags = (fksi)->ksi_flags;                          \
  124 } while (/*CONSTCOND*/0)
  125 
  126 
  127 /* Predicate macros to test how a ksiginfo_t was generated. */
  128 #define KSI_TRAP_P(ksi)         (((ksi)->ksi_flags & KSI_TRAP) != 0)
  129 #define KSI_EMPTY_P(ksi)        (((ksi)->ksi_flags & KSI_EMPTY) != 0)
  130 
  131 /*
  132  * Old-style signal handler "code" arguments were only non-zero for
  133  * signals caused by traps.
  134  */
  135 #define KSI_TRAPCODE(ksi)       (KSI_TRAP_P(ksi) ? (ksi)->ksi_trap : 0)
  136 #endif /* _KERNEL */
  137 
  138 typedef union siginfo {
  139         char    si_pad[128];    /* Total size; for future expansion */
  140         struct _ksiginfo _info;
  141 } siginfo_t;
  142 
  143 /** Field access macros */
  144 #define si_signo        _info._signo
  145 #define si_code         _info._code
  146 #define si_errno        _info._errno
  147 
  148 #define si_sigval       _info._reason._rt._sigval
  149 #define si_pid          _info._reason._child._pid
  150 #define si_uid          _info._reason._child._uid
  151 #define si_status       _info._reason._child._status
  152 #define si_utime        _info._reason._child._utime
  153 #define si_stime        _info._reason._child._stime
  154 
  155 #define si_addr         _info._reason._fault._addr
  156 #define si_trap         _info._reason._fault._trap
  157 
  158 #define si_band         _info._reason._poll._band
  159 #define si_fd           _info._reason._poll._fd
  160 
  161 #ifdef _KERNEL
  162 /** Field access macros */
  163 #define ksi_signo       ksi_info._signo
  164 #define ksi_code        ksi_info._code
  165 #define ksi_errno       ksi_info._errno
  166 
  167 #define ksi_sigval      ksi_info._reason._rt._sigval
  168 #define ksi_pid         ksi_info._reason._child._pid
  169 #define ksi_uid         ksi_info._reason._child._uid
  170 #define ksi_status      ksi_info._reason._child._status
  171 #define ksi_utime       ksi_info._reason._child._utime
  172 #define ksi_stime       ksi_info._reason._child._stime
  173 
  174 #define ksi_addr        ksi_info._reason._fault._addr
  175 #define ksi_trap        ksi_info._reason._fault._trap
  176 
  177 #define ksi_band        ksi_info._reason._poll._band
  178 #define ksi_fd          ksi_info._reason._poll._fd
  179 #endif /* _KERNEL */
  180 
  181 /** si_code */
  182 /* SIGILL */
  183 #define ILL_ILLOPC      1       /* Illegal opcode                       */
  184 #define ILL_ILLOPN      2       /* Illegal operand                      */
  185 #define ILL_ILLADR      3       /* Illegal addressing mode              */
  186 #define ILL_ILLTRP      4       /* Illegal trap                         */
  187 #define ILL_PRVOPC      5       /* Privileged opcode                    */
  188 #define ILL_PRVREG      6       /* Privileged register                  */
  189 #define ILL_COPROC      7       /* Coprocessor error                    */
  190 #define ILL_BADSTK      8       /* Internal stack error                 */
  191 
  192 /* SIGFPE */
  193 #define FPE_INTDIV      1       /* Integer divide by zero               */
  194 #define FPE_INTOVF      2       /* Integer overflow                     */
  195 #define FPE_FLTDIV      3       /* Floating point divide by zero        */
  196 #define FPE_FLTOVF      4       /* Floating point overflow              */
  197 #define FPE_FLTUND      5       /* Floating point underflow             */
  198 #define FPE_FLTRES      6       /* Floating point inexact result        */
  199 #define FPE_FLTINV      7       /* Invalid Floating point operation     */
  200 #define FPE_FLTSUB      8       /* Subscript out of range               */
  201 
  202 /* SIGSEGV */
  203 #define SEGV_MAPERR     1       /* Address not mapped to object         */
  204 #define SEGV_ACCERR     2       /* Invalid permissions for mapped object*/
  205 
  206 /* SIGBUS */
  207 #define BUS_ADRALN      1       /* Invalid address alignment            */
  208 #define BUS_ADRERR      2       /* Non-existent physical address        */
  209 #define BUS_OBJERR      3       /* Object specific hardware error       */
  210 
  211 /* SIGTRAP */
  212 #define TRAP_BRKPT      1       /* Process breakpoint                   */
  213 #define TRAP_TRACE      2       /* Process trace trap                   */
  214 
  215 /* SIGCHLD */
  216 #define CLD_EXITED      1       /* Child has exited                     */
  217 #define CLD_KILLED      2       /* Child has terminated abnormally but  */
  218                                 /* did not create a core file           */
  219 #define CLD_DUMPED      3       /* Child has terminated abnormally and  */
  220                                 /* created a core file                  */
  221 #define CLD_TRAPPED     4       /* Traced child has trapped             */
  222 #define CLD_STOPPED     5       /* Child has stopped                    */
  223 #define CLD_CONTINUED   6       /* Stopped child has continued          */
  224 
  225 /* SIGPOLL */
  226 #define POLL_IN         1       /* Data input available                 */
  227 #define POLL_OUT        2       /* Output buffers available             */
  228 #define POLL_MSG        3       /* Input message available              */
  229 #define POLL_ERR        4       /* I/O Error                            */
  230 #define POLL_PRI        5       /* High priority input available        */
  231 #define POLL_HUP        4       /* Device disconnected                  */
  232 
  233 
  234 /** si_code */
  235 #define SI_NOINFO       32767   /* No signal specific info available    */
  236 #define SI_USER         0       /* Sent by kill(2)                      */
  237 #define SI_QUEUE        -1      /* Sent by the sigqueue(2)              */
  238 #define SI_TIMER        -2      /* Generated by expiration of a timer   */
  239                                 /* set by timer_settime(2)              */
  240 #define SI_ASYNCIO      -3      /* Generated by completion of an        */
  241                                 /* asynchronous I/O signal              */
  242 #define SI_MESGQ        -4      /* Generated by arrival of a message on */
  243                                 /* an empty message queue               */
  244 
  245 #if defined(COMPAT_NETBSD32) && defined(_KERNEL)
  246 
  247 typedef union sigval32 {
  248         int sival_int;
  249         uint32_t sival_ptr;
  250 } sigval32_t;
  251 
  252 struct __ksiginfo32 {
  253         int     _signo;
  254         int     _code;
  255         int     _errno;
  256 
  257         union {
  258                 struct {
  259                         pid_t _pid;
  260                         uid_t _uid;
  261                         sigval32_t _sigval;
  262                 } _rt;
  263 
  264                 struct {
  265                         pid_t _pid;
  266                         uid_t _uid;
  267                         int _status;
  268                         clock_t _utime;
  269                         clock_t _stime;
  270                 } _child;
  271 
  272                 struct {
  273                         uint32_t _addr;
  274                         int _trap;
  275                 } _fault;
  276 
  277                 struct {
  278                         int32_t _band;
  279                         int _fd;
  280                 } _poll;
  281         } _reason;
  282 };
  283 
  284 typedef union siginfo32 {
  285         char    si_pad[128];
  286         struct __ksiginfo32 _info;
  287 } siginfo32_t;
  288 
  289 #endif /* COMPAT_NETBSD32 && _KERNEL */
  290 
  291 #endif /* !_SYS_SIGINFO_H_ */

Cache object: e9a3b0a86190f0dc0f97a27f90c71037


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.