summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2015-07-07 18:19:50 +0200
committerKeith Packard <keithp@keithp.com>2015-08-24 00:00:18 -0700
commitd206c240c0b85c4da44f073d6e9a692afb6b96d2 (patch)
tree31eebed4e7b51c3e83c243046f707982f9c88ae5 /include
parent7ecdfbf0af3547295b245efa754123db65cabb43 (diff)
configurable maximum number of clients
Make the maximum number of clients user configurable, either from the command line or from xorg.conf This patch works by using the MAXCLIENTS (raised to 512) as the maximum allowed number of clients, but allowing the actual limit to be set by the user to a lower value (keeping the default of 256). There is a limit size of 29 bits to be used to store both the client ID and the X resources ID, so by reducing the number of clients allowed to connect to the X server, the user can increase the number of X resources per client or vice-versa. Parts of this patch are based on a similar patch from Adam Jackson <ajax@redhat.com> This now requires at least xproto 7.0.28 Signed-off-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'include')
-rw-r--r--include/misc.h3
-rw-r--r--include/opaque.h1
-rw-r--r--include/resource.h15
3 files changed, 5 insertions, 14 deletions
diff --git a/include/misc.h b/include/misc.h
index 9b1c03a67..56e138c6b 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -86,7 +86,8 @@ OF THIS SOFTWARE.
#ifndef MAXGPUSCREENS
#define MAXGPUSCREENS 16
#endif
-#define MAXCLIENTS 256
+#define MAXCLIENTS 512
+#define LIMITCLIENTS 256 /* Must be a power of 2 and <= MAXCLIENTS */
#define MAXEXTENSIONS 128
#define MAXFORMATS 8
#define MAXDEVICES 40 /* input devices */
diff --git a/include/opaque.h b/include/opaque.h
index a2c54aa6a..0ba0d64da 100644
--- a/include/opaque.h
+++ b/include/opaque.h
@@ -36,6 +36,7 @@ from The Open Group.
extern _X_EXPORT const char *defaultTextFont;
extern _X_EXPORT const char *defaultCursorFont;
extern _X_EXPORT int MaxClients;
+extern _X_EXPORT int LimitClients;
extern _X_EXPORT volatile char isItTimeToYield;
extern _X_EXPORT volatile char dispatchException;
diff --git a/include/resource.h b/include/resource.h
index 772f363b0..597f7b63c 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -85,21 +85,10 @@ typedef uint32_t RESTYPE;
#define RT_LASTPREDEF ((RESTYPE)9)
#define RT_NONE ((RESTYPE)0)
+extern unsigned int ResourceClientBits(void);
/* bits and fields within a resource id */
#define RESOURCE_AND_CLIENT_COUNT 29 /* 29 bits for XIDs */
-#if MAXCLIENTS == 64
-#define RESOURCE_CLIENT_BITS 6
-#endif
-#if MAXCLIENTS == 128
-#define RESOURCE_CLIENT_BITS 7
-#endif
-#if MAXCLIENTS == 256
-#define RESOURCE_CLIENT_BITS 8
-#endif
-#if MAXCLIENTS == 512
-#define RESOURCE_CLIENT_BITS 9
-#endif
-/* client field offset */
+#define RESOURCE_CLIENT_BITS ResourceClientBits() /* client field offset */
#define CLIENTOFFSET (RESOURCE_AND_CLIENT_COUNT - RESOURCE_CLIENT_BITS)
/* resource field */
#define RESOURCE_ID_MASK ((1 << CLIENTOFFSET) - 1)