7030089 X fd_sets use too many fd's in 64-bit mode
authorAlan Coopersmith <Alan.Coopersmith@Oracle.COM>
Wed, 23 Mar 2011 11:22:28 -0700
changeset 1095 f3ae5df34b0b
parent 1094 5f9b839fcbf7
child 1096 6a4781d63ac3
7030089 X fd_sets use too many fd's in 64-bit mode
open-src/app/Makefile.inc
open-src/app/xscope/Makefile
open-src/common/Makefile.init
open-src/doc/Makefile.inc
open-src/driver/Makefile.inc
open-src/util/Makefile.inc
open-src/xserver/Makefile.inc
--- a/open-src/app/Makefile.inc	Wed Mar 16 13:49:29 2011 -0700
+++ b/open-src/app/Makefile.inc	Wed Mar 23 11:22:28 2011 -0700
@@ -1,6 +1,6 @@
 # -*- Makefile -*- rules common to most X.Org application modules
 #
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -40,6 +40,7 @@
 
 # Flags to build & link applications with
 MODTYPE_CFLAGS=$(PROG_CFLAGS)
+MODTYPE_CPPFLAGS=$(PROG_CPPFLAGS)
 MODTYPE_CXXFLAGS=$(PROG_CXXFLAGS)
 MODTYPE_LDFLAGS=$(PROG_LDFLAGS)
 
--- a/open-src/app/xscope/Makefile	Wed Mar 16 13:49:29 2011 -0700
+++ b/open-src/app/xscope/Makefile	Wed Mar 23 11:22:28 2011 -0700
@@ -53,4 +53,10 @@
 # Compatibility links from /usr/X11/bin to /usr/bin
 MODULE_X11_BINCOMPAT_LINKS = xscope
 
+# Since xscope allocates a 32k buffer for FD_SETSIZE file descriptors,
+# we want far fewer than the 1024 default in 32-bit builds or the 
+# 65536 default in 64-bit builds - working to make this dynamic upstream.
+FD_SETSIZE=256
+FD_SETSIZE_SET=yes
+
 include ../Makefile.inc
--- a/open-src/common/Makefile.init	Wed Mar 16 13:49:29 2011 -0700
+++ b/open-src/common/Makefile.init	Wed Mar 23 11:22:28 2011 -0700
@@ -161,9 +161,16 @@
 LIB_CPPFLAGS 		= -D_REENTRANT
 LIB_CFLAGS 		= $(CFLAGS) $(ARCH_LIB_FLAGS)
 LIB_CXXFLAGS 		= $(CXXFLAGS) $(ARCH_LIB_FLAGS)
+PROG_CPPFLAGS		= -DFD_SETSIZE=$(FD_SETSIZE)
 PROG_CFLAGS		= $(CFLAGS)
 PROG_CXXFLAGS		= $(CXXFLAGS)
 
+# Default FD_SETSIZE - 1024 was the 32-bit default and was big enough
+# <sys/select.h> makes the 64-bit default be 65536 which is way too big,
+# and eats a lot of memory for fd_sets and cpu doing operations on them
+FD_SETSIZE_DEFAULT	= $(FD_SETSIZE_SET:yes=$(POUND_SIGN))
+$(FD_SETSIZE_DEFAULT)	FD_SETSIZE = 1024
+
 ### Linker flags
 
 # Linker mapfiles to link with for better performance & security
--- a/open-src/doc/Makefile.inc	Wed Mar 16 13:49:29 2011 -0700
+++ b/open-src/doc/Makefile.inc	Wed Mar 23 11:22:28 2011 -0700
@@ -1,6 +1,6 @@
 # -*- Makefile -*- rules common to most X.Org doc modules
 #
-# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -43,6 +43,7 @@
 
 # Use prog flags for building doc tools
 MODTYPE_CFLAGS=$(PROG_CFLAGS)
+MODTYPE_CPPFLAGS=$(PROG_CPPFLAGS)
 MODTYPE_LDFLAGS=$(PROG_LDFLAGS)
 MODTYPE_LD_OPTIONS=
 
--- a/open-src/driver/Makefile.inc	Wed Mar 16 13:49:29 2011 -0700
+++ b/open-src/driver/Makefile.inc	Wed Mar 23 11:22:28 2011 -0700
@@ -1,6 +1,6 @@
 # -*- Makefile -*- rules common to all X.Org drivers
 #
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -81,7 +81,7 @@
 # Set comments in ELF binaries to help identify versions/builds
 MODTYPE_ADD_BUILD_TARGETS=set-elf-comments
 
-MODTYPE_CPPFLAGS= \
+MODTYPE_CPPFLAGS= $(PROG_CPPFLAGS) \
 	-I$(PROTODIR)/usr/include		\
 	-I$(PROTODIR)/usr/include/pixman-1	\
 	-I$(PROTODIR)$(XORG_SDK_INCLUDES_DIR)	\
--- a/open-src/util/Makefile.inc	Wed Mar 16 13:49:29 2011 -0700
+++ b/open-src/util/Makefile.inc	Wed Mar 23 11:22:28 2011 -0700
@@ -1,6 +1,6 @@
 # -*- Makefile -*- rules common to most X.Org utility modules
 #
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -48,6 +48,7 @@
 
 # Use the flags we normally use to build & link applications with
 MODTYPE_CFLAGS=$(PROG_CFLAGS)
+MODTYPE_CPPFLAGS=$(PROG_CPPFLAGS)
 MODTYPE_LDFLAGS=$(PROG_LDFLAGS)
 MODTYPE_LD_OPTIONS=
 
--- a/open-src/xserver/Makefile.inc	Wed Mar 16 13:49:29 2011 -0700
+++ b/open-src/xserver/Makefile.inc	Wed Mar 23 11:22:28 2011 -0700
@@ -101,6 +101,7 @@
 MODTYPE_DEBUG_FLAGS=$(MODTYPE_DEBUG_FLAGS_$(MACH)_$(MODULE_COMPILER))
 
 MODTYPE_CFLAGS=$(PROG_CFLAGS)
+MODTYPE_CPPFLAGS += $(PROG_CPPFLAGS)
 MODTYPE_CXXFLAGS=$(PROG_CXXFLAGS)
 MODTYPE_LDFLAGS=$(PROG_LDFLAGS)