signal.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* Generic signal.h */
  2. /* $OpenLDAP$ */
  3. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  4. *
  5. * Copyright 1998-2022 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. #ifndef _AC_SIGNAL_H
  17. #define _AC_SIGNAL_H
  18. #include <signal.h>
  19. #undef SIGNAL
  20. #if defined( HAVE_SIGACTION )
  21. #define SIGNAL lutil_sigaction
  22. typedef void (*lutil_sig_t)(int);
  23. LDAP_LUTIL_F(lutil_sig_t) lutil_sigaction( int sig, lutil_sig_t func );
  24. #define SIGNAL_REINSTALL(sig,act) (void)0
  25. #elif defined( HAVE_SIGSET )
  26. #define SIGNAL sigset
  27. #define SIGNAL_REINSTALL sigset
  28. #else
  29. #define SIGNAL signal
  30. #define SIGNAL_REINSTALL signal
  31. #endif
  32. #if !defined( LDAP_SIGUSR1 ) || !defined( LDAP_SIGUSR2 )
  33. #undef LDAP_SIGUSR1
  34. #undef LDAP_SIGUSR2
  35. # if defined(WINNT) || defined(_WINNT) || defined(_WIN32)
  36. # define LDAP_SIGUSR1 SIGILL
  37. # define LDAP_SIGUSR2 SIGTERM
  38. # elif !defined(HAVE_LINUX_THREADS)
  39. # define LDAP_SIGUSR1 SIGUSR1
  40. # define LDAP_SIGUSR2 SIGUSR2
  41. # else
  42. /*
  43. * Some versions of LinuxThreads unfortunately uses the only
  44. * two signals reserved for user applications. This forces
  45. * OpenLDAP to use other signals reserved for other uses.
  46. */
  47. # if defined( SIGSTKFLT )
  48. # define LDAP_SIGUSR1 SIGSTKFLT
  49. # elif defined ( SIGSYS )
  50. # define LDAP_SIGUSR1 SIGSYS
  51. # endif
  52. # if defined( SIGUNUSED )
  53. # define LDAP_SIGUSR2 SIGUNUSED
  54. # elif defined ( SIGINFO )
  55. # define LDAP_SIGUSR2 SIGINFO
  56. # elif defined ( SIGEMT )
  57. # define LDAP_SIGUSR2 SIGEMT
  58. # endif
  59. # endif
  60. #endif
  61. #ifndef LDAP_SIGCHLD
  62. #ifdef SIGCHLD
  63. #define LDAP_SIGCHLD SIGCHLD
  64. #elif SIGCLD
  65. #define LDAP_SIGCHLD SIGCLD
  66. #endif
  67. #endif
  68. #endif /* _AC_SIGNAL_H */