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 6286806..e2a517e 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);
+       int signum;
+
        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();
@@ -726,7 +728,7 @@ static void afs_signal_post_select(struct sched *s, struct task *t)
                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;
index f0d450a..99b4c7d 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);
+       int signum;
 
        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:
-               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");
        }
 }
index 2afb6db..ba5dabd 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);
+       int signum;
 
        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;
@@ -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:
-               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.
index 7be960e..a628df4 100644 (file)
--- a/signal.h
+++ b/signal.h
@@ -12,8 +12,6 @@
 struct signal_task {
        /** The signal pipe. */
        int fd;
-       /** The number of the most recent signal. */
-       int signum;
        /** The associated task structure. */
        struct task task;
 };