Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorSiva Chandra Reddy <sivachandra@google.com>2022-10-25 01:18:58 +0300
committerSiva Chandra Reddy <sivachandra@google.com>2022-10-25 03:24:49 +0300
commit6faf40bb75cfc97bf3f5168672bf71e906496a46 (patch)
tree67ca56ebe481ea57972f8a18e13ca96c22624fa9 /libc
parent67ad31c88e8b77798f347aff9385f9973ea05798 (diff)
[libc] Add the header sys/types.h.
Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D136642
Diffstat (limited to 'libc')
-rw-r--r--libc/config/linux/api.td7
-rw-r--r--libc/config/linux/x86_64/headers.txt1
-rw-r--r--libc/include/CMakeLists.txt29
-rw-r--r--libc/include/sys/types.h.def16
-rw-r--r--libc/spec/posix.td11
5 files changed, 64 insertions, 0 deletions
diff --git a/libc/config/linux/api.td b/libc/config/linux/api.td
index abccc0f48ed2..dfd2b9adde69 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 a44ea884b902..123fc7ef4328 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 cd00565aa13c..135e659a7468 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -348,6 +348,35 @@ add_gen_header(
)
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
GEN_HDR sys/utsname.h
diff --git a/libc/include/sys/types.h.def b/libc/include/sys/types.h.def
new file mode 100644
index 000000000000..689482973fc7
--- /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 32e411372e4f..e54b48887bef 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,