diff mbox series

[2/3] lapi: Add epoll_pwait_supported() and epoll_pwait2_supported() check

Message ID 20210727124507.28356-3-xieziyao@huawei.com
State Superseded
Headers show
Series epoll_pwait: Add test variants for epoll_pwait2 in epoll_pwait01 | expand

Commit Message

Xie Ziyao July 27, 2021, 12:45 p.m. UTC
Add the function of checking whether epoll_pwait or epoll_pwait2 is supported.

Signed-off-by: Xie Ziyao <xieziyao@huawei.com>
---
 include/lapi/epoll.h | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

--
2.17.1

Comments

Cyril Hrubis July 27, 2021, 2:53 p.m. UTC | #1
Hi!
Looks good.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
diff mbox series

Patch

diff --git a/include/lapi/epoll.h b/include/lapi/epoll.h
index e5b4387f1..fc068ae20 100644
--- a/include/lapi/epoll.h
+++ b/include/lapi/epoll.h
@@ -14,18 +14,32 @@ 
 #define EPOLL_CLOEXEC 02000000
 #endif

+static inline void epoll_pwait_supported(void)
+{
+	/* allow the tests to fail early */
+	tst_syscall(__NR_epoll_pwait);
+}
+
 #ifndef HAVE_EPOLL_PWAIT
-int epoll_pwait(int epfd, struct epoll_event *events, int maxevents,
-		int timeout, const sigset_t *sigmask)
+static inline int epoll_pwait(int epfd, struct epoll_event *events,
+			      int maxevents, int timeout,
+			      const sigset_t *sigmask)
 {
 	return tst_syscall(__NR_epoll_pwait, epfd, events, maxevents,
 			   timeout, sigmask, _NSIG / 8);
 }
 #endif

+static inline void epoll_pwait2_supported(void)
+{
+	/* allow the tests to fail early */
+	tst_syscall(__NR_epoll_pwait2);
+}
+
 #ifndef HAVE_EPOLL_PWAIT2
-int epoll_pwait2(int epfd, struct epoll_event *events, int maxevents,
-		 const struct timespec *timeout, const sigset_t *sigmask)
+static inline int epoll_pwait2(int epfd, struct epoll_event *events,
+			       int maxevents, const struct timespec *timeout,
+			       const sigset_t *sigmask)
 {
 	if (timeout == NULL)
 		return tst_syscall(__NR_epoll_pwait2, epfd, events, maxevents,