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.14 2005/12/11 12:25:21 christos 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 #include <machine/signal.h>     /* XXX: __HAVE_SIGINFO */
   43 #ifdef _KERNEL
   44 #include <sys/queue.h>
   45 #endif
   46 
   47 typedef union sigval {
   48         int     sival_int;
   49         void    *sival_ptr;
   50 } sigval_t;
   51 
   52 struct _ksiginfo {
   53         int     _signo;
   54         int     _code;
   55         int     _errno;
   56 #ifdef _LP64
   57         /* In _LP64 the union starts on an 8-byte boundary. */
   58         int     _pad;
   59 #endif
   60         union {
   61                 struct {
   62                         pid_t   _pid;
   63                         uid_t   _uid;
   64                         sigval_t        _sigval;
   65                 } _rt;
   66 
   67                 struct {
   68                         pid_t   _pid;
   69                         uid_t   _uid;
   70                         int     _status;
   71                         clock_t _utime;
   72                         clock_t _stime;
   73                 } _child;
   74 
   75                 struct {
   76                         void   *_addr;
   77                         int     _trap;
   78                 } _fault;
   79 
   80                 struct {
   81                         long    _band;
   82                         int     _fd;
   83                 } _poll;
   84         } _reason;
   85 };
   86 
   87 #ifdef _KERNEL
   88 typedef struct ksiginfo {
   89         u_long          ksi_flags;      /* 4 or 8 bytes, depending on LP64 */
   90         CIRCLEQ_ENTRY(ksiginfo) ksi_list;
   91         struct _ksiginfo ksi_info;
   92 } ksiginfo_t;
   93 
   94 #define KSI_TRAP        0x01    /* signal caused by trap */
   95 #define KSI_EMPTY       0x02    /* no additional information */
   96 
   97 /* Macros to initialize a ksiginfo_t. */
   98 #define KSI_INIT(ksi)                                                   \
   99 do {                                                                    \
  100         memset((ksi), 0, sizeof(*(ksi)));                               \
  101 } while (/*CONSTCOND*/0)
  102 
  103 #define KSI_INIT_EMPTY(ksi)                                             \
  104 do {                                                                    \
  105         KSI_INIT((ksi));                                                \
  106         (ksi)->ksi_flags = KSI_EMPTY;                                   \
  107 } while (/*CONSTCOND*/0)
  108 
  109 #define KSI_INIT_TRAP(ksi)                                              \
  110 do {                                                                    \
  111         KSI_INIT((ksi));                                                \
  112         (ksi)->ksi_flags = KSI_TRAP;                                    \
  113 } while (/*CONSTCOND*/0)
  114 
  115 /* Copy the part of ksiginfo_t without the queue pointers */
  116 #define KSI_COPY(fksi, tksi)                                            \
  117 do {                                                                    \
  118         (tksi)->ksi_info = (fksi)->ksi_info;                            \
  119         (tksi)->ksi_flags = (fksi)->ksi_flags;                          \
  120 } while (/*CONSTCOND*/0)
  121 
  122 
  123 /* Predicate macros to test how a ksiginfo_t was generated. */
  124 #define KSI_TRAP_P(ksi)         (((ksi)->ksi_flags & KSI_TRAP) != 0)
  125 #define KSI_EMPTY_P(ksi)        (((ksi)->ksi_flags & KSI_EMPTY) != 0)
  126 
  127 /*
  128  * Old-style signal handler "code" arguments were only non-zero for
  129  * signals caused by traps.
  130  */
  131 #define KSI_TRAPCODE(ksi)       (KSI_TRAP_P(ksi) ? (ksi)->ksi_trap : 0)
  132 #endif /* _KERNEL */
  133 
  134 typedef union siginfo {
  135         char    si_pad[128];    /* Total size; for future expansion */
  136         struct _ksiginfo _info;
  137 } siginfo_t;
  138 
  139 /** Field access macros */
  140 #define si_signo        _info._signo
  141 #define si_code         _info._code
  142 #define si_errno        _info._errno
  143 
  144 #define si_sigval       _info._reason._rt._sigval
  145 #define si_pid          _info._reason._child._pid
  146 #define si_uid          _info._reason._child._uid
  147 #define si_status       _info._reason._child._status
  148 #define si_utime        _info._reason._child._utime
  149 #define si_stime        _info._reason._child._stime
  150 
  151 #define si_addr         _info._reason._fault._addr
  152 #define si_trap         _info._reason._fault._trap
  153 
  154 #define si_band         _info._reason._poll._band
  155 #define si_fd           _info._reason._poll._fd
  156 
  157 #ifdef _KERNEL
  158 /** Field access macros */
  159 #define ksi_signo       ksi_info._signo
  160 #define ksi_code        ksi_info._code
  161 #define ksi_errno       ksi_info._errno
  162 
  163 #define ksi_sigval      ksi_info._reason._rt._sigval
  164 #define ksi_pid         ksi_info._reason._child._pid
  165 #define ksi_uid         ksi_info._reason._child._uid
  166 #define ksi_status      ksi_info._reason._child._status
  167 #define ksi_utime       ksi_info._reason._child._utime
  168 #define ksi_stime       ksi_info._reason._child._stime
  169 
  170 #define ksi_addr        ksi_info._reason._fault._addr
  171 #define ksi_trap        ksi_info._reason._fault._trap
  172 
  173 #define ksi_band        ksi_info._reason._poll._band
  174 #define ksi_fd          ksi_info._reason._poll._fd
  175 #endif /* _KERNEL */
  176 
  177 /** si_code */
  178 /* SIGILL */
  179 #define ILL_ILLOPC      1       /* Illegal opcode                       */
  180 #define ILL_ILLOPN      2       /* Illegal operand                      */
  181 #define ILL_ILLADR      3       /* Illegal addressing mode              */
  182 #define ILL_ILLTRP      4       /* Illegal trap                         */
  183 #define ILL_PRVOPC      5       /* Privileged opcode                    */
  184 #define ILL_PRVREG      6       /* Privileged register                  */
  185 #define ILL_COPROC      7       /* Coprocessor error                    */
  186 #define ILL_BADSTK      8       /* Internal stack error                 */
  187 
  188 /* SIGFPE */
  189 #define FPE_INTDIV      1       /* Integer divide by zero               */
  190 #define FPE_INTOVF      2       /* Integer overflow                     */
  191 #define FPE_FLTDIV      3       /* Floating point divide by zero        */
  192 #define FPE_FLTOVF      4       /* Floating point overflow              */
  193 #define FPE_FLTUND      5       /* Floating point underflow             */
  194 #define FPE_FLTRES      6       /* Floating point inexact result        */
  195 #define FPE_FLTINV      7       /* Invalid Floating point operation     */
  196 #define FPE_FLTSUB      8       /* Subscript out of range               */
  197 
  198 /* SIGSEGV */
  199 #define SEGV_MAPERR     1       /* Address not mapped to object         */
  200 #define SEGV_ACCERR     2       /* Invalid permissions for mapped object*/
  201 
  202 /* SIGBUS */
  203 #define BUS_ADRALN      1       /* Invalid address alignment            */
  204 #define BUS_ADRERR      2       /* Non-existent physical address        */
  205 #define BUS_OBJERR      3       /* Object specific hardware error       */
  206 
  207 /* SIGTRAP */
  208 #define TRAP_BRKPT      1       /* Process breakpoint                   */
  209 #define TRAP_TRACE      2       /* Process trace trap                   */
  210 
  211 /* SIGCHLD */
  212 #define CLD_EXITED      1       /* Child has exited                     */
  213 #define CLD_KILLED      2       /* Child has terminated abnormally but  */
  214                                 /* did not create a core file           */
  215 #define CLD_DUMPED      3       /* Child has terminated abnormally and  */
  216                                 /* created a core file                  */
  217 #define CLD_TRAPPED     4       /* Traced child has trapped             */
  218 #define CLD_STOPPED     5       /* Child has stopped                    */
  219 #define CLD_CONTINUED   6       /* Stopped child has continued          */
  220 
  221 /* SIGPOLL */
  222 #define POLL_IN         1       /* Data input available                 */
  223 #define POLL_OUT        2       /* Output buffers available             */
  224 #define POLL_MSG        3       /* Input message available              */
  225 #define POLL_ERR        4       /* I/O Error                            */
  226 #define POLL_PRI        5       /* High priority input available        */
  227 #define POLL_HUP        4       /* Device disconnected                  */
  228 
  229 
  230 /** si_code */
  231 #define SI_NOINFO       32767   /* No signal specific info available    */
  232 #define SI_USER         0       /* Sent by kill(2)                      */
  233 #define SI_QUEUE        -1      /* Sent by the sigqueue(2)              */
  234 #define SI_TIMER        -2      /* Generated by expiration of a timer   */
  235                                 /* set by timer_settime(2)              */
  236 #define SI_ASYNCIO      -3      /* Generated by completion of an        */
  237                                 /* asynchronous I/O signal              */
  238 #define SI_MESGQ        -4      /* Generated by arrival of a message on */
  239                                 /* an empty message queue               */
  240 
  241 #endif /* !_SYS_SIGINFO_H_ */

Cache object: 481740f13a419c0f7bc23f6e27d7300e


[ 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.