27 |
|
#include "stdinc.h" |
28 |
|
#include "list.h" |
29 |
|
#include "modules.h" |
30 |
< |
#include "s_log.h" |
30 |
> |
#include "log.h" |
31 |
|
#include "ircd.h" |
32 |
|
#include "client.h" |
33 |
|
#include "send.h" |
34 |
< |
#include "s_conf.h" |
35 |
< |
#include "handlers.h" |
34 |
> |
#include "conf.h" |
35 |
|
#include "numeric.h" |
36 |
|
#include "parse.h" |
37 |
|
#include "ircd_defs.h" |
39 |
|
#include "memory.h" |
40 |
|
|
41 |
|
|
42 |
< |
dlink_list mod_list = { NULL, NULL, 0 }; |
44 |
< |
|
42 |
> |
static dlink_list modules_list = { NULL, NULL, 0 }; |
43 |
|
|
44 |
|
static const char *unknown_ver = "<unknown>"; |
45 |
|
|
120 |
|
if (modp->modexit) |
121 |
|
modp->modexit(); |
122 |
|
|
123 |
< |
assert(dlink_list_length(&mod_list) > 0); |
124 |
< |
dlinkDelete(&modp->node, &mod_list); |
123 |
> |
assert(dlink_list_length(&modules_list) > 0); |
124 |
> |
dlinkDelete(&modp->node, &modules_list); |
125 |
|
MyFree(modp->name); |
126 |
|
|
127 |
|
lt_dlclose(modp->handle); |
128 |
|
|
129 |
|
if (warn == 1) |
130 |
|
{ |
131 |
< |
ilog(L_INFO, "Module %s unloaded", name); |
131 |
> |
ilog(LOG_TYPE_IRCD, "Module %s unloaded", name); |
132 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, "Module %s unloaded", name); |
133 |
|
} |
134 |
|
|
156 |
|
|
157 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, "Error loading module %s: %s", |
158 |
|
mod_basename, err); |
159 |
< |
ilog(L_WARN, "Error loading module %s: %s", mod_basename, err); |
159 |
> |
ilog(LOG_TYPE_IRCD, "Error loading module %s: %s", mod_basename, err); |
160 |
|
return -1; |
161 |
|
} |
162 |
|
|
164 |
|
{ |
165 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, "Module %s has no module_entry export", |
166 |
|
mod_basename); |
167 |
< |
ilog(L_WARN, "Module %s has no module_entry export", mod_basename); |
167 |
> |
ilog(LOG_TYPE_IRCD, "Module %s has no module_entry export", mod_basename); |
168 |
|
lt_dlclose(tmpptr); |
169 |
|
return -1; |
170 |
|
} |
178 |
|
modp->flags |= MODULE_FLAG_CORE; |
179 |
|
|
180 |
|
DupString(modp->name, mod_basename); |
181 |
< |
dlinkAdd(modp, &modp->node, &mod_list); |
181 |
> |
dlinkAdd(modp, &modp->node, &modules_list); |
182 |
|
|
183 |
|
if (modp->modinit) |
184 |
|
modp->modinit(); |
188 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
189 |
|
"Module %s [version: %s handle: %p] loaded.", |
190 |
|
modp->name, modp->version, tmpptr); |
191 |
< |
ilog(L_WARN, "Module %s [version: %s handle: %p] loaded.", |
191 |
> |
ilog(LOG_TYPE_IRCD, "Module %s [version: %s handle: %p] loaded.", |
192 |
|
modp->name, modp->version, tmpptr); |
193 |
|
} |
194 |
|
|
207 |
|
{ |
208 |
|
if (lt_dlinit()) |
209 |
|
{ |
210 |
< |
ilog(L_ERROR, "Couldn't initialize the libltdl run time dynamic" |
210 |
> |
ilog(LOG_TYPE_IRCD, "Couldn't initialize the libltdl run time dynamic" |
211 |
|
" link library. Exiting."); |
212 |
|
exit(0); |
213 |
|
} |
319 |
|
{ |
320 |
|
dlink_node *ptr = NULL; |
321 |
|
|
322 |
< |
DLINK_FOREACH(ptr, mod_list.head) |
322 |
> |
DLINK_FOREACH(ptr, modules_list.head) |
323 |
|
{ |
324 |
|
struct module *modp = ptr->data; |
325 |
|
|
347 |
|
|
348 |
|
if ((system_module_dir = opendir(AUTOMODPATH)) == NULL) |
349 |
|
{ |
350 |
< |
ilog(L_WARN, "Could not load modules from %s: %s", |
350 |
> |
ilog(LOG_TYPE_IRCD, "Could not load modules from %s: %s", |
351 |
|
AUTOMODPATH, strerror(errno)); |
352 |
|
return; |
353 |
|
} |
405 |
|
|
406 |
|
if (load_a_module(module_name, warn, 1) == -1) |
407 |
|
{ |
408 |
< |
ilog(L_CRIT, "Error loading core module %s: terminating ircd", |
408 |
> |
ilog(LOG_TYPE_IRCD, "Error loading core module %s: terminating ircd", |
409 |
|
core_module_table[i]); |
410 |
|
exit(EXIT_FAILURE); |
411 |
|
} |
451 |
|
|
452 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
453 |
|
"Cannot locate module %s", path); |
454 |
< |
ilog(L_WARN, "Cannot locate module %s", path); |
454 |
> |
ilog(LOG_TYPE_IRCD, "Cannot locate module %s", path); |
455 |
|
return -1; |
456 |
|
} |
457 |
|
|
558 |
|
{ |
559 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, "Error reloading core " |
560 |
|
"module: %s: terminating ircd", parv[1]); |
561 |
< |
ilog(L_CRIT, "Error loading core module %s: terminating ircd", parv[1]); |
561 |
> |
ilog(LOG_TYPE_IRCD, "Error loading core module %s: terminating ircd", parv[1]); |
562 |
|
exit(0); |
563 |
|
} |
564 |
|
} |
577 |
|
return; |
578 |
|
} |
579 |
|
|
580 |
< |
DLINK_FOREACH(ptr, mod_list.head) |
580 |
> |
DLINK_FOREACH(ptr, modules_list.head) |
581 |
|
{ |
582 |
|
const struct module *modp = ptr->data; |
583 |
|
|
611 |
|
sendto_one(source_p, ":%s NOTICE %s :Reloading all modules", |
612 |
|
me.name, source_p->name); |
613 |
|
|
614 |
< |
modnum = dlink_list_length(&mod_list); |
614 |
> |
modnum = dlink_list_length(&modules_list); |
615 |
|
|
616 |
< |
DLINK_FOREACH_SAFE(ptr, ptr_next, mod_list.head) |
616 |
> |
DLINK_FOREACH_SAFE(ptr, ptr_next, modules_list.head) |
617 |
|
{ |
618 |
|
struct module *modp = ptr->data; |
619 |
|
unload_one_module(modp->name, 0); |
624 |
|
load_core_modules(0); |
625 |
|
|
626 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
627 |
< |
"Module Restart: %u modules unloaded, %u modules loaded", |
628 |
< |
modnum, dlink_list_length(&mod_list)); |
629 |
< |
ilog(L_WARN, "Module Restart: %u modules unloaded, %u modules loaded", |
630 |
< |
modnum, dlink_list_length(&mod_list)); |
627 |
> |
"Module Restart: %u modules unloaded, %u modules loaded", |
628 |
> |
modnum, dlink_list_length(&modules_list)); |
629 |
> |
ilog(LOG_TYPE_IRCD, "Module Restart: %u modules unloaded, %u modules loaded", |
630 |
> |
modnum, dlink_list_length(&modules_list)); |
631 |
|
} |