Home | History | Annotate | Line # | Download | only in mips
linux_siginfo.h revision 1.1
      1 /*	$NetBSD: linux_siginfo.h,v 1.1 2001/08/26 16:41:58 manu Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 1998, 2001 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 and Emmanuel Dreyfus.
      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 _MIPS_LINUX_SIGINFO_H
     40 #define _MIPS_LINUX_SIGINFO_H
     41 
     42 /*
     43  * Everything is from Linux's include/asm-mips/siginfo.h
     44  */
     45 typedef union linux_sigval {
     46 	int sival_int;
     47 	void *sival_ptr;
     48 } linux_sigval_t;
     49 
     50 #define SI_MAX_SIZE	128
     51 #define SI_PAD_SIZE	((SI_MAX_SIZE/sizeof(int)) - 3)
     52 
     53 typedef struct linux_siginfo {
     54 	int lsi_signo;
     55 	int lsi_code;
     56 	int lsi_errno;
     57 	union {
     58 		int _pad[SI_PAD_SIZE];
     59 
     60 		/* kill() */
     61 		struct {
     62 			linux_pid_t	_pid;
     63 			linux_uid_t	_uid;
     64 		} _kill;
     65 
     66 		/* SIGCHLD */
     67 		struct {
     68 			linux_pid_t	_pid;
     69 			linux_uid_t	_uid;
     70 			linux_clock_t _utime;
     71 			int _status;
     72 			linux_clock_t _stime;
     73 		} _sigchld;
     74 
     75 		/* IRIX SIGCHLD */
     76 		struct {
     77 			pid_t _pid;
     78 			linux_clock_t _utime;
     79 			int _status;
     80 			linux_clock_t _stime;
     81 		} _irix_sigchld;
     82 
     83 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
     84 		struct {
     85 			void *_addr;
     86 		} _sigfault;
     87 
     88 		/* SIGPOLL, SIGXFSZ (To do ...)  */
     89 		struct {
     90 			int _band;
     91 			int _fd;
     92 		} _sigpoll;
     93 
     94 		/* POSIX.1b timers */
     95 		struct {
     96 			unsigned int _timer1;
     97 			unsigned int _timer2;
     98 		} _timer;
     99 
    100 		/* POSIX.1b signals */
    101 		struct {
    102 			linux_pid_t	_pid;
    103 			linux_uid_t	_uid;
    104 			linux_sigval_t	_sigval;
    105 		} _rt;
    106 
    107 	} _sidata;	/* This is _sifields for Linux/mips */
    108 } linux_siginfo_t;
    109 
    110 #define lsi_pid _sidata._kill._pid
    111 #define lsi_uid _sidata._kill._uid
    112 
    113 /*
    114  * si_code values
    115  * Digital reserves positive values for kernel-generated signals.
    116  */
    117 #define LINUX__SI_CODE(T,N)  (N)
    118 
    119 #define LINUX_SI_USER		0
    120 #define LINUX_SI_KERNEL		0x80
    121 #define LINUX_SI_QUEUE		-1
    122 #define LINUX_SI_ASYNCIO	-2
    123 #define LINUX_SI_TIMER		LINUX__SI_CODE(__SI_TIMER,-3)
    124 #define LINUX_SI_MESGQ		-4
    125 #define LINUX_SI_SIGIO  	-5
    126 
    127 #define LINUX_SI_FROMUSER(siptr)	((siptr)->si_code <= 0)
    128 #define LINUX_SI_FROMKERENL(siptr)	((siptr)->si_code > 0)
    129 
    130 
    131 #endif /* !_MIPS_LINUX_SIGINFO_H */
    132