Back to index

glibc  2.9
siginfo.h
Go to the documentation of this file.
00001 /* siginfo_t, sigevent and constants.  Stub version.
00002    Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #if !defined _SIGNAL_H && !defined __need_siginfo_t \
00021     && !defined __need_sigevent_t
00022 # error "Never include this file directly.  Use <signal.h> instead"
00023 #endif
00024 
00025 #if (!defined __have_sigval_t \
00026      && (defined _SIGNAL_H || defined __need_siginfo_t \
00027         || defined __need_sigevent_t))
00028 # define __have_sigval_t 1
00029 
00030 /* Type for data associated with a signal.  */
00031 typedef union sigval
00032   {
00033     int sival_int;
00034     void *sival_ptr;
00035   } sigval_t;
00036 #endif
00037 
00038 #if (!defined __have_siginfo_t \
00039      && (defined _SIGNAL_H || defined __need_siginfo_t))
00040 # define __have_siginfo_t   1
00041 
00042 typedef struct siginfo
00043   {
00044     int si_signo;           /* Signal number.  */
00045     int si_errno;           /* If non-zero, an errno value associated with
00046                                this signal, as defined in <errno.h>.  */
00047     int si_code;            /* Signal code.  */
00048     __pid_t si_pid;         /* Sending process ID.  */
00049     __uid_t si_uid;         /* Real user ID of sending process.  */
00050     void *si_addr;          /* Address of faulting instruction.  */
00051     int si_status;          /* Exit value or signal.  */
00052     long int si_band;              /* Band event for SIGPOLL.  */
00053     union sigval si_value;  /* Signal value.  */
00054   } siginfo_t;
00055 
00056 
00057 /* Values for `si_code'.  Positive values are reserved for kernel-generated
00058    signals.  */
00059 enum
00060 {
00061   SI_ASYNCIO = -4,          /* Sent by AIO completion.  */
00062 # define SI_ASYNCIO  SI_ASYNCIO
00063   SI_MESGQ,                 /* Sent by real time mesq state change.  */
00064 # define SI_MESGQ    SI_MESGQ
00065   SI_TIMER,                 /* Sent by timer expiration.  */
00066 # define SI_TIMER    SI_TIMER
00067   SI_QUEUE,                 /* Sent by sigqueue.  */
00068 # define SI_QUEUE    SI_QUEUE
00069   SI_USER                   /* Sent by kill, sigsend, raise.  */
00070 # define SI_USER     SI_USER
00071 };
00072 
00073 
00074 /* `si_code' values for SIGILL signal.  */
00075 enum
00076 {
00077   ILL_ILLOPC = 1,           /* Illegal opcode.  */
00078 # define ILL_ILLOPC  ILL_ILLOPC
00079   ILL_ILLOPN,               /* Illegal operand.  */
00080 # define ILL_ILLOPN  ILL_ILLOPN
00081   ILL_ILLADR,               /* Illegal addressing mode.  */
00082 # define ILL_ILLADR  ILL_ILLADR
00083   ILL_ILLTRP,               /* Illegal trap. */
00084 # define ILL_ILLTRP  ILL_ILLTRP
00085   ILL_PRVOPC,               /* Privileged opcode.  */
00086 # define ILL_PRVOPC  ILL_PRVOPC
00087   ILL_PRVREG,               /* Privileged register.  */
00088 # define ILL_PRVREG  ILL_PRVREG
00089   ILL_COPROC,               /* Coprocessor error.  */
00090 # define ILL_COPROC  ILL_COPROC
00091   ILL_BADSTK                /* Internal stack error.  */
00092 # define ILL_BADSTK  ILL_BADSTK
00093 };
00094 
00095 /* `si_code' values for SIGFPE signal.  */
00096 enum
00097 {
00098   FPE_INTDIV = 1,           /* Integer divide by zero.  */
00099 # define FPE_INTDIV  FPE_INTDIV
00100   FPE_INTOVF,               /* Integer overflow.  */
00101 # define FPE_INTOVF  FPE_INTOVF
00102   FPE_FLTDIV,               /* Floating point divide by zero.  */
00103 # define FPE_FLTDIV  FPE_FLTDIV
00104   FPE_FLTOVF,               /* Floating point overflow.  */
00105 # define FPE_FLTOVF  FPE_FLTOVF
00106   FPE_FLTUND,               /* Floating point underflow.  */
00107 # define FPE_FLTUND  FPE_FLTUND
00108   FPE_FLTRES,               /* Floating point inexact result.  */
00109 # define FPE_FLTRES  FPE_FLTRES
00110   FPE_FLTINV,               /* Floating point invalid operation.  */
00111 # define FPE_FLTINV  FPE_FLTINV
00112   FPE_FLTSUB                /* Subscript out of range.  */
00113 # define FPE_FLTSUB  FPE_FLTSUB
00114 };
00115 
00116 /* `si_code' values for SIGSEGV signal.  */
00117 enum
00118 {
00119   SEGV_MAPERR = 1,          /* Address not mapped to object.  */
00120 # define SEGV_MAPERR SEGV_MAPERR
00121   SEGV_ACCERR               /* Invalid permissions for mapped object.  */
00122 # define SEGV_ACCERR SEGV_ACCERR
00123 };
00124 
00125 /* `si_code' values for SIGBUS signal.  */
00126 enum
00127 {
00128   BUS_ADRALN = 1,           /* Invalid address alignment.  */
00129 # define BUS_ADRALN  BUS_ADRALN
00130   BUS_ADRERR,               /* Non-existant physical address.  */
00131 # define BUS_ADRERR  BUS_ADRERR
00132   BUS_OBJERR                /* Object specific hardware error.  */
00133 # define BUS_OBJERR  BUS_OBJERR
00134 };
00135 
00136 /* `si_code' values for SIGTRAP signal.  */
00137 enum
00138 {
00139   TRAP_BRKPT = 1,           /* Process breakpoint.  */
00140 # define TRAP_BRKPT  TRAP_BRKPT
00141   TRAP_TRACE                /* Process trace trap.  */
00142 # define TRAP_TRACE  TRAP_TRACE
00143 };
00144 
00145 /* `si_code' values for SIGCHLD signal.  */
00146 enum
00147 {
00148   CLD_EXITED = 1,           /* Child has exited.  */
00149 # define CLD_EXITED  CLD_EXITED
00150   CLD_KILLED,               /* Child was killed.  */
00151 # define CLD_KILLED  CLD_KILLED
00152   CLD_DUMPED,               /* Child terminated abnormally.  */
00153 # define CLD_DUMPED  CLD_DUMPED
00154   CLD_TRAPPED,                     /* Traced child has trapped.  */
00155 # define CLD_TRAPPED CLD_TRAPPED
00156   CLD_STOPPED,                     /* Child has stopped.  */
00157 # define CLD_STOPPED CLD_STOPPED
00158   CLD_CONTINUED                    /* Stopped child has continued.  */
00159 # define CLD_CONTINUED      CLD_CONTINUED
00160 };
00161 
00162 /* `si_code' values for SIGPOLL signal.  */
00163 enum
00164 {
00165   POLL_IN = 1,                     /* Data input available.  */
00166 # define POLL_IN     POLL_IN
00167   POLL_OUT,                 /* Output buffers available.  */
00168 # define POLL_OUT    POLL_OUT
00169   POLL_MSG,                 /* Input message available.   */
00170 # define POLL_MSG    POLL_MSG
00171   POLL_ERR,                 /* I/O error.  */
00172 # define POLL_ERR    POLL_ERR
00173   POLL_PRI,                 /* High priority input available.  */
00174 # define POLL_PRI    POLL_PRI
00175   POLL_HUP                  /* Device disconnected.  */
00176 # define POLL_HUP    POLL_HUP
00177 };
00178 
00179 # undef __need_siginfo_t
00180 #endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t).  */
00181 
00182 
00183 #if (defined _SIGNAL_H || defined __need_sigevent_t) \
00184     && !defined __have_sigevent_t
00185 # define __have_sigevent_t  1
00186 
00187 /* Structure to transport application-defined values with signals.  */
00188 # define SIGEV_MAX_SIZE     64
00189 # define SIGEV_PAD_SIZE     ((SIGEV_MAX_SIZE / sizeof (int)) - 3)
00190 
00191 typedef struct sigevent
00192   {
00193     sigval_t sigev_value;
00194     int sigev_signo;
00195     int sigev_notify;
00196     void (*sigev_notify_function) (sigval_t);        /* Function to start.  */
00197     void *sigev_notify_attributes;            /* Really pthread_attr_t.*/
00198   } sigevent_t;
00199 
00200 /* `sigev_notify' values.  */
00201 enum
00202 {
00203   SIGEV_SIGNAL = 0,         /* Notify via signal.  */
00204 # define SIGEV_SIGNAL       SIGEV_SIGNAL
00205   SIGEV_NONE,               /* Other notification: meaningless.  */
00206 # define SIGEV_NONE  SIGEV_NONE
00207   SIGEV_THREAD                     /* Deliver via thread creation.  */
00208 # define SIGEV_THREAD       SIGEV_THREAD
00209 };
00210 
00211 #endif /* have _SIGNAL_H.  */