signal.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#ifndef _UCB_SYS_SIGNAL_H
#define _UCB_SYS_SIGNAL_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* 4.3BSD signal compatibility header
*
* this file includes all standard SVR4 header info, plus the 4.3BSD
* structures - 4.3BSD signal codes are translated to SVR4 generic
* signal codes where applicable
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* SysV <signal.h>
*/
/* ---- <signal.h> ---- */
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
#ifndef _SIGNAL_H
#define _SIGNAL_H
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _SYS_SIGNAL_H
#define _SYS_SIGNAL_H
#if defined(__cplusplus)
typedef void SIG_FUNC_TYP(int);
typedef SIG_FUNC_TYP *SIG_TYP;
#define SIG_DFL (void(*)(int))0
#define SIG_ERR (void(*)(int))0
#define SIG_IGN (void (*)(int))0
#define SIG_HOLD (void(*)(int))0
#else
#define SIG_DFL (void(*)())0
#define SIG_ERR (void(*)())-1
#define SIG_IGN (void (*)())1
#define SIG_HOLD (void(*)())2
#endif
#define SIG_BLOCK 1
#define SIG_UNBLOCK 2
#define SIG_SETMASK 3
#define SIGNO_MASK 0xFF
#define SIGDEFER 0x100
#define SIGHOLD 0x200
#define SIGRELSE 0x400
#define SIGIGNORE 0x800
#define SIGPAUSE 0x1000
#if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE)
#ifndef _SIGSET_T
#define _SIGSET_T
typedef struct { /* signal set type */
unsigned int __sigbits[4];
} sigset_t;
#endif /* _SIGSET_T */
typedef struct {
unsigned int __sigbits[2];
} k_sigset_t;
struct sigaction {
int sa_flags;
#if defined(__cplusplus)
void (*sa_handler)(int);
#else
void (*sa_handler)();
#endif
int sa_resv[2];
};
/* this is only valid for SIGCLD */
#endif
#if !defined(_STRICT_STDC) && !defined(_POSIX_SOURCE)
/* non-comformant ANSI compilation */
/* definitions for the sa_flags field */
#define SA_ONSTACK 0x00000001
#define SA_RESETHAND 0x00000002
#define SA_RESTART 0x00000004
#define SA_SIGINFO 0x00000008
#define SA_NODEFER 0x00000010
/* this is only valid for SIGCLD */
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
#define SS_ONSTACK 0x00000001
#define SS_DISABLE 0x00000002
struct sigaltstack {
char *ss_sp;
int ss_size;
int ss_flags;
};
typedef struct sigaltstack stack_t;
#endif /* __STDC__ && !POSIX */
#endif /* _SYS_SIGNAL_H */
typedef int sig_atomic_t;
#if defined(__STDC__)
extern const char *_sys_siglist[];
extern const int _sys_nsig;
#ifdef __cplusplus
#else
extern void (*signal(int, void (*)(int)))(int);
#endif
extern int raise(int);
#if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE) || \
defined(_XOPEN_SOURCE)
extern int sigemptyset(sigset_t *);
extern int sigfillset(sigset_t *);
extern int sigismember(const sigset_t *, int);
extern int sigpending(sigset_t *);
extern int sigsuspend(const sigset_t *);
#endif
#if !defined(_STRICT_STDC) && !defined(_POSIX_SOURCE)
extern int gsignal(int);
extern void (*sigset(int, void (*)(int)))(int);
extern int sighold(int);
extern int sigrelse(int);
extern int sigignore(int);
extern int sigpause(int);
extern int (*ssignal(int, int (*)(int)))(int);
/* extern int sigsend(idtype_t, id_t, int); */
/* extern int sigsendset(const procset_t *, int); */
#endif
#else
extern char *_sys_siglist[];
extern int _sys_nsig;
extern void(*signal())();
extern void(*sigset())();
#endif /* __STDC__ */
#endif /* _SIGNAL_H */
/* ---- end of SysV <signal.h> ---- */
/*
* 4.3BSD structure used in sigstack call.
*/
struct sigstack {
char *ss_sp; /* signal stack pointer */
int ss_onstack; /* current status */
};
#define sv_onstack sv_flags
struct sigcontext {
int sc_onstack; /* sigstack state to restore */
int sc_mask; /* signal mask to restore */
#ifdef u3b2
int sc_sp; /* sp to restore */
int sc_fp; /* fp to restore */
int sc_ap; /* ap to restore */
int sc_pc; /* pc to restore */
int sc_ps; /* psw to restore */
#endif
#ifdef vax
int sc_sp; /* sp to restore */
int sc_fp; /* fp to restore */
int sc_ap; /* ap to restore */
int sc_pc; /* pc to restore */
int sc_ps; /* psl to restore */
#endif /* vax */
#ifdef mc68000
int sc_sp; /* sp to restore */
int sc_pc; /* pc to retore */
int sc_ps; /* psl to restore */
#endif /* mc68000 */
#ifdef __sparc
long sc_sp; /* sp to restore */
long sc_pc; /* pc to retore */
long sc_npc; /* next pc to restore */
long sc_psr; /* psr to restore */
/* aliased to REG_CCR for sparcv9 */
long sc_g1; /* register that must be restored */
long sc_o0;
int sc_wbcnt; /* number of outstanding windows */
#endif /* __sparc */
#if defined(__amd64)
long sc_sp; /* sp to restore */
long sc_pc; /* pc to retore */
long sc_ps; /* psl to restore */
long sc_rax; /* rax to restore */
long sc_rdx; /* rdx to restore */
int sc_sp; /* sp to restore */
int sc_pc; /* pc to retore */
int sc_ps; /* psl to restore */
int sc_eax; /* eax to restore */
int sc_edx; /* edx to restore */
#endif
};
/*
* 4.3BSD signal vector structure used in sigvec call.
*/
struct sigvec {
#if defined(__cplusplus)
void (*sv_handler)(int, int, struct sigcontext *, char *);
#else
void (*sv_handler)(); /* signal handler */
#endif
int sv_mask; /* signal mask to apply */
int sv_flags; /* see signal options below */
};
#if defined(__STDC__)
extern int sigblock(int);
extern int sigsetmask(int);
#endif
/*
* Signal codes taken verbatim from SunOS4.1
*/
#ifdef vax
#endif /* vax */
#ifdef mc68000
#endif /* mc68000 */
#ifdef sparc
/* codes from 0x80 to 0xff are software traps */
#endif /* sparc */
#endif
#ifdef mc68000
#endif /* mc68000 */
#ifdef sparc
#endif /* sparc */
#ifdef vax
#endif /* vax */
#ifdef mc68000
#ifdef sun
#endif /* sun */
#endif /* mc68000 */
#ifdef sparc
#endif /* sparc */
/*
* The codes for SIGBUS and SIGSEGV are described in <vm/faultcode.h>
* These are the same between SunOS4.1 and SunOS5.0
*/
#include <vm/faultcode.h>
#ifdef BUS_OBJERR /* namespace conflict with SysV */
#endif
/*
* The BUS_CODE(code) will be one of the above. In the BUS_OBJERR case,
* doing a BUS_ERRNO(code) gives an errno value reported by the underlying
* file object mapped at the fault address. Note that this appears to be
* duplicated with the segmentation fault case below -- unfortunate, since
* the specification has always claimed that such errors produce SIGBUS.
* The segmentation cases are left defined as a transition aid.
*/
/*
* The SEGV_CODE(code) will be SEGV_NOMAP, SEGV_PROT, or SEGV_OBJERR.
* In the SEGV_OBJERR case, doing a SEGV_ERRNO(code) gives an errno value
* reported by the underlying file object mapped at the fault address.
*/
#define SEGV_ERRNO(C) FC_ERRNO(C)
#define SEGV_MAKE_ERR(e) FC_MAKE_ERR(e)
#define SIG_NOADDR ((char *)~0)
#if defined(lint)
#define BADSIG (void(*)())0
#else
#define BADSIG (void(*)())-1
#endif
#ifdef __cplusplus
}
#endif
#endif /* _UCB_SYS_SIGNAL_H */