Skip to content

Commit e241964

Browse files
[libc] Fix macro definition hermeticity (#114467)
Previously shm_test was including <asm-generic/fcntl.h> for the macro FD_CLOEXEC. This patch adds that macro to the list we have defined, and redirects the test to use the correct proxy header.
1 parent aa70d84 commit e241964

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

libc/include/llvm-libc-macros/linux/fcntl-macros.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@
8888
// Close on succesful
8989
#define F_CLOEXEC 1
9090

91+
// Close on execute for fcntl.
92+
#define FD_CLOEXEC 1
93+
9194
#define F_RDLCK 0
9295
#define F_WRLCK 1
9396
#define F_UNLCK 2

libc/test/src/sys/mman/linux/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,6 @@ add_libc_unittest(
163163
libc.src.unistd.ftruncate
164164
libc.src.unistd.close
165165
libc.src.__support.OSUtil.osutil
166+
libc.hdr.fcntl_macros
166167
libc.test.UnitTest.ErrnoSetterMatcher
167168
)

libc/test/src/sys/mman/linux/shm_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "hdr/fcntl_macros.h"
910
#include "src/__support/OSUtil/syscall.h"
1011
#include "src/fcntl/fcntl.h"
1112
#include "src/sys/mman/mmap.h"
@@ -16,7 +17,6 @@
1617
#include "src/unistd/ftruncate.h"
1718
#include "test/UnitTest/ErrnoSetterMatcher.h"
1819
#include "test/UnitTest/LibcTest.h"
19-
#include <asm-generic/fcntl.h>
2020
#include <sys/syscall.h>
2121

2222
using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;

0 commit comments

Comments
 (0)