- changed select calls to newly indroduced uselect
SKIPPED: psi/sinqhttpprot.c
This commit is contained in:
9
ascon.c
9
ascon.c
@ -12,6 +12,7 @@
|
|||||||
#include "sics.h"
|
#include "sics.h"
|
||||||
#include "splitter.h"
|
#include "splitter.h"
|
||||||
#include "ascon.i"
|
#include "ascon.i"
|
||||||
|
#include "uselect.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CreateSocketAdress stolen from Tcl. Thanks to John Ousterhout
|
CreateSocketAdress stolen from Tcl. Thanks to John Ousterhout
|
||||||
@ -161,7 +162,7 @@ int AsconReadGarbage(int fd) {
|
|||||||
result = 0;
|
result = 0;
|
||||||
do {
|
do {
|
||||||
FD_SET(fd, &rmask);
|
FD_SET(fd, &rmask);
|
||||||
ret = select(fd + 1, &rmask, NULL, NULL, &tmo);
|
ret = uselect(fd + 1, &rmask, NULL, NULL, &tmo);
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
l = recv(fd, garbage, sizeof garbage, 0);
|
l = recv(fd, garbage, sizeof garbage, 0);
|
||||||
if (l > 0) {
|
if (l > 0) {
|
||||||
@ -199,7 +200,7 @@ int AsconConnectSuccess(int fd) {
|
|||||||
FD_ZERO(&rmask);
|
FD_ZERO(&rmask);
|
||||||
FD_SET(fd, &wmask);
|
FD_SET(fd, &wmask);
|
||||||
FD_SET(fd, &rmask);
|
FD_SET(fd, &rmask);
|
||||||
ret = select(fd + 1, &rmask, &wmask, NULL, &tmo);
|
ret = uselect(fd + 1, &rmask, &wmask, NULL, &tmo);
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
assert(FD_ISSET(fd, &wmask));
|
assert(FD_ISSET(fd, &wmask));
|
||||||
if (FD_ISSET(fd, &rmask)) { /* there may already be data for read */
|
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_ZERO(&rmask);
|
||||||
FD_SET(fd, &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;
|
if (ret <= 0) return ret;
|
||||||
ret = recv(fd, chr, 1, 0);
|
ret = recv(fd, chr, 1, 0);
|
||||||
/* PrintChar(*chr); */
|
/* PrintChar(*chr); */
|
||||||
@ -252,7 +253,7 @@ int AsconWriteChars(int fd, char *data, int length) {
|
|||||||
*/
|
*/
|
||||||
FD_ZERO(&wmask);
|
FD_ZERO(&wmask);
|
||||||
FD_SET(fd, &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;
|
if (ret <= 0) return ASCON_SELECT_ERROR;
|
||||||
ret = send(fd, data, length, 0);
|
ret = send(fd, data, length, 0);
|
||||||
if (ret > 0) return ret;
|
if (ret > 0) return ret;
|
||||||
|
2
make_gen
2
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 \
|
sicshdbadapter.o polldriv.o sicspoll.o statemon.o hmslave.o \
|
||||||
nwatch.o asyncqueue.o asyncprotocol.o sicsobj.o \
|
nwatch.o asyncqueue.o asyncprotocol.o sicsobj.o \
|
||||||
nxcopy.o nxinterhelper.o nxinter_wrap.o genericcontroller.o nxstack.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
|
MOTOROBJ = motor.o simdriv.o
|
||||||
COUNTEROBJ = countdriv.o simcter.o counter.o
|
COUNTEROBJ = countdriv.o simcter.o counter.o
|
||||||
|
15
network.c
15
network.c
@ -51,6 +51,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include "uselect.h"
|
||||||
|
|
||||||
#define PORT 1
|
#define PORT 1
|
||||||
#define SOCKET 2
|
#define SOCKET 2
|
||||||
@ -193,7 +194,7 @@ CreateSocketAdress(
|
|||||||
{
|
{
|
||||||
return NULL; /* eof */
|
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)
|
if( iRet <= 0)
|
||||||
{
|
{
|
||||||
/* failure, or no request */
|
/* failure, or no request */
|
||||||
@ -335,7 +336,7 @@ CreateSocketAdress(
|
|||||||
FD_ZERO(&rmask);
|
FD_ZERO(&rmask);
|
||||||
FD_SET(self->sockid, &wmask);
|
FD_SET(self->sockid, &wmask);
|
||||||
FD_SET(self->sockid, &rmask);
|
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) return 0; /* in progress */
|
||||||
if (iret > 0) {
|
if (iret > 0) {
|
||||||
/* the connection has either succeded or failed
|
/* the connection has either succeded or failed
|
||||||
@ -480,7 +481,7 @@ CreateSocketAdress(
|
|||||||
FD_SET(self->sockid,&lMask);
|
FD_SET(self->sockid,&lMask);
|
||||||
tmo.tv_usec = 0;
|
tmo.tv_usec = 0;
|
||||||
tmo.tv_sec = delta;
|
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) {
|
if (iRet < 0) {
|
||||||
/* failure, or no data */
|
/* failure, or no data */
|
||||||
self->iType = 0;
|
self->iType = 0;
|
||||||
@ -541,7 +542,7 @@ CreateSocketAdress(
|
|||||||
{
|
{
|
||||||
return -1; /* eof */
|
return -1; /* eof */
|
||||||
}
|
}
|
||||||
iRet = select( (self->sockid + 1),&lMask, NULL, NULL,&tmo);
|
iRet = uselect( (self->sockid + 1),&lMask, NULL, NULL,&tmo);
|
||||||
if( iRet <= 0)
|
if( iRet <= 0)
|
||||||
{
|
{
|
||||||
/* failure, or no data
|
/* failure, or no data
|
||||||
@ -589,7 +590,7 @@ CreateSocketAdress(
|
|||||||
{
|
{
|
||||||
return -1; /* eof */
|
return -1; /* eof */
|
||||||
}
|
}
|
||||||
iRet = select( (self->sockid + 1),&lMask, NULL, NULL,&tmo);
|
iRet = uselect( (self->sockid + 1),&lMask, NULL, NULL,&tmo);
|
||||||
if( iRet < 0)
|
if( iRet < 0)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -760,7 +761,7 @@ int NETReconnectWithFlags(mkChannel* self, int flags)
|
|||||||
FD_ZERO(&wmask);
|
FD_ZERO(&wmask);
|
||||||
FD_SET(self->sockid, &rmask);
|
FD_SET(self->sockid, &rmask);
|
||||||
FD_SET(self->sockid, &wmask);
|
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 */
|
if (iRet < 0) /* error */
|
||||||
iRet = -1;
|
iRet = -1;
|
||||||
else if (iRet == 0) /* timeout */
|
else if (iRet == 0) /* timeout */
|
||||||
@ -916,7 +917,7 @@ int NETReconnect(mkChannel* self)
|
|||||||
tmo.tv_usec = (timeout % 1000) *1000;
|
tmo.tv_usec = (timeout % 1000) *1000;
|
||||||
tmo.tv_sec = timeout / 1000;
|
tmo.tv_sec = timeout / 1000;
|
||||||
lMask = (1 << self->sockid);
|
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)
|
if( iRet <= 0)
|
||||||
{
|
{
|
||||||
/* failure, or no data */
|
/* failure, or no data */
|
||||||
|
3
nread.c
3
nread.c
@ -38,6 +38,7 @@
|
|||||||
#include "telnet.h"
|
#include "telnet.h"
|
||||||
#include "nread.h"
|
#include "nread.h"
|
||||||
#include "commandlog.h"
|
#include "commandlog.h"
|
||||||
|
#include "uselect.h"
|
||||||
|
|
||||||
extern pServer pServ;
|
extern pServer pServ;
|
||||||
extern int VerifyChannel(mkChannel *self); /* defined in network.c */
|
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 */
|
/* the select itself */
|
||||||
tmo.tv_usec = self->iReadTimeout;
|
tmo.tv_usec = self->iReadTimeout;
|
||||||
iCount++;
|
iCount++;
|
||||||
iRet = select(iCount, &lMask,NULL,NULL,&tmo);
|
iRet = uselect(iCount, &lMask,NULL,NULL,&tmo);
|
||||||
if(iRet <= 0) /* no pending request */
|
if(iRet <= 0) /* no pending request */
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
3
nwatch.c
3
nwatch.c
@ -19,6 +19,7 @@
|
|||||||
#include "fortify.h"
|
#include "fortify.h"
|
||||||
#include "nwatch.h"
|
#include "nwatch.h"
|
||||||
#include "sics.h"
|
#include "sics.h"
|
||||||
|
#include "uselect.h"
|
||||||
|
|
||||||
#define NWMAGIC 51966
|
#define NWMAGIC 51966
|
||||||
|
|
||||||
@ -395,7 +396,7 @@ int NetWatchTask (void* pData)
|
|||||||
|
|
||||||
iRet = 0;
|
iRet = 0;
|
||||||
if (iCount >= 0)
|
if (iCount >= 0)
|
||||||
iRet = select(iCount+1, &rMask, &wMask, NULL, &tmo);
|
iRet = uselect(iCount+1, &rMask, &wMask, NULL, &tmo);
|
||||||
|
|
||||||
if(iRet > 0) {
|
if(iRet > 0) {
|
||||||
/* invoke the active callbacks */
|
/* invoke the active callbacks */
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#DFORTIFY= -DFORTIFY
|
#DFORTIFY= -DFORTIFY
|
||||||
#FORTIFYOBJ= fortify.o strdup.o
|
#FORTIFYOBJ= fortify.o strdup.o
|
||||||
DFORTIFY= -pg
|
|
||||||
|
|
||||||
MFLAGS=-f makefile_linux$(DUMMY)
|
MFLAGS=-f makefile_linux$(DUMMY)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user