Subject: bin/18906: misc. select() to poll() updates.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <roskens@elfin.net>
List: netbsd-bugs
Date: 11/03/2002 14:53:01
>Number: 18906
>Category: bin
>Synopsis: misc. select() to poll() updates.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Nov 03 12:54:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:
>Release: NetBSD-current from 11/2/2002
>Organization:
>Environment:
>Description:
After the conversion from select() to poll() the following files still have comments and/or messages that reference select().
games/hunt/huntd/driver.c
libexec/identd/identd.c
usr.sbin/apmd/apmd.c
usr.sbin/mopd/common/loop-bsd.c
usr.sbin/nfsd/nfsd.c
usr.sbin/pkg_install/lib/ftpio.c
usr.sbin/route6d/route6d.c
usr.sbin/rtadvd/rtadvd.c
usr.sbin/rtsold/rtsold.c
usr.sbin/sushi/run.c
usr.sbin/timed/timed/readmsg.c
usr.sbin/traceroute/traceroute.c
usr.bin/talk/io.c
usr.bin/telnet/sys_bsd.c
usr.bin/telnet/tn3270.c
usr.bin/telnet/utilities.c
usr.bin/tn3270/sys_curses/system.c
usr.bin/top/top.c
>How-To-Repeat:
Inspect code.
>Fix:
--- games/hunt/huntd/driver.c.orig Fri Sep 20 15:54:16 2002
+++ games/hunt/huntd/driver.c Sun Nov 3 13:41:12 2002
@@ -110,9 +110,9 @@
{
if (errno != EINTR)
# ifdef LOG
- syslog(LOG_WARNING, "select: %m");
+ syslog(LOG_WARNING, "poll: %m");
# else
- warn("select");
+ warn("poll");
# endif
errno = 0;
}
@@ -353,7 +353,7 @@
# endif
/*
- * Initialize minimal select mask
+ * Initialize minimal poll struct
*/
fdset[0].fd = Socket;
fdset[0].events = POLLIN;
--- libexec/identd/identd.c.orig Mon Sep 23 07:48:02 2002
+++ libexec/identd/identd.c Sun Nov 3 13:51:31 2002
@@ -699,7 +699,7 @@
} while (nfds < 0 && errno == EINTR);
/*
- ** An error occurred in select? Just die
+ ** An error occurred in poll? Just die
*/
if (nfds < 0)
ERROR("main: poll");
--- usr.sbin/apmd/apmd.c.orig Mon Sep 23 07:44:34 2002
+++ usr.sbin/apmd/apmd.c Sun Nov 3 13:52:58 2002
@@ -527,7 +527,7 @@
}
}
}
- syslog(LOG_ERR, "select failed: %m");
+ syslog(LOG_ERR, "poll failed: %m");
exit(1);
}
--- usr.sbin/mopd/common/loop-bsd.c.orig Fri Sep 20 09:16:03 2002
+++ usr.sbin/mopd/common/loop-bsd.c Sun Nov 3 13:56:50 2002
@@ -93,7 +93,7 @@
/*
* The list of all interfaces that are being listened to. loop()
- * "selects" on the descriptors in this list.
+ * "polls" on the descriptors in this list.
*/
struct if_info *iflist;
@@ -128,7 +128,7 @@
exit(0);
}
/*
- * Find the highest numbered file descriptor for select().
+ * Find the highest numbered file descriptor for poll().
* Initialize the set of descriptors to listen to.
*/
for (ii = iflist, n = 0; ii; ii = ii->next, n++)
--- usr.sbin/nfsd/nfsd.c.orig Tue Sep 24 12:32:03 2002
+++ usr.sbin/nfsd/nfsd.c Sun Nov 3 13:59:05 2002
@@ -729,7 +729,7 @@
*/
for (;;) {
if (poll(set, 4, INFTIM) < 1) {
- syslog(LOG_ERR, "select failed: %m");
+ syslog(LOG_ERR, "poll failed: %m");
exit(1);
}
--- usr.sbin/pkg_install/lib/ftpio.c.orig Sun Oct 27 11:43:04 2002
+++ usr.sbin/pkg_install/lib/ftpio.c Sun Nov 3 14:00:51 2002
@@ -139,12 +139,12 @@
case -1:
if (errno == EINTR)
break;
- warn("expect: select() failed (probably ftp died because of bad args)");
+ warn("expect: poll() failed (probably ftp died because of bad args)");
done = 1;
retval = -1;
break;
case 0:
- warnx("expect: select() timeout");
+ warnx("expect: poll() timeout");
/* need to send ftp coprocess SIGINT to make it stop
* downloading into dir that we'll blow away in a second */
kill(ftp_pid, SIGINT);
--- usr.sbin/route6d/route6d.c.orig Sun Oct 27 11:43:05 2002
+++ usr.sbin/route6d/route6d.c Sun Nov 3 14:03:36 2002
@@ -444,7 +444,7 @@
{
case -1:
if (errno != EINTR) {
- fatal("select");
+ fatal("poll");
/*NOTREACHED*/
}
continue;
--- usr.sbin/rtadvd/rtadvd.c.orig Mon Sep 23 07:48:10 2002
+++ usr.sbin/rtadvd/rtadvd.c Sun Nov 3 14:06:16 2002
@@ -271,7 +271,7 @@
timeout->tv_usec / 1000) : INFTIM)) < 0) {
/* EINTR would occur upon SIGUSR1 for status dump */
if (errno != EINTR)
- syslog(LOG_ERR, "<%s> select: %s",
+ syslog(LOG_ERR, "<%s> poll: %s",
__func__, strerror(errno));
continue;
}
usr.sbin/rtsold/rtsold.c: 810 lines, 18419 characters.
--- usr.sbin/rtsold/rtsold.c.orig Mon Sep 23 07:48:10 2002
+++ usr.sbin/rtsold/rtsold.c Sun Nov 3 14:10:18 2002
@@ -285,7 +285,7 @@
e = poll(set, 2, timeout ? (timeout->tv_sec * 1000 + timeout->tv_usec / 1000) : INFTIM);
if (e < 1) {
if (e < 0 && errno != EINTR) {
- warnmsg(LOG_ERR, __FUNCTION__, "select: %s",
+ warnmsg(LOG_ERR, __FUNCTION__, "poll: %s",
strerror(errno));
}
continue;
--- usr.sbin/sushi/run.c.orig Mon Sep 23 07:48:10 2002
+++ usr.sbin/sushi/run.c Sun Nov 3 14:11:54 2002
@@ -115,7 +115,7 @@
{
int xcor,ycor;
int j, x;
- int selectfailed, multiloop, cols;
+ int pollfailed, multiloop, cols;
int status, master, slave;
struct pollfd set[2];
int dataflow[2];
@@ -227,13 +227,13 @@
set[1].events = POLLIN;
cols = 0;
- for (selectfailed = 0,multiloop=0;;) {
+ for (pollfailed = 0,multiloop=0;;) {
again:
if (multiloop > 10)
goto loop; /* XXX */
- if (selectfailed) {
+ if (pollfailed) {
char *msg = catgets(catalog, 1, 7,
- "select failed but no child died");
+ "poll failed but no child died");
if(logging)
(void)fprintf(logfile, msg);
bailout(msg);
@@ -244,9 +244,9 @@
perror("poll");
if (logging)
(void)fprintf(logfile, "%s: %s\n",
- catgets(catalog, 1, 17, "select failure"),
+ catgets(catalog, 1, 17, "poll failure"),
strerror(errno));
- ++selectfailed;
+ ++pollfailed;
} else {
if (set[1].revents & POLLIN) {
n = read(STDIN_FILENO, ibuf, MAXBUF);
--- usr.sbin/traceroute/traceroute.c.orig Tue Oct 1 00:56:12 2002
+++ usr.sbin/traceroute/traceroute.c Sun Nov 3 14:13:05 2002
@@ -1041,7 +1041,7 @@
retval = poll(set, 1, wait.tv_sec * 1000 + wait.tv_usec / 1000);
if (retval < 0) {
/* If we continue, we probably just flood the remote host. */
- Fprintf(stderr, "%s: select: %s\n", prog, strerror(errno));
+ Fprintf(stderr, "%s: poll: %s\n", prog, strerror(errno));
exit(1);
}
if (retval > 0) {
--- usr.bin/talk/io.c.orig Mon Sep 23 07:48:03 2002
+++ usr.bin/talk/io.c Sun Nov 3 14:13:34 2002
@@ -85,7 +85,7 @@
if (errno == EINTR)
continue;
/* panic, we don't know what happened */
- p_error("Unexpected error from select");
+ p_error("Unexpected error from poll");
quit();
}
if (set[0].revents & POLLIN) {
--- usr.bin/telnet/sys_bsd.c.orig Mon Sep 23 07:48:04 2002
+++ usr.bin/telnet/sys_bsd.c Sun Nov 3 14:14:04 2002
@@ -1024,7 +1024,7 @@
return 0;
# endif /* defined(TN3270) */
/* I don't like this, does it ever happen? */
- printf("sleep(5) from telnet, after select\r\n");
+ printf("sleep(5) from telnet, after poll\r\n");
sleep(5);
}
return 0;
--- usr.bin/telnet/tn3270.c.orig Mon Sep 23 07:48:04 2002
+++ usr.bin/telnet/tn3270.c Sun Nov 3 14:14:54 2002
@@ -200,7 +200,7 @@
* DataToTerminal - queue up some data to go to terminal.
*
* Note: there are people who call us and depend on our processing
- * *all* the data at one time (thus the select).
+ * *all* the data at one time (thus the poll).
*/
int
--- usr.bin/telnet/utilities.c.orig Mon Sep 23 07:48:05 2002
+++ usr.bin/telnet/utilities.c Sun Nov 3 14:15:22 2002
@@ -889,7 +889,7 @@
/* EmptyTerminal - called to make sure that the terminal buffer is empty.
* Note that we consider the buffer to run all the
- * way to the kernel (thus the select).
+ * way to the kernel (thus the poll).
*/
void
--- usr.bin/tn3270/sys_curses/system.c.orig Wed Sep 18 14:54:25 2002
+++ usr.bin/tn3270/sys_curses/system.c Sun Nov 3 14:15:50 2002
@@ -484,7 +484,7 @@
if (errno == EINTR) {
continue;
} else {
- perror("in select waiting for API connection");
+ perror("in poll waiting for API connection");
return -1;
}
} else {
--- usr.bin/top/top.c.orig Mon Sep 23 07:48:05 2002
+++ usr.bin/top/top.c Sun Nov 3 14:17:57 2002
@@ -628,7 +628,7 @@
/* assume valid command unless told otherwise */
no_command = No;
- /* set up arguments for select with timeout */
+ /* set up arguments for poll with timeout */
set[0].fd = 0;
set[0].events = POLLIN;
>Release-Note:
>Audit-Trail:
>Unformatted: