]> git.sur5r.net Git - openldap/commitdiff
Additional mods to fix NT single threaded support.
authorKurt Zeilenga <kurt@openldap.org>
Mon, 1 Nov 1999 22:00:18 +0000 (22:00 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 1 Nov 1999 22:00:18 +0000 (22:00 +0000)
include/ac/unistd.h
include/ldap_pvt_thread.h
servers/slapd/main.c

index d62d3b86bde7dc8331091c13d7efc67d80001a30..5203e78606d5be52079f4c404f5d1e40ffcd945b 100644 (file)
 #      include <unistd.h>
 #endif
 
+#if HAVE_PROCESS_H
+#      include <process.h>
+#endif
+
 /* note: callers of crypt(3) should include <ac/crypt.h> */
 
 #ifdef __MINGW32__
index 415c6d5d0e3ff080b2c24795eb2b8496ae2101e3..09c761781f9f4dcb2e7edb1408e5db4bb8935e08 100644 (file)
@@ -137,8 +137,7 @@ typedef struct ldap_pvt_thread_lwp_cv ldap_pvt_thread_cond_t;
 
 LDAP_END_DECL
 
-/* If we're in the NT env at all, we want these defs, threaded or not (which should be fixed) */
-#elif defined(WINNT) || defined(_WINNT) || defined(_WIN32) || defined(HAVE_NT_THREADS)
+#elif defined(HAVE_NT_THREADS)
 
 LDAP_BEGIN_DECL
 
index dc021eb46ed5e6aa3d3d4b07fbc66044ab543411..db833db299995e9d9b9e914d41863f6332b3ce6f 100644 (file)
@@ -38,18 +38,19 @@ void CommenceStartupProcessing( LPCTSTR serviceName,
 void ReportSlapdShutdownComplete( void );
 void *getRegParam( char *svc, char *value );
 
-#define SERVICE_EXIT( e, n ) \
-               if ( is_NT_Service ) \
-{ \
-                       SLAPDServiceStatus.dwWin32ExitCode                              = e; \
-                       SLAPDServiceStatus.dwServiceSpecificExitCode    = n; \
-} 
+#define SERVICE_EXIT( e, n )   do { \
+       if ( is_NT_Service ) { \
+               SLAPDServiceStatus.dwWin32ExitCode                              = (e); \
+               SLAPDServiceStatus.dwServiceSpecificExitCode    = (n); \
+       } \
+} while ( 0 )
+
 #else
 #define SERVICE_EXIT( e, n )
 #define MAIN_RETURN(x) return(x)
 #endif
 
-#ifdef HAVE_NT_EVENT_MANAGER
+#ifdef HAVE_NT_EVENT_LOG
 void LogSlapdStartedEvent( char *svc, int slap_debug, char *configfile, char *urls );
 void LogSlapdStoppedEvent( char *svc );
 #endif
@@ -111,7 +112,7 @@ usage( char *name )
 #ifdef LOG_LOCAL4
                "\t-l sysloguser\tSyslog User (default: LOCAL4)\n"
 #endif
-#ifdef HAVE_WINSOCK
+#ifdef HAVE_NT_EVENT_LOG
                "\t-n NTserviceName\tNT service name\n"
 #endif
 
@@ -145,8 +146,11 @@ int main( int argc, char **argv )
 #ifdef LOG_LOCAL4
     int     syslogUser = DEFAULT_SYSLOG_USER;
 #endif
-#ifdef HAVE_WINSOCK
+
+#ifdef HAVE_NT_EVENT_LOG
        char        *NTservice  = SERVICE_NAME;
+#endif
+#ifdef HAVE_NT_SERVICE_MANAGER
        char            *configfile = ".\\slapd.conf";
 #else
        char            *configfile = SLAPD_DEFAULT_CONFIGFILE;
@@ -223,7 +227,7 @@ int main( int argc, char **argv )
 #ifdef LDAP_CONNECTIONLESS
                                 "c"
 #endif
-#ifdef HAVE_WINSOCK
+#ifdef HAVE_NT_EVENT_LOG
                                 "n:"
 #endif
 #ifdef HAVE_TLS
@@ -312,7 +316,7 @@ int main( int argc, char **argv )
                        break;
 #endif /* SETUID && GETUID */
 
-#ifdef HAVE_WINSOCK
+#ifdef HAVE_NT_EVENT_LOG
                case 'n':  /* NT service name */
                        NTservice = ch_strdup( optarg );
                        break;
@@ -392,7 +396,7 @@ int main( int argc, char **argv )
 #endif
 
 #ifndef HAVE_WINSOCK
-               lutil_detach( no_detach, 0 );
+       lutil_detach( no_detach, 0 );
 #endif /* HAVE_WINSOCK */
 
 #ifdef CSRIMALLOC
@@ -428,7 +432,7 @@ int main( int argc, char **argv )
                }
        }
 
-#ifdef HAVE_NT_EVENT_MANAGER
+#ifdef HAVE_NT_EVENT_LOG
        LogSlapdStartedEvent( NTservice, slap_debug, configfile, urls );
 #endif
 
@@ -449,7 +453,7 @@ destroy:
        rc |= slap_destroy();
 
 stop:
-#ifdef HAVE_NT_EVENT_MANAGER
+#ifdef HAVE_NT_EVENT_LOG
        LogSlapdStoppedEvent( NTservice );
 #endif