[PATCH] Feature test macros overhaul: signal.h (part 3)

Thomas Preudhomme thomas.preudhomme@foss.arm.com
Mon Jun 19 08:29:00 GMT 2017


Ping?

Best regards,

Thomas

On 15/06/17 15:20, Thomas Preudhomme wrote:
> Please find attached a proposed git-format patch fixing both these issues:
>
> Commit 8a3b3bb4d7224d419cc1a4af60ccf7e70edc876b changed the guard on
> some functions from _POSIX_THREADS to __POSIX_VISIBLE. As a consequence,
> some use of siginfo_t and pthread_t became visible under configurations
> where _POSIX_THREADS is unset but __POSIX_VISIBLE is. Build then fails
> because the definition of those types are still unavailable.
>
> This commit make those type definition visible for __POSIX_VISIBLE
> configurations. This requires moving the siginfo_t definition out of the
> RTEMS specific definitions in sys/signal.h while still guarding it
> against cygwin case.
>
> Best regards,
>
> Thomas
>
> On 15/06/17 13:52, Thomas Preudhomme wrote:
>> Actually siginfo_t is also a problem due to sigwaitinfo and sigtimedwait using
>> it, yet it's not defined.
>>
>> Best regards,
>>
>> Thomas
>>
>> On 15/06/17 10:48, Thomas Preudhomme wrote:
>>> Hi,
>>>
>>> This patch makes lots of function using pthread_t type visible when
>>> __POSIX_THREADS is not defined as long as __POSIX_VISIBLE is. However, the guard
>>> in sys/_pthreadtypes.h is still checking against __POSIX_THREADS. This leads to
>>> build failure on arm-none-eabi targets.
>>>
>>> Best regards,
>>>
>>> Thomas
>>>
>>> On 13/06/17 21:00, Yaakov Selkowitz wrote:
>>>> Notably, sigaction and friends are POSIX, but the form of sigpause
>>>> currently provided is BSD.
>>>>
>>>> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
>>>> ---
>>>>  newlib/libc/include/sys/signal.h | 24 ++++++++++++++++--------
>>>>  1 file changed, 16 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/newlib/libc/include/sys/signal.h
>>>> b/newlib/libc/include/sys/signal.h
>>>> index 8d1b53fce..a56f18a1b 100644
>>>> --- a/newlib/libc/include/sys/signal.h
>>>> +++ b/newlib/libc/include/sys/signal.h
>>>> @@ -152,13 +152,15 @@ typedef struct sigaltstack {
>>>>    size_t    ss_size;  /* Stack size.  */
>>>>  } stack_t;
>>>>
>>>> +#if __POSIX_VISIBLE
>>>>  #define SIG_SETMASK 0    /* set mask with sigprocmask() */
>>>>  #define SIG_BLOCK 1    /* set of signals to block */
>>>>  #define SIG_UNBLOCK 2    /* set of signals to, well, unblock */
>>>>
>>>>  int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset));
>>>> +#endif
>>>>
>>>> -#if defined(_POSIX_THREADS)
>>>> +#if __POSIX_VISIBLE >= 199506
>>>>  int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset));
>>>>  #endif
>>>>
>>>> @@ -168,10 +170,14 @@ int _EXFUN(_kill, (pid_t, int));
>>>>  #endif /* _COMPILING_NEWLIB */
>>>>  #endif /* __CYGWIN__ || __rtems__ */
>>>>
>>>> +#if __POSIX_VISIBLE
>>>>  int _EXFUN(kill, (pid_t, int));
>>>> +#endif
>>>>
>>>>  #if __BSD_VISIBLE || __XSI_VISIBLE >= 4
>>>>  int _EXFUN(killpg, (pid_t, int));
>>>> +#endif
>>>> +#if __POSIX_VISIBLE
>>>>  int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *));
>>>>  int _EXFUN(sigaddset, (sigset_t *, const int));
>>>>  int _EXFUN(sigdelset, (sigset_t *, const int));
>>>> @@ -180,7 +186,7 @@ int _EXFUN(sigfillset, (sigset_t *));
>>>>  int _EXFUN(sigemptyset, (sigset_t *));
>>>>  int _EXFUN(sigpending, (sigset_t *));
>>>>  int _EXFUN(sigsuspend, (const sigset_t *));
>>>> -int _EXFUN(sigpause, (int));
>>>> +int _EXFUN(sigwait, (const sigset_t *set, int *sig));
>>>>
>>>>  #if !defined(__CYGWIN__) && !defined(__rtems__)
>>>>  /* These depend upon the type of sigset_t, which right now
>>>> @@ -192,17 +198,21 @@ int _EXFUN(sigpause, (int));
>>>>  #define sigfillset(what)    (*(what) = ~(0), 0)
>>>>  #define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
>>>>  #endif /* !__CYGWIN__ && !__rtems__ */
>>>> -#endif /* __BSD_VISIBLE || __XSI_VISIBLE >= 4 */
>>>> +#endif /* __POSIX_VISIBLE */
>>>> +
>>>> +#if __BSD_VISIBLE
>>>> +int _EXFUN(sigpause, (int));
>>>> +#endif
>>>>
>>>>  #if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
>>>>  int _EXFUN(sigaltstack, (const stack_t *__restrict, stack_t *__restrict));
>>>>  #endif
>>>>
>>>> -#if defined(_POSIX_THREADS)
>>>> +#if __POSIX_VISIBLE >= 199506
>>>>  int _EXFUN(pthread_kill, (pthread_t thread, int sig));
>>>>  #endif
>>>>
>>>> -#if defined(_POSIX_REALTIME_SIGNALS)
>>>> +#if __POSIX_VISIBLE >= 199309
>>>>
>>>>  /*  3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
>>>>      NOTE: P1003.1c/D10, p. 39 adds sigwait().  */
>>>> @@ -211,12 +221,10 @@ int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t
>>>> *info));
>>>>  int _EXFUN(sigtimedwait,
>>>>    (const sigset_t *set, siginfo_t *info, const struct timespec  *timeout)
>>>>  );
>>>> -int _EXFUN(sigwait, (const sigset_t *set, int *sig));
>>>> -
>>>>  /*  3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */
>>>>  int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value));
>>>>
>>>> -#endif /* defined(_POSIX_REALTIME_SIGNALS) */
>>>> +#endif /* __POSIX_VISIBLE >= 199309 */
>>>>
>>>>  #if defined(___AM29K__)
>>>>  /* These all need to be defined for ANSI C, but I don't think they are
>>>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-guard-for-siginfo_t-and-pthread_t-definition.patch
Type: text/x-patch
Size: 3076 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20170619/1b2582f2/attachment.bin>


More information about the Newlib mailing list