Remove some of the ifdef WIN32 checks from WaitForSomething
This commit is contained in:
parent
2782b88711
commit
e62d85baa3
35
os/WaitFor.c
35
os/WaitFor.c
|
@ -76,6 +76,23 @@ SOFTWARE.
|
||||||
#include "dpmsproc.h"
|
#include "dpmsproc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
/* Error codes from windows sockets differ from fileio error codes */
|
||||||
|
#undef EINTR
|
||||||
|
#define EINTR WSAEINTR
|
||||||
|
#undef EINVAL
|
||||||
|
#define EINVAL WSAEINVAL
|
||||||
|
#undef EBADF
|
||||||
|
#define EBADF WSAENOTSOCK
|
||||||
|
/* Windows select does not set errno. Use GetErrno as wrapper for
|
||||||
|
WSAGetLastError */
|
||||||
|
#define GetErrno WSAGetLastError
|
||||||
|
#else
|
||||||
|
/* This is just a fallback to errno to hide the differences between unix and
|
||||||
|
Windows in the code */
|
||||||
|
#define GetErrno() errno
|
||||||
|
#endif
|
||||||
|
|
||||||
/* modifications by raphael */
|
/* modifications by raphael */
|
||||||
int
|
int
|
||||||
mffs(fd_mask mask)
|
mffs(fd_mask mask)
|
||||||
|
@ -222,11 +239,7 @@ WaitForSomething(int *pClientsReady)
|
||||||
{
|
{
|
||||||
i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt);
|
i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt);
|
||||||
}
|
}
|
||||||
#ifndef WIN32
|
selecterr = GetErrno();
|
||||||
selecterr = errno;
|
|
||||||
#else
|
|
||||||
selecterr = WSAGetLastError();
|
|
||||||
#endif
|
|
||||||
WakeupHandler(i, (pointer)&LastSelectMask);
|
WakeupHandler(i, (pointer)&LastSelectMask);
|
||||||
#ifdef XTESTEXT1
|
#ifdef XTESTEXT1
|
||||||
if (playback_on) {
|
if (playback_on) {
|
||||||
|
@ -248,30 +261,18 @@ WaitForSomething(int *pClientsReady)
|
||||||
return 0;
|
return 0;
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
|
||||||
if (selecterr == EBADF) /* Some client disconnected */
|
if (selecterr == EBADF) /* Some client disconnected */
|
||||||
#else
|
|
||||||
if (selecterr == WSAENOTSOCK) /* Some client disconnected */
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
CheckConnections ();
|
CheckConnections ();
|
||||||
if (! XFD_ANYSET (&AllClients))
|
if (! XFD_ANYSET (&AllClients))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifndef WIN32
|
|
||||||
else if (selecterr == EINVAL)
|
else if (selecterr == EINVAL)
|
||||||
#else
|
|
||||||
else if (selecterr == WSAEINVAL)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
FatalError("WaitForSomething(): select: errno=%d\n",
|
FatalError("WaitForSomething(): select: errno=%d\n",
|
||||||
selecterr);
|
selecterr);
|
||||||
}
|
}
|
||||||
#ifndef WIN32
|
|
||||||
else if (selecterr != EINTR)
|
else if (selecterr != EINTR)
|
||||||
#else
|
|
||||||
else if (selecterr != WSAEINTR)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
ErrorF("WaitForSomething(): select: errno=%d\n",
|
ErrorF("WaitForSomething(): select: errno=%d\n",
|
||||||
selecterr);
|
selecterr);
|
||||||
|
|
Loading…
Reference in New Issue