From 373063fab6dfe5373f97ca654664be0f27dfe634 Mon Sep 17 00:00:00 2001 From: zolliker Date: Thu, 16 Oct 2008 13:53:39 +0000 Subject: [PATCH] - changed select calls to newly indroduced uselect SKIPPED: psi/sinqhttpprot.c --- ascon.c | 9 +++++---- make_gen | 2 +- network.c | 15 ++++++++------- nread.c | 3 ++- nwatch.c | 3 ++- sllinux_def | 1 - 6 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ascon.c b/ascon.c index 3fb2fe23..68f0641b 100644 --- a/ascon.c +++ b/ascon.c @@ -12,6 +12,7 @@ #include "sics.h" #include "splitter.h" #include "ascon.i" +#include "uselect.h" /* CreateSocketAdress stolen from Tcl. Thanks to John Ousterhout @@ -161,7 +162,7 @@ int AsconReadGarbage(int fd) { result = 0; do { FD_SET(fd, &rmask); - ret = select(fd + 1, &rmask, NULL, NULL, &tmo); + ret = uselect(fd + 1, &rmask, NULL, NULL, &tmo); if (ret > 0) { l = recv(fd, garbage, sizeof garbage, 0); if (l > 0) { @@ -199,7 +200,7 @@ int AsconConnectSuccess(int fd) { FD_ZERO(&rmask); FD_SET(fd, &wmask); FD_SET(fd, &rmask); - ret = select(fd + 1, &rmask, &wmask, NULL, &tmo); + ret = uselect(fd + 1, &rmask, &wmask, NULL, &tmo); if (ret > 0) { assert(FD_ISSET(fd, &wmask)); if (FD_ISSET(fd, &rmask)) { /* there may already be data for read */ @@ -223,7 +224,7 @@ int AsconReadChar(int fd, char *chr) { FD_ZERO(&rmask); FD_SET(fd, &rmask); - ret = select(fd + 1, &rmask, NULL, NULL, &tmo); + ret = uselect(fd + 1, &rmask, NULL, NULL, &tmo); if (ret <= 0) return ret; ret = recv(fd, chr, 1, 0); /* PrintChar(*chr); */ @@ -252,7 +253,7 @@ int AsconWriteChars(int fd, char *data, int length) { */ FD_ZERO(&wmask); FD_SET(fd, &wmask); - ret = select(fd + 1, NULL, &wmask, NULL, &tmo); + ret = uselect(fd + 1, NULL, &wmask, NULL, &tmo); if (ret <= 0) return ASCON_SELECT_ERROR; ret = send(fd, data, length, 0); if (ret > 0) return ret; diff --git a/make_gen b/make_gen index 4d986c81..e53f064d 100644 --- a/make_gen +++ b/make_gen @@ -37,7 +37,7 @@ SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \ sicshdbadapter.o polldriv.o sicspoll.o statemon.o hmslave.o \ nwatch.o asyncqueue.o asyncprotocol.o sicsobj.o \ nxcopy.o nxinterhelper.o nxinter_wrap.o genericcontroller.o nxstack.o \ - sctdriveadapter.o sctdriveobj.o + sctdriveadapter.o sctdriveobj.o uselect.o MOTOROBJ = motor.o simdriv.o COUNTEROBJ = countdriv.o simcter.o counter.o diff --git a/network.c b/network.c index c8ae7ead..add22e11 100644 --- a/network.c +++ b/network.c @@ -51,6 +51,7 @@ #include #include #include +#include "uselect.h" #define PORT 1 #define SOCKET 2 @@ -193,7 +194,7 @@ CreateSocketAdress( { return NULL; /* eof */ } - iRet = select( (self->sockid + 1),(fd_set *)&lMask, NULL, NULL,&tmo); + iRet = uselect( (self->sockid + 1),(fd_set *)&lMask, NULL, NULL,&tmo); if( iRet <= 0) { /* failure, or no request */ @@ -335,7 +336,7 @@ CreateSocketAdress( FD_ZERO(&rmask); FD_SET(self->sockid, &wmask); FD_SET(self->sockid, &rmask); - iret = select(self->sockid+1, &rmask, &wmask, NULL, &tmo); + iret = uselect(self->sockid+1, &rmask, &wmask, NULL, &tmo); if (iret == 0) return 0; /* in progress */ if (iret > 0) { /* the connection has either succeded or failed @@ -480,7 +481,7 @@ CreateSocketAdress( FD_SET(self->sockid,&lMask); tmo.tv_usec = 0; tmo.tv_sec = delta; - iRet = select( (self->sockid + 1),NULL, &lMask, NULL,&tmo); + iRet = uselect( (self->sockid + 1),NULL, &lMask, NULL,&tmo); if (iRet < 0) { /* failure, or no data */ self->iType = 0; @@ -541,7 +542,7 @@ CreateSocketAdress( { return -1; /* eof */ } - iRet = select( (self->sockid + 1),&lMask, NULL, NULL,&tmo); + iRet = uselect( (self->sockid + 1),&lMask, NULL, NULL,&tmo); if( iRet <= 0) { /* failure, or no data @@ -589,7 +590,7 @@ CreateSocketAdress( { return -1; /* eof */ } - iRet = select( (self->sockid + 1),&lMask, NULL, NULL,&tmo); + iRet = uselect( (self->sockid + 1),&lMask, NULL, NULL,&tmo); if( iRet < 0) { return -1; @@ -760,7 +761,7 @@ int NETReconnectWithFlags(mkChannel* self, int flags) FD_ZERO(&wmask); FD_SET(self->sockid, &rmask); FD_SET(self->sockid, &wmask); - iRet = select(self->sockid+1, &rmask, &wmask, NULL, &tmo); + iRet = uselect(self->sockid+1, &rmask, &wmask, NULL, &tmo); if (iRet < 0) /* error */ iRet = -1; else if (iRet == 0) /* timeout */ @@ -916,7 +917,7 @@ int NETReconnect(mkChannel* self) tmo.tv_usec = (timeout % 1000) *1000; tmo.tv_sec = timeout / 1000; lMask = (1 << self->sockid); - iRet = select( (self->sockid + 1),(fd_set *)&lMask, NULL, NULL,&tmo); + iRet = uselect( (self->sockid + 1),(fd_set *)&lMask, NULL, NULL,&tmo); if( iRet <= 0) { /* failure, or no data */ diff --git a/nread.c b/nread.c index 58dc0998..438e83f4 100644 --- a/nread.c +++ b/nread.c @@ -38,6 +38,7 @@ #include "telnet.h" #include "nread.h" #include "commandlog.h" +#include "uselect.h" extern pServer pServ; extern int VerifyChannel(mkChannel *self); /* defined in network.c */ @@ -765,7 +766,7 @@ extern int VerifyChannel(mkChannel *self); /* defined in network.c */ /* the select itself */ tmo.tv_usec = self->iReadTimeout; iCount++; - iRet = select(iCount, &lMask,NULL,NULL,&tmo); + iRet = uselect(iCount, &lMask,NULL,NULL,&tmo); if(iRet <= 0) /* no pending request */ { return 1; diff --git a/nwatch.c b/nwatch.c index bf024ccc..80627318 100644 --- a/nwatch.c +++ b/nwatch.c @@ -19,6 +19,7 @@ #include "fortify.h" #include "nwatch.h" #include "sics.h" +#include "uselect.h" #define NWMAGIC 51966 @@ -395,7 +396,7 @@ int NetWatchTask (void* pData) iRet = 0; if (iCount >= 0) - iRet = select(iCount+1, &rMask, &wMask, NULL, &tmo); + iRet = uselect(iCount+1, &rMask, &wMask, NULL, &tmo); if(iRet > 0) { /* invoke the active callbacks */ diff --git a/sllinux_def b/sllinux_def index fdd1cc2a..38576c3a 100644 --- a/sllinux_def +++ b/sllinux_def @@ -6,7 +6,6 @@ #DFORTIFY= -DFORTIFY #FORTIFYOBJ= fortify.o strdup.o -DFORTIFY= -pg MFLAGS=-f makefile_linux$(DUMMY)