- changed select calls to newly introduced uselect

This commit is contained in:
zolliker
2008-10-16 13:55:18 +00:00
parent 373063fab6
commit 2802f92b86
2 changed files with 37 additions and 0 deletions

30
uselect.c Normal file
View File

@ -0,0 +1,30 @@
#include <signal.h>
#include <errno.h>
#include "uselect.h"
/* for logging */
#include "sics.h"
#include "commandlog.h"
/* an uninterruptable version of select. M.Z. Oct 2008 */
static int cnt;
int uselect(int nfds,
fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
struct timeval *timeout) {
sigset_t sigmask;
struct timespec tmo;
int result;
char buffer[80];
sigfillset(&sigmask);
tmo.tv_sec = timeout->tv_sec;
tmo.tv_nsec = timeout->tv_usec * 1000;
result = pselect(nfds, readfds, writefds, exceptfds, &tmo, &sigmask);
if (result < 0 && errno == EINTR) {
WriteToCommandLog("SYS>","pselect was interrupted!");
}
return result;
}

7
uselect.h Normal file
View File

@ -0,0 +1,7 @@
#include <sys/select.h>
/* an uninterruptable version of select. M.Z. Oct 2008 */
int uselect(int nfds,
fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
struct timeval *timeout);