[asterisk-commits] mjordan: branch mjordan/1.8_instrumented r362426 - /team/mjordan/1.8_instrume...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Apr 18 08:56:56 CDT 2012
Author: mjordan
Date: Wed Apr 18 08:56:50 2012
New Revision: 362426
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=362426
Log:
Add more printfs and what not
Well, it appears as if some of the time, Asterisk dies pretty early
in the startup sequence. Way earlier then I thought. Need to narrow
down just how early.
Modified:
team/mjordan/1.8_instrumented/main/asterisk.c
Modified: team/mjordan/1.8_instrumented/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/1.8_instrumented/main/asterisk.c?view=diff&rev=362426&r1=362425&r2=362426
==============================================================================
--- team/mjordan/1.8_instrumented/main/asterisk.c (original)
+++ team/mjordan/1.8_instrumented/main/asterisk.c Wed Apr 18 08:56:50 2012
@@ -1466,7 +1466,7 @@
int res;
ast_consock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (ast_consock < 0) {
- ast_log(LOG_WARNING, "Unable to create socket: %s\n", strerror(errno));
+ printf("Unable to create socket: %s\n", strerror(errno));
return 0;
}
memset(&sunaddr, 0, sizeof(sunaddr));
@@ -1474,6 +1474,7 @@
ast_copy_string(sunaddr.sun_path, ast_config_AST_SOCKET, sizeof(sunaddr.sun_path));
res = connect(ast_consock, (struct sockaddr *)&sunaddr, sizeof(sunaddr));
if (res) {
+ printf("connect returned %s\n", strerror(errno));
close(ast_consock);
ast_consock = -1;
return 0;
@@ -3316,6 +3317,8 @@
ast_fd_init();
ast_pbx_init();
+ printf("Parsing command line arguments\n");
+
if (getenv("HOME"))
snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
/* Check for options */
@@ -3435,6 +3438,8 @@
}
}
+ printf("Past command line argument parsing\n");
+
if (ast_opt_console || option_verbose || (ast_opt_remote && !ast_opt_exec)) {
if (ast_register_verbose(console_verboser)) {
ast_log(LOG_WARNING, "Unable to register console verboser?\n");
@@ -3462,6 +3467,8 @@
ast_readconfig();
env_init();
+ printf("Past environment initialization\n");
+
if (ast_opt_remote && remotesock != NULL)
ast_copy_string((char *) cfg_paths.socket_path, remotesock, sizeof(cfg_paths.socket_path));
@@ -3540,7 +3547,7 @@
if (errno == EEXIST) {
rundir_exists = 1;
} else {
- ast_log(LOG_WARNING, "Unable to create socket file directory. Remote consoles will not be able to connect! (%s)\n", strerror(x));
+ printf("Unable to create socket file directory. Remote consoles will not be able to connect! (%s)\n", strerror(x));
}
}
@@ -3554,18 +3561,18 @@
struct group *gr;
gr = getgrnam(rungroup);
if (!gr) {
- ast_log(LOG_WARNING, "No such group '%s'!\n", rungroup);
+ printf("No such group '%s'!\n", rungroup);
exit(1);
}
if (!rundir_exists && chown(ast_config_AST_RUN_DIR, -1, gr->gr_gid)) {
ast_log(LOG_WARNING, "Unable to chgrp run directory to %d (%s)\n", (int) gr->gr_gid, rungroup);
}
if (setgid(gr->gr_gid)) {
- ast_log(LOG_WARNING, "Unable to setgid to %d (%s)\n", (int)gr->gr_gid, rungroup);
+ printf("Unable to setgid to %d (%s)\n", (int)gr->gr_gid, rungroup);
exit(1);
}
if (setgroups(0, NULL)) {
- ast_log(LOG_WARNING, "Unable to drop unneeded groups\n");
+ printf("Unable to drop unneeded groups\n");
exit(1);
}
if (option_verbose)
@@ -3579,7 +3586,7 @@
struct passwd *pw;
pw = getpwnam(runuser);
if (!pw) {
- ast_log(LOG_WARNING, "No such user '%s'!\n", runuser);
+ printf("No such user '%s'!\n", runuser);
exit(1);
}
if (chown(ast_config_AST_RUN_DIR, pw->pw_uid, -1)) {
@@ -3592,21 +3599,21 @@
}
#endif /* HAVE_CAP */
if (!isroot && pw->pw_uid != geteuid()) {
- ast_log(LOG_ERROR, "Asterisk started as nonroot, but runuser '%s' requested.\n", runuser);
+ printf("Asterisk started as nonroot, but runuser '%s' requested.\n", runuser);
exit(1);
}
if (!rungroup) {
if (setgid(pw->pw_gid)) {
- ast_log(LOG_WARNING, "Unable to setgid to %d!\n", (int)pw->pw_gid);
+ printf("Unable to setgid to %d!\n", (int)pw->pw_gid);
exit(1);
}
if (isroot && initgroups(pw->pw_name, pw->pw_gid)) {
- ast_log(LOG_WARNING, "Unable to init groups for '%s'\n", runuser);
+ printf("Unable to init groups for '%s'\n", runuser);
exit(1);
}
}
if (setuid(pw->pw_uid)) {
- ast_log(LOG_WARNING, "Unable to setuid to %d (%s)\n", (int)pw->pw_uid, runuser);
+ printf("Unable to setuid to %d (%s)\n", (int)pw->pw_uid, runuser);
exit(1);
}
if (option_verbose)
@@ -3659,7 +3666,7 @@
}
}
}
-
+ printf("Berfore terminal init\n");
ast_term_init();
printf("%s", term_end());
fflush(stdout);
@@ -3667,6 +3674,7 @@
if (ast_opt_console && !option_verbose)
ast_verbose("[ Initializing Custom Configuration Options ]\n");
/* custom config setup */
+ printf("Some asterisks die before this point....\n");
register_config_cli();
read_config_maps();
@@ -3683,6 +3691,7 @@
if (ast_opt_remote) {
if (ast_opt_exec) {
ast_remotecontrol(xarg);
+ printf("Shutting down fast after command execution\n");
quit_handler(0, SHUTDOWN_FAST, 0);
exit(0);
}
@@ -3691,12 +3700,12 @@
quit_handler(0, SHUTDOWN_FAST, 0);
exit(0);
} else {
- ast_log(LOG_ERROR, "Asterisk already running on %s. Use 'asterisk -r' to connect.\n", ast_config_AST_SOCKET);
+ printf("Asterisk already running on %s. Use 'asterisk -r' to connect.\n", ast_config_AST_SOCKET);
printf("%s", term_quit());
exit(1);
}
} else if (ast_opt_remote || ast_opt_exec) {
- ast_log(LOG_ERROR, "Unable to connect to remote asterisk (does %s exist?)\n", ast_config_AST_SOCKET);
+ printf("Unable to connect to remote asterisk (does %s exist?)\n", ast_config_AST_SOCKET);
printf("%s", term_quit());
exit(1);
}
@@ -3707,7 +3716,7 @@
fprintf(f, "%ld\n", (long)getpid());
fclose(f);
} else
- ast_log(LOG_WARNING, "Unable to open pid file '%s': %s\n", ast_config_AST_PID, strerror(errno));
+ printf("Unable to open pid file '%s': %s\n", ast_config_AST_PID, strerror(errno));
#if HAVE_WORKING_FORK
if (ast_opt_always_fork || !ast_opt_no_fork) {
@@ -3782,7 +3791,7 @@
#endif
ast_aoc_cli_init();
-
+ printf("Before make socket\n");
ast_makesocket();
sigemptyset(&sigs);
sigaddset(&sigs, SIGHUP);
@@ -3796,7 +3805,7 @@
signal(SIGTERM, __quit_handler);
sigaction(SIGHUP, &hup_handler, NULL);
sigaction(SIGPIPE, &ignore_sig_handler, NULL);
-
+ printf("After signal handlers\n");
/* ensure that the random number generators are seeded with a different value every time
Asterisk is started
*/
More information about the asterisk-commits
mailing list