Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/identd select() -> poll()
details: https://anonhg.NetBSD.org/src/rev/9764808c96c8
branches: trunk
changeset: 536569:9764808c96c8
user: mycroft <mycroft%NetBSD.org@localhost>
date: Wed Sep 18 20:17:55 2002 +0000
description:
select() -> poll()
diffstat:
libexec/identd/identd.c | 36 ++++++++----------------------------
1 files changed, 8 insertions(+), 28 deletions(-)
diffs (89 lines):
diff -r 8b7d645950c8 -r 9764808c96c8 libexec/identd/identd.c
--- a/libexec/identd/identd.c Wed Sep 18 20:04:51 2002 +0000
+++ b/libexec/identd/identd.c Wed Sep 18 20:17:55 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: identd.c,v 1.12 2002/05/26 00:02:07 wiz Exp $ */
+/* $NetBSD: identd.c,v 1.13 2002/09/18 20:17:55 mycroft Exp $ */
/*
** identd.c A TCP/IP link identification protocol server
@@ -41,6 +41,7 @@
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
+#include <sys/poll.h>
#ifndef _AUX_SOURCE
# include <sys/file.h>
#endif
@@ -56,10 +57,6 @@
# include <arpa/inet.h>
#endif
-#ifdef _AIX32
-# include <sys/select.h>
-#endif
-
#if defined(MIPS) || defined(BSD43)
extern int errno;
#endif
@@ -284,9 +281,6 @@
int i, len;
struct sockaddr_in sin;
struct in_addr laddr, faddr;
-#ifndef USE_SIGALARM
- struct timeval tv;
-#endif
int one = 1;
int background_flag = 0;
@@ -652,7 +646,7 @@
if (background_flag)
{
int nfds, fd;
- fd_set read_set;
+ struct pollfd set[1];
struct sockaddr sad;
int sadlen;
@@ -671,6 +665,9 @@
signal(SIGCHLD, child_handler);
#endif
+ set[0].fd = 0;
+ set[0].events = POLLIN;
+
/*
** Loop and dispatch client handling processes
*/
@@ -693,29 +690,12 @@
*/
do
{
- FD_ZERO(&read_set);
- FD_SET(0, &read_set);
-
#ifndef USE_SIGALARM
if (timeout)
- {
- tv.tv_sec = timeout;
- tv.tv_usec = 0;
-#ifdef __hpux
- nfds = select(FD_SETSIZE,
- (int *) &read_set, NULL, NULL, &tv);
-#else
- nfds = select(FD_SETSIZE, &read_set, NULL, NULL, &tv);
-#endif
- }
+ nfds = poll(set, 1, timeout * 1000);
else
#endif
-
-#ifdef __hpux
- nfds = select(FD_SETSIZE, (int *) &read_set, NULL, NULL, NULL);
-#else
- nfds = select(FD_SETSIZE, &read_set, NULL, NULL, NULL);
-#endif
+ nfds = poll(set, 1, INFTIM);
} while (nfds < 0 && errno == EINTR);
/*
Home |
Main Index |
Thread Index |
Old Index