PR/18906: roskens at elfin dot net: misc. select() to poll() updates.

Adapted to -current by myself, thanks for the patch!
This commit is contained in:
elad 2006-10-07 17:27:57 +00:00
parent 007b992d97
commit 1232ea27c4
13 changed files with 39 additions and 39 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: driver.c,v 1.11 2006/05/09 20:18:06 mrg Exp $ */ /* $NetBSD: driver.c,v 1.12 2006/10/07 17:27:57 elad Exp $ */
/* /*
* Copyright (c) 1983-2003, Regents of the University of California. * Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: driver.c,v 1.11 2006/05/09 20:18:06 mrg Exp $"); __RCSID("$NetBSD: driver.c,v 1.12 2006/10/07 17:27:57 elad Exp $");
#endif /* not lint */ #endif /* not lint */
# include <sys/ioctl.h> # include <sys/ioctl.h>
@ -135,9 +135,9 @@ again:
{ {
if (errno != EINTR) if (errno != EINTR)
# ifdef LOG # ifdef LOG
syslog(LOG_WARNING, "select: %m"); syslog(LOG_WARNING, "poll: %m");
# else # else
warn("select"); warn("poll");
# endif # endif
errno = 0; errno = 0;
} }
@ -378,7 +378,7 @@ init()
# endif # endif
/* /*
* Initialize minimal select mask * Initialize minimal poll mask
*/ */
fdset[0].fd = Socket; fdset[0].fd = Socket;
fdset[0].events = POLLIN; fdset[0].events = POLLIN;

View File

