Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/isdn select() -> poll()
details: https://anonhg.NetBSD.org/src/rev/651ca10bd6be
branches: trunk
changeset: 536676:651ca10bd6be
user: mycroft <mycroft%NetBSD.org@localhost>
date: Fri Sep 20 15:15:49 2002 +0000
description:
select() -> poll()
diffstat:
usr.sbin/isdn/isdnd/curses.c | 48 ++++++++++++---------------------
usr.sbin/isdn/isdnd/isdnd.h | 3 +-
usr.sbin/isdn/isdnmonitor/curses.c | 26 ++++++------------
usr.sbin/isdn/isdnmonitor/monprivate.h | 3 +-
usr.sbin/isdn/isdntel/defs.h | 3 +-
usr.sbin/isdn/isdntel/main.c | 15 +++-------
6 files changed, 37 insertions(+), 61 deletions(-)
diffs (truncated from 307 to 300 lines):
diff -r 485447212271 -r 651ca10bd6be usr.sbin/isdn/isdnd/curses.c
--- a/usr.sbin/isdn/isdnd/curses.c Fri Sep 20 15:03:22 2002 +0000
+++ b/usr.sbin/isdn/isdnd/curses.c Fri Sep 20 15:15:49 2002 +0000
@@ -27,7 +27,7 @@
* i4b daemon - curses fullscreen output
* -------------------------------------
*
- * $Id: curses.c,v 1.3 2002/03/27 13:46:35 martin Exp $
+ * $Id: curses.c,v 1.4 2002/09/20 15:15:49 mycroft Exp $
*
* $FreeBSD$
*
@@ -172,8 +172,7 @@
WINDOW *menu_w;
int c;
int mpos;
- fd_set set;
- struct timeval timeout;
+ struct pollfd set[1];
/* create a new window in the lower screen area */
@@ -207,18 +206,15 @@
/* input loop */
+ set[0].fd = STDIN_FILENO;
+ set[0].events = POLLIN;
for(;;)
{
wrefresh(menu_w);
- FD_ZERO(&set);
- FD_SET(STDIN_FILENO, &set);
- timeout.tv_sec = WMTIMEOUT;
- timeout.tv_usec = 0;
-
/* if no char is available within timeout, exit menu*/
- if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0)
+ if((poll(set, 1, WMTIMEOUT * 1000)) <= 0)
goto mexit;
c = wgetch(menu_w);
@@ -548,8 +544,7 @@
int i, cnt = 0;
WINDOW *chan_w;
int nlines, ncols, pos_x, pos_y;
- fd_set set;
- struct timeval timeout;
+ struct pollfd set[1];
struct cfg_entry *cep = NULL;
struct isdn_ctrl_state *ctrl;
@@ -647,18 +642,15 @@
}
}
+ set[0].fd = STDIN_FILENO;
+ set[0].events = POLLIN;
for(;;)
{
wrefresh(chan_w);
- FD_ZERO(&set);
- FD_SET(STDIN_FILENO, &set);
- timeout.tv_sec = WMTIMEOUT;
- timeout.tv_usec = 0;
-
/* if no char is available within timeout, exit menu*/
- if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0)
+ if((poll(set, 1, WMTIMEOUT * 1000)) <= 0)
break;
ncols = wgetch(chan_w);
@@ -701,8 +693,7 @@
{
WINDOW *chan_w;
int nlines, ncols, pos_x, pos_y;
- fd_set set;
- struct timeval timeout;
+ struct pollfd set[1];
int i;
struct isdn_ctrl_state *ctrl;
@@ -740,12 +731,10 @@
wrefresh(chan_w);
- FD_ZERO(&set);
- FD_SET(STDIN_FILENO, &set);
- timeout.tv_sec = WMTIMEOUT*2;
- timeout.tv_usec = 0;
+ set[0].fd = STDIN_FILENO;
+ set[0].events = POLLIN;
- if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0)
+ if((poll(set, 1, WMTIMEOUT*2 * 1000)) <= 0)
{
delwin(chan_w);
return;
@@ -763,8 +752,7 @@
{
WINDOW *bud_w;
int nlines, ncols, pos_x, pos_y;
- fd_set set;
- struct timeval timeout;
+ struct pollfd set[1];
int j;
struct cfg_entry *cep;
time_t now;
@@ -867,12 +855,10 @@
wrefresh(bud_w);
- FD_ZERO(&set);
- FD_SET(STDIN_FILENO, &set);
- timeout.tv_sec = WMTIMEOUT*3;
- timeout.tv_usec = 0;
+ set[0].fd = STDIN_FILENO;
+ set[0].events = POLLIN;
- if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0)
+ if((poll(set, 1, WMTIMEOUT*3 * 1000)) <= 0)
{
delwin(bud_w);
return;
diff -r 485447212271 -r 651ca10bd6be usr.sbin/isdn/isdnd/isdnd.h
--- a/usr.sbin/isdn/isdnd/isdnd.h Fri Sep 20 15:03:22 2002 +0000
+++ b/usr.sbin/isdn/isdnd/isdnd.h Fri Sep 20 15:15:49 2002 +0000
@@ -27,7 +27,7 @@
* i4b daemon - main header file
* -----------------------------
*
- * $Id: isdnd.h,v 1.8 2002/04/10 23:35:07 martin Exp $
+ * $Id: isdnd.h,v 1.9 2002/09/20 15:15:49 mycroft Exp $
*
* $FreeBSD$
*
@@ -64,6 +64,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/ioctl.h>
+#include <sys/poll.h>
#ifdef USE_RTPRIO
#include <sys/rtprio.h>
diff -r 485447212271 -r 651ca10bd6be usr.sbin/isdn/isdnmonitor/curses.c
--- a/usr.sbin/isdn/isdnmonitor/curses.c Fri Sep 20 15:03:22 2002 +0000
+++ b/usr.sbin/isdn/isdnmonitor/curses.c Fri Sep 20 15:15:49 2002 +0000
@@ -27,7 +27,7 @@
* i4b daemon - curses fullscreen output
* -------------------------------------
*
- * $Id: curses.c,v 1.2 2002/03/27 13:46:35 martin Exp $
+ * $Id: curses.c,v 1.3 2002/09/20 15:15:49 mycroft Exp $
*
* $FreeBSD$
*
@@ -313,8 +313,7 @@
WINDOW *menu_w;
int c;
int mpos;
- fd_set set;
- struct timeval timeout;
+ struct pollfd set[1];
/* create a new window in the lower screen area */
@@ -347,18 +346,15 @@
/* input loop */
+ set[0].fd = STDIN_FILENO;
+ set[0].events = POLLIN;
for(;;)
{
wrefresh(menu_w);
- FD_ZERO(&set);
- FD_SET(STDIN_FILENO, &set);
- timeout.tv_sec = WMTIMEOUT;
- timeout.tv_usec = 0;
-
/* if no char is available within timeout, exit menu*/
- if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0)
+ if((poll(set, 1, WMTIMEOUT * 1000)) <= 0)
goto mexit;
c = wgetch(menu_w);
@@ -485,8 +481,7 @@
int cnt = 0;
WINDOW *chan_w;
int nlines, ncols, pos_x, pos_y;
- fd_set set;
- struct timeval timeout;
+ struct pollfd set[1];
/* need this later to close the connection */
struct ctlr_chan {
@@ -578,18 +573,15 @@
}
}
+ set[0].fd = STDIN_FILENO;
+ set[0].events = POLLIN;
for(;;)
{
wrefresh(chan_w);
- FD_ZERO(&set);
- FD_SET(STDIN_FILENO, &set);
- timeout.tv_sec = WMTIMEOUT;
- timeout.tv_usec = 0;
-
/* if no char is available within timeout, exit menu*/
- if((select(STDIN_FILENO + 1, &set, NULL, NULL, &timeout)) <= 0)
+ if((poll(set, 1, WMTIMEOUT * 1000)) <= 0)
break;
ncols = wgetch(chan_w);
diff -r 485447212271 -r 651ca10bd6be usr.sbin/isdn/isdnmonitor/monprivate.h
--- a/usr.sbin/isdn/isdnmonitor/monprivate.h Fri Sep 20 15:03:22 2002 +0000
+++ b/usr.sbin/isdn/isdnmonitor/monprivate.h Fri Sep 20 15:15:49 2002 +0000
@@ -27,7 +27,7 @@
* i4b remote monitor - private header
* -----------------------------------
*
- * $Id: monprivate.h,v 1.1.1.1 2001/01/06 13:00:29 martin Exp $
+ * $Id: monprivate.h,v 1.2 2002/09/20 15:15:49 mycroft Exp $
*
* $FreeBSD$
*
@@ -54,6 +54,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/ioctl.h>
+#include <sys/poll.h>
#endif
/*---------------------------------------------------------------------------*
diff -r 485447212271 -r 651ca10bd6be usr.sbin/isdn/isdntel/defs.h
--- a/usr.sbin/isdn/isdntel/defs.h Fri Sep 20 15:03:22 2002 +0000
+++ b/usr.sbin/isdn/isdntel/defs.h Fri Sep 20 15:15:49 2002 +0000
@@ -27,7 +27,7 @@
* isdntel - isdn4bsd telephone answering support
* ==============================================
*
- * $Id: defs.h,v 1.1.1.1 2001/01/06 13:00:35 martin Exp $
+ * $Id: defs.h,v 1.2 2002/09/20 15:15:50 mycroft Exp $
*
* $FreeBSD$
*
@@ -52,6 +52,7 @@
#include <sys/dir.h>
#endif
#include <sys/param.h>
+#include <sys/poll.h>
#include <netisdn/i4b_ioctl.h>
diff -r 485447212271 -r 651ca10bd6be usr.sbin/isdn/isdntel/main.c
--- a/usr.sbin/isdn/isdntel/main.c Fri Sep 20 15:03:22 2002 +0000
+++ b/usr.sbin/isdn/isdntel/main.c Fri Sep 20 15:15:49 2002 +0000
@@ -27,7 +27,7 @@
* isdntel - isdn4bsd telephone answering machine support
* ======================================================
*
- * $Id: main.c,v 1.2 2002/02/04 16:48:44 drochner Exp $
+ * $Id: main.c,v 1.3 2002/09/20 15:15:50 mycroft Exp $
*
* $FreeBSD$
*
@@ -56,6 +56,7 @@
{
int i;
int kchar;
+ struct pollfd set[1];
char *aliasfile = ALIASFILE;
int rrtimeout = REREADTIMEOUT;
@@ -112,19 +113,13 @@
/* go into loop */
+ set[0].fd = STDIN_FILENO;
+ set[0].events = POLLIN;
for (;;)
{
- fd_set set;
- struct timeval timeout;
-
- FD_ZERO(&set);
- FD_SET(STDIN_FILENO, &set);
- timeout.tv_sec = rrtimeout;
- timeout.tv_usec = 0;
-
Home |
Main Index |
Thread Index |
Old Index