Skip to content

Commit 8192bc0

Browse files
edliawakpm00
authored andcommitted
selftests/mm: guard defines from shm
thuge-gen.c defines SHM_HUGE_* macros that are provided by the uapi since 4.14. These macros get redefined when compiling with Android's bionic because its sys/shm.h will import the uapi definitions. However if linux/shm.h is included, with glibc, sys/shm.h will clash on some struct definitions: /usr/include/linux/shm.h:26:8: error: redefinition of ‘struct shmid_ds’ 26 | struct shmid_ds { | ^~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/bits/shm.h:45, from /usr/include/x86_64-linux-gnu/sys/shm.h:30: /usr/include/x86_64-linux-gnu/bits/types/struct_shmid_ds.h:24:8: note: originally defined here 24 | struct shmid_ds | ^~~~~~~~ For now, guard the SHM_HUGE_* defines with ifndef to prevent redefinition warnings on Android bionic. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Edward Liaw <[email protected]> Reviewed-by: Carlos Llamas <[email protected]> Reviewed-by: Muhammad Usama Anjum <[email protected]> Cc: Bill Wendling <[email protected]> Cc: Carlos Llamas <[email protected]> Cc: Justin Stitt <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 05f3f75 commit 8192bc0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/testing/selftests/mm/thuge-gen.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,18 @@
3434
#endif
3535

3636
#define SHM_HUGETLB 04000 /* segment will use huge TLB pages */
37+
#ifndef SHM_HUGE_SHIFT
3738
#define SHM_HUGE_SHIFT 26
39+
#endif
40+
#ifndef SHM_HUGE_MASK
3841
#define SHM_HUGE_MASK 0x3f
42+
#endif
43+
#ifndef SHM_HUGE_2MB
3944
#define SHM_HUGE_2MB (21 << SHM_HUGE_SHIFT)
45+
#endif
46+
#ifndef SHM_HUGE_1GB
4047
#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT)
48+
#endif
4149

4250
#define NUM_PAGESIZES 5
4351
#define NUM_PAGES 4

0 commit comments

Comments
 (0)