version 1.3, 1996/12/12 11:35:59 |
version 1.4, 1997/12/16 22:07:38 |
|
|
stilloob() |
stilloob() |
{ |
{ |
static struct timeval timeout = { 0 }; |
static struct timeval timeout = { 0 }; |
fd_set excepts; |
fd_set *fdsp; |
|
int fdsn; |
int value; |
int value; |
|
|
|
fdsn = howmany(net+1, NFDBITS) * sizeof(fd_mask); |
|
if ((fdsp = (fd_set *)malloc(fdsn)) == NULL) |
|
err(1, "malloc"); |
|
|
do { |
do { |
FD_ZERO(&excepts); |
memset(fdsp, 0, fdsn); |
FD_SET(net, &excepts); |
FD_SET(net, fdsp); |
value = select(net+1, (fd_set *)0, (fd_set *)0, &excepts, &timeout); |
value = select(net+1, (fd_set *)0, (fd_set *)0, fdsp, &timeout); |
} while ((value == -1) && (errno == EINTR)); |
} while ((value == -1) && (errno == EINTR)); |
|
|
if (value < 0) { |
if (value < 0) { |
perror("select"); |
perror("select"); |
|
free(fdsp); |
(void) quit(); |
(void) quit(); |
/* NOTREACHED */ |
/* NOTREACHED */ |
} |
} |
if (FD_ISSET(net, &excepts)) { |
if (FD_ISSET(net, fdsp)) { |
|
free(fdsp); |
return 1; |
return 1; |
} else { |
} else { |
|
free(fdsp); |
return 0; |
return 0; |
} |
} |
} |
} |