X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsignal.in.h;h=e18e0b29832c089648fb9d140b3f582ebd787dcf;hb=4f6a7ef5f2097b501ddeac9db94d02306e4546d0;hp=036e4f2deb35368d3a2305f182446769b84dcc16;hpb=fa6f00004c5ea9f4b341a7c60db177a7419f06aa;p=gnulib.git diff --git a/lib/signal.in.h b/lib/signal.in.h index 036e4f2de..e18e0b298 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -20,21 +20,49 @@ #endif @PRAGMA_COLUMNS@ -#if defined __need_sig_atomic_t || defined __need_sigset_t -/* Special invocation convention inside glibc header files. */ +#if defined __need_sig_atomic_t || defined __need_sigset_t || defined _GL_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T) +/* Special invocation convention: + - Inside glibc header files. + - On glibc systems we have a sequence of nested includes + -> -> . + In this situation, the functions are not yet declared, therefore we cannot + provide the C++ aliases. + - On glibc systems with GCC 4.3 we have a sequence of nested includes + -> -> -> . + In this situation, some of the functions are not yet declared, therefore + we cannot provide the C++ aliases. */ # @INCLUDE_NEXT@ @NEXT_SIGNAL_H@ #else /* Normal invocation convention. */ -#ifndef _GL_SIGNAL_H +#ifndef _@GUARD_PREFIX@_SIGNAL_H + +#define _GL_ALREADY_INCLUDING_SIGNAL_H + +/* Define pid_t, uid_t. + Also, mingw defines sigset_t not in , but in . + On Solaris 10, includes , which eventually includes + us; so include now, before the second inclusion guard. */ +#include /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_SIGNAL_H@ -#ifndef _GL_SIGNAL_H -#define _GL_SIGNAL_H +#undef _GL_ALREADY_INCLUDING_SIGNAL_H + +#ifndef _@GUARD_PREFIX@_SIGNAL_H +#define _@GUARD_PREFIX@_SIGNAL_H + +/* MacOS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6 declare + pthread_sigmask in , not in . + But avoid namespace pollution on glibc systems.*/ +#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \ + && ((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ || defined __sun) \ + && ! defined __GLIBC__ +# include +#endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -42,10 +70,6 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ -/* Define pid_t, uid_t. - Also, mingw defines sigset_t not in , but in . */ -#include - /* On AIX, sig_atomic_t already includes volatile. C99 requires that 'volatile sig_atomic_t' ignore the extra modifier, but C89 did not. Hence, redefine this to a non-volatile type as needed. */ @@ -100,9 +124,64 @@ typedef void (*sighandler_t) (int); #endif +#if @GNULIB_PTHREAD_SIGMASK@ +# if @REPLACE_PTHREAD_SIGMASK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_sigmask +# define pthread_sigmask rpl_pthread_sigmask +# endif +_GL_FUNCDECL_RPL (pthread_sigmask, int, + (int how, const sigset_t *new_mask, sigset_t *old_mask)); +_GL_CXXALIAS_RPL (pthread_sigmask, int, + (int how, const sigset_t *new_mask, sigset_t *old_mask)); +# else +# if !@HAVE_PTHREAD_SIGMASK@ +_GL_FUNCDECL_SYS (pthread_sigmask, int, + (int how, const sigset_t *new_mask, sigset_t *old_mask)); +# endif +_GL_CXXALIAS_SYS (pthread_sigmask, int, + (int how, const sigset_t *new_mask, sigset_t *old_mask)); +# endif +_GL_CXXALIASWARN (pthread_sigmask); +#elif defined GNULIB_POSIXCHECK +# undef pthread_sigmask +# if HAVE_RAW_DECL_PTHREAD_SIGMASK +_GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - " + "use gnulib module pthread_sigmask for portability"); +# endif +#endif + + +#if @GNULIB_RAISE@ +# if @REPLACE_RAISE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef raise +# define raise rpl_raise +# endif +_GL_FUNCDECL_RPL (raise, int, (int sig)); +_GL_CXXALIAS_RPL (raise, int, (int sig)); +# else +# if !@HAVE_RAISE@ +_GL_FUNCDECL_SYS (raise, int, (int sig)); +# endif +_GL_CXXALIAS_SYS (raise, int, (int sig)); +# endif +_GL_CXXALIASWARN (raise); +#elif defined GNULIB_POSIXCHECK +# undef raise +/* Assume raise is always declared. */ +_GL_WARN_ON_USE (raise, "raise can crash on native Windows - " + "use gnulib module raise for portability"); +#endif + + #if @GNULIB_SIGPROCMASK@ # if !@HAVE_POSIX_SIGNALBLOCKING@ +# ifndef GNULIB_defined_signal_blocking +# define GNULIB_defined_signal_blocking 1 +# endif + /* Maximum signal number + 1. */ # ifndef NSIG # define NSIG 32 @@ -228,18 +307,10 @@ _GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t, # endif _GL_CXXALIASWARN (signal); -/* Raise signal SIG. */ # if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef raise -# define raise rpl_raise -# endif -_GL_FUNCDECL_RPL (raise, int, (int sig)); -_GL_CXXALIAS_RPL (raise, int, (int sig)); -# else -_GL_CXXALIAS_SYS (raise, int, (int sig)); +/* Raise signal SIGPIPE. */ +_GL_EXTERN_C int _gl_raise_SIGPIPE (void); # endif -_GL_CXXALIASWARN (raise); #elif defined GNULIB_POSIXCHECK # undef sigaddset @@ -371,6 +442,6 @@ _GL_WARN_ON_USE (sigaction, "sigaction is unportable - " #endif -#endif /* _GL_SIGNAL_H */ -#endif /* _GL_SIGNAL_H */ +#endif /* _@GUARD_PREFIX@_SIGNAL_H */ +#endif /* _@GUARD_PREFIX@_SIGNAL_H */ #endif