os: Move ETEST macro from io.c to osdep.h

This lets other code share this functionality

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Keith Packard 2016-06-01 22:35:09 -07:00 committed by Adam Jackson
parent 0d294462a5
commit ef7ddbe242
2 changed files with 14 additions and 14 deletions

14
os/io.c
View File

@ -102,20 +102,6 @@ typedef struct _connectionOutput {
static ConnectionInputPtr AllocateInputBuffer(void);
static ConnectionOutputPtr AllocateOutputBuffer(void);
/* If EAGAIN and EWOULDBLOCK are distinct errno values, then we check errno
* for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
* systems are broken and return EWOULDBLOCK when they should return EAGAIN
*/
#ifndef WIN32
# if (EAGAIN != EWOULDBLOCK)
# define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK)
# else
# define ETEST(err) (err == EAGAIN)
# endif
#else /* WIN32 The socket errorcodes differ from the normal errors */
#define ETEST(err) (err == EAGAIN || err == WSAEWOULDBLOCK)
#endif
static Bool CriticalOutputPending;
static int timesThisConnection = 0;
static ConnectionInputPtr FreeInputs = (ConnectionInputPtr) NULL;

View File

@ -100,6 +100,20 @@ SOFTWARE.
#include <stddef.h>
/* If EAGAIN and EWOULDBLOCK are distinct errno values, then we check errno
* for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
* systems are broken and return EWOULDBLOCK when they should return EAGAIN
*/
#ifndef WIN32
# if (EAGAIN != EWOULDBLOCK)
# define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK)
# else
# define ETEST(err) (err == EAGAIN)
# endif
#else /* WIN32 The socket errorcodes differ from the normal errors */
#define ETEST(err) (err == EAGAIN || err == WSAEWOULDBLOCK)
#endif
#if defined(XDMCP) || defined(HASXDMAUTH)
typedef Bool (*ValidatorFunc) (ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
typedef Bool (*GeneratorFunc) (ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);