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