From: Andre Noll Date: Sat, 12 Apr 2008 17:46:37 +0000 (+0200) Subject: com_si(): Report also the afs pid. X-Git-Tag: v0.3.3~74 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=b17c70f1f96ca624064dd5202c54be55ed4d71c6 com_si(): Report also the afs pid. Replace mmd->server_pid by mmd->afs_pid because everybody can easily find out the server pid. --- diff --git a/command.c b/command.c index b3d9855f..3932ed22 100644 --- a/command.c +++ b/command.c @@ -280,7 +280,8 @@ int com_si(int fd, int argc, __a_unused char * const * argv) } ut = uptime_str(); ret = send_va_buffer(fd, "up: %s\nplayed: %u\n" - "pid: %d\n" + "server_pid: %d\n" + "afs_pid: %d\n" "connections (active/accepted/total): %u/%u/%u\n" "current loglevel: %i\n" "supported audio formats: %s\n" @@ -288,6 +289,7 @@ int com_si(int fd, int argc, __a_unused char * const * argv) "%s", ut, mmd->num_played, (int)getppid(), + (int)mmd->afs_pid, mmd->active_connections, mmd->num_commands, mmd->num_connects, diff --git a/server.c b/server.c index 5ea8811f..7da05898 100644 --- a/server.c +++ b/server.c @@ -115,7 +115,6 @@ static FILE *logfile; /** The file containing user information (public key, permissions). */ static char *user_list_file = NULL; static int mmd_shm_id; -static pid_t afs_pid; /** The task responsible for server command handling. */ @@ -260,8 +259,8 @@ static void handle_sighup(void) logfile = NULL; parse_config(1); /* reopens log */ init_user_list(user_list_file); /* reload user list */ - if (afs_pid) - kill(afs_pid, SIGHUP); + if (mmd->afs_pid) + kill(mmd->afs_pid, SIGHUP); } static void signal_post_select(struct sched *s, struct task *t) @@ -282,7 +281,7 @@ static void signal_post_select(struct sched *s, struct task *t) int ret = para_reap_child(&pid); if (ret <= 0) break; - if (pid != afs_pid) + if (pid != mmd->afs_pid) continue; PARA_EMERG_LOG("fatal: afs died\n"); goto genocide; @@ -448,10 +447,10 @@ static int init_afs(void) if (ret < 0) exit(EXIT_FAILURE); afs_socket_cookie = para_random((uint32_t)-1); - afs_pid = fork(); - if (afs_pid < 0) + mmd->afs_pid = fork(); + if (mmd->afs_pid < 0) exit(EXIT_FAILURE); - if (!afs_pid) { /* child (afs) */ + if (!mmd->afs_pid) { /* child (afs) */ close(afs_server_socket[0]); afs_init(afs_socket_cookie, afs_server_socket[1]); } @@ -493,7 +492,6 @@ static void server_init(int argc, char **argv) daemon_init(); PARA_NOTICE_LOG("initializing audio format handlers\n"); afh_init(); - mmd->server_pid = getpid(); init_signal_task(); PARA_NOTICE_LOG("initializing the audio file selector\n"); afs_socket = init_afs(); diff --git a/server.h b/server.h index 1468b458..b37c9f13 100644 --- a/server.h +++ b/server.h @@ -92,8 +92,8 @@ struct misc_meta_data { unsigned int num_connects; /** The number of connections currently active. */ unsigned int active_connections; - /** The process id of para_server. */ - pid_t server_pid; + /** The process id of the audio file selector. */ + pid_t afs_pid; /** This gets updated by afs and contains its current mode. */ char afs_mode_string[MAXLINE]; /** Used by the sender command. */