From: Andre Noll Date: Thu, 8 Apr 2010 20:02:30 +0000 (+0200) Subject: Remove ->signum from struct signal_task. X-Git-Tag: v0.4.3~25^2~12 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=9bf4bc297a7cb88f4f886c6b8d600fd6c584139c;p=paraslash.git Remove ->signum from struct signal_task. It is only needed in the signal handlers where a local variable can be used instead. --- diff --git a/afs.c b/afs.c index 62868060..e2a517ec 100644 --- 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; diff --git a/audiod.c b/audiod.c index f0d450a6..99b4c7df 100644 --- 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"); } } diff --git a/server.c b/server.c index 2afb6db5..ba5dabde 100644 --- 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. diff --git a/signal.h b/signal.h index 7be960ef..a628df45 100644 --- 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; };