代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/npth 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From b5ecd8d2c6fdb988f6139c5157c124ebea293bd7 Mon Sep 17 00:00:00 2001
From: NIIBE Yutaka <gniibe@fsij.org>
Date: Wed, 22 Dec 2021 09:52:44 +0900
Subject: [PATCH 1/2] posix: Add npth_poll/npth_ppoll.
* configure.ac: Add checks for poll.h and ppoll.
--
GnuPG-bug-id: 5748
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Signed-off-by: EulerOSWander <314264452@qq.com>
---
configure.ac | 6 ++---
src/npth.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/npth.h.in | 5 +++++
3 files changed, 78 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 3d76661..cf8bb0e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@
# Process this file with autoconf to produce a configure script.
-AC_PREREQ([2.67])
+AC_PREREQ([2.69])
min_automake_version="1.14"
# To build a release you need to create a tag with the version number
@@ -198,7 +198,7 @@ AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
#
# fixme: For what do we need the sys/socket test?
AC_CHECK_HEADERS([sys/socket.h sys/select.h unistd.h sys/time.h time.h \
- signal.h])
+ signal.h poll.h])
INSERT_SYS_SELECT_H=
if test x"$ac_cv_header_sys_select_h" = xyes; then
INSERT_SYS_SELECT_H="include <sys/select.h>"
@@ -277,7 +277,7 @@ if test "$have_w32_system" = no; then
fi
fi
-AC_CHECK_FUNCS([select pselect gettimeofday])
+AC_CHECK_FUNCS([select pselect gettimeofday ppoll])
npth_LIBSOCKET
config_libs="$config_libs $LIBSOCKET"
diff --git a/src/npth.c b/src/npth.c
index 45ca7ee..22314a6 100644
--- a/src/npth.c
+++ b/src/npth.c
@@ -71,6 +71,9 @@ sem_wait (sem_t *sem)
#ifndef HAVE_PSELECT
# include <signal.h>
#endif
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
#include "npth.h"
@@ -675,6 +678,73 @@ npth_pselect(int nfd, fd_set *rfds, fd_set *wfds, fd_set *efds,
}
+int
+npth_poll (struct pollfd *fds, unsigned long nfds, int timeout)
+{
+ int res;
+
+ ENTER();
+#ifdef HAVE_POLL_H
+ res = poll (fds, (nfds_t)nfds, timeout);
+#endif
+ LEAVE();
+ return res;
+}
+
+
+int
+npth_ppoll (struct pollfd *fds, unsigned long nfds,
+ const struct timespec *timeout, const sigset_t *sigmask)
+{
+ int res;
+
+ ENTER();
+#ifdef HAVE_POLL_H
+#ifdef HAVE_PPOLL
+ res = ppoll (fds, (nfds_t)nfds, timeout, sigmask);
+#else /*!HAVE_PPOLL*/
+ {
+# ifdef __GNUC__
+# warning Using a non race free ppoll emulation.
+# endif
+
+ int t;
+
+ if (!timeout)
+ t = -1;
+ else if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000)
+ t = timeout->tv_sec * 1000 + (timeout->tv_nsec + 999999) / 1000000;
+ else
+ {
+ errno = EINVAL;
+ res = -1;
+ goto leave;
+ }
+
+ if (sigmask)
+ {
+ int save_errno;
+ sigset_t savemask;
+
+ pthread_sigmask (SIG_SETMASK, sigmask, &savemask);
+ res = poll (fds, (nfds_t)nfds, timeout);
+ save_errno = errno;
+ pthread_sigmask (SIG_SETMASK, &savemask, NULL);
+ errno = save_errno;
+ }
+ else
+ res = poll (fds, (nfds_t)nfds, timeout);
+
+ leave:
+ ;
+ }
+#endif
+#endif
+ LEAVE();
+ return res;
+}
+
+
ssize_t
npth_read(int fd, void *buf, size_t nbytes)
{
diff --git a/src/npth.h.in b/src/npth.h.in
index 39dcf32..db57935 100644
--- a/src/npth.h.in
+++ b/src/npth.h.in
@@ -345,6 +345,11 @@ ssize_t npth_write(int fd, const void *buf, size_t nbytes);
int npth_recvmsg (int fd, struct msghdr *msg, int flags);
int npth_sendmsg (int fd, const struct msghdr *msg, int flags);
+struct pollfd;
+int npth_poll (struct pollfd *fds, unsigned long nfds, int timeout);
+int npth_ppoll (struct pollfd *fds, unsigned long nfds,
+ const struct timespec *timeout, const sigset_t *sigmask);
+
/* For anything not covered here, you can enter/leave manually at your
own risk. */
void npth_unprotect (void);
--
1.8.3.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。