1 /*	$NetBSD: signal.h,v 1.1.1.3 2010/12/12 15:21:27 adam Exp $	*/
2 
3 /* Generic signal.h */
4 /* OpenLDAP: pkg/ldap/include/ac/signal.h,v 1.25.2.5 2010/04/13 20:22:51 kurt Exp */
5 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
6  *
7  * Copyright 1998-2010 The OpenLDAP Foundation.
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted only as authorized by the OpenLDAP
12  * Public License.
13  *
14  * A copy of this license is available in file LICENSE in the
15  * top-level directory of the distribution or, alternatively, at
16  * <http://www.OpenLDAP.org/license.html>.
17  */
18 
19 #ifndef _AC_SIGNAL_H
20 #define _AC_SIGNAL_H
21 
22 #include <signal.h>
23 
24 #undef SIGNAL
25 
26 #if defined( HAVE_SIGACTION )
27 #define SIGNAL lutil_sigaction
28 typedef void (*lutil_sig_t)(int);
29 LDAP_LUTIL_F(lutil_sig_t) lutil_sigaction( int sig, lutil_sig_t func );
30 #define SIGNAL_REINSTALL(sig,act)	(void)0
31 #elif defined( HAVE_SIGSET )
32 #define SIGNAL sigset
33 #define SIGNAL_REINSTALL sigset
34 #else
35 #define SIGNAL signal
36 #define SIGNAL_REINSTALL signal
37 #endif
38 
39 #if !defined( LDAP_SIGUSR1 ) || !defined( LDAP_SIGUSR2 )
40 #undef LDAP_SIGUSR1
41 #undef LDAP_SIGUSR2
42 
43 #	if defined(WINNT) || defined(_WINNT) || defined(_WIN32)
44 #		define LDAP_SIGUSR1	SIGILL
45 #		define LDAP_SIGUSR2	SIGTERM
46 
47 #	elif !defined(HAVE_LINUX_THREADS)
48 #		define LDAP_SIGUSR1	SIGUSR1
49 #		define LDAP_SIGUSR2	SIGUSR2
50 
51 #	else
52 		/*
53 		 * Some versions of LinuxThreads unfortunately uses the only
54 		 * two signals reserved for user applications.  This forces
55 		 * OpenLDAP to use other signals reserved for other uses.
56 		 */
57 
58 #		if defined( SIGSTKFLT )
59 #			define LDAP_SIGUSR1	SIGSTKFLT
60 #		elif defined ( SIGSYS )
61 #			define LDAP_SIGUSR1	SIGSYS
62 #		endif
63 
64 #		if defined( SIGUNUSED )
65 #			define LDAP_SIGUSR2	SIGUNUSED
66 #		elif defined ( SIGINFO )
67 #			define LDAP_SIGUSR2	SIGINFO
68 #		elif defined ( SIGEMT )
69 #			define LDAP_SIGUSR2	SIGEMT
70 #		endif
71 #	endif
72 #endif
73 
74 #ifndef LDAP_SIGCHLD
75 #ifdef SIGCHLD
76 #define LDAP_SIGCHLD SIGCHLD
77 #elif SIGCLD
78 #define LDAP_SIGCHLD SIGCLD
79 #endif
80 #endif
81 
82 #endif /* _AC_SIGNAL_H */
83