SimRsim.c: removal of pre-POSIX.1-2001 select() interface ifdefs
POSIX.1-2001 introduced fd_set for use with select() and all current systems support POSIX.
This commit is contained in:
parent
2259ef626d
commit
2b62123459
|
|
@ -629,11 +629,7 @@ SimFillBuffer(
|
||||||
int charsRead = 0;
|
int charsRead = 0;
|
||||||
char *temp;
|
char *temp;
|
||||||
int n, nfd;
|
int n, nfd;
|
||||||
#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(__APPLE__) || defined(EMSCRIPTEN)
|
|
||||||
fd_set readfds, writefds, exceptfds;
|
fd_set readfds, writefds, exceptfds;
|
||||||
#else
|
|
||||||
int nr, nex;
|
|
||||||
#endif /* SYSV */
|
|
||||||
|
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
|
|
||||||
|
|
@ -645,10 +641,8 @@ SimFillBuffer(
|
||||||
|
|
||||||
/* read reply from Rsim */
|
/* read reply from Rsim */
|
||||||
|
|
||||||
#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(__APPLE__) || defined(EMSCRIPTEN)
|
|
||||||
FD_ZERO(&readfds);
|
FD_ZERO(&readfds);
|
||||||
FD_ZERO(&exceptfds);
|
FD_ZERO(&exceptfds);
|
||||||
#endif /* SYSV */
|
|
||||||
|
|
||||||
ASSERT(pipeIn >= 0 && pipeIn < FD_SETSIZE, "pipeIn>=0&&pipeIn<FD_SETSIZE");
|
ASSERT(pipeIn >= 0 && pipeIn < FD_SETSIZE, "pipeIn>=0&&pipeIn<FD_SETSIZE");
|
||||||
if (pipeIn < 0 || pipeIn >= FD_SETSIZE)
|
if (pipeIn < 0 || pipeIn >= FD_SETSIZE)
|
||||||
|
|
@ -661,18 +655,11 @@ SimFillBuffer(
|
||||||
|
|
||||||
try_again:
|
try_again:
|
||||||
|
|
||||||
#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(__APPLE__) || defined(EMSCRIPTEN)
|
|
||||||
FD_SET(pipeIn, &readfds);
|
FD_SET(pipeIn, &readfds);
|
||||||
FD_ZERO(&writefds);
|
FD_ZERO(&writefds);
|
||||||
FD_SET(pipeIn, &exceptfds);
|
FD_SET(pipeIn, &exceptfds);
|
||||||
n = select(nfd, &readfds, &writefds, &exceptfds, &timeout);
|
n = select(nfd, &readfds, &writefds, &exceptfds, &timeout);
|
||||||
|
|
||||||
#else /* !SYSV */
|
|
||||||
nr = nex = 1 << pipeIn;
|
|
||||||
n = select(nfd, &nr, NULL, &nex, &timeout);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return 0; /* select() timed out */
|
return 0; /* select() timed out */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue