Remove ->signum from struct signal_task.
authorAndre Noll <maan@systemlinux.org>
Thu, 8 Apr 2010 20:02:30 +0000 (22:02 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 25 Apr 2010 18:11:22 +0000 (20:11 +0200)
It is only needed in the signal handlers where a local variable
can be used instead.

afs.c
audiod.c
server.c
signal.h

diff --git a/afs.c b/afs.c
index 6286806013471ea55278593d0cbf2de74f8934b7..e2a517ece2c8451b7a2715bc7f7a943b7680d079 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -710,14 +710,16 @@ static void signal_pre_select(struct sched *s, struct task *t)
 static void afs_signal_post_select(struct sched *s, struct task *t)
 {
        struct signal_task *st = container_of(t, struct signal_task, task);
 static void afs_signal_post_select(struct sched *s, struct task *t)
 {
        struct signal_task *st = container_of(t, struct signal_task, task);
+       int signum;
+
        if (getppid() == 1) {
                PARA_EMERG_LOG("para_server died\n");
                goto shutdown;
        }
        if (!FD_ISSET(st->fd, &s->rfds))
                return;
        if (getppid() == 1) {
                PARA_EMERG_LOG("para_server died\n");
                goto shutdown;
        }
        if (!FD_ISSET(st->fd, &s->rfds))
                return;
-       st->signum = para_next_signal();
-       if (st->signum == SIGHUP) {
+       signum = para_next_signal();
+       if (signum == SIGHUP) {
                close_afs_tables();
                parse_config_or_die(1);
                t->error = open_afs_tables();
                close_afs_tables();
                parse_config_or_die(1);
                t->error = open_afs_tables();
@@ -726,7 +728,7 @@ static void afs_signal_post_select(struct sched *s, struct task *t)
                init_admissible_files(current_mop);
                return;
        }
                init_admissible_files(current_mop);
                return;
        }
-       PARA_EMERG_LOG("terminating on signal %d\n", st->signum);
+       PARA_EMERG_LOG("terminating on signal %d\n", signum);
 shutdown:
        sched_shutdown();
        t->error = -E_AFS_SIGNAL;
 shutdown:
        sched_shutdown();
        t->error = -E_AFS_SIGNAL;
index f0d450a6ee49ea784c226aa1b8ae04bff6ce0b95..99b4c7df78ddfe2b48058726a5a3acc9ca18fd61 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -983,16 +983,17 @@ static void signal_pre_select(struct sched *s, struct task *t)
 static void signal_post_select(struct sched *s, struct task *t)
 {
        struct signal_task *st = container_of(t, struct signal_task, task);
 static void signal_post_select(struct sched *s, struct task *t)
 {
        struct signal_task *st = container_of(t, struct signal_task, task);
+       int signum;
 
        if (!FD_ISSET(st->fd, &s->rfds))
                return;
 
 
        if (!FD_ISSET(st->fd, &s->rfds))
                return;
 
-       st->signum = para_next_signal();
-       switch (st->signum) {
+       signum = para_next_signal();
+       switch (signum) {
        case SIGINT:
        case SIGTERM:
        case SIGHUP:
        case SIGINT:
        case SIGTERM:
        case SIGHUP:
-               PARA_EMERG_LOG("terminating on signal %d\n", st->signum);
+               PARA_EMERG_LOG("terminating on signal %d\n", signum);
                clean_exit(EXIT_FAILURE, "caught deadly signal");
        }
 }
                clean_exit(EXIT_FAILURE, "caught deadly signal");
        }
 }
index 2afb6db58de95906ba9bbd19f52a79ce054ae59d..ba5dabde066050825a46ef3abae82556474e7226 100644 (file)
--- a/server.c
+++ b/server.c
@@ -279,12 +279,13 @@ static void handle_sighup(void)
 static void signal_post_select(struct sched *s, struct task *t)
 {
        struct signal_task *st = container_of(t, struct signal_task, task);
 static void signal_post_select(struct sched *s, struct task *t)
 {
        struct signal_task *st = container_of(t, struct signal_task, task);
+       int signum;
 
        if (!FD_ISSET(st->fd, &s->rfds))
                return;
 
 
        if (!FD_ISSET(st->fd, &s->rfds))
                return;
 
-       st->signum = para_next_signal();
-       switch (st->signum) {
+       signum = para_next_signal();
+       switch (signum) {
        case SIGHUP:
                handle_sighup();
                break;
        case SIGHUP:
                handle_sighup();
                break;
@@ -304,7 +305,7 @@ static void signal_post_select(struct sched *s, struct task *t)
        /* die on sigint/sigterm. Kill all children too. */
        case SIGINT:
        case SIGTERM:
        /* die on sigint/sigterm. Kill all children too. */
        case SIGINT:
        case SIGTERM:
-               PARA_EMERG_LOG("terminating on signal %d\n", st->signum);
+               PARA_EMERG_LOG("terminating on signal %d\n", signum);
                kill(0, SIGTERM);
                /*
                 * We must wait for afs because afs catches SIGINT/SIGTERM.
                kill(0, SIGTERM);
                /*
                 * We must wait for afs because afs catches SIGINT/SIGTERM.
index 7be960efa56c983a1f9fe0e2f0b6fb9d4e4eeddb..a628df45263f258b519c311d88e7cc67f0d138c0 100644 (file)
--- a/signal.h
+++ b/signal.h
@@ -12,8 +12,6 @@
 struct signal_task {
        /** The signal pipe. */
        int fd;
 struct signal_task {
        /** The signal pipe. */
        int fd;
-       /** The number of the most recent signal. */
-       int signum;
        /** The associated task structure. */
        struct task task;
 };
        /** The associated task structure. */
        struct task task;
 };