]> git.tue.mpg.de Git - paraslash.git/commitdiff
com_si(): Report also the afs pid.
authorAndre Noll <maan@systemlinux.org>
Sat, 12 Apr 2008 17:46:37 +0000 (19:46 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 12 Apr 2008 17:46:37 +0000 (19:46 +0200)
Replace mmd->server_pid by mmd->afs_pid because everybody
can easily find out the server pid.

command.c
server.c
server.h

index b3d9855fea4488dbb1f8cfd2b70235d668134d47..3932ed2215691ea12fbbf04b7c7de9884c4cce4b 100644 (file)
--- 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,
index 5ea8811f960550c26d9b99a2c0a15b9ac204f7f7..7da05898b69b528563fc0e902f0568c0728752a8 100644 (file)
--- 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();
index 1468b458f4cc94d0dcd2eb43fbb1b1ca506970e7..b37c9f13921908701f284f989ef17ac7c2c6bb24 100644 (file)
--- 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. */