[libc-commits] [libc] 3496dd3 - [libc][Obvious] Move some macros definitions to sys/stat.h.
Siva Chandra Reddy via libc-commits
libc-commits at lists.llvm.org
Mon Aug 22 16:20:18 PDT 2022
Author: Siva Chandra Reddy
Date: 2022-08-22T23:19:18Z
New Revision: 3496dd3bb65481bac5f153e9c62af74d6b064827
URL: https://github.com/llvm/llvm-project/commit/3496dd3bb65481bac5f153e9c62af74d6b064827
DIFF: https://github.com/llvm/llvm-project/commit/3496dd3bb65481bac5f153e9c62af74d6b064827.diff
LOG: [libc][Obvious] Move some macros definitions to sys/stat.h.
They were previously incorrectly listed in fcntl.h
Added:
libc/include/llvm-libc-macros/linux/sys-stat-macros.h
libc/include/llvm-libc-macros/sys-stat-macros.h
Modified:
libc/include/CMakeLists.txt
libc/include/llvm-libc-macros/CMakeLists.txt
libc/include/llvm-libc-macros/linux/CMakeLists.txt
libc/include/sys/stat.h.def
Removed:
################################################################################
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 78b4ee18ea0ba..cec90f5c9171b 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -208,6 +208,7 @@ add_gen_header(
GEN_HDR sys/stat.h
DEPENDS
.llvm_libc_common_h
+ .llvm-libc-macros.sys_stat_macros
.llvm-libc-types.mode_t
)
diff --git a/libc/include/llvm-libc-macros/CMakeLists.txt b/libc/include/llvm-libc-macros/CMakeLists.txt
index f583a915e6995..e1907694e52ab 100644
--- a/libc/include/llvm-libc-macros/CMakeLists.txt
+++ b/libc/include/llvm-libc-macros/CMakeLists.txt
@@ -13,3 +13,11 @@ add_header(
HDR
file-seek-macros.h
)
+
+add_header(
+ sys_stat_macros
+ HDR
+ sys-stat-macros.h
+ DEPENDS
+ .linux.sys_stat_macros
+)
diff --git a/libc/include/llvm-libc-macros/linux/CMakeLists.txt b/libc/include/llvm-libc-macros/linux/CMakeLists.txt
index bc06a8f6f48d9..09b9ba2199d45 100644
--- a/libc/include/llvm-libc-macros/linux/CMakeLists.txt
+++ b/libc/include/llvm-libc-macros/linux/CMakeLists.txt
@@ -3,3 +3,9 @@ add_header(
HDR
fcntl-macros.h
)
+
+add_header(
+ sys_stat_macros
+ HDR
+ sys-stat-macros.h
+)
diff --git a/libc/include/llvm-libc-macros/linux/sys-stat-macros.h b/libc/include/llvm-libc-macros/linux/sys-stat-macros.h
new file mode 100644
index 0000000000000..59f29e80a31ab
--- /dev/null
+++ b/libc/include/llvm-libc-macros/linux/sys-stat-macros.h
@@ -0,0 +1,28 @@
+//===-- Definition of macros from sys/stat.h ------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
+#define __LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
+
+// File mode flags
+#define S_IRWXU 0700
+#define S_IRUSR 0400
+#define S_IWUSR 0200
+#define S_IXUSR 0100
+#define S_IRWXG 070
+#define S_IRGRP 040
+#define S_IWGRP 020
+#define S_IXGRP 010
+#define S_IRWXO 07
+#define S_IROTH 04
+#define S_IWOTH 02
+#define S_IXOTH 01
+#define S_ISUID 04000
+#define S_ISGID 02000
+
+#endif // __LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
diff --git a/libc/include/llvm-libc-macros/sys-stat-macros.h b/libc/include/llvm-libc-macros/sys-stat-macros.h
new file mode 100644
index 0000000000000..c09b489b58567
--- /dev/null
+++ b/libc/include/llvm-libc-macros/sys-stat-macros.h
@@ -0,0 +1,16 @@
+//===-- Macros defined in sys/stat.h header file --------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __LLVM_LIBC_MACROS_SYS_STAT_MACROS_H
+#define __LLVM_LIBC_MACROS_SYS_STAT_MACROS_H
+
+#ifdef __unix__
+#include "linux/sys-stat-macros.h"
+#endif
+
+#endif // __LLVM_LIBC_MACROS_SYS_STAT_MACROS_H
diff --git a/libc/include/sys/stat.h.def b/libc/include/sys/stat.h.def
index f925208d8db13..ed37d010f497d 100644
--- a/libc/include/sys/stat.h.def
+++ b/libc/include/sys/stat.h.def
@@ -11,6 +11,8 @@
#include <__llvm-libc-common.h>
+#include <llvm-libc-macros/sys-stat-macros.h>
+
%%public_api()
#endif // LLVM_LIBC_SYS_STAT_H
More information about the libc-commits
mailing list