signal.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
  2. /* A GNU-like <signal.h>.
  3. Copyright (C) 2006-2011 Free Software Foundation, Inc.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #if __GNUC__ >= 3
  15. #pragma GCC system_header
  16. #endif
  17. #include "config.h"
  18. #if defined __need_sig_atomic_t || defined __need_sigset_t
  19. /* Special invocation convention inside glibc header files. */
  20. # include_next <signal.h>
  21. #else
  22. /* Normal invocation convention. */
  23. #ifndef _GL_SIGNAL_H
  24. /* The include_next requires a split double-inclusion guard. */
  25. #include_next <signal.h>
  26. #ifndef _GL_SIGNAL_H
  27. #define _GL_SIGNAL_H
  28. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  29. #ifndef _GL_CXXDEFS_H
  30. #define _GL_CXXDEFS_H
  31. /* The three most frequent use cases of these macros are:
  32. * For providing a substitute for a function that is missing on some
  33. platforms, but is declared and works fine on the platforms on which
  34. it exists:
  35. #if @GNULIB_FOO@
  36. # if !@HAVE_FOO@
  37. _GL_FUNCDECL_SYS (foo, ...);
  38. # endif
  39. _GL_CXXALIAS_SYS (foo, ...);
  40. _GL_CXXALIASWARN (foo);
  41. #elif defined GNULIB_POSIXCHECK
  42. ...
  43. #endif
  44. * For providing a replacement for a function that exists on all platforms,
  45. but is broken/insufficient and needs to be replaced on some platforms:
  46. #if @GNULIB_FOO@
  47. # if @REPLACE_FOO@
  48. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  49. # undef foo
  50. # define foo rpl_foo
  51. # endif
  52. _GL_FUNCDECL_RPL (foo, ...);
  53. _GL_CXXALIAS_RPL (foo, ...);
  54. # else
  55. _GL_CXXALIAS_SYS (foo, ...);
  56. # endif
  57. _GL_CXXALIASWARN (foo);
  58. #elif defined GNULIB_POSIXCHECK
  59. ...
  60. #endif
  61. * For providing a replacement for a function that exists on some platforms
  62. but is broken/insufficient and needs to be replaced on some of them and
  63. is additionally either missing or undeclared on some other platforms:
  64. #if @GNULIB_FOO@
  65. # if @REPLACE_FOO@
  66. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  67. # undef foo
  68. # define foo rpl_foo
  69. # endif
  70. _GL_FUNCDECL_RPL (foo, ...);
  71. _GL_CXXALIAS_RPL (foo, ...);
  72. # else
  73. # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
  74. _GL_FUNCDECL_SYS (foo, ...);
  75. # endif
  76. _GL_CXXALIAS_SYS (foo, ...);
  77. # endif
  78. _GL_CXXALIASWARN (foo);
  79. #elif defined GNULIB_POSIXCHECK
  80. ...
  81. #endif
  82. */
  83. /* _GL_EXTERN_C declaration;
  84. performs the declaration with C linkage. */
  85. #if defined __cplusplus
  86. # define _GL_EXTERN_C extern "C"
  87. #else
  88. # define _GL_EXTERN_C extern
  89. #endif
  90. /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
  91. declares a replacement function, named rpl_func, with the given prototype,
  92. consisting of return type, parameters, and attributes.
  93. Example:
  94. _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
  95. _GL_ARG_NONNULL ((1)));
  96. */
  97. #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
  98. _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
  99. #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
  100. _GL_EXTERN_C rettype rpl_func parameters_and_attributes
  101. /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
  102. declares the system function, named func, with the given prototype,
  103. consisting of return type, parameters, and attributes.
  104. Example:
  105. _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
  106. _GL_ARG_NONNULL ((1)));
  107. */
  108. #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
  109. _GL_EXTERN_C rettype func parameters_and_attributes
  110. /* _GL_CXXALIAS_RPL (func, rettype, parameters);
  111. declares a C++ alias called GNULIB_NAMESPACE::func
  112. that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
  113. Example:
  114. _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
  115. */
  116. #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
  117. _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
  118. #if defined __cplusplus && defined GNULIB_NAMESPACE
  119. # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
  120. namespace GNULIB_NAMESPACE \
  121. { \
  122. rettype (*const func) parameters = ::rpl_func; \
  123. } \
  124. _GL_EXTERN_C int _gl_cxxalias_dummy
  125. #else
  126. # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
  127. _GL_EXTERN_C int _gl_cxxalias_dummy
  128. #endif
  129. /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
  130. is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
  131. except that the C function rpl_func may have a slightly different
  132. declaration. A cast is used to silence the "invalid conversion" error
  133. that would otherwise occur. */
  134. #if defined __cplusplus && defined GNULIB_NAMESPACE
  135. # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
  136. namespace GNULIB_NAMESPACE \
  137. { \
  138. rettype (*const func) parameters = \
  139. reinterpret_cast<rettype(*)parameters>(::rpl_func); \
  140. } \
  141. _GL_EXTERN_C int _gl_cxxalias_dummy
  142. #else
  143. # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
  144. _GL_EXTERN_C int _gl_cxxalias_dummy
  145. #endif
  146. /* _GL_CXXALIAS_SYS (func, rettype, parameters);
  147. declares a C++ alias called GNULIB_NAMESPACE::func
  148. that redirects to the system provided function func, if GNULIB_NAMESPACE
  149. is defined.
  150. Example:
  151. _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
  152. */
  153. #if defined __cplusplus && defined GNULIB_NAMESPACE
  154. /* If we were to write
  155. rettype (*const func) parameters = ::func;
  156. like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
  157. better (remove an indirection through a 'static' pointer variable),
  158. but then the _GL_CXXALIASWARN macro below would cause a warning not only
  159. for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
  160. # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
  161. namespace GNULIB_NAMESPACE \
  162. { \
  163. static rettype (*func) parameters = ::func; \
  164. } \
  165. _GL_EXTERN_C int _gl_cxxalias_dummy
  166. #else
  167. # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
  168. _GL_EXTERN_C int _gl_cxxalias_dummy
  169. #endif
  170. /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
  171. is like _GL_CXXALIAS_SYS (func, rettype, parameters);
  172. except that the C function func may have a slightly different declaration.
  173. A cast is used to silence the "invalid conversion" error that would
  174. otherwise occur. */
  175. #if defined __cplusplus && defined GNULIB_NAMESPACE
  176. # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
  177. namespace GNULIB_NAMESPACE \
  178. { \
  179. static rettype (*func) parameters = \
  180. reinterpret_cast<rettype(*)parameters>(::func); \
  181. } \
  182. _GL_EXTERN_C int _gl_cxxalias_dummy
  183. #else
  184. # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
  185. _GL_EXTERN_C int _gl_cxxalias_dummy
  186. #endif
  187. /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
  188. is like _GL_CXXALIAS_SYS (func, rettype, parameters);
  189. except that the C function is picked among a set of overloaded functions,
  190. namely the one with rettype2 and parameters2. Two consecutive casts
  191. are used to silence the "cannot find a match" and "invalid conversion"
  192. errors that would otherwise occur. */
  193. #if defined __cplusplus && defined GNULIB_NAMESPACE
  194. /* The outer cast must be a reinterpret_cast.
  195. The inner cast: When the function is defined as a set of overloaded
  196. functions, it works as a static_cast<>, choosing the designated variant.
  197. When the function is defined as a single variant, it works as a
  198. reinterpret_cast<>. The parenthesized cast syntax works both ways. */
  199. # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
  200. namespace GNULIB_NAMESPACE \
  201. { \
  202. static rettype (*func) parameters = \
  203. reinterpret_cast<rettype(*)parameters>( \
  204. (rettype2(*)parameters2)(::func)); \
  205. } \
  206. _GL_EXTERN_C int _gl_cxxalias_dummy
  207. #else
  208. # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
  209. _GL_EXTERN_C int _gl_cxxalias_dummy
  210. #endif
  211. /* _GL_CXXALIASWARN (func);
  212. causes a warning to be emitted when ::func is used but not when
  213. GNULIB_NAMESPACE::func is used. func must be defined without overloaded
  214. variants. */
  215. #if defined __cplusplus && defined GNULIB_NAMESPACE
  216. # define _GL_CXXALIASWARN(func) \
  217. _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
  218. # define _GL_CXXALIASWARN_1(func,namespace) \
  219. _GL_CXXALIASWARN_2 (func, namespace)
  220. /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
  221. we enable the warning only when not optimizing. */
  222. # if !__OPTIMIZE__
  223. # define _GL_CXXALIASWARN_2(func,namespace) \
  224. _GL_WARN_ON_USE (func, \
  225. "The symbol ::" #func " refers to the system function. " \
  226. "Use " #namespace "::" #func " instead.")
  227. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  228. # define _GL_CXXALIASWARN_2(func,namespace) \
  229. extern __typeof__ (func) func
  230. # else
  231. # define _GL_CXXALIASWARN_2(func,namespace) \
  232. _GL_EXTERN_C int _gl_cxxalias_dummy
  233. # endif
  234. #else
  235. # define _GL_CXXALIASWARN(func) \
  236. _GL_EXTERN_C int _gl_cxxalias_dummy
  237. #endif
  238. /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
  239. causes a warning to be emitted when the given overloaded variant of ::func
  240. is used but not when GNULIB_NAMESPACE::func is used. */
  241. #if defined __cplusplus && defined GNULIB_NAMESPACE
  242. # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
  243. _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
  244. GNULIB_NAMESPACE)
  245. # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
  246. _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
  247. /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
  248. we enable the warning only when not optimizing. */
  249. # if !__OPTIMIZE__
  250. # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
  251. _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
  252. "The symbol ::" #func " refers to the system function. " \
  253. "Use " #namespace "::" #func " instead.")
  254. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  255. # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
  256. extern __typeof__ (func) func
  257. # else
  258. # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
  259. _GL_EXTERN_C int _gl_cxxalias_dummy
  260. # endif
  261. #else
  262. # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
  263. _GL_EXTERN_C int _gl_cxxalias_dummy
  264. #endif
  265. #endif /* _GL_CXXDEFS_H */
  266. /* The definition of _GL_ARG_NONNULL is copied here. */
  267. /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
  268. that the values passed as arguments n, ..., m must be non-NULL pointers.
  269. n = 1 stands for the first argument, n = 2 for the second argument etc. */
  270. #ifndef _GL_ARG_NONNULL
  271. # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
  272. # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
  273. # else
  274. # define _GL_ARG_NONNULL(params)
  275. # endif
  276. #endif
  277. /* The definition of _GL_WARN_ON_USE is copied here. */
  278. #ifndef _GL_WARN_ON_USE
  279. # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
  280. /* A compiler attribute is available in gcc versions 4.3.0 and later. */
  281. # define _GL_WARN_ON_USE(function, message) \
  282. extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
  283. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  284. /* Verify the existence of the function. */
  285. # define _GL_WARN_ON_USE(function, message) \
  286. extern __typeof__ (function) function
  287. # else /* Unsupported. */
  288. # define _GL_WARN_ON_USE(function, message) \
  289. _GL_WARN_EXTERN_C int _gl_warn_on_use
  290. # endif
  291. #endif
  292. /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
  293. is like _GL_WARN_ON_USE (function, "string"), except that the function is
  294. declared with the given prototype, consisting of return type, parameters,
  295. and attributes.
  296. This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
  297. not work in this case. */
  298. #ifndef _GL_WARN_ON_USE_CXX
  299. # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
  300. # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
  301. extern rettype function parameters_and_attributes \
  302. __attribute__ ((__warning__ (msg)))
  303. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  304. /* Verify the existence of the function. */
  305. # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
  306. extern rettype function parameters_and_attributes
  307. # else /* Unsupported. */
  308. # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
  309. _GL_WARN_EXTERN_C int _gl_warn_on_use
  310. # endif
  311. #endif
  312. /* _GL_WARN_EXTERN_C declaration;
  313. performs the declaration with C linkage. */
  314. #ifndef _GL_WARN_EXTERN_C
  315. # if defined __cplusplus
  316. # define _GL_WARN_EXTERN_C extern "C"
  317. # else
  318. # define _GL_WARN_EXTERN_C extern
  319. # endif
  320. #endif
  321. /* Define pid_t, uid_t.
  322. Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */
  323. #include <sys/types.h>
  324. /* On AIX, sig_atomic_t already includes volatile. C99 requires that
  325. 'volatile sig_atomic_t' ignore the extra modifier, but C89 did not.
  326. Hence, redefine this to a non-volatile type as needed. */
  327. #if ! 1
  328. # if !GNULIB_defined_sig_atomic_t
  329. typedef int rpl_sig_atomic_t;
  330. # undef sig_atomic_t
  331. # define sig_atomic_t rpl_sig_atomic_t
  332. # define GNULIB_defined_sig_atomic_t 1
  333. # endif
  334. #endif
  335. /* A set or mask of signals. */
  336. #if !1
  337. # if !GNULIB_defined_sigset_t
  338. typedef unsigned int sigset_t;
  339. # define GNULIB_defined_sigset_t 1
  340. # endif
  341. #endif
  342. /* Define sighandler_t, the type of signal handlers. A GNU extension. */
  343. #if !0
  344. # ifdef __cplusplus
  345. extern "C" {
  346. # endif
  347. # if !GNULIB_defined_sighandler_t
  348. typedef void (*sighandler_t) (int);
  349. # define GNULIB_defined_sighandler_t 1
  350. # endif
  351. # ifdef __cplusplus
  352. }
  353. # endif
  354. #endif
  355. #if 0
  356. # ifndef SIGPIPE
  357. /* Define SIGPIPE to a value that does not overlap with other signals. */
  358. # define SIGPIPE 13
  359. # define GNULIB_defined_SIGPIPE 1
  360. /* To actually use SIGPIPE, you also need the gnulib modules 'sigprocmask',
  361. 'write', 'stdio'. */
  362. # endif
  363. #endif
  364. /* Maximum signal number + 1. */
  365. #ifndef NSIG
  366. # if defined __TANDEM
  367. # define NSIG 32
  368. # endif
  369. #endif
  370. #if 1
  371. # if !0
  372. /* Maximum signal number + 1. */
  373. # ifndef NSIG
  374. # define NSIG 32
  375. # endif
  376. /* This code supports only 32 signals. */
  377. # if !GNULIB_defined_verify_NSIG_constraint
  378. typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
  379. # define GNULIB_defined_verify_NSIG_constraint 1
  380. # endif
  381. # endif
  382. /* Test whether a given signal is contained in a signal set. */
  383. # if 0
  384. /* This function is defined as a macro on MacOS X. */
  385. # if defined __cplusplus && defined GNULIB_NAMESPACE
  386. # undef sigismember
  387. # endif
  388. # else
  389. _GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig)
  390. _GL_ARG_NONNULL ((1)));
  391. # endif
  392. _GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig));
  393. _GL_CXXALIASWARN (sigismember);
  394. /* Initialize a signal set to the empty set. */
  395. # if 0
  396. /* This function is defined as a macro on MacOS X. */
  397. # if defined __cplusplus && defined GNULIB_NAMESPACE
  398. # undef sigemptyset
  399. # endif
  400. # else
  401. _GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
  402. # endif
  403. _GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set));
  404. _GL_CXXALIASWARN (sigemptyset);
  405. /* Add a signal to a signal set. */
  406. # if 0
  407. /* This function is defined as a macro on MacOS X. */
  408. # if defined __cplusplus && defined GNULIB_NAMESPACE
  409. # undef sigaddset
  410. # endif
  411. # else
  412. _GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig)
  413. _GL_ARG_NONNULL ((1)));
  414. # endif
  415. _GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig));
  416. _GL_CXXALIASWARN (sigaddset);
  417. /* Remove a signal from a signal set. */
  418. # if 0
  419. /* This function is defined as a macro on MacOS X. */
  420. # if defined __cplusplus && defined GNULIB_NAMESPACE
  421. # undef sigdelset
  422. # endif
  423. # else
  424. _GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig)
  425. _GL_ARG_NONNULL ((1)));
  426. # endif
  427. _GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig));
  428. _GL_CXXALIASWARN (sigdelset);
  429. /* Fill a signal set with all possible signals. */
  430. # if 0
  431. /* This function is defined as a macro on MacOS X. */
  432. # if defined __cplusplus && defined GNULIB_NAMESPACE
  433. # undef sigfillset
  434. # endif
  435. # else
  436. _GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
  437. # endif
  438. _GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set));
  439. _GL_CXXALIASWARN (sigfillset);
  440. /* Return the set of those blocked signals that are pending. */
  441. # if !0
  442. _GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
  443. # endif
  444. _GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set));
  445. _GL_CXXALIASWARN (sigpending);
  446. /* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET.
  447. Then, if SET is not NULL, affect the current set of blocked signals by
  448. combining it with *SET as indicated in OPERATION.
  449. In this implementation, you are not allowed to change a signal handler
  450. while the signal is blocked. */
  451. # if !0
  452. # define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */
  453. # define SIG_SETMASK 1 /* blocked_set = *set; */
  454. # define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */
  455. _GL_FUNCDECL_SYS (sigprocmask, int,
  456. (int operation, const sigset_t *set, sigset_t *old_set));
  457. # endif
  458. _GL_CXXALIAS_SYS (sigprocmask, int,
  459. (int operation, const sigset_t *set, sigset_t *old_set));
  460. _GL_CXXALIASWARN (sigprocmask);
  461. /* Install the handler FUNC for signal SIG, and return the previous
  462. handler. */
  463. # ifdef __cplusplus
  464. extern "C" {
  465. # endif
  466. # if !GNULIB_defined_function_taking_int_returning_void_t
  467. typedef void (*_gl_function_taking_int_returning_void_t) (int);
  468. # define GNULIB_defined_function_taking_int_returning_void_t 1
  469. # endif
  470. # ifdef __cplusplus
  471. }
  472. # endif
  473. # if !0
  474. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  475. # define signal rpl_signal
  476. # endif
  477. _GL_FUNCDECL_RPL (signal, _gl_function_taking_int_returning_void_t,
  478. (int sig, _gl_function_taking_int_returning_void_t func));
  479. _GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t,
  480. (int sig, _gl_function_taking_int_returning_void_t func));
  481. # else
  482. _GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t,
  483. (int sig, _gl_function_taking_int_returning_void_t func));
  484. # endif
  485. _GL_CXXALIASWARN (signal);
  486. /* Raise signal SIG. */
  487. # if !0 && GNULIB_defined_SIGPIPE
  488. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  489. # undef raise
  490. # define raise rpl_raise
  491. # endif
  492. _GL_FUNCDECL_RPL (raise, int, (int sig));
  493. _GL_CXXALIAS_RPL (raise, int, (int sig));
  494. # else
  495. _GL_CXXALIAS_SYS (raise, int, (int sig));
  496. # endif
  497. _GL_CXXALIASWARN (raise);
  498. #elif defined GNULIB_POSIXCHECK
  499. # undef sigaddset
  500. # if HAVE_RAW_DECL_SIGADDSET
  501. _GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - "
  502. "use the gnulib module sigprocmask for portability");
  503. # endif
  504. # undef sigdelset
  505. # if HAVE_RAW_DECL_SIGDELSET
  506. _GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - "
  507. "use the gnulib module sigprocmask for portability");
  508. # endif
  509. # undef sigemptyset
  510. # if HAVE_RAW_DECL_SIGEMPTYSET
  511. _GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - "
  512. "use the gnulib module sigprocmask for portability");
  513. # endif
  514. # undef sigfillset
  515. # if HAVE_RAW_DECL_SIGFILLSET
  516. _GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - "
  517. "use the gnulib module sigprocmask for portability");
  518. # endif
  519. # undef sigismember
  520. # if HAVE_RAW_DECL_SIGISMEMBER
  521. _GL_WARN_ON_USE (sigismember, "sigismember is unportable - "
  522. "use the gnulib module sigprocmask for portability");
  523. # endif
  524. # undef sigpending
  525. # if HAVE_RAW_DECL_SIGPENDING
  526. _GL_WARN_ON_USE (sigpending, "sigpending is unportable - "
  527. "use the gnulib module sigprocmask for portability");
  528. # endif
  529. # undef sigprocmask
  530. # if HAVE_RAW_DECL_SIGPROCMASK
  531. _GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - "
  532. "use the gnulib module sigprocmask for portability");
  533. # endif
  534. #endif /* 1 */
  535. #if 1
  536. # if !0
  537. # if !0
  538. # if !GNULIB_defined_siginfo_types
  539. /* Present to allow compilation, but unsupported by gnulib. */
  540. union sigval
  541. {
  542. int sival_int;
  543. void *sival_ptr;
  544. };
  545. /* Present to allow compilation, but unsupported by gnulib. */
  546. struct siginfo_t
  547. {
  548. int si_signo;
  549. int si_code;
  550. int si_errno;
  551. pid_t si_pid;
  552. uid_t si_uid;
  553. void *si_addr;
  554. int si_status;
  555. long si_band;
  556. union sigval si_value;
  557. };
  558. typedef struct siginfo_t siginfo_t;
  559. # define GNULIB_defined_siginfo_types 1
  560. # endif
  561. # endif /* !0 */
  562. /* We assume that platforms which lack the sigaction() function also lack
  563. the 'struct sigaction' type, and vice versa. */
  564. # if !GNULIB_defined_struct_sigaction
  565. struct sigaction
  566. {
  567. union
  568. {
  569. void (*_sa_handler) (int);
  570. /* Present to allow compilation, but unsupported by gnulib. POSIX
  571. says that implementations may, but not must, make sa_sigaction
  572. overlap with sa_handler, but we know of no implementation where
  573. they do not overlap. */
  574. void (*_sa_sigaction) (int, siginfo_t *, void *);
  575. } _sa_func;
  576. sigset_t sa_mask;
  577. /* Not all POSIX flags are supported. */
  578. int sa_flags;
  579. };
  580. # define sa_handler _sa_func._sa_handler
  581. # define sa_sigaction _sa_func._sa_sigaction
  582. /* Unsupported flags are not present. */
  583. # define SA_RESETHAND 1
  584. # define SA_NODEFER 2
  585. # define SA_RESTART 4
  586. # define GNULIB_defined_struct_sigaction 1
  587. # endif
  588. _GL_FUNCDECL_SYS (sigaction, int, (int, const struct sigaction *restrict,
  589. struct sigaction *restrict));
  590. # elif !1
  591. # define sa_sigaction sa_handler
  592. # endif /* !0, !1 */
  593. _GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict,
  594. struct sigaction *restrict));
  595. _GL_CXXALIASWARN (sigaction);
  596. #elif defined GNULIB_POSIXCHECK
  597. # undef sigaction
  598. # if HAVE_RAW_DECL_SIGACTION
  599. _GL_WARN_ON_USE (sigaction, "sigaction is unportable - "
  600. "use the gnulib module sigaction for portability");
  601. # endif
  602. #endif
  603. /* Some systems don't have SA_NODEFER. */
  604. #ifndef SA_NODEFER
  605. # define SA_NODEFER 0
  606. #endif
  607. #endif /* _GL_SIGNAL_H */
  608. #endif /* _GL_SIGNAL_H */
  609. #endif