## 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
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?=
# 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
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;
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() ) {
}
#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 )
}
}
-#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 );
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 );
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
dtblsize = getdtablesize();
#endif /* USE_SYSCONF */
+#ifdef FD_SETSIZE
+ if( dtblsize > FD_SETSIZE ) {
+ dtblsize = FD_SETSIZE;
+ }
+#endif /* FD_SETSIZE */
+
#ifndef NOSETPROCTITLE
/* for setproctitle */
Argv = argv;
if(dtblsize > FD_SETSIZE) {
dtblsize = FD_SETSIZE;
}
-#endif /* !FD_SETSIZE*/
+#endif /* !FD_SETSIZE */
c = (Connection *) ch_calloc( 1, dtblsize * sizeof(Connection) );
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
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