Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want to use CPU_SET, which is a glibc linux-specific macro that should be defined in sched.h The manpage clearly states that _GNU_SOURCE must be defined so that the macro is defined. However, looking at the header, CPU_SET is defined only if __USE_GNU is defined (there is an #ifdef guard). I seem to remember a few years ago that _GNU_SOURCE was needed.

Questions:

1) Clearly the manpage is off. How do I notify the maintainer that the manpage is incorrect?

2) When did the transition from _GNU_SOURCE to __USE_GNU happen (either in terms of version or time)

3) Are there circumstances where newer versions of glibc still use _GNU_SOURCE? Or can I safely assume that defining __USE_GNU is sufficient?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
363 views
Welcome To Ask or Share your Answers For Others

1 Answer

_GNU_SOURCE is the only one you should ever define yourself. __USE_GNU is defined internally through a mechanism in features.h (which is included by all other glibc headers) when _GNU_SOURCE is defined, and possibly under other conditions. Defining or undefining __USE_GNU yourself will badly break the glibc headers.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...