#include "asterisk/autoconfig.h"
#include "asterisk/compat.h"
#include "asterisk/paths.h"
Include dependency graph for asterisk.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Defines | |
| #define | ASTERISK_FILE_VERSION(file, version) |
| Register/unregister a source code file with the core. | |
| #define | DEFAULT_LANGUAGE "en" |
| #define | DEFAULT_SAMPLE_RATE 8000 |
| #define | DEFAULT_SAMPLES_PER_MS ((DEFAULT_SAMPLE_RATE)/1000) |
| #define | sched_setscheduler __PLEASE_USE_ast_set_priority_INSTEAD_OF_sched_setscheduler__ |
| #define | setpriority __PLEASE_USE_ast_set_priority_INSTEAD_OF_setpriority__ |
Functions | |
| int | ast_add_profile (const char *, uint64_t scale) |
| support for event profiling | |
| void | ast_autoservice_init (void) |
| void | ast_builtins_init (void) |
| initialize the _full_cmd string in * each of the builtins. | |
| void | ast_channels_init (void) |
| int64_t | ast_mark (int, int start1_stop0) |
| int | ast_module_reload (const char *name) |
| Reload asterisk modules. | |
| int64_t | ast_profile (int, int64_t) |
| int | ast_register_atexit (void(*func)(void)) |
| Register a function to be executed before Asterisk exits. | |
| void | ast_register_file_version (const char *file, const char *version) |
| Register the version of a source code file with the core. | |
| int | ast_set_priority (int) |
| We set ourselves to a high priority, that we might pre-empt everything else. If your PBX has heavy activity on it, this is a good thing. | |
| int | ast_term_init (void) |
| void | ast_unregister_atexit (void(*func)(void)) |
| Unregister a function registered with ast_register_atexit(). | |
| void | ast_unregister_file_version (const char *file) |
| Unregister a source code file from the core. | |
| int | astdb_init (void) |
| int | astobj2_init (void) |
| void | close_logger (void) |
| int | dnsmgr_init (void) |
| int | dnsmgr_reload (void) |
| void | dnsmgr_start_refresh (void) |
| int | init_framer (void) |
| int | init_logger (void) |
| int | load_modules (unsigned int) |
| int | load_pbx (void) |
| int | reload_logger (int) |
| void | threadstorage_init (void) |
Variables | |
| char | ast_config_AST_AGI_DIR [PATH_MAX] |
| char | ast_config_AST_CONFIG_DIR [PATH_MAX] |
| char | ast_config_AST_CONFIG_FILE [PATH_MAX] |
| char | ast_config_AST_CTL [PATH_MAX] |
| char | ast_config_AST_CTL_GROUP [PATH_MAX] |
| char | ast_config_AST_CTL_OWNER [PATH_MAX] |
| char | ast_config_AST_CTL_PERMISSIONS [PATH_MAX] |
| char | ast_config_AST_DATA_DIR [PATH_MAX] |
| char | ast_config_AST_DB [PATH_MAX] |
| char | ast_config_AST_KEY_DIR [PATH_MAX] |
| char | ast_config_AST_LOG_DIR [PATH_MAX] |
| char | ast_config_AST_MODULE_DIR [PATH_MAX] |
| char | ast_config_AST_MONITOR_DIR [PATH_MAX] |
| char | ast_config_AST_PID [PATH_MAX] |
| char | ast_config_AST_RUN_DIR [PATH_MAX] |
| char | ast_config_AST_SOCKET [PATH_MAX] |
| char | ast_config_AST_SPOOL_DIR [PATH_MAX] |
| char | ast_config_AST_SYSTEM_NAME [20] |
| char | ast_config_AST_VAR_DIR [PATH_MAX] |
Definition in file asterisk.h.
| #define ASTERISK_FILE_VERSION | ( | file, | |||
| version | ) |
Register/unregister a source code file with the core.
| file | the source file name | |
| version | the version string (typically a CVS revision keyword string) |
Example:
ASTERISK_FILE_VERSION(__FILE__, "\$Revision\$")
Definition at line 171 of file asterisk.h.
| #define DEFAULT_LANGUAGE "en" |
| #define DEFAULT_SAMPLE_RATE 8000 |
Definition at line 33 of file asterisk.h.
Referenced by check_header(), ogg_vorbis_rewrite(), setformat(), and write_header().
| #define DEFAULT_SAMPLES_PER_MS ((DEFAULT_SAMPLE_RATE)/1000) |
Definition at line 34 of file asterisk.h.
Referenced by ast_stream_fastforward(), ast_stream_rewind(), and isAnsweringMachine().
| #define sched_setscheduler __PLEASE_USE_ast_set_priority_INSTEAD_OF_sched_setscheduler__ |
| #define setpriority __PLEASE_USE_ast_set_priority_INSTEAD_OF_setpriority__ |
| int ast_add_profile | ( | const char * | name, | |
| uint64_t | scale | |||
| ) |
support for event profiling
Definition at line 380 of file asterisk.c.
References ast_calloc, ast_realloc, ast_strdup, profile_data::e, profile_data::entries, profile_entry::events, profile_entry::mark, profile_data::max_size, profile_entry::name, prof_data, profile_entry::scale, and profile_entry::value.
Referenced by extension_match_core().
00381 { 00382 int l = sizeof(struct profile_data); 00383 int n = 10; /* default entries */ 00384 00385 if (prof_data == NULL) { 00386 prof_data = ast_calloc(1, l + n*sizeof(struct profile_entry)); 00387 if (prof_data == NULL) 00388 return -1; 00389 prof_data->entries = 0; 00390 prof_data->max_size = n; 00391 } 00392 if (prof_data->entries >= prof_data->max_size) { 00393 void *p; 00394 n = prof_data->max_size + 20; 00395 p = ast_realloc(prof_data, l + n*sizeof(struct profile_entry)); 00396 if (p == NULL) 00397 return -1; 00398 prof_data = p; 00399 prof_data->max_size = n; 00400 } 00401 n = prof_data->entries++; 00402 prof_data->e[n].name = ast_strdup(name); 00403 prof_data->e[n].value = 0; 00404 prof_data->e[n].events = 0; 00405 prof_data->e[n].mark = 0; 00406 prof_data->e[n].scale = scale; 00407 return n; 00408 }
| void ast_autoservice_init | ( | void | ) |
Provided by astobj2.c Provided by autoservice.c
Definition at line 311 of file autoservice.c.
References as_cond, and ast_cond_init().
Referenced by main().
00312 { 00313 ast_cond_init(&as_cond, NULL); 00314 }
| void ast_builtins_init | ( | void | ) |
initialize the _full_cmd string in * each of the builtins.
Provided by cli.c
Definition at line 1505 of file cli.c.
References ast_cli_entry::_full_cmd, ast_cli_register_multiple(), ast_join(), ast_log(), builtins, cli_cli, ast_cli_entry::cmda, LOG_WARNING, and strdup.
Referenced by main().
01506 { 01507 struct ast_cli_entry *e; 01508 01509 for (e = builtins; e->cmda[0] != NULL; e++) { 01510 char buf[80]; 01511 ast_join(buf, sizeof(buf), e->cmda); 01512 e->_full_cmd = strdup(buf); 01513 if (!e->_full_cmd) 01514 ast_log(LOG_WARNING, "-- cannot allocate <%s>\n", buf); 01515 } 01516 01517 ast_cli_register_multiple(cli_cli, sizeof(cli_cli) / sizeof(struct ast_cli_entry)); 01518 }
| void ast_channels_init | ( | void | ) |
Provided by channel.c
Definition at line 4440 of file channel.c.
References ast_cli_register_multiple(), and cli_channel.
Referenced by main().
04441 { 04442 ast_cli_register_multiple(cli_channel, sizeof(cli_channel) / sizeof(struct ast_cli_entry)); 04443 }
| int64_t ast_mark | ( | int | , | |
| int | start1_stop0 | |||
| ) |
Definition at line 445 of file asterisk.c.
References profile_data::e, profile_data::entries, profile_entry::events, profile_entry::mark, prof_data, rdtsc(), profile_entry::scale, and profile_entry::value.
Referenced by extension_match_core().
00446 { 00447 if (!prof_data || i < 0 || i > prof_data->entries) /* invalid index */ 00448 return 0; 00449 if (startstop == 1) 00450 prof_data->e[i].mark = rdtsc(); 00451 else { 00452 prof_data->e[i].mark = (rdtsc() - prof_data->e[i].mark); 00453 if (prof_data->e[i].scale > 1) 00454 prof_data->e[i].mark /= prof_data->e[i].scale; 00455 prof_data->e[i].value += prof_data->e[i].mark; 00456 prof_data->e[i].events++; 00457 } 00458 return prof_data->e[i].mark; 00459 }
| int ast_module_reload | ( | const char * | name | ) |
Reload asterisk modules.
| name | the name of the module to reload |
Definition at line 545 of file loader.c.
References ast_lastreloadtime, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log(), ast_mutex_trylock(), ast_mutex_unlock(), ast_verbose(), ast_module::declined, ast_module_info::description, ast_module::flags, ast_module::info, LOG_NOTICE, option_verbose, ast_module_info::reload, resource_name_match(), ast_module::running, and VERBOSE_PREFIX_3.
Referenced by action_updateconfig(), handle_reload(), handle_reload_deprecated(), and monitor_sig_flags().
00546 { 00547 struct ast_module *cur; 00548 int res = 0; /* return value. 0 = not found, others, see below */ 00549 int i; 00550 00551 if (ast_mutex_trylock(&reloadlock)) { 00552 ast_verbose("The previous reload command didn't finish yet\n"); 00553 return -1; /* reload already in progress */ 00554 } 00555 ast_lastreloadtime = time(NULL); 00556 00557 /* Call "predefined" reload here first */ 00558 for (i = 0; reload_classes[i].name; i++) { 00559 if (!name || !strcasecmp(name, reload_classes[i].name)) { 00560 reload_classes[i].reload_fn(); /* XXX should check error ? */ 00561 res = 2; /* found and reloaded */ 00562 } 00563 } 00564 00565 if (name && res) { 00566 ast_mutex_unlock(&reloadlock); 00567 return res; 00568 } 00569 00570 AST_LIST_LOCK(&module_list); 00571 AST_LIST_TRAVERSE(&module_list, cur, entry) { 00572 const struct ast_module_info *info = cur->info; 00573 00574 if (name && resource_name_match(name, cur->resource)) 00575 continue; 00576 00577 if (!cur->flags.running || cur->flags.declined) { 00578 if (!name) 00579 continue; 00580 ast_log(LOG_NOTICE, "The module '%s' was not properly initialized. " 00581 "Before reloading the module, you must run \"module load %s\" " 00582 "and fix whatever is preventing the module from being initialized.\n", 00583 name, name); 00584 res = 2; /* Don't report that the module was not found */ 00585 break; 00586 } 00587 00588 if (!info->reload) { /* cannot be reloaded */ 00589 if (res < 1) /* store result if possible */ 00590 res = 1; /* 1 = no reload() method */ 00591 continue; 00592 } 00593 00594 res = 2; 00595 if (option_verbose > 2) 00596 ast_verbose(VERBOSE_PREFIX_3 "Reloading module '%s' (%s)\n", cur->resource, info->description); 00597 info->reload(); 00598 } 00599 AST_LIST_UNLOCK(&module_list); 00600 00601 ast_mutex_unlock(&reloadlock); 00602 00603 return res; 00604 }
| int64_t ast_profile | ( | int | , | |
| int64_t | ||||
| ) |
Definition at line 410 of file asterisk.c.
References profile_data::e, profile_data::entries, profile_entry::events, prof_data, profile_entry::scale, and profile_entry::value.
00411 { 00412 if (!prof_data || i < 0 || i > prof_data->entries) /* invalid index */ 00413 return 0; 00414 if (prof_data->e[i].scale > 1) 00415 delta /= prof_data->e[i].scale; 00416 prof_data->e[i].value += delta; 00417 prof_data->e[i].events++; 00418 return prof_data->e[i].value; 00419 }
| int ast_register_atexit | ( | void(*)(void) | func | ) |
Register a function to be executed before Asterisk exits.
| func | The callback function to use. |
Definition at line 713 of file asterisk.c.
References ast_calloc, AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_UNLOCK, and ast_unregister_atexit().
Referenced by do_reload(), and load_module().
00714 { 00715 struct ast_atexit *ae; 00716 00717 if (!(ae = ast_calloc(1, sizeof(*ae)))) 00718 return -1; 00719 00720 ae->func = func; 00721 00722 ast_unregister_atexit(func); 00723 00724 AST_LIST_LOCK(&atexits); 00725 AST_LIST_INSERT_HEAD(&atexits, ae, list); 00726 AST_LIST_UNLOCK(&atexits); 00727 00728 return 0; 00729 }
| void ast_register_file_version | ( | const char * | file, | |
| const char * | version | |||
| ) |
Register the version of a source code file with the core.
| file | the source file name | |
| version | the version string (typically a CVS revision keyword string) |
Definition at line 264 of file asterisk.c.
References ast_calloc, AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_strdupa, and ast_strip_quoted().
00265 { 00266 struct file_version *new; 00267 char *work; 00268 size_t version_length; 00269 00270 work = ast_strdupa(version); 00271 work = ast_strip(ast_strip_quoted(work, "$", "$")); 00272 version_length = strlen(work) + 1; 00273 00274 if (!(new = ast_calloc(1, sizeof(*new) + version_length))) 00275 return; 00276 00277 new->file = file; 00278 new->version = (char *) new + sizeof(*new); 00279 memcpy(new->version, work, version_length); 00280 AST_LIST_LOCK(&file_versions); 00281 AST_LIST_INSERT_HEAD(&file_versions, new, list); 00282 AST_LIST_UNLOCK(&file_versions); 00283 }
| int ast_set_priority | ( | int | ) |
We set ourselves to a high priority, that we might pre-empt everything else. If your PBX has heavy activity on it, this is a good thing.
Provided by asterisk.c
Definition at line 1195 of file asterisk.c.
References ast_log(), ast_verbose(), LOG_WARNING, sched_setscheduler, and setpriority.
Referenced by app_exec(), ast_safe_system(), icesencode(), launch_script(), main(), mp3play(), NBScatplay(), send_waveform_to_fd(), spawn_mp3(), and spawn_ras().
01196 { 01197 struct sched_param sched; 01198 memset(&sched, 0, sizeof(sched)); 01199 #ifdef __linux__ 01200 if (pri) { 01201 sched.sched_priority = 10; 01202 if (sched_setscheduler(0, SCHED_RR, &sched)) { 01203 ast_log(LOG_WARNING, "Unable to set high priority\n"); 01204 return -1; 01205 } else 01206 if (option_verbose) 01207 ast_verbose("Set to realtime thread\n"); 01208 } else { 01209 sched.sched_priority = 0; 01210 /* According to the manpage, these parameters can never fail. */ 01211 sched_setscheduler(0, SCHED_OTHER, &sched); 01212 } 01213 #else 01214 if (pri) { 01215 if (setpriority(PRIO_PROCESS, 0, -10) == -1) { 01216 ast_log(LOG_WARNING, "Unable to set high priority\n"); 01217 return -1; 01218 } else 01219 if (option_verbose) 01220 ast_verbose("Set to high priority\n"); 01221 } else { 01222 /* According to the manpage, these parameters can never fail. */ 01223 setpriority(PRIO_PROCESS, 0, 0); 01224 } 01225 #endif 01226 return 0; 01227 }
| int ast_term_init | ( | void | ) |
Provided by term.c
Definition at line 75 of file term.c.
References ast_opt_console, ast_opt_no_color, ast_opt_no_fork, ATTR_BRIGHT, ATTR_RESET, COLOR_BLACK, COLOR_BROWN, COLOR_WHITE, convshort(), and ESC.
Referenced by main().
00076 { 00077 char *term = getenv("TERM"); 00078 char termfile[256] = ""; 00079 char buffer[512] = ""; 00080 int termfd = -1, parseokay = 0, i; 00081 00082 if (!term) 00083 return 0; 00084 if (!ast_opt_console || ast_opt_no_color || !ast_opt_no_fork) 00085 return 0; 00086 00087 for (i=0 ;; i++) { 00088 if (termpath[i] == NULL) { 00089 break; 00090 } 00091 snprintf(termfile, sizeof(termfile), "%s/%c/%s", termpath[i], *term, term); 00092 termfd = open(termfile, O_RDONLY); 00093 if (termfd > -1) { 00094 break; 00095 } 00096 } 00097 if (termfd > -1) { 00098 int actsize = read(termfd, buffer, sizeof(buffer) - 1); 00099 short sz_names = convshort(buffer + 2); 00100 short sz_bools = convshort(buffer + 4); 00101 short n_nums = convshort(buffer + 6); 00102 00103 /* if ((sz_names + sz_bools) & 1) 00104 sz_bools++; */ 00105 00106 if (sz_names + sz_bools + n_nums < actsize) { 00107 /* Offset 13 is defined in /usr/include/term.h, though we do not 00108 * include it here, as it conflicts with include/asterisk/term.h */ 00109 short max_colors = convshort(buffer + 12 + sz_names + sz_bools + 13 * 2); 00110 if (max_colors > 0) { 00111 vt100compat = 1; 00112 } 00113 parseokay = 1; 00114 } 00115 close(termfd); 00116 } 00117 00118 if (!parseokay) { 00119 /* These comparisons should not be substrings nor case-insensitive, as 00120 * terminal types are very particular about how they treat suffixes and 00121 * capitalization. For example, terminal type 'linux-m' does NOT 00122 * support color, while 'linux' does. Not even all vt100* terminals 00123 * support color, either (e.g. 'vt100+fnkeys'). */ 00124 if (!strcmp(term, "linux")) { 00125 vt100compat = 1; 00126 } else if (!strcmp(term, "xterm")) { 00127 vt100compat = 1; 00128 } else if (!strcmp(term, "xterm-color")) { 00129 vt100compat = 1; 00130 } else if (!strncmp(term, "Eterm", 5)) { 00131 /* Both entries which start with Eterm support color */ 00132 vt100compat = 1; 00133 } else if (!strcmp(term, "vt100")) { 00134 vt100compat = 1; 00135 } else if (!strncmp(term, "crt", 3)) { 00136 /* Both crt terminals support color */ 00137 vt100compat = 1; 00138 } 00139 } 00140 00141 if (vt100compat) { 00142 /* Make commands show up in nice colors */ 00143 snprintf(prepdata, sizeof(prepdata), "%c[%d;%d;%dm", ESC, ATTR_BRIGHT, COLOR_BROWN, COLOR_BLACK + 10); 00144 snprintf(enddata, sizeof(enddata), "%c[%d;%d;%dm", ESC, ATTR_RESET, COLOR_WHITE, COLOR_BLACK + 10); 00145 snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC); 00146 } 00147 return 0; 00148 }
| void ast_unregister_atexit | ( | void(*)(void) | func | ) |
Unregister a function registered with ast_register_atexit().
| func | The callback function to unregister. |
Definition at line 731 of file asterisk.c.
References AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, free, and ast_atexit::func.
Referenced by ast_register_atexit(), and do_reload().
00732 { 00733 struct ast_atexit *ae = NULL; 00734 00735 AST_LIST_LOCK(&atexits); 00736 AST_LIST_TRAVERSE_SAFE_BEGIN(&atexits, ae, list) { 00737 if (ae->func == func) { 00738 AST_LIST_REMOVE_CURRENT(&atexits, list); 00739 break; 00740 } 00741 } 00742 AST_LIST_TRAVERSE_SAFE_END 00743 AST_LIST_UNLOCK(&atexits); 00744 00745 if (ae) 00746 free(ae); 00747 }
| void ast_unregister_file_version | ( | const char * | file | ) |
Unregister a source code file from the core.
| file | the source file name |
Definition at line 285 of file asterisk.c.
References AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, and free.
00286 { 00287 struct file_version *find; 00288 00289 AST_LIST_LOCK(&file_versions); 00290 AST_LIST_TRAVERSE_SAFE_BEGIN(&file_versions, find, list) { 00291 if (!strcasecmp(find->file, file)) { 00292 AST_LIST_REMOVE_CURRENT(&file_versions, list); 00293 break; 00294 } 00295 } 00296 AST_LIST_TRAVERSE_SAFE_END; 00297 AST_LIST_UNLOCK(&file_versions); 00298 if (find) 00299 free(find); 00300 }
| int astdb_init | ( | void | ) |
Provided by db.c
Definition at line 585 of file db.c.
References ast_cli_register_multiple(), ast_manager_register, cli_database, dbinit(), EVENT_FLAG_SYSTEM, manager_dbget(), and manager_dbput().
Referenced by main().
00586 { 00587 dbinit(); 00588 ast_cli_register_multiple(cli_database, sizeof(cli_database) / sizeof(struct ast_cli_entry)); 00589 ast_manager_register("DBGet", EVENT_FLAG_SYSTEM, manager_dbget, "Get DB Entry"); 00590 ast_manager_register("DBPut", EVENT_FLAG_SYSTEM, manager_dbput, "Put DB Entry"); 00591 return 0; 00592 }
| int astobj2_init | ( | void | ) |
Definition at line 721 of file astobj2.c.
References ARRAY_LEN, and ast_cli_register_multiple().
Referenced by main().
00722 { 00723 #ifdef AO2_DEBUG 00724 ast_cli_register_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2)); 00725 #endif 00726 00727 return 0; 00728 }
| void close_logger | ( | void | ) |
Provided by logger.c
Definition at line 628 of file logger.c.
References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, eventlog, f, and qlog.
Referenced by quit_handler().
00629 { 00630 struct logchannel *f; 00631 00632 AST_LIST_LOCK(&logchannels); 00633 00634 if (eventlog) { 00635 fclose(eventlog); 00636 eventlog = NULL; 00637 } 00638 00639 if (qlog) { 00640 fclose(qlog); 00641 qlog = NULL; 00642 } 00643 00644 AST_LIST_TRAVERSE(&logchannels, f, list) { 00645 if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) { 00646 fclose(f->fileptr); 00647 f->fileptr = NULL; 00648 } 00649 } 00650 00651 closelog(); /* syslog */ 00652 00653 AST_LIST_UNLOCK(&logchannels); 00654 00655 return; 00656 }
| int dnsmgr_init | ( | void | ) |
Provided by dnsmgr.c
Definition at line 342 of file dnsmgr.c.
References ast_cli_register(), ast_log(), cli_refresh, cli_reload, cli_status, do_reload(), LOG_ERROR, sched, and sched_context_create().
Referenced by main().
00343 { 00344 if (!(sched = sched_context_create())) { 00345 ast_log(LOG_ERROR, "Unable to create schedule context.\n"); 00346 return -1; 00347 } 00348 ast_cli_register(&cli_reload); 00349 ast_cli_register(&cli_status); 00350 ast_cli_register(&cli_refresh); 00351 return do_reload(1); 00352 }
| int dnsmgr_reload | ( | void | ) |
Provided by dnsmgr.c
Definition at line 354 of file dnsmgr.c.
References do_reload().
00355 { 00356 return do_reload(0); 00357 }
| void dnsmgr_start_refresh | ( | void | ) |
Provided by dnsmgr.c
Definition at line 252 of file dnsmgr.c.
References ast_sched_add_variable(), AST_SCHED_DEL, master_refresh_info, refresh_list(), and sched.
Referenced by main().
00253 { 00254 if (refresh_sched > -1) { 00255 AST_SCHED_DEL(sched, refresh_sched); 00256 refresh_sched = ast_sched_add_variable(sched, 100, refresh_list, &master_refresh_info, 1); 00257 } 00258 }
| int init_framer | ( | void | ) |
Provided by frame.c
Definition at line 1018 of file frame.c.
References ast_cli_register_multiple(), and my_clis.
Referenced by main().
01019 { 01020 ast_cli_register_multiple(my_clis, sizeof(my_clis) / sizeof(struct ast_cli_entry)); 01021 return 0; 01022 }
| int init_logger | ( | void | ) |
Provided by logger.c
Definition at line 589 of file logger.c.
References ast_cli_register_multiple(), ast_config_AST_LOG_DIR, ast_log(), ast_queue_log(), ast_verbose(), cli_logger, errno, eventlog, EVENTLOG, handle_SIGXFSZ(), init_logger_chain(), LOG_ERROR, LOG_EVENT, logfiles, option_verbose, qlog, and QUEUELOG.
Referenced by main().
00590 { 00591 char tmp[256]; 00592 int res = 0; 00593 00594 /* auto rotate if sig SIGXFSZ comes a-knockin */ 00595 (void) signal(SIGXFSZ,(void *) handle_SIGXFSZ); 00596 00597 /* register the logger cli commands */ 00598 ast_cli_register_multiple(cli_logger, sizeof(cli_logger) / sizeof(struct ast_cli_entry)); 00599 00600 mkdir((char *)ast_config_AST_LOG_DIR, 0755); 00601 00602 /* create log channels */ 00603 init_logger_chain(); 00604 00605 /* create the eventlog */ 00606 if (logfiles.event_log) { 00607 mkdir((char *)ast_config_AST_LOG_DIR, 0755); 00608 snprintf(tmp, sizeof(tmp), "%s/%s", (char *)ast_config_AST_LOG_DIR, EVENTLOG); 00609 eventlog = fopen((char *)tmp, "a"); 00610 if (eventlog) { 00611 ast_log(LOG_EVENT, "Started Asterisk Event Logger\n"); 00612 if (option_verbose) 00613 ast_verbose("Asterisk Event Logger Started %s\n",(char *)tmp); 00614 } else { 00615 ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno)); 00616 res = -1; 00617 } 00618 } 00619 00620 if (logfiles.queue_log) { 00621 snprintf(tmp, sizeof(tmp), "%s/%s", (char *)ast_config_AST_LOG_DIR, QUEUELOG); 00622 qlog = fopen(tmp, "a"); 00623 ast_queue_log("NONE", "NONE", "NONE", "QUEUESTART", "%s", ""); 00624 } 00625 return res; 00626 }
| int load_modul |