1 /* @(#)signal.h	1.16 21/07/15 Copyright 1997-2021 J. Schilling */
2 /*
3  *	Signal abstraction for signals
4  *
5  *	Copyright (c) 1997-2021 J. Schilling
6  */
7 /*
8  * The contents of this file are subject to the terms of the
9  * Common Development and Distribution License, Version 1.0 only
10  * (the "License").  You may not use this file except in compliance
11  * with the License.
12  *
13  * See the file CDDL.Schily.txt in this distribution for details.
14  * A copy of the CDDL is also available via the Internet at
15  * http://www.opensource.org/licenses/cddl1.txt
16  *
17  * When distributing Covered Code, include this CDDL HEADER in each
18  * file and include the License file CDDL.Schily.txt from this distribution.
19  */
20 
21 #ifndef	_SCHILY_SIGNAL_H
22 #define	_SCHILY_SIGNAL_H
23 
24 #ifndef _SCHILY_MCONFIG_H
25 #include <schily/mconfig.h>
26 #endif
27 #ifndef	_SCHILY_TYPES_H
28 #include <schily/types.h>
29 #endif
30 
31 #ifdef	HAVE_SIGNAL_H
32 #ifndef	_INCL_SIGNAL_H
33 #include <signal.h>
34 #define	_INCL_SIGNAL_H
35 #endif
36 #endif
37 
38 #ifndef	SIGCHLD		/* POSIX name is missing */
39 #ifdef	SIGCLD
40 #define	SIGCHLD	SIGCLD
41 #endif
42 #endif
43 
44 /*
45  * z/OS does not provide the NSIG definition, so we #define it here
46  * based on the largest signal number we are aware of in 2021.
47  */
48 #ifndef	NSIG
49 #if	(defined(OS390) || defined(__MVS__)) && defined(SIGDUMP)
50 #define	NSIG	(SIGDUMP+1)
51 #endif
52 #endif
53 
54 /*
55  * Very old Solaris versions (probably only before 1993) did not include
56  * siginfo.h in sginal.h. POSIX requires the availaibility of siginfo_t
57  * from signal.h, so include siginfo.h if available on this platform.
58  */
59 #ifdef	HAVE_SIGINFO_H
60 #ifndef	_INCL_SIGINFO_H
61 #include <siginfo.h>
62 #define	_INCL_SIGINFO_H
63 #endif
64 #else
65 #ifdef	HAVE_SYS_SIGINFO_H
66 #ifndef	_INCL_SYS_SIGINFO_H
67 #include <sys/siginfo.h>
68 #define	_INCL_SYS_SIGINFO_H
69 #endif
70 #endif
71 #endif
72 
73 #if	!defined(HAVE_TYPE_SIGINFO_T) && !defined(HAVE_SIGINFO_T)
74 
75 #ifndef _SCHILY_TIME_H
76 #include <schily/time.h>
77 #endif
78 #ifndef _SCHILY_TIMES_H
79 #include <schily/times.h>
80 #endif
81 
82 #ifdef	__cplusplus
83 extern "C" {
84 #endif
85 
86 typedef struct {
87 	int	si_code;	/* Child status code */
88 	pid_t	si_pid;		/* Child pid */
89 	int	si_status;	/* Child exit code or signal number */
90 	clock_t	si_utime;
91 	clock_t	si_stime;
92 } siginfo_t;
93 
94 #ifndef	id_t
95 #define	id_t	pid_t
96 #endif
97 
98 #ifdef	__cplusplus
99 }
100 #endif
101 
102 #endif	/* !defined(HAVE_TYPE_SIGINFO_T) && !defined(HAVE_SIGINFO_T) */
103 
104 #endif	/* _SCHILY_SIGNAL_H */
105