* [LTP] [PATCH 1/1] lapi/fsmount.h: Fix headers conflict
@ 2024-01-05 0:17 Petr Vorel
2024-01-05 0:29 ` Petr Vorel
0 siblings, 1 reply; 2+ messages in thread
From: Petr Vorel @ 2024-01-05 0:17 UTC (permalink / raw)
To: ltp
glibc doc [1] mentions conflict between <linux/mount.h> and
<sys/mount.h>. Because <linux/fs.h> includes <linux/mount.h> it's easy
to get <linux/mount.h> mounted indirectly.
Problem was fixed on glibc 2.37:
774058d729 ("linux: Fix sys/mount.h usage with kernel headers")
and it got backported to git tree for 2.36 and to some distros.
But it still fails for older glibc.
Therefore include <sys/mount.h> only if <linux/mount.h> not already
included.
[1] https://sourceware.org/glibc/wiki/Synchronizing_Headers
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Tested:
https://github.com/pevik/ltp/actions/runs/7416306243
vs. failures on Cyril's tst_fd iterator patchset which would be affected
by this
https://github.com/pevik/ltp/actions/runs/7415994730
Kind regards,
Petr
include/lapi/fsmount.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/lapi/fsmount.h b/include/lapi/fsmount.h
index 07eb42ffa..da3cdf3c2 100644
--- a/include/lapi/fsmount.h
+++ b/include/lapi/fsmount.h
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Linux Test Project, 2021-2022
+ * Copyright (c) Linux Test Project, 2021-2024
* Copyright (c) 2020 Linaro Limited. All rights reserved.
* Author: Viresh Kumar <viresh.kumar@linaro.org>
*/
@@ -11,12 +11,13 @@
#include "config.h"
#include <sys/syscall.h>
#include <sys/types.h>
-#include <sys/mount.h>
#ifndef HAVE_FSOPEN
# ifdef HAVE_LINUX_MOUNT_H
# include <linux/mount.h>
# endif
+#elif !defined(HAVE_LINUX_MOUNT_H)
+# include <sys/mount.h>
#endif
#include "lapi/fcntl.h"
--
2.43.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH 1/1] lapi/fsmount.h: Fix headers conflict
2024-01-05 0:17 [LTP] [PATCH 1/1] lapi/fsmount.h: Fix headers conflict Petr Vorel
@ 2024-01-05 0:29 ` Petr Vorel
0 siblings, 0 replies; 2+ messages in thread
From: Petr Vorel @ 2024-01-05 0:29 UTC (permalink / raw)
To: ltp
Hi,
I'm sorry, this is broken, fixed v2 is sent.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-05 0:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-05 0:17 [LTP] [PATCH 1/1] lapi/fsmount.h: Fix headers conflict Petr Vorel
2024-01-05 0:29 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox