diff --git a/Make-common b/Make-common index 1869d320d9a9a745ebd771292c87bf99c83de2c8..a11976265c2debb0dfe31f4f891a4c5c8ec1c727 100644 --- a/Make-common +++ b/Make-common @@ -45,9 +45,9 @@ RUNTIMEETCDIR?= $(ETCDIR) ## General compiler options ## ############################################################################# # Passed to every compile (cc or gcc). This is where you put -O or -g, etc. -EXTRACFLAGS=-O -g +#EXTRACFLAGS=-O -g #EXTRACFLAGS=-O -#EXTRACFLAGS=-g +EXTRACFLAGS=-g # Passed to every link (ld). Include -g here if you did in EXTRACFLAGS. EXTRALDFLAGS=-g @@ -142,8 +142,15 @@ SLAPD_BACKENDS= -DLDAP_LDBM # -DLDAP_SHELL -DLDAP_PASSWD LDBMBACKEND?=-DLDBM_USE_NDBM LDBMINCLUDE?= LDBMLIB?= -# -# if you want to use a non-default threads package change these lines +# if you want to use a non-default threads package change the defines below +# to one of: +# -DPOSIX_THREADS (draft 10 or standard) +# -DTHREAD_MIT_PTHREADS (draft 4) +# -DTHREAD_NEXT_CTHREADS +# -DTHREAD_DCE_PTHREADS +# -DTHREAD_SUNOS4_LWP +# -DTHREAD_SUNOS5_LWP +# and select the appropriate library. #THREADS?=-DNO_THREADS #THREADSLIB?= diff --git a/build/platforms/freebsd-gcc/Make-platform b/build/platforms/freebsd-gcc/Make-platform index 66a943256ff71edcbe255b251f7ac4ad9a8067f1..6df57c5be5ce68adf6ae242a4e452fb1a2e7c808 100644 --- a/build/platforms/freebsd-gcc/Make-platform +++ b/build/platforms/freebsd-gcc/Make-platform @@ -18,18 +18,12 @@ LDBMINCLUDE=-I/usr/include # package. Rather than resolve this globally, I have marked the # threading as "preeemptive", even though it is technically not. # -# As far as I have been able to determine, there are not buzz-loop -# based races in the LDAP code (at least not now that I've fixed -# the bogus FD_SETSIZE assumptions about the select(2) system call -# implementation being in any way related to getdtablesize(2) -- -# if it were, sys/types.h would define FD_SETSIZE in terms of the -# getdtablesize(2) call, and there would be no implicit limits). -# # This means that the implicit-yield threading is topologically # equivalent to preemptive threading. # THREADS= -D_THREAD_SAFE -DPOSIX_THREADS -DPTHREAD_PREEMPTIVE THREADSLIB= -pthread +#THREADSLIB= -lc_r # we need to link in the V3 library to get sigset() PLATFORMLIBS= -lcrypt diff --git a/clients/finger/main.c b/clients/finger/main.c index 64640543a4ffe457fdfa8ace23d85cdf41b1d5f9..77e076fdc769697726f0c04dc036d9fc542273f1 100644 --- a/clients/finger/main.c +++ b/clients/finger/main.c @@ -172,20 +172,17 @@ static do_query() exit( 1 ); } -#ifdef FD_SETSIZE - /* - * It is invalid to use a set size in excess of the type - * scope, as defined for the fd_set in sys/types.h. This - * is true for any OS. - */ - tblsize = FD_SETSIZE; -#else /* !FD_SETSIZE*/ #ifdef USE_SYSCONF tblsize = sysconf( _SC_OPEN_MAX ); #else /* USE_SYSCONF */ tblsize = getdtablesize(); #endif /* USE_SYSCONF */ -#endif /* !FD_SETSIZE*/ + +#ifdef FD_SETSIZE + if (tblsize > FD_SETSIZE) { + tblsize = FD_SETSIZE; + } +#endif /* FD_SETSIZE*/ timeout.tv_sec = FINGER_TIMEOUT; timeout.tv_usec = 0; diff --git a/clients/gopher/detach.c b/clients/gopher/detach.c index f543cc30604d03e95ce7e18d824bf761121b2678..09997c129814db3117f303278080437ad51b1cec 100644 --- a/clients/gopher/detach.c +++ b/clients/gopher/detach.c @@ -33,6 +33,13 @@ int debug; nbits = getdtablesize(); #endif /* USE_SYSCONF */ +#ifdef FD_SETSIZE + if (nbits > FD_SETSIZE) { + nbits = FD_SETSIZE; + } +#endif /* FD_SETSIZE*/ + + if ( debug == 0 || !(isatty( 1 )) ) { for ( i = 0; i < 5; i++ ) { switch ( fork() ) { diff --git a/clients/gopher/go500.c b/clients/gopher/go500.c index 484c39c556639f62a5784f8883746cef5408044d..069790429503b2c0ca2710a07f6d9050443ce4d8 100644 --- a/clients/gopher/go500.c +++ b/clients/gopher/go500.c @@ -140,20 +140,18 @@ char **argv; } #endif -#ifdef FD_SETSIZE - /* - * It is invalid to use a set size in excess of the type - * scope, as defined for the fd_set in sys/types.h. This - * is true for any OS. - */ - dtblsize = FD_SETSIZE; -#else /* !FD_SETSIZE*/ #ifdef USE_SYSCONF dtblsize = sysconf( _SC_OPEN_MAX ); #else /* USE_SYSCONF */ dtblsize = getdtablesize(); #endif /* USE_SYSCONF */ -#endif /* !FD_SETSIZE*/ + +#ifdef FD_SETSIZE + if (dtblsize > FD_SETSIZE) { + dtblsize = FD_SETSIZE; + } +#endif /* FD_SETSIZE*/ + /* detach if stderr is redirected or no debugging */ if ( inetd == 0 ) diff --git a/clients/gopher/go500gw.c b/clients/gopher/go500gw.c index 01d8b0cbc4e22372c2ce61821c3700853697048e..16674d0e80bc79777f9f97aad487f152c6b5afeb 100644 --- a/clients/gopher/go500gw.c +++ b/clients/gopher/go500gw.c @@ -150,20 +150,19 @@ char **argv; } } -#ifdef FD_SETSIZE - /* - * It is invalid to use a set size in excess of the type - * scope, as defined for the fd_set in sys/types.h. This - * is true for any OS. - */ - dtblsize = FD_SETSIZE; -#else /* !FD_SETSIZE*/ #ifdef USE_SYSCONF dtblsize = sysconf( _SC_OPEN_MAX ); #else /* USE_SYSCONF */ dtblsize = getdtablesize(); #endif /* USE_SYSCONF */ -#endif /* !FD_SETSIZE*/ + +#ifdef FD_SETSIZE + if ( dtblsize > FD_SETSIZE ) { + dtblsize = FD_SETSIZE; + } +#endif /* FD_SETSIZE*/ + + #ifdef GO500GW_HOSTNAME strcpy( myhost, GO500GW_HOSTNAME ); diff --git a/contrib/whois++/command.c b/contrib/whois++/command.c index f9688b37e523ce4079a77f7e108ffe8a8c757062..2a59e32d8b53fd05a407dbe77eda0d724f6304c0 100644 --- a/contrib/whois++/command.c +++ b/contrib/whois++/command.c @@ -50,16 +50,14 @@ char *token; int i, status, tablesize; if ( buffer == NULL ) { -#ifdef FD_SETSIZE - /* - * It is invalid to use a set size in excess of the type - * scope, as defined for the fd_set in sys/types.h. This - * is true for any OS. - */ - tablesize = FD_SETSIZE; -#else /* !FD_SETSIZE*/ tablesize = getdtablesize(); -#endif /* !FD_SETSIZE*/ + +#ifdef FD_SETSIZE + if ( tablesize > FD_SETSIZE ) { + tablesize = FD_SETSIZE; + } +#endif /* FD_SETSIZE */ + timeout.tv_sec = 60; timeout.tv_usec = 0; FD_ZERO( &readfds ); diff --git a/servers/ldapd/detach.c b/servers/ldapd/detach.c index ff435eea82853f265b0a1e305fdcaf3cad66da7b..ca45fda1a07695321e7bdc51c54f74cbf1acc13d 100644 --- a/servers/ldapd/detach.c +++ b/servers/ldapd/detach.c @@ -39,6 +39,12 @@ detach() nbits = getdtablesize(); #endif /* USE_SYSCONF */ +#ifdef FD_SETSIZE + if( nbits > FD_SETSIZE ) { + nbits = FD_SETSIZE; + } +#endif /* FD_SETSIZE */ + #ifdef LDAP_DEBUG if ( ldap_debug == 0 ) { #endif diff --git a/servers/ldapd/main.c b/servers/ldapd/main.c index 9edd4b532ea503d9886f9f7e84ed3577fb0111e4..1be869fbc66c91fa2591fb366754fb8b2c2b0f69 100644 --- a/servers/ldapd/main.c +++ b/servers/ldapd/main.c @@ -241,6 +241,12 @@ char **argv; dtblsize = getdtablesize(); #endif /* USE_SYSCONF */ +#ifdef FD_SETSIZE + if( dtblsize > FD_SETSIZE ) { + dtblsize = FD_SETSIZE; + } +#endif /* FD_SETSIZE */ + #ifndef NOSETPROCTITLE /* for setproctitle */ Argv = argv; diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index c88ab7ecc9891ab612ce824565b0b155a477e56a..5044456cb7d696d90e882edd99f2aee2c509460b 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -89,7 +89,7 @@ slapd_daemon( if(dtblsize > FD_SETSIZE) { dtblsize = FD_SETSIZE; } -#endif /* !FD_SETSIZE*/ +#endif /* !FD_SETSIZE */ c = (Connection *) ch_calloc( 1, dtblsize * sizeof(Connection) ); diff --git a/servers/slapd/detach.c b/servers/slapd/detach.c index 7b3fdab57ae97fc181fae0452a6ee4c3cd04b1de..4b771223479f2384eb4e0c8cc5a24798cdfea6f4 100644 --- a/servers/slapd/detach.c +++ b/servers/slapd/detach.c @@ -39,6 +39,12 @@ detach() nbits = getdtablesize(); #endif /* USE_SYSCONF */ +#ifdef FD_SETSIZE + if ( nbits > FD_SETSIZE ) { + nbits = FD_SETSIZE; + } +#endif /* FD_SETSIZE */ + #ifdef LDAP_DEBUG if ( ldap_debug == 0 ) { #endif diff --git a/servers/slurpd/detach.c b/servers/slurpd/detach.c index 7b3fdab57ae97fc181fae0452a6ee4c3cd04b1de..4b771223479f2384eb4e0c8cc5a24798cdfea6f4 100644 --- a/servers/slurpd/detach.c +++ b/servers/slurpd/detach.c @@ -39,6 +39,12 @@ detach() nbits = getdtablesize(); #endif /* USE_SYSCONF */ +#ifdef FD_SETSIZE + if ( nbits > FD_SETSIZE ) { + nbits = FD_SETSIZE; + } +#endif /* FD_SETSIZE */ + #ifdef LDAP_DEBUG if ( ldap_debug == 0 ) { #endif