diff options
author | Keith Packard <keithp@keithp.com> | 2016-05-24 21:04:14 -0700 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2016-07-21 15:04:47 -0400 |
commit | e0edb963fe09582f23a4b55da4f8840173e7a1ee (patch) | |
tree | 0baa044014d4c064bbde9e7ba7c2e2b78a37d170 /os/osdep.h | |
parent | 30bc0732f959bbc63f318c06d48de080d495da32 (diff) |
os: eliminate fd value limits for clients
With no code depending on the range of file descriptors, checking
for that can be eliminated.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'os/osdep.h')
-rw-r--r-- | os/osdep.h | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/os/osdep.h b/os/osdep.h index df0abebb0..90a247fab 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -63,42 +63,8 @@ SOFTWARE. #undef _POSIX_SOURCE #endif -#ifndef OPEN_MAX -#ifdef SVR4 -#define OPEN_MAX 512 -#else -#include <sys/param.h> -#ifndef OPEN_MAX -#if defined(NOFILE) && !defined(NOFILES_MAX) -#define OPEN_MAX NOFILE -#else -#if !defined(WIN32) || defined(__CYGWIN__) -#define OPEN_MAX NOFILES_MAX -#else -#define OPEN_MAX 512 -#endif -#endif -#endif -#endif -#endif - -#include <X11/Xpoll.h> - -/* - * MAXSOCKS is used only for initialising MaxClients when no other method - * like sysconf(_SC_OPEN_MAX) is not supported. - */ - -#if OPEN_MAX <= 512 -#define MAXSOCKS (OPEN_MAX - 1) -#else -#define MAXSOCKS 512 -#endif - -/* MAXSELECT is the number of fds that select() can handle */ -#define MAXSELECT (sizeof(fd_set) * NBBY) - #include <stddef.h> +#include <X11/Xos.h> /* If EAGAIN and EWOULDBLOCK are distinct errno values, then we check errno * for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX @@ -187,6 +153,12 @@ listen_to_client(ClientPtr client); #if !defined(WIN32) || defined(__CYGWIN__) extern int *ConnectionTranslation; +extern int ConnectionTranslationSize; +static inline int GetConnectionTranslation(int conn) { + if (conn >= ConnectionTranslationSize) + return 0; + return ConnectionTranslation[conn]; +} #else extern int GetConnectionTranslation(int conn); extern void SetConnectionTranslation(int conn, int client); |