signal.h revision 19d32b9ab53d17ac6605971e14c45a5281f8d9bb
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2010 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 _SYS_SIGNAL_H
#define _SYS_SIGNAL_H
#include <sys/feature_tests.h>
#ifdef __cplusplus
extern "C" {
#endif
defined(__XOPEN_OR_POSIX)
#if defined(__EXTENSIONS__) || defined(_KERNEL) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
/*
*/
#endif
/* Duplicated in <sys/ucontext.h> as a result of XPG4v2 requirements */
#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[3];
} k_sigset_t;
/*
* The signal handler routine can have either one or three arguments.
* Existing C code has used either form so not specifing the arguments
* neatly finesses the problem. C++ doesn't accept this. To C++
* "(*sa_handler)()" indicates a routine with no arguments (ANSI C would
* specify this as "(*sa_handler)(void)"). One or the other form must be
* used for C++ and the only logical choice is "(*sa_handler)(int)" to allow
* the SIG_* defines to work. "(*sa_sigaction)(int, siginfo_t *, void *)"
* can be used for the three argument form.
*/
/*
* Note: storage overlap by sa_handler and sa_sigaction
*/
struct sigaction {
int sa_flags;
union {
#ifdef __cplusplus
void (*_handler)(int);
#else
void (*_handler)();
#endif
#if defined(__EXTENSIONS__) || defined(_KERNEL) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
void (*_sigaction)(int, siginfo_t *, void *);
#endif
} _funcptr;
#ifndef _LP64
int sa_resv[2];
#endif
};
#if defined(_SYSCALL32)
/* Kernel view of the ILP32 user sigaction structure */
struct sigaction32 {
union {
} _funcptr;
};
#endif /* _SYSCALL32 */
/* this is only valid for SIGCLD */
#endif
#if defined(__EXTENSIONS__) || defined(_KERNEL) || \
(!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
defined(_XPG4_2)
/* non-conformant ANSI compilation */
/* definitions for the sa_flags field */
#define SA_ONSTACK 0x00000001
#define SA_RESETHAND 0x00000002
#define SA_RESTART 0x00000004
#endif
#if defined(__EXTENSIONS__) || defined(_KERNEL) || \
(!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
#define SA_SIGINFO 0x00000008
#endif
#if defined(__EXTENSIONS__) || defined(_KERNEL) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
defined(_XPG4_2)
#define SA_NODEFER 0x00000010
/* this is only valid for SIGCLD */
#if defined(__EXTENSIONS__) || !defined(_XPG4_2)
/*
* use of these symbols by applications is injurious
* to binary compatibility
*/
#endif /* defined(__EXTENSIONS__) || !defined(_XPG4_2) */
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
#define SS_ONSTACK 0x00000001
#define SS_DISABLE 0x00000002
/* Duplicated in <sys/ucontext.h> as a result of XPG4v2 requirements. */
#ifndef _STACK_T
#define _STACK_T
#if defined(__EXTENSIONS__) || !defined(_XPG4_2)
typedef struct sigaltstack {
#else
typedef struct {
#endif
void *ss_sp;
int ss_flags;
} stack_t;
#if defined(_SYSCALL32)
/* Kernel view of the ILP32 user sigaltstack structure */
typedef struct sigaltstack32 {
} stack32_t;
#endif /* _SYSCALL32 */
#endif /* _STACK_T */
#endif /* defined(__EXTENSIONS__) || defined(_KERNEL) ... */
#if defined(__EXTENSIONS__) || defined(_KERNEL) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
/* signotify id used only by libc for mq_notify()/aio_notify() */
typedef struct signotify_id { /* signotify id struct */
int sn_index; /* index in preallocated pool */
int sn_pad; /* reserved */
#if defined(_SYSCALL32)
/* Kernel view of the ILP32 user signotify_id structure */
typedef struct signotify32_id {
#endif /* _SYSCALL32 */
/* Command codes for sig_notify call */
#endif /* defined(__EXTENSIONS__) || defined(_KERNEL) ... */
/* Added as per XPG4v2 */
#if defined(__EXTENSIONS__) || defined(_KERNEL) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
defined(_XPG4_2)
struct sigstack {
void *ss_sp;
int ss_onstack;
};
#endif /* defined(__EXTENSIONS__) || defined(_KERNEL) ... */
/*
* For definition of ucontext_t; must follow struct definition
* for sigset_t
*/
#if defined(_XPG4_2)
#include <sys/ucontext.h>
#endif /* defined(_XPG4_2) */
#ifdef _KERNEL
#define FILLSET0 0xffffffffu
#define FILLSET1 0xffffffffu
#else
#error "fix me: MAXSIG out of bounds"
#endif
#define CANTMASK1 0
#define CANTMASK2 0
#define sigemptyset(s) (*(s) = nullsmask)
#define sigfillset(s) (*(s) = fillset)
(s)->__sigbits[2]))
typedef struct {
int sig; /* signal no. */
int perm; /* flag for EPERM */
int checkperm; /* check perm or not */
} sigsend_t;
typedef struct {
} signotifyq_t;
typedef struct sigqhdr { /* sigqueue pool header */
int sqb_count; /* sigq free count */
} sigqhdr_t;
#define _SIGNOTIFY_MAX 32
extern void setsigact(int, void (*)(int), const k_sigset_t *, int);
extern void sigintr(k_sigset_t *, int);
extern void sigunintr(k_sigset_t *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SIGNAL_H */