X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=blobdiff_plain;f=src%2Fmodules.c;h=f48c41a0b2b0eda7a55987eda7522398057f807f;hp=0de4505ea9df74c1474f0c7ce95298e0360d59fc;hb=HEAD;hpb=40944b658837895643bc792457710a66f5ee4331 diff --git a/src/modules.c b/src/modules.c index 0de4505..f48c41a 100644 --- a/src/modules.c +++ b/src/modules.c @@ -19,7 +19,14 @@ #include #endif -/* 000-011 */ #include "main.h" +/* 000-001 */ #include "main.h" +/* 002-004 */ #include "tools.h" +#ifdef ENABLE_MUTEX_DEBUG +/* 005-006 */ #include "mutexDebug.h" +#endif +/* 007-009 */ /* main.h */ +/* 010 */ #include "log.h" +/* 011 */ /* main.h */ /* 012 */ #include "BanNode.h" /* 013-019 */ #include "bots.h" /* 020-025 */ #include "ChanNode.h" @@ -36,11 +43,13 @@ /* 099-102 */ #include "memoryDebug.h" #endif /* 103-106 */ #include "memoryInfo.h" -/* 107-125 */ #include "modcmd.h" +/* 107-122 */ #include "modcmd.h" +/* 123 */ /* deprecated */ +/* 124-125 */ /* modcmd.h */ /* 126-136 */ #include "ModeNode.h" /* 137-142 */ #include "mysqlConn.h" /* 143-149 */ #include "timeq.h" -/* 150-169 */ #include "tools.h" +/* 150-169 */ /* tools.h */ /* 170-180 */ #include "UserNode.h" /* 181-183 */ #include "WHOHandler.h" /* 184-188 */ #include "version.h" @@ -56,15 +65,20 @@ void *global_functions[] = { /* 000 */ (Function) getStartTime, /* 001 */ (Function) getRunningThreads, -/* 002 */ (Function) exit_daemon, +/* 002 */ (Function) getCurrentSecondsOfDay, /* 003 */ (Function) stricmp, /* 004 */ (Function) stricmplen, -/* 005 */ (Function) restart_process, -/* 006 */ (Function) cleanup, +#ifdef ENABLE_MUTEX_DEBUG +/* 005 */ (Function) xmutex, +/* 006 */ (Function) mutex_debug, +#else +/* 005 */ (Function) NULL, +/* 006 */ (Function) NULL, +#endif /* 007 */ (Function) restart_bot, /* 008 */ (Function) stop_bot, /* 009 */ (Function) reload_config, -/* 010 */ (Function) putlog, +/* 010 */ (Function) printf_log, #ifdef HAVE_THREADS /* 011 */ (Function) getCurrentThreadID, #else @@ -309,7 +323,7 @@ struct ModuleInfo *loadModule(char *name) { module = dlopen(fname, RTLD_LAZY); } if(!module) { - putlog(LOGLEVEL_ERROR, "Error loading module '%s': %s not found.\n", name, fname); + printf_log("main", LOG_ERROR, "Error loading module '%s': %s not found.\n", name, fname); return NULL; } void* initfunc = dlsym(module, "init_module"); @@ -320,7 +334,7 @@ struct ModuleInfo *loadModule(char *name) { sprintf(fname, "%s.dll", name); HMODULE module = LoadLibrary(fname); if(!module) { - putlog(LOGLEVEL_ERROR, "Error loading module '%s': %s not found.\n", name, fname); + printf_log("main", LOG_ERROR, "Error loading module '%s': %s not found.\n", name, fname); return NULL; } FARPROC initfunc = GetProcAddress(module, "init_module"); @@ -329,19 +343,19 @@ struct ModuleInfo *loadModule(char *name) { FARPROC modversion = GetProcAddress(module, "modversion"); #endif if(!startfunc || !stopfunc || !modversion) { - putlog(LOGLEVEL_ERROR, "Error loading module '%s': required symbols not found.\n", name); + printf_log("main", LOG_ERROR, "Error loading module '%s': required symbols not found.\n", name); return NULL; } int version = ((int (*)(void)) modversion)(); if(version != MODULE_VERSION) { - putlog(LOGLEVEL_ERROR, "Error loading module '%s': version mismatch ('%d' main code, '%d' module)\n", name, MODULE_VERSION, version); + printf_log("main", LOG_ERROR, "Error loading module '%s': version mismatch ('%d' main code, '%d' module)\n", name, MODULE_VERSION, version); return NULL; } //start module int errid; int module_id = module_id_counter++; if((errid = ((int (*)(void **, int)) initfunc)(global_functions, module_id))) { - putlog(LOGLEVEL_ERROR, "Error loading module '%s': module reported error (errid: %d)\n", name, errid); + printf_log("main", LOG_ERROR, "Error loading module '%s': module reported error (errid: %d)\n", name, errid); return NULL; } modinfo = malloc(sizeof(*modinfo));