#endif /* ! epoll && ! /dev/poll */
#ifdef HAVE_TCPD
-# include <tcpd.h>
int allow_severity = LOG_INFO;
int deny_severity = LOG_NOTICE;
-
-# define SLAP_STRING_UNKNOWN STRING_UNKNOWN
-#else /* ! TCP Wrappers */
-# define SLAP_STRING_UNKNOWN "unknown"
-#endif /* ! TCP Wrappers */
+#endif /* TCP Wrappers */
#ifdef LDAP_PF_LOCAL
# include <sys/stat.h>
# define SLAP_SOCK_CLR_READ(s) SLAP_EPOLL_SOCK_CLR((s), EPOLLIN)
# define SLAP_SOCK_CLR_WRITE(s) SLAP_EPOLL_SOCK_CLR((s), EPOLLOUT)
-# ifdef SLAP_LIGHTWEIGHT_DISPATCHER
# define SLAP_SOCK_SET_SUSPEND(s) \
( slap_daemon.sd_suspend[SLAP_EPOLL_SOCK_IX(s)] = 1 )
# define SLAP_SOCK_CLR_SUSPEND(s) \
( slap_daemon.sd_suspend[SLAP_EPOLL_SOCK_IX(s)] = 0 )
# define SLAP_SOCK_IS_SUSPEND(s) \
( slap_daemon.sd_suspend[SLAP_EPOLL_SOCK_IX(s)] == 1 )
-# endif /* SLAP_LIGHTWEIGHT_DISPATCHER */
# define SLAP_EPOLL_EVENT_CLR(i, mode) (revents[(i)].events &= ~(mode))
(int *)(ptr) <= &slap_daemon.sd_index[dtblsize]) ? 0 : 1 )
# define SLAP_EPOLL_EV_PTRFD(ptr) (SLAP_EPOLL_EV_LISTENER(ptr) ? \
- ((Listener *)ptr)->sl_sd : (int *)(ptr) - slap_daemon.sd_index)
+ ((Listener *)ptr)->sl_sd : \
+ (ber_socket_t) ((int *)(ptr) - slap_daemon.sd_index))
# define SLAP_SOCK_DEL(s) do { \
int fd, rc, index = SLAP_EPOLL_SOCK_IX((s)); \
# define SLAP_SOCK_CLR_READ(s) SLAP_DEVPOLL_SOCK_CLR((s), POLLIN)
# define SLAP_SOCK_CLR_WRITE(s) SLAP_DEVPOLL_SOCK_CLR((s), POLLOUT)
-# ifdef SLAP_LIGHTWEIGHT_DISPATCHER
# define SLAP_SOCK_SET_SUSPEND(s) \
( slap_daemon.sd_suspend[SLAP_DEVPOLL_SOCK_IX((s))] = 1 )
# define SLAP_SOCK_CLR_SUSPEND(s) \
( slap_daemon.sd_suspend[SLAP_DEVPOLL_SOCK_IX((s))] = 0 )
# define SLAP_SOCK_IS_SUSPEND(s) \
( slap_daemon.sd_suspend[SLAP_DEVPOLL_SOCK_IX((s))] == 1 )
-# endif /* SLAP_LIGHTWEIGHT_DISPATCHER */
# define SLAP_DEVPOLL_EVENT_CLR(i, mode) (revents[(i)].events &= ~(mode))
ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
-#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
WAKE_LISTENER(1);
-#endif /* SLAP_LIGHTWEIGHT_DISPATCHER */
}
/*
l.sl_url.bv_val = NULL;
l.sl_mute = 0;
-#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
l.sl_busy = 0;
-#endif /* SLAP_LIGHTWEIGHT_DISPATCHER */
#ifndef HAVE_TLS
if( ldap_pvt_url_scheme2tls( lud->lud_scheme ) ) {
Sockaddr from;
ber_socket_t s;
- socklen_t len = sizeof(from);
+ ber_socklen_t len = sizeof(from);
Connection *c;
slap_ssf_t ssf = 0;
struct berval authid = BER_BVNULL;
s = accept( sl->sl_sd, (struct sockaddr *) &from, &len );
-#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
/* Resume the listener FD to allow concurrent-processing of
* additional incoming connections.
*/
sl->sl_busy = 0;
WAKE_LISTENER(1);
-#endif /* SLAP_LIGHTWEIGHT_DISPATCHER */
if ( s == AC_SOCKET_INVALID ) {
int err = sock_errno();
{
uid_t uid;
gid_t gid;
- int rc;
#ifdef LDAP_PF_LOCAL_SENDMSG
peerbv.bv_val = peerbuf;
return 0;
}
-#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
static void*
slap_listener_thread(
void* ctx,
}
return rc;
}
-#endif /* SLAP_LIGHTWEIGHT_DISPATCHER */
static void *
slapd_daemon_task(
return (void*)-1;
}
-#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
/* make the listening socket non-blocking */
if ( ber_pvt_socket_set_nonblock( slap_listeners[l]->sl_sd, 1 ) < 0 ) {
Debug( LDAP_DEBUG_ANY, "slapd_daemon_task: "
slapd_shutdown = 2;
return (void*)-1;
}
-#endif /* SLAP_LIGHTWEIGHT_DISPATCHER */
slapd_add( slap_listeners[l]->sl_sd, 0, slap_listeners[l] );
}
}
#endif /* HAVE_NT_SERVICE_MANAGER */
-#ifdef SLAP_SEM_LOAD_CONTROL
- /*
- * initialize count and lazyness of a semaphore
- */
- (void) ldap_lazy_sem_init(
- SLAP_MAX_WORKER_THREADS + 4 /* max workers + margin */,
- 4 /* lazyness */ );
-#endif /* SLAP_SEM_LOAD_CONTROL */
-
/* initialization complete. Here comes the loop. */
while ( !slapd_shutdown ) {
if ( lr->sl_sd == AC_SOCKET_INVALID ) continue;
-#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
if ( lr->sl_mute || lr->sl_busy )
-#else /* ! SLAP_LIGHTWEIGHT_DISPATCHER */
- if ( lr->sl_mute )
-#endif /* ! SLAP_LIGHTWEIGHT_DISPATCHER */
{
SLAP_SOCK_CLR_READ( lr->sl_sd );
} else {
continue;
}
-#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
if ( lr->sl_busy ) {
Debug( LDAP_DEBUG_CONNS,
"daemon: " SLAP_EVENT_FNAME ": "
lr->sl_sd, 0, 0 );
continue;
}
-#endif /* SLAP_LIGHTWEIGHT_DISPATCHER */
Debug( LDAP_DEBUG_CONNS,
"daemon: " SLAP_EVENT_FNAME ": "
SLAP_EVENT_CLR_WRITE( slap_listeners[l]->sl_sd );
ns--;
-#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
rc = slap_listener_activate( slap_listeners[l] );
-#else /* ! SLAP_LIGHTWEIGHT_DISPATCHER */
- rc = slap_listener( slap_listeners[l] );
-#endif /* ! SLAP_LIGHTWEIGHT_DISPATCHER */
}
/* bypass the following tests if no descriptors left */
* active.
*/
-#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
connection_read_activate( rd );
-#else /* ! SLAP_LIGHTWEIGHT_DISPATCHER */
- connection_read( rd );
-#endif /* ! SLAP_LIGHTWEIGHT_DISPATCHER */
}
#else /* !SLAP_EVENTS_ARE_INDEXED */
/* FIXME */
int rc = 1, fd;
if ( SLAP_EVENT_IS_LISTENER( i ) ) {
-#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
rc = slap_listener_activate( SLAP_EVENT_LISTENER( i ) );
-#else /* ! SLAP_LIGHTWEIGHT_DISPATCHER */
- rc = slap_listener( SLAP_EVENT_LISTENER( i ) );
-#endif /* ! SLAP_LIGHTWEIGHT_DISPATCHER */
}
/* If we found a regular listener, rc is now zero, and we
fd, 0, 0 );
SLAP_EVENT_CLR_READ( i );
-#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
connection_read_activate( fd );
-#else /* ! SLAP_LIGHTWEIGHT_DISPATCHER */
- /*
- * NOTE: it is possible that the connection was closed
- * and that the stream is now inactive.
- * connection_read() must valid the stream is still
- * active.
- */
- connection_read( fd );
-#endif /* ! SLAP_LIGHTWEIGHT_DISPATCHER */
} else {
Debug( LDAP_DEBUG_CONNS,
"daemon: hangup on %d\n", fd, 0, 0 );