[libc-commits] [libc] 6faf40b - [libc] Add the header sys/types.h.
Siva Chandra Reddy via libc-commits
libc-commits at lists.llvm.org
Mon Oct 24 17:24:57 PDT 2022
Author: Siva Chandra Reddy
Date: 2022-10-25T00:24:49Z
New Revision: 6faf40bb75cfc97bf3f5168672bf71e906496a46
URL: https://github.com/llvm/llvm-project/commit/6faf40bb75cfc97bf3f5168672bf71e906496a46
DIFF: https://github.com/llvm/llvm-project/commit/6faf40bb75cfc97bf3f5168672bf71e906496a46.diff
LOG: [libc] Add the header sys/types.h.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D136642
Added:
libc/include/sys/types.h.def
Modified:
libc/config/linux/api.td
libc/config/linux/x86_64/headers.txt
libc/include/CMakeLists.txt
libc/spec/posix.td
Removed:
################################################################################
diff --git a/libc/config/linux/api.td b/libc/config/linux/api.td
index abccc0f48ed2b..dfd2b9adde693 100644
--- a/libc/config/linux/api.td
+++ b/libc/config/linux/api.td
@@ -296,6 +296,13 @@ def SysSendfileAPI : PublicAPI<"sys/sendfile.h"> {
let Types = ["off_t", "size_t", "ssize_t"];
}
+def SysTypesAPI : PublicAPI<"sys/types.h"> {
+ let Types = ["blkcnt_t", "blksize_t", "clockid_t", "dev_t", "gid_t", "ino_t",
+ "mode_t", "nlink_t", "off_t", "pid_t", "pthread_attr_t", "pthread_key_t",
+ "pthread_mutex_t", "pthread_mutexattr_t", "pthread_once_t", "pthread_t",
+ "size_t", "ssize_t", "suseconds_t", "time_t", "uid_t"];
+}
+
def SysUtsNameAPI : PublicAPI<"sys/utsname.h"> {
let Types = ["struct utsname"];
}
diff --git a/libc/config/linux/x86_64/headers.txt b/libc/config/linux/x86_64/headers.txt
index a44ea884b9028..123fc7ef43286 100644
--- a/libc/config/linux/x86_64/headers.txt
+++ b/libc/config/linux/x86_64/headers.txt
@@ -29,6 +29,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.sys_stat
libc.include.sys_syscall
libc.include.sys_time
+ libc.include.sys_types
libc.include.sys_utsname
libc.include.sys_wait
)
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index cd00565aa13cb..135e659a74684 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -347,6 +347,35 @@ add_gen_header(
.llvm-libc-macros.sys_time_macros
)
+add_gen_header(
+ sys_types
+ DEF_FILE sys/types.h.def
+ GEN_HDR sys/types.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.blkcnt_t
+ .llvm-libc-types.blksize_t
+ .llvm-libc-types.clockid_t
+ .llvm-libc-types.dev_t
+ .llvm-libc-types.gid_t
+ .llvm-libc-types.ino_t
+ .llvm-libc-types.mode_t
+ .llvm-libc-types.nlink_t
+ .llvm-libc-types.off_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.pthread_attr_t
+ .llvm-libc-types.pthread_key_t
+ .llvm-libc-types.pthread_mutex_t
+ .llvm-libc-types.pthread_mutexattr_t
+ .llvm-libc-types.pthread_once_t
+ .llvm-libc-types.pthread_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ .llvm-libc-types.suseconds_t
+ .llvm-libc-types.time_t
+ .llvm-libc-types.uid_t
+)
+
add_gen_header(
sys_utsname
DEF_FILE sys/utsname.h.def
diff --git a/libc/include/sys/types.h.def b/libc/include/sys/types.h.def
new file mode 100644
index 0000000000000..689482973fc7a
--- /dev/null
+++ b/libc/include/sys/types.h.def
@@ -0,0 +1,16 @@
+//===-- Header for sys/types.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_SYS_TYPES_H
+#define LLVM_LIBC_SYS_TYPES_H
+
+#include <__llvm-libc-common.h>
+
+%%public_api()
+
+#endif // LLVM_LIBC_SYS_TYPES_H
diff --git a/libc/spec/posix.td b/libc/spec/posix.td
index 32e411372e4f4..e54b48887bef4 100644
--- a/libc/spec/posix.td
+++ b/libc/spec/posix.td
@@ -1205,6 +1205,16 @@ def POSIX : StandardSpec<"POSIX"> {
]
>;
+ HeaderSpec SysTypes = HeaderSpec<
+ "sys/types.h",
+ [], // Macros
+ [BlkCntT, BlkSizeT, ClockIdT, DevT, GidT, InoT, ModeTType, NLinkT, OffTType, PidT,
+ PThreadAttrTType, PThreadKeyT, PThreadMutexTType, PThreadMutexAttrTType, PThreadOnceT, PThreadTType,
+ SizeTType, SSizeTType, SuSecondsT, TimeTType, UidT],
+ [], // Enumerations
+ [] // Functions
+ >;
+
let Headers = [
CType,
Dirent,
@@ -1220,6 +1230,7 @@ def POSIX : StandardSpec<"POSIX"> {
SysResource,
SysSelect,
SysStat,
+ SysTypes,
SysUtsName,
SysWait,
Time,
More information about the libc-commits
mailing list