signal.h 27 KB

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