[rtems-libbsd commit] DHCPCD(8): Use select() instead of pselect()

Sebastian Huber sebh at rtems.org
Thu Jan 30 15:35:14 UTC 2014


Module:    rtems-libbsd
Branch:    master
Commit:    e6d558f7ae6aff8a47b689eb290a8a77585359f6
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=e6d558f7ae6aff8a47b689eb290a8a77585359f6

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Dec 17 14:10:37 2013 +0100

DHCPCD(8): Use select() instead of pselect()

---

 dhcpcd/compat/pselect.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/dhcpcd/compat/pselect.c b/dhcpcd/compat/pselect.c
index 8c6d8ed..a18e5b3 100644
--- a/dhcpcd/compat/pselect.c
+++ b/dhcpcd/compat/pselect.c
@@ -27,6 +27,7 @@
 
 #include <sys/time.h>
 #include <sys/types.h>
+#include <sys/select.h>
 
 #include <limits.h>
 #include <poll.h>
@@ -42,6 +43,8 @@ pollts(struct pollfd *restrict fds, nfds_t nfds,
 	fd_set read_fds;
 	nfds_t n;
 	int maxfd, r;
+	struct timeval tv;
+	struct timeval *tvp;
 
 	FD_ZERO(&read_fds);
 	maxfd = 0;
@@ -53,7 +56,14 @@ pollts(struct pollfd *restrict fds, nfds_t nfds,
 		}
 	}
 
-	r = pselect(maxfd + 1, &read_fds, NULL, NULL, ts, sigmask);
+	if (ts != NULL) {
+		TIMESPEC_TO_TIMEVAL(&tv, ts);
+		tvp = &tv;
+	} else {
+		tvp = NULL;
+	}
+
+	r = select(maxfd + 1, &read_fds, NULL, NULL, tvp);
 	if (r > 0) {
 		for (n = 0; n < nfds; n++) {
 			fds[n].revents =




More information about the vc mailing list