Bug 4749 - __USE_GNU should be used for unshare() and clone() in bits/sched.h
Summary: __USE_GNU should be used for unshare() and clone() in bits/sched.h
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-07 09:00 UTC by Michael Kerrisk
Modified: 2014-07-04 16:14 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Kerrisk 2007-07-07 09:00:32 UTC
in bits/sched.h, the macro used to control exposure of unshare() and clone() is
__USE_MISC (i.e., _SVID_SOURCE || _BSD_SOURCE).  Surely this should really be
_GNU_SOURCE, since these APIs are Linux specific.  (I realise that this might
cause source compatibility problems, so perhaps the governing if should then
best be changed:

#if defined(__USE_MISC) || defined (__USE_GNU)

I realised this issue while reviewing the documentation of feature test macros
for the manual pages for these calls.  To date the FTM requirements were not
documented. I plan to document them as _GNU_SOURCE.
Comment 1 Ulrich Drepper 2007-07-07 16:37:43 UTC
> #if defined(__USE_MISC) || defined (__USE_GNU)

This makes no sense.  __USE_MISC is implied in __USE_GNU.  The header is fine.
Comment 2 Michael Kerrisk 2007-07-07 17:00:55 UTC
Agreed -- that last sentence made no sense.  But the first point does.  Why us
__USE_MISC being used to expose Linux-specific definitions?  The correct #ifdef
should be

#ifdef __GNU_SOURCE
Comment 3 Michael Kerrisk 2014-03-11 09:24:44 UTC
Silently fixed as I suggested, in glibc 2.14...