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