]> code.citadel.org Git - citadel.git/blobdiff - citadel/sysdep.c
* Removed code from some of the utilities which was still attempting
[citadel.git] / citadel / sysdep.c
index 71ed16fc2a5e5a6b729fb7702cd2bb476b1eeb97..1220155690896468ff7673d47196ad43c0db0945 100644 (file)
@@ -33,7 +33,6 @@
 #include "server.h"
 #include "sysdep_decls.h"
 #include "citserver.h"
-#include "hooks.h"
 #include "support.h"
 #include "config.h"
 #include "database.h"
 
 pthread_mutex_t Critters[MAX_SEMAPHORES];      /* Things needing locking */
 pthread_key_t MyConKey;                                /* TSD key for MyContext() */
-symtab *my_symtab;                             /* Dynamic modules symbol table */
 
 int msock;                                     /* master listening socket */
 int verbosity = 3;                             /* Logging level */
 
+struct CitContext masterCC;
+
 
 /*
  * lprintf()  ...   Write logging information
@@ -111,7 +111,6 @@ void begin_critical_section(int which_one)
        int oldval;
 
        lprintf(8, "begin_critical_section(%d)\n", which_one);
-       if (CC != NULL) hook_crit_get(CC->cs_pid, which_one);
 
        /* Don't get interrupted during the critical section */
        pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldval);
@@ -119,7 +118,6 @@ void begin_critical_section(int which_one)
        /* Obtain a semaphore */
        pthread_mutex_lock(&Critters[which_one]);
 
-       if (CC != NULL) hook_crit_got(CC->cs_pid, which_one);
        }
 
 /*
@@ -130,7 +128,6 @@ void end_critical_section(int which_one)
        int oldval;
 
        lprintf(8, "  end_critical_section(%d)\n", which_one);
-       if (CC != NULL) hook_crit_end(CC->cs_pid, which_one);
 
        /* Let go of the semaphore */
        pthread_mutex_unlock(&Critters[which_one]);
@@ -216,7 +213,10 @@ int ig_tcp_server(int port_number, int queue_len)
  * Return a pointer to a thread's own CitContext structure (new)
  */
 struct CitContext *MyContext(void) {
-       return (struct CitContext *) pthread_getspecific(MyConKey);
+       struct CitContext *retCC;
+       retCC = (struct CitContext *) pthread_getspecific(MyConKey);
+       if (retCC == NULL) retCC = &masterCC;
+       return(retCC);
        }
 
 
@@ -650,7 +650,7 @@ int main(int argc, char **argv)
        openlog("citserver",LOG_PID,LOG_USER);
         lprintf(1, "Initting modules...\n");
         snprintf(modpath, 128, "%s/modules", BBSDIR);
-        DLoader_Init(modpath, &my_symtab);
+        DLoader_Init(modpath);
         lprintf(1, "Modules done initializing...\n");
 /*
         lprintf(1, "First symtab item:");
@@ -660,16 +660,9 @@ int main(int argc, char **argv)
        /* Load site-specific parameters */
        lprintf(7, "Loading citadel.config\n");
        get_config();
-       hook_init();
-
-       /* Databases must be opened *after* config is loaded, otherwise we might
-        * end up working in the wrong directory.
-        */
-       lprintf(7, "Opening databases\n");
-       open_databases();
 
-       lprintf(7, "Checking floor reference counts\n");
-       check_ref_counts();
+       /* Do non system dependent startup functions */
+       master_startup();
 
        /*
         * Bind the server to our favourite port.