diff options
author | michaelrj-google <71531609+michaelrj-google@users.noreply.github.com> | 2024-01-30 10:07:47 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-30 10:07:47 -0800 |
commit | 9f3854a01f878831c229db0eb5078fa9d56e60ff (patch) | |
tree | 303766f3bbcfb18ae35d27b8efb7ce0bbda2a3b6 /libc/include | |
parent | 69cb99f9cb2e8757ad2c09b87fc96d5bff73c490 (diff) | |
download | llvm-9f3854a01f878831c229db0eb5078fa9d56e60ff.zip llvm-9f3854a01f878831c229db0eb5078fa9d56e60ff.tar.gz llvm-9f3854a01f878831c229db0eb5078fa9d56e60ff.tar.bz2 |
[reland][libc] add epoll_wait functions (#79635)
The epoll_wait functions are syscall wrappers that were requested by
upstream users. This patch adds them, as well as their header and types.
The tests are currently incomplete since they require epoll_create to
properly test epoll_wait. That will be added in a followup patch since
this one is already very large.
Diffstat (limited to 'libc/include')
-rw-r--r-- | libc/include/CMakeLists.txt | 11 | ||||
-rw-r--r-- | libc/include/llvm-libc-types/CMakeLists.txt | 2 | ||||
-rw-r--r-- | libc/include/llvm-libc-types/struct_epoll_data.h | 21 | ||||
-rw-r--r-- | libc/include/llvm-libc-types/struct_epoll_event.h | 19 | ||||
-rw-r--r-- | libc/include/sys/epoll.h.def | 16 |
5 files changed, 69 insertions, 0 deletions
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt index 9474bdd..e315114 100644 --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -342,6 +342,17 @@ add_gen_header( ) add_gen_header( + sys_epoll + DEF_FILE sys/epoll.h.def + GEN_HDR sys/epoll.h + DEPENDS + .llvm_libc_common_h + .llvm-libc-types.struct_epoll_event + .llvm-libc-types.struct_epoll_data + .llvm-libc-types.sigset_t +) + +add_gen_header( sys_ioctl DEF_FILE sys/ioctl.h.def GEN_HDR sys/ioctl.h diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index 500900f..6f004d2 100644 --- a/libc/include/llvm-libc-types/CMakeLists.txt +++ b/libc/include/llvm-libc-types/CMakeLists.txt @@ -96,3 +96,5 @@ add_header(rpc_opcodes_t HDR rpc_opcodes_t.h) add_header(ACTION HDR ACTION.h) add_header(ENTRY HDR ENTRY.h) add_header(struct_hsearch_data HDR struct_hsearch_data.h) +add_header(struct_epoll_event HDR struct_epoll_event.h) +add_header(struct_epoll_data HDR struct_epoll_data.h) diff --git a/libc/include/llvm-libc-types/struct_epoll_data.h b/libc/include/llvm-libc-types/struct_epoll_data.h new file mode 100644 index 0000000..c363171 --- /dev/null +++ b/libc/include/llvm-libc-types/struct_epoll_data.h @@ -0,0 +1,21 @@ +//===-- Definition of epoll_data type -------------------------------------===// +// +// 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_TYPES_EPOLL_DATA_H__ +#define __LLVM_LIBC_TYPES_EPOLL_DATA_H__ + +union epoll_data { + void *ptr; + int fd; + __UINT32_TYPE__ u32; + __UINT64_TYPE__ u64; +}; + +typedef union epoll_data epoll_data_t; + +#endif // __LLVM_LIBC_TYPES_EPOLL_DATA_H__ diff --git a/libc/include/llvm-libc-types/struct_epoll_event.h b/libc/include/llvm-libc-types/struct_epoll_event.h new file mode 100644 index 0000000..edfa026 --- /dev/null +++ b/libc/include/llvm-libc-types/struct_epoll_event.h @@ -0,0 +1,19 @@ +//===-- Definition of epoll_event type ------------------------------------===// +// +// 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_TYPES_EPOLL_EVENT_H__ +#define __LLVM_LIBC_TYPES_EPOLL_EVENT_H__ + +#include <llvm-libc-types/struct_epoll_data.h> + +typedef struct epoll_event { + __UINT32_TYPE__ events; + epoll_data_t data; +} epoll_event; + +#endif // __LLVM_LIBC_TYPES_EPOLL_EVENT_H__ diff --git a/libc/include/sys/epoll.h.def b/libc/include/sys/epoll.h.def new file mode 100644 index 0000000..490fad9 --- /dev/null +++ b/libc/include/sys/epoll.h.def @@ -0,0 +1,16 @@ +//===-- Linux header epoll.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_EPOLL_H +#define LLVM_LIBC_SYS_EPOLL_H + +#include <__llvm-libc-common.h> + +%%public_api() + +#endif // LLVM_LIBC_SYS_EPOLL_H |