[comp.windows.x] Number of connections to server

brossard@sasun1.epfl.ch (Alain Brossard EPFL-SIC/SII) (11/09/90)

	Under Sun OS 4.1, there is a way to increase the number of
descriptors a program has opened from the soft limit of 64 to the
real hard limit of 128.  Right now the Xserver uses the soft
limit, could somebody let me know where such an allocation is
done in the actual MIT X server?
	If I knew where to look, I could probably do a patch
which I would be quite willing to distribute afterwards.
And yes I would put appropriate ifdef's so that it would still
compile on other platforms :-).


					Alain Brossard
					brossard@sasun1.epfl.ch

mouse@LARRY.MCRCIM.MCGILL.EDU (12/19/90)

> Under Sun OS 4.1, there is a way to increase the number of
> descriptors a program has opened from the soft limit of 64 to the
> real hard limit of 128.  Right now the Xserver uses the soft limit,
> could somebody let me know where such an allocation is done in the
> actual MIT X server?

(Bet you thought everybody'd forgotten! :-)

Look in os/4.2bsd/connection.c...

	void
	CreateWellKnownSockets()
	{
...
	#ifdef	hpux
		lastfdesc = _NFILE - 2;
	#else
		lastfdesc = getdtablesize() - 2;
	#endif	/* hpux */
	
	    if (lastfdesc > MAXSOCKS)
	    {
		lastfdesc = MAXSOCKS;
		if (debug_conns)
		    ErrorF( "GOT TO END OF SOCKETS %d\n", MAXSOCKS);
	    }
	
	    WellKnownConnections = 0;

(The above is roughly correct, but may not be precise, as it is
regenerated from a locally-modified version.  The essence for these
purposes is correct.)

Just before the assignment to lastfdesc would probably be a reasonable
place to raise the soft limit to the hard limit.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

guy@auspex.auspex.com (Guy Harris) (01/05/91)

>Just before the assignment to lastfdesc would probably be a reasonable
>place to raise the soft limit to the hard limit.

For anyone who cares, note that S5R4 has the same kind of hard and soft
limits for file descriptors (and other things; it's your old friend
"getrlimit()" and "setrlimit()") so you could do the same sort of thing
in a server on S5R4.