diff --git a/libc/config/linux/api.td b/libc/config/linux/api.td --- a/libc/config/linux/api.td +++ b/libc/config/linux/api.td @@ -296,6 +296,13 @@ 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 --- a/libc/config/linux/x86_64/headers.txt +++ b/libc/config/linux/x86_64/headers.txt @@ -29,6 +29,7 @@ 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 --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -347,6 +347,35 @@ .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 --- /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 --- a/libc/spec/posix.td +++ b/libc/spec/posix.td @@ -1205,6 +1205,16 @@ ] >; + 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 @@ SysResource, SysSelect, SysStat, + SysTypes, SysUtsName, SysWait, Time,