New way for syncing with kernel headers
Dmitry V. Levin
ldv@altlinux.org
Fri Dec 8 20:32:00 GMT 2017
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20171208/79eff9f9/attachment.sig>
More information about the Libc-alpha
mailing list