netlib.narod.ru< Назад | Оглавление | Далее >

include/asm-i386/siginfo.h

11835 #ifndef _I386_SIGINFO_H
11836 #define _I386_SIGINFO_H
11837 
11838 #include <linux/types.h>
11839 
11840 /* XXX: This structure was copied from the Alpha; is
11841  * there an iBCS version?  */
11842 
11843 typedef union sigval {
11844   int sival_int;
11845   void *sival_ptr;
11846 } sigval_t;
11847 
11848 #define SI_MAX_SIZE     128
11849 #define SI_PAD_SIZE     ((SI_MAX_SIZE/sizeof(int)) - 3)
11850 
 Комментарий
11851 typedef struct siginfo {
11852   int si_signo;
11853   int si_errno;
11854   int si_code;
11855 
11856   union {
11857     int _pad[SI_PAD_SIZE];
11858 
11859     /* kill() */
11860     struct {
11861       pid_t _pid;             /* sender's pid */
11862       uid_t _uid;             /* sender's uid */
11863     } _kill;
11864 
11865     /* POSIX.1b timers */
11866     struct {
11867       unsigned int _timer1;
11868       unsigned int _timer2;
11869     } _timer;
11870 
11871     /* POSIX.1b signals */
11872     struct {
11873       pid_t _pid;             /* sender's pid */
11874       uid_t _uid;             /* sender's uid */
11875       sigval_t _sigval;
11876     } _rt;
11877 
11878     /* SIGCHLD */
11879     struct {
11880       pid_t _pid;             /* which child */
11881       uid_t _uid;             /* sender's uid */
11882       int _status;            /* exit code */
11883       clock_t _utime;
11884       clock_t _stime;
11885     } _sigchld;
11886 
11887     /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
11888     struct {
11889       void *_addr; /* faulting insn/memory ref. */
11890     } _sigfault;
11891 
11892     /* SIGPOLL */
11893     struct {
11894       int _band;      /* POLL_IN, POLL_OUT, POLL_MSG */
11895       int _fd;
11896     } _sigpoll;
11897   } _sifields;
11898 } siginfo_t;
11899 
11900 /* How these fields are to be accessed.  */
11901 #define si_pid          _sifields._kill._pid
11902 #define si_uid          _sifields._kill._uid
11903 #define si_status       _sifields._sigchld._status
11904 #define si_utime        _sifields._sigchld._utime
11905 #define si_stime        _sifields._sigchld._stime
11906 #define si_value        _sifields._rt._sigval
11907 #define si_int          _sifields._rt._sigval.sival_int
11908 #define si_ptr          _sifields._rt._sigval.sival_ptr
11909 #define si_addr         _sifields._sigfault._addr
11910 #define si_band         _sifields._sigpoll._band
11911 #define si_fd           _sifields._sigpoll._fd
11912 
11913 /* si_code values Digital reserves positive values for
11914  * kernel-generated signals.  */
11915 #define SI_USER    0    /* sent by kill/sigsend/raise */
11916 #define SI_KERNEL  0x80 /* sent by the kernel */
11917 #define SI_QUEUE   -1   /* sent by sigqueue */
11918 #define SI_TIMER   -2   /* sent by timer expiration */
11919 #define SI_MESGQ   -3   /* sent by RT mesq state chg */
11920 #define SI_ASYNCIO -4   /* sent by AIO completion */
11921 #define SI_SIGIO   -5   /* sent by queued SIGIO */
11922 
11923 #define SI_FROMUSER(siptr)      ((siptr)->si_code <= 0)
11924 #define SI_FROMKERNEL(siptr)    ((siptr)->si_code > 0)
11925 
11926 /* SIGILL si_codes */
11927 #define ILL_ILLOPC      1 /* illegal opcode */
11928 #define ILL_ILLOPN      2 /* illegal operand */
11929 #define ILL_ILLADR      3 /* illegal addressing mode */
11930 #define ILL_ILLTRP      4 /* illegal trap */
11931 #define ILL_PRVOPC      5 /* privileged opcode */
11932 #define ILL_PRVREG      6 /* privileged register */
11933 #define ILL_COPROC      7 /* coprocessor error */
11934 #define ILL_BADSTK      8 /* internal stack error */
11935 #define NSIGILL         8
11936 
11937 /* SIGFPE si_codes */
11938 #define FPE_INTDIV  1 /* integer divide by zero */
11939 #define FPE_INTOVF  2 /* integer overflow */
11940 #define FPE_FLTDIV  3 /* floating point divide by zero */
11941 #define FPE_FLTOVF  4 /* floating point overflow */
11942 #define FPE_FLTUND  5 /* floating point underflow */
11943 #define FPE_FLTRES  6 /* floating point inexact result */
11944 #define FPE_FLTINV  7 /* floating point invalid op */
11945 #define FPE_FLTSUB  8 /* subscript out of range */
11946 #define NSIGFPE     8
11947 
11948 /* SIGSEGV si_codes */
11949 #define SEGV_MAPERR 1 /* address not mapped to object */
11950 #define SEGV_ACCERR 2 /* invalid perms for mapped obj */
11951 #define NSIGSEGV    2
11952 
11953 /* SIGBUS si_codes */
11954 #define BUS_ADRALN 1 /* invalid address alignment */
11955 #define BUS_ADRERR 2 /* non-existant physical address */
11956 #define BUS_OBJERR 3 /* object specific hardware error */
11957 #define NSIGBUS    3
11958 
11959 /* SIGTRAP si_codes */
11960 #define TRAP_BRKPT      1       /* process breakpoint */
11961 #define TRAP_TRACE      2       /* process trace trap */
11962 #define NSIGTRAP
11963 
11964 /* SIGCHLD si_codes */
11965 #define CLD_EXITED    1 /* child has exited */
11966 #define CLD_KILLED    2 /* child was killed */
11967 #define CLD_DUMPED    3 /* child terminated abnormally */
11968 #define CLD_TRAPPED   4 /* traced child has trapped */
11969 #define CLD_STOPPED   5 /* child has stopped */
11970 #define CLD_CONTINUED 6 /* stopped child has continued */
11971 #define NSIGCHLD
11972 
11973 /* SIGPOLL si_codes */
11974 #define POLL_IN         1  /* data input available */
11975 #define POLL_OUT        2  /* output buffers available */
11976 #define POLL_MSG        3  /* input message available */
11977 #define POLL_ERR        4  /* i/o error */
11978 #define POLL_PRI        5  /* high-pri input available */
11979 #define POLL_HUP        6  /* device disconnected */
11980 #define NSIGPOLL        6
11981 
11982 /* sigevent definitions
11983  *
11984  * It seems likely that SIGEV_THREAD will have to be
11985  * handled from userspace, libpthread transmuting it to
11986  * SIGEV_SIGNAL, which the thread manager then catches
11987  * and does the appropriate nonsense.  However,
11988  * everything is written out here so as to not get lost.
11989  */
11990 #define SIGEV_SIGNAL 0  /* notify via signal */
11991 #define SIGEV_NONE   1  /* other notif: meaningless */
11992 #define SIGEV_THREAD 2  /* deliver via thread creation */
11993 
11994 #define SIGEV_MAX_SIZE 64
11995 #define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
11996 
11997 typedef struct sigevent {
11998   sigval_t sigev_value;
11999   int sigev_signo;
12000   int sigev_notify;
12001   union {
12002     int _pad[SIGEV_PAD_SIZE];
12003 
12004     struct {
12005       void (*_function)(sigval_t);
12006       void *_attribute;       /* really pthread_attr_t */
12007     } _sigev_thread;
12008   } _sigev_un;
12009 } sigevent_t;
12010 
12011 #define sigev_notify_function                           \
12012   _sigev_un._sigev_thread._function
12013 #define sigev_notify_attributes                         \
12014   _sigev_un._sigev_thread._attribute
12015 
12016 #endif

netlib.narod.ru< Назад | Оглавление | Далее >

Сайт управляется системой uCoz