diff options
author | cvsadm <cvsadm> | 2005-01-21 00:44:34 +0000 |
---|---|---|
committer | cvsadm <cvsadm> | 2005-01-21 00:44:34 +0000 |
commit | b2093e3016027d6b5cf06b3f91f30769bfc099e2 (patch) | |
tree | cf58939393a9032182c4fbc4441164a9456e82f8 /ldap/servers/slapd/init.c | |
download | ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.tar.gz ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.tar.xz ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.zip |
Moving NSCP Directory Server from DirectoryBranch to TRUNK, initial drop. (foxworth)ldapserver7x
Diffstat (limited to 'ldap/servers/slapd/init.c')
-rw-r--r-- | ldap/servers/slapd/init.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/ldap/servers/slapd/init.c b/ldap/servers/slapd/init.c new file mode 100644 index 00000000..3bd4d934 --- /dev/null +++ b/ldap/servers/slapd/init.c @@ -0,0 +1,63 @@ +/** BEGIN COPYRIGHT BLOCK + * Copyright 2001 Sun Microsystems, Inc. + * Portions copyright 1999, 2001-2003 Netscape Communications Corporation. + * All rights reserved. + * END COPYRIGHT BLOCK **/ +/* init.c - initialize various things */ + +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#ifndef _WIN32 +#include <sys/time.h> +#include <netinet/in.h> +#include <sys/socket.h> +#include <arpa/inet.h> +#include <netdb.h> +#endif +#include "slap.h" +#include "fe.h" +#if defined( MACOS ) || defined( DOS ) || defined( _WIN32 ) || defined( NEED_BSDREGEX ) +#include "regex.h" +#endif + +void +slapd_init() +{ +#ifdef _WIN32 + WSADATA wsadata; + int err; + + if( err = WSAStartup(0x0101, &wsadata ) != 0 ) { + LDAPDebug( LDAP_DEBUG_ANY, + "Windows Sockets initialization failed, error %d (%s)\n", + err, slapd_system_strerror( err ), 0 ); + exit( 1 ); + } +#endif /* _WIN32 */ + + ops_mutex = PR_NewLock(); + num_conns_mutex = PR_NewLock(); + g_set_num_sent_mutex( PR_NewLock() ); + g_set_current_conn_count_mutex( PR_NewLock() ); + slapd_re_init(); + + if ( ops_mutex == NULL || + num_conns_mutex == NULL || + g_get_num_sent_mutex() == NULL || + g_get_current_conn_count_mutex() == NULL ) + { + LDAPDebug( LDAP_DEBUG_ANY, + "init: PR_NewLock failed\n", 0, 0, 0 ); + exit( -1 ); + } + +#ifndef HAVE_TIME_R + if ((time_func_mutex = PR_NewLock()) == NULL ) { + LDAPDebug( LDAP_DEBUG_ANY, + "init: PR_NewLock failed\n", 0, 0, 0 ); + exit(-1); + } + +#endif /* HAVE_TIME_R */ +} |