diff options
author | Keith Packard <keithp@keithp.com> | 2016-06-01 22:35:09 -0700 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2016-07-18 15:27:51 -0400 |
commit | ef7ddbe242ed4c461f816663fb88646e41f1c21b (patch) | |
tree | e5ca665b1e106c1b7cd9dea9be1fbfc0a34beddc | |
parent | 0d294462a5af08ada654c588fad921ed7a22749b (diff) |
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>
-rw-r--r-- | os/io.c | 14 | ||||
-rw-r--r-- | os/osdep.h | 14 |
2 files changed, 14 insertions, 14 deletions
@@ -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; diff --git a/os/osdep.h b/os/osdep.h index 3dc2daf55..9dbf0fb89 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -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); |