@ -1,4 +1,4 @@
/* $NetBSD: io.c,v 1.11 2006/03/18 03:40:51 ginsbach Exp $ */ /* $NetBSD: io.c,v 1.12 2006/10/07 17:27:57 elad Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93"; static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93";
#endif #endif
__RCSID("$NetBSD: io.c,v 1.11 2006/03/18 03:40:51 ginsbach Exp $"); __RCSID("$NetBSD: io.c,v 1.12 2006/10/07 17:27:57 elad Exp $");
#endif /* not lint */ #endif /* not lint */
/* /*
@ -81,7 +81,7 @@ talk()
if (errno == EINTR) if (errno == EINTR)
continue; continue;
/* panic, we don't know what happened */ /* panic, we don't know what happened */
p_error("Unexpected error from select"); p_error("Unexpected error from poll");
quit(); quit();
} }
if (set[0].revents & POLLIN) { if (set[0].revents & POLLIN) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: tn3270.c,v 1.21 2003/08/07 11:16:12 agc Exp $ */ /* $NetBSD: tn3270.c,v 1.22 2006/10/07 17:27:57 elad Exp $ */
/* /*
* Copyright (c) 1988, 1993 * Copyright (c) 1988, 1993
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)tn3270.c 8.2 (Berkeley) 5/30/95"; static char sccsid[] = "@(#)tn3270.c 8.2 (Berkeley) 5/30/95";
#else #else
__RCSID("$NetBSD: tn3270.c,v 1.21 2003/08/07 11:16:12 agc Exp $"); __RCSID("$NetBSD: tn3270.c,v 1.22 2006/10/07 17:27:57 elad Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -186,7 +186,7 @@ outputPurge(void)
* DataToTerminal - queue up some data to go to terminal. * DataToTerminal - queue up some data to go to terminal.
* *
* Note: there are people who call us and depend on our processing * 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 int

View File

@ -1,4 +1,4 @@
/* $NetBSD: utilities.c,v 1.21 2005/02/06 20:39:35 dsl Exp $ */ /* $NetBSD: utilities.c,v 1.22 2006/10/07 17:27:57 elad Exp $ */
/* /*
* Copyright (c) 1988, 1993 * Copyright (c) 1988, 1993
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)utilities.c 8.3 (Berkeley) 5/30/95"; static char sccsid[] = "@(#)utilities.c 8.3 (Berkeley) 5/30/95";
#else #else
__RCSID("$NetBSD: utilities.c,v 1.21 2005/02/06 20:39:35 dsl Exp $"); __RCSID("$NetBSD: utilities.c,v 1.22 2006/10/07 17:27:57 elad Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -860,7 +860,7 @@ printsub(
/* EmptyTerminal - called to make sure that the terminal buffer is empty. /* EmptyTerminal - called to make sure that the terminal buffer is empty.
* Note that we consider the buffer to run all the * 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 void

View File

@ -1,4 +1,4 @@
/* $NetBSD: system.c,v 1.20 2006/05/11 00:27:27 mrg Exp $ */ /* $NetBSD: system.c,v 1.21 2006/10/07 17:27:57 elad Exp $ */
/*- /*-
* Copyright (c) 1988 The Regents of the University of California. * Copyright (c) 1988 The Regents of the University of California.
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)system.c 4.5 (Berkeley) 4/26/91"; static char sccsid[] = "@(#)system.c 4.5 (Berkeley) 4/26/91";
#else #else
__RCSID("$NetBSD: system.c,v 1.20 2006/05/11 00:27:27 mrg Exp $"); __RCSID("$NetBSD: system.c,v 1.21 2006/10/07 17:27:57 elad Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -479,7 +479,7 @@ doconnect()
if (errno == EINTR) { if (errno == EINTR) {
continue; continue;
} else { } else {
perror("in select waiting for API connection"); perror("in poll waiting for API connection");
return -1; return -1;
} }
} else { } else {

View File

@ -1,4 +1,4 @@
/* $NetBSD: top.c,v 1.23 2005/10/03 05:34:51 christos Exp $ */ /* $NetBSD: top.c,v 1.24 2006/10/07 17:27:57 elad Exp $ */
const char copyright[] = "Copyright (c) 1984 through 1996, William LeFebvre"; const char copyright[] = "Copyright (c) 1984 through 1996, William LeFebvre";
@ -49,7 +49,7 @@ const char copyright[] = "Copyright (c) 1984 through 1996, William LeFebvre";
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: top.c,v 1.23 2005/10/03 05:34:51 christos Exp $"); __RCSID("$NetBSD: top.c,v 1.24 2006/10/07 17:27:57 elad Exp $");
#endif #endif
#include "os.h" #include "os.h"
@ -626,7 +626,7 @@ Usage: %s [-bIinqSuv] [-d count] [-o field] [-s time] [-U username] [number]\n",
/* assume valid command unless told otherwise */ /* assume valid command unless told otherwise */
no_command = No; no_command = No;
/* set up arguments for select with timeout */ /* set up arguments for poll with timeout */
set[0].fd = 0; set[0].fd = 0;
set[0].events = POLLIN; set[0].events = POLLIN;

View File

@ -1,4 +1,4 @@
/* $NetBSD: apmd.c,v 1.29 2006/05/09 20:18:09 mrg Exp $ */ /* $NetBSD: apmd.c,v 1.30 2006/10/07 17:27:57 elad Exp $ */
/*- /*-
* Copyright (c) 1996, 2000 The NetBSD Foundation, Inc. * Copyright (c) 1996, 2000 The NetBSD Foundation, Inc.
@ -526,7 +526,7 @@ main(int argc, char *argv[])
} }
} }
} }
syslog(LOG_ERR, "select failed: %m"); syslog(LOG_ERR, "poll failed: %m");
exit(1); exit(1);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: loop-bsd.c,v 1.8 2006/05/25 00:27:56 christos Exp $ */ /* $NetBSD: loop-bsd.c,v 1.9 2006/10/07 17:27:57 elad Exp $ */
/* /*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved. * Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -31,7 +31,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: loop-bsd.c,v 1.8 2006/05/25 00:27:56 christos Exp $"); __RCSID("$NetBSD: loop-bsd.c,v 1.9 2006/10/07 17:27:57 elad Exp $");
#endif #endif
#include <errno.h> #include <errno.h>
@ -94,7 +94,7 @@ mopReadDL()
/* /*
* The list of all interfaces that are being listened to. loop() * 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; struct if_info *iflist;
@ -124,7 +124,7 @@ Loop()
if (buf == 0) if (buf == 0)
mopLogErr("malloc"); mopLogErr("malloc");
/* /*
* Find the highest numbered file descriptor for select(). * Find the highest numbered file descriptor for poll().
* Initialize the set of descriptors to listen to. * Initialize the set of descriptors to listen to.
*/ */
for (ii = iflist, n = 0; ii; ii = ii->next, n++) for (ii = iflist, n = 0; ii; ii = ii->next, n++)

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfsd.c,v 1.48 2006/08/25 11:59:30 hubertf Exp $ */ /* $NetBSD: nfsd.c,v 1.49 2006/10/07 17:27:57 elad Exp $ */
/* /*
* Copyright (c) 1989, 1993, 1994 * Copyright (c) 1989, 1993, 1994
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\n\
#if 0 #if 0
static char sccsid[] = "@(#)nfsd.c 8.9 (Berkeley) 3/29/95"; static char sccsid[] = "@(#)nfsd.c 8.9 (Berkeley) 3/29/95";
#else #else
__RCSID("$NetBSD: nfsd.c,v 1.48 2006/08/25 11:59:30 hubertf Exp $"); __RCSID("$NetBSD: nfsd.c,v 1.49 2006/10/07 17:27:57 elad Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -615,7 +615,7 @@ main(argc, argv)
*/ */
for (;;) { for (;;) {
if (poll(set, 4, INFTIM) < 1) { if (poll(set, 4, INFTIM) < 1) {
syslog(LOG_ERR, "select failed: %m"); syslog(LOG_ERR, "poll failed: %m");
exit(1); exit(1);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: route6d.c,v 1.58 2006/05/25 02:40:58 rpaulo Exp $ */ /* $NetBSD: route6d.c,v 1.59 2006/10/07 17:27:57 elad Exp $ */
/* $KAME: route6d.c,v 1.94 2002/10/26 20:08:55 itojun Exp $ */ /* $KAME: route6d.c,v 1.94 2002/10/26 20:08:55 itojun Exp $ */
/* /*
@ -32,7 +32,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: route6d.c,v 1.58 2006/05/25 02:40:58 rpaulo Exp $"); __RCSID("$NetBSD: route6d.c,v 1.59 2006/10/07 17:27:57 elad Exp $");
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -455,7 +455,7 @@ main(int argc, char **argv)
{ {
case -1: case -1:
if (errno != EINTR) { if (errno != EINTR) {
fatal("select"); fatal("poll");
/*NOTREACHED*/ /*NOTREACHED*/
} }
continue; continue;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtadvd.c,v 1.32 2006/08/02 13:44:53 tron Exp $ */ /* $NetBSD: rtadvd.c,v 1.33 2006/10/07 17:27:57 elad Exp $ */
/* $KAME: rtadvd.c,v 1.92 2005/10/17 14:40:02 suz Exp $ */ /* $KAME: rtadvd.c,v 1.92 2005/10/17 14:40:02 suz Exp $ */
/* /*
@ -272,7 +272,7 @@ main(argc, argv)
timeout->tv_usec / 1000) : INFTIM)) < 0) { timeout->tv_usec / 1000) : INFTIM)) < 0) {
/* EINTR would occur upon SIGUSR1 for status dump */ /* EINTR would occur upon SIGUSR1 for status dump */
if (errno != EINTR) if (errno != EINTR)
syslog(LOG_ERR, "<%s> select: %s", syslog(LOG_ERR, "<%s> poll: %s",
__func__, strerror(errno)); __func__, strerror(errno));
continue; continue;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtsold.c,v 1.32 2006/05/11 08:38:38 mrg Exp $ */ /* $NetBSD: rtsold.c,v 1.33 2006/10/07 17:27:57 elad Exp $ */
/* $KAME: rtsold.c,v 1.77 2004/01/03 01:35:13 itojun Exp $ */ /* $KAME: rtsold.c,v 1.77 2004/01/03 01:35:13 itojun Exp $ */
/* /*
@ -296,7 +296,7 @@ main(int argc, char **argv)
e = poll(set, 2, timeout ? (timeout->tv_sec * 1000 + timeout->tv_usec / 1000) : INFTIM); e = poll(set, 2, timeout ? (timeout->tv_sec * 1000 + timeout->tv_usec / 1000) : INFTIM);
if (e < 1) { if (e < 1) {
if (e < 0 && errno != EINTR) { if (e < 0 && errno != EINTR) {
warnmsg(LOG_ERR, __func__, "select: %s", warnmsg(LOG_ERR, __func__, "poll: %s",
strerror(errno)); strerror(errno));
} }
continue; continue;

View File

@ -1,4 +1,4 @@
/* $NetBSD: traceroute.c,v 1.67 2006/10/07 10:23:33 elad Exp $ */ /* $NetBSD: traceroute.c,v 1.68 2006/10/07 17:27:57 elad Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997 * Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997
@ -29,7 +29,7 @@ static const char rcsid[] =
#else #else
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997\n\ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997\n\
The Regents of the University of California. All rights reserved.\n"); The Regents of the University of California. All rights reserved.\n");
__RCSID("$NetBSD: traceroute.c,v 1.67 2006/10/07 10:23:33 elad Exp $"); __RCSID("$NetBSD: traceroute.c,v 1.68 2006/10/07 17:27:57 elad Exp $");
#endif #endif
#endif #endif
@ -1103,7 +1103,7 @@ wait_for_reply(int sock, struct sockaddr_in *fromp, struct timeval *tp)
retval = poll(set, 1, wait.tv_sec * 1000 + wait.tv_usec / 1000); retval = poll(set, 1, wait.tv_sec * 1000 + wait.tv_usec / 1000);
if (retval < 0) { if (retval < 0) {
/* If we continue, we probably just flood the remote host. */ /* 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); exit(1);
} }
if (retval > 0) { if (retval > 0) {