]> code.citadel.org Git - citadel.git/blobdiff - citadel/sysdep.c
Changeover to new room structure. See ChangeLog for details.
[citadel.git] / citadel / sysdep.c
index dee294066b4f4d65b14d3f87345e9e20bda70089..9f5adf9bf1e80cfb1232d8b92f0a7f5032630f82 100644 (file)
@@ -21,6 +21,7 @@
 #include <sys/wait.h>
 #include <sys/socket.h>
 #include <sys/time.h>
+#include <limits.h>
 #include <netinet/in.h>
 #include <netdb.h>
 #include <string.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
@@ -212,7 +214,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);
        }
 
 
@@ -646,7 +651,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:");
@@ -657,14 +662,8 @@ int main(int argc, char **argv)
        lprintf(7, "Loading citadel.config\n");
        get_config();
 
-       /* 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.