This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New way for syncing with kernel headers


On Fri, Dec 08, 2017 at 02:21:27PM +0100, Florian Weimer wrote:
> Would this be an acceptable way to obtain definitions from the Linux 
> headers in places where namespace cleanliness is not a must?
> 
> /* Obtain the definitions of the MEMBARRIER_CMD_* constants.  */
> 
> #include <linux/version.h>
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
> # include <linux/membarrier.h>
> #else
> 
> /* Definitions from Linux 4.14 follow.  */
> 
> enum membarrier_cmd
> {
>    MEMBARRIER_CMD_QUERY = 0,
>    MEMBARRIER_CMD_SHARED = 1,
>    MEMBARRIER_CMD_PRIVATE_EXPEDITED = 8,
>    MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = 16,
> };
> 
> #endif

Isn't it going to break when userspace uses e.g.
LINUX_VERSION_CODE == KERNEL_VERSION(4, 13, 0)
and includes <linux/membarrier.h> after this header?


-- 
ldv

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]