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