[comp.windows.x] Clients galore under SunOS 4.1

ado@elsie.UUCP (Arthur David Olson) (05/26/90)

Changes to Xsun that let you boost the server's number-of-open-files limit
(and thus the number-of-clients limit) are attached.
-- 
	Arthur David Olson   ado@alw.nih.gov   ADO is a trademark of Ampex.

mit/server/SCCS/s.Xserver.man: 1.1 vs. 1.2
*** 1.1/mit/server/Xserver.man	Fri May 25 22:01:22 1990
--- 1.2/mit/server/Xserver.man	Fri May 25 22:01:22 1990
***************
*** 134,139 ****
--- 134,146 ----
  of -1 leaves the stack space limit unchanged.  This option is not available in
  all operating systems.
  .TP 8
+ .B \-ln \fInofiles\fP
+ sets the number-of-open-files limit of the server to the specified number.
+ The default value is zero,
+ making the number-of-open-files limit as large as possible.
+ A value of -1 leaves the number-of-open-files limit unchanged.
+ This option is not available in all operating systems.
+ .TP 8
  .B \-logo
  turns on the X Window System logo display in the screen-saver.
  There is currently no way to change this from a client.
mit/server/os/4.2bsd/SCCS/s.osinit.c: 1.1 vs. 1.2
*** 1.1/mit/server/os/4.2bsd/osinit.c	Fri May 25 22:01:25 1990
--- 1.2/mit/server/os/4.2bsd/osinit.c	Fri May 25 22:01:25 1990
***************
*** 58,63 ****
--- 58,66 ----
  #ifndef SYSV
  int limitDataSpace = -1;
  int limitStackSpace = -1;
+ #ifdef RLIMIT_NOFILE
+ int limitNoFile = -1;
+ #endif /* defined RLIMIT_NOFILE */
  #endif
  
  OsInit()
***************
*** 135,140 ****
--- 138,158 ----
  		(void)setrlimit(RLIMIT_STACK, &rlim);
  	    }
  	}
+ #ifdef RLIMIT_NOFILE
+ 	if (limitNoFile >= 0)
+ 	{
+ 	    struct rlimit	rlim;
+ 
+ 	    if (!getrlimit(RLIMIT_NOFILE, &rlim))
+ 	    {
+ 		if ((limitNoFile > 0) && (limitNoFile < rlim.rlim_max))
+ 		    rlim.rlim_cur = limitNoFile;
+ 		else
+ 		    rlim.rlim_cur = rlim.rlim_max;
+ 		(void)setrlimit(RLIMIT_NOFILE, &rlim);
+ 	    }
+ 	}
+ #endif /* defined RLIMIT_NOFILE */
  #endif
  #endif
  	been_here = TRUE;
mit/server/os/4.2bsd/SCCS/s.utils.c: 1.1 vs. 1.2
*** 1.1/mit/server/os/4.2bsd/utils.c	Fri May 25 22:01:29 1990
--- 1.2/mit/server/os/4.2bsd/utils.c	Fri May 25 22:01:29 1990
***************
*** 42,47 ****
--- 42,50 ----
  #endif
  #ifndef SYSV
  extern int limitDataSpace, limitStackSpace;
+ #ifdef RLIMIT_NOFILE
+ extern int limitNoFile;
+ #endif /* defined RLIMIT_NOFILE */
  #endif
  extern int defaultColorVisualClass;
  extern long ScreenSaverTime;		/* for forcing reset */
***************
*** 152,157 ****
--- 155,161 ----
  #ifndef SYSV
      ErrorF("-ld int                limit data space to N Kb\n");
      ErrorF("-ls int                limit stack space to N Kb\n");
+     ErrorF("-ln int                limit number of open files to N\n");
  #endif
  #ifndef NOLOGOHACK
      ErrorF("-logo                  enable logo in screen saver\n");
***************
*** 323,328 ****
--- 327,343 ----
  	    else
  		UseMsg();
  	}
+ #ifdef RLIMIT_NOFILE
+ 	else if ( strcmp( argv[i], "-ln") == 0)
+ 	{
+ 	    if(++i < argc)
+ 	    {
+ 	        limitNoFile = atoi(argv[i]);
+ 	    }
+ 	    else
+ 		UseMsg();
+ 	}
+ #endif /* defined RLIMIT_NOFILE */
  #endif
  #ifndef NOLOGOHACK
  	else if ( strcmp( argv[i], "-logo") == 0)