Commit 3f36aa25 authored by Howard Chu's avatar Howard Chu Committed by Quanah Gibson-Mount
Browse files

ITS#7450 enforce SLAPD_MAX_DAEMON_THREADS

Also allow the max to be redefined at compile time. Of course, there is no
legitimate reason to do so.
parent 22410b25
......@@ -73,7 +73,9 @@ ber_socket_t dtblsize;
slap_ssf_t local_ssf = LDAP_PVT_SASL_LOCAL_SSF;
struct runqueue_s slapd_rq;
#define MAX_DAEMON_THREADS 16
#ifndef SLAPD_MAX_DAEMON_THREADS
#define SLAPD_MAX_DAEMON_THREADS 16
#endif
int slapd_daemon_threads = 1;
int slapd_daemon_mask;
......@@ -92,7 +94,7 @@ static ldap_pvt_thread_t *listener_tid;
#define DAEMON_ID(fd) (fd & slapd_daemon_mask)
static ber_socket_t wake_sds[MAX_DAEMON_THREADS][2];
static ber_socket_t wake_sds[SLAPD_MAX_DAEMON_THREADS][2];
static int emfile;
static time_t chk_writetime;
......@@ -158,7 +160,7 @@ typedef struct slap_daemon_st {
#endif /* ! epoll && ! /dev/poll */
} slap_daemon_st;
static slap_daemon_st slap_daemon[MAX_DAEMON_THREADS];
static slap_daemon_st slap_daemon[SLAPD_MAX_DAEMON_THREADS];
/*
* NOTE: naming convention for macros:
......@@ -1609,7 +1611,7 @@ slapd_daemon_init( const char *urls )
Debug( LDAP_DEBUG_ARGS, "daemon_init: %s\n",
urls ? urls : "<null>", 0, 0 );
for ( i=0; i<MAX_DAEMON_THREADS; i++ ) {
for ( i=0; i<SLAPD_MAX_DAEMON_THREADS; i++ ) {
wake_sds[i][0] = AC_SOCKET_INVALID;
wake_sds[i][1] = AC_SOCKET_INVALID;
}
......@@ -2895,6 +2897,9 @@ slapd_daemon( void )
connectionless_init();
#endif /* LDAP_CONNECTIONLESS */
if ( slapd_daemon_threads > SLAPD_MAX_DAEMON_THREADS )
slapd_daemon_threads = SLAPD_MAX_DAEMON_THREADS;
listener_tid = ch_malloc(slapd_daemon_threads * sizeof(ldap_pvt_thread_t));
/* daemon_init only inits element 0 */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment