forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc] add remaining epoll functions, pipe (llvm#84587)
The epoll_wait functions need the rest of the epoll functions (create, ctl) to be available to actually test them, as well as pipe to create a usable file descriptor. This patch adds epoll_create, epoll_create1, epoll_ctl, and pipe. These have tests, and the tests for epoll_wait, epoll_pwait, and epoll_pwait2 (currently disabled) are updated to use these newly available functions.
- Loading branch information
1 parent
2f55056
commit 5fb8215
Showing
40 changed files
with
933 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//===-- Definition of macros from signal.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_HDR_SIGNAL_MACROS_H | ||
#define LLVM_LIBC_HDR_SIGNAL_MACROS_H | ||
|
||
#ifdef LIBC_FULL_BUILD | ||
|
||
#include "include/llvm-libc-macros/signal-macros.h" | ||
|
||
#else // Overlay mode | ||
|
||
#include <signal.h> | ||
|
||
#endif // LLVM_LIBC_FULL_BUILD | ||
|
||
#endif // LLVM_LIBC_HDR_SIGNAL_MACROS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//===-- Definition of macros from sys/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_HDR_SYS_EPOLL_MACROS_H | ||
#define LLVM_LIBC_HDR_SYS_EPOLL_MACROS_H | ||
|
||
#ifdef LIBC_FULL_BUILD | ||
|
||
#include "include/llvm-libc-macros/sys-epoll-macros.h" | ||
|
||
#else // Overlay mode | ||
|
||
#include <sys/epoll.h> | ||
|
||
#endif // LLVM_LIBC_FULL_BUILD | ||
|
||
#endif // LLVM_LIBC_HDR_SYS/EPOLL_MACROS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//===-- Macros defined in sys/epoll.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_LINUX_SYS_EPOLL_MACROS_H | ||
#define LLVM_LIBC_MACROS_LINUX_SYS_EPOLL_MACROS_H | ||
|
||
#include "fcntl-macros.h" | ||
|
||
// These are also defined in <linux/eventpoll.h> but that also contains a | ||
// different definition of the epoll_event struct that is different from the | ||
// userspace version. | ||
|
||
#define EPOLL_CLOEXEC O_CLOEXEC | ||
|
||
#define EPOLL_CTL_ADD 1 | ||
#define EPOLL_CTL_DEL 2 | ||
#define EPOLL_CTL_MOD 3 | ||
|
||
#define EPOLLIN 0x1 | ||
#define EPOLLPRI 0x2 | ||
#define EPOLLOUT 0x4 | ||
#define EPOLLERR 0x8 | ||
#define EPOLLHUP 0x10 | ||
#define EPOLLRDNORM 0x40 | ||
#define EPOLLRDBAND 0x80 | ||
#define EPOLLWRNORM 0x100 | ||
#define EPOLLWRBAND 0x200 | ||
#define EPOLLMSG 0x400 | ||
#define EPOLLRDHUP 0x2000 | ||
#define EPOLLEXCLUSIVE 0x10000000 | ||
#define EPOLLWAKEUP 0x20000000 | ||
#define EPOLLONESHOT 0x40000000 | ||
#define EPOLLET 0x80000000 | ||
|
||
#endif // LLVM_LIBC_MACROS_LINUX_SYS_EPOLL_MACROS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//===-- Macros defined in sys/epoll.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_EPOLL_MACROS_H | ||
#define LLVM_LIBC_MACROS_SYS_EPOLL_MACROS_H | ||
|
||
#ifdef __linux__ | ||
#include "linux/sys-epoll-macros.h" | ||
#endif | ||
|
||
#endif // LLVM_LIBC_MACROS_SYS_EPOLL_MACROS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//===-- Implementation header for epoll_create function ---------*- C++ -*-===// | ||
// | ||
// 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_SRC_SYS_EPOLL_EPOLL_CREATE_H | ||
#define LLVM_LIBC_SRC_SYS_EPOLL_EPOLL_CREATE_H | ||
|
||
namespace LIBC_NAMESPACE { | ||
|
||
int epoll_create(int size); | ||
|
||
} // namespace LIBC_NAMESPACE | ||
|
||
#endif // LLVM_LIBC_SRC_SYS_EPOLL_EPOLL_CREATE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//===-- Implementation header for epoll_create1 function --------*- C++ -*-===// | ||
// | ||
// 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_SRC_SYS_EPOLL_EPOLL_CREATE1_H | ||
#define LLVM_LIBC_SRC_SYS_EPOLL_EPOLL_CREATE1_H | ||
|
||
namespace LIBC_NAMESPACE { | ||
|
||
int epoll_create1(int flags); | ||
|
||
} // namespace LIBC_NAMESPACE | ||
|
||
#endif // LLVM_LIBC_SRC_SYS_EPOLL_EPOLL_CREATE1_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//===-- Implementation header for epoll_ctl function ------------*- C++ -*-===// | ||
// | ||
// 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_SRC_SYS_EPOLL_EPOLL_CTL_H | ||
#define LLVM_LIBC_SRC_SYS_EPOLL_EPOLL_CTL_H | ||
|
||
#include "hdr/types/struct_epoll_event.h" | ||
|
||
namespace LIBC_NAMESPACE { | ||
|
||
// TODO: event should be nullable | ||
int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event); | ||
|
||
} // namespace LIBC_NAMESPACE | ||
|
||
#endif // LLVM_LIBC_SRC_SYS_EPOLL_EPOLL_CTL_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.