Bug 4749

Summary: __USE_GNU should be used for unshare() and clone() in bits/sched.h
Product: glibc Reporter: Michael Kerrisk <michael.kerrisk>
Component: libcAssignee: Ulrich Drepper <drepper.fsp>
Status: RESOLVED FIXED    
Severity: normal CC: glibc-bugs, mtk.manpages, neleai
Priority: P2 Flags: fweimer: security-
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

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...