From e46601d8a300796b1a84a417e58ca763ec2282b7 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 15 Jul 2009 00:21:49 +0200 Subject: [PATCH] runsv: rename field in a struct to not collide with other name no code changes Signed-off-by: Denys Vlasenko --- runit/runit_lib.h | 2 +- runit/runsv.c | 37 +++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/runit/runit_lib.h b/runit/runit_lib.h index fd94db9d7..28769e5fa 100644 --- a/runit/runit_lib.h +++ b/runit/runit_lib.h @@ -90,7 +90,7 @@ typedef struct svstatus_t { uint32_t time_nsec_be32 PACKED; uint32_t pid_le32 PACKED; uint8_t paused; - uint8_t want; + uint8_t want; /* 'u' or 'd' */ uint8_t got_term; uint8_t run_or_finish; } svstatus_t; diff --git a/runit/runsv.c b/runit/runsv.c index 5cb5d2f13..e93e25a4d 100644 --- a/runit/runsv.c +++ b/runit/runsv.c @@ -78,7 +78,7 @@ struct svdir { int pid; smallint state; smallint ctrl; - smallint want; + smallint sd_want; smallint islog; struct timespec start; int fdlock; @@ -201,7 +201,7 @@ static void update_status(struct svdir *s) if (s->ctrl & C_PAUSE) p = add_str(p, ", paused"); if (s->ctrl & C_TERM) p = add_str(p, ", got TERM"); if (s->state != S_DOWN) - switch (s->want) { + switch (s->sd_want) { case W_DOWN: p = add_str(p, ", want down"); break; @@ -224,7 +224,7 @@ static void update_status(struct svdir *s) status.pid_le32 = SWAP_LE32(s->pid); if (s->ctrl & C_PAUSE) status.paused = 1; - if (s->want == W_UP) + if (s->sd_want == W_UP) status.want = 'u'; else status.want = 'd'; @@ -291,12 +291,12 @@ static void stopservice(struct svdir *s) s->ctrl |= C_TERM; update_status(s); } - if (s->want == W_DOWN) { + if (s->sd_want == W_DOWN) { kill(s->pid, SIGCONT); custom(s, 'd'); return; } - if (s->want == W_EXIT) { + if (s->sd_want == W_EXIT) { kill(s->pid, SIGCONT); custom(s, 'x'); } @@ -360,13 +360,13 @@ static int ctrl(struct svdir *s, char c) switch (c) { case 'd': /* down */ - s->want = W_DOWN; + s->sd_want = W_DOWN; update_status(s); if (s->pid && s->state != S_FINISH) stopservice(s); break; case 'u': /* up */ - s->want = W_UP; + s->sd_want = W_UP; update_status(s); if (s->pid == 0) startservice(s); @@ -374,7 +374,7 @@ static int ctrl(struct svdir *s, char c) case 'x': /* exit */ if (s->islog) break; - s->want = W_EXIT; + s->sd_want = W_EXIT; update_status(s); /* FALLTHROUGH */ case 't': /* sig term */ @@ -399,7 +399,7 @@ static int ctrl(struct svdir *s, char c) update_status(s); break; case 'o': /* once */ - s->want = W_DOWN; + s->sd_want = W_DOWN; update_status(s); if (!s->pid) startservice(s); @@ -459,11 +459,12 @@ int runsv_main(int argc UNUSED_PARAM, char **argv) /* bss: svd[0].pid = 0; */ if (S_DOWN) svd[0].state = S_DOWN; /* otherwise already 0 (bss) */ if (C_NOOP) svd[0].ctrl = C_NOOP; - if (W_UP) svd[0].want = W_UP; + if (W_UP) svd[0].sd_want = W_UP; /* bss: svd[0].islog = 0; */ /* bss: svd[1].pid = 0; */ gettimeofday_ns(&svd[0].start); - if (stat("down", &s) != -1) svd[0].want = W_DOWN; + if (stat("down", &s) != -1) + svd[0].sd_want = W_DOWN; if (stat("log", &s) == -1) { if (errno != ENOENT) @@ -476,11 +477,11 @@ int runsv_main(int argc UNUSED_PARAM, char **argv) haslog = 1; svd[1].state = S_DOWN; svd[1].ctrl = C_NOOP; - svd[1].want = W_UP; + svd[1].sd_want = W_UP; svd[1].islog = 1; gettimeofday_ns(&svd[1].start); if (stat("log/down", &s) != -1) - svd[1].want = W_DOWN; + svd[1].sd_want = W_DOWN; xpiped_pair(logpipe); close_on_exec_on(logpipe.rd); close_on_exec_on(logpipe.wr); @@ -558,10 +559,10 @@ int runsv_main(int argc UNUSED_PARAM, char **argv) char ch; if (haslog) - if (!svd[1].pid && svd[1].want == W_UP) + if (!svd[1].pid && svd[1].sd_want == W_UP) startservice(&svd[1]); if (!svd[0].pid) - if (svd[0].want == W_UP || svd[0].state == S_FINISH) + if (svd[0].sd_want == W_UP || svd[0].state == S_FINISH) startservice(&svd[0]); x[0].fd = selfpipe.rd; @@ -634,11 +635,11 @@ int runsv_main(int argc UNUSED_PARAM, char **argv) sigterm = 0; } - if (svd[0].want == W_EXIT && svd[0].state == S_DOWN) { + if (svd[0].sd_want == W_EXIT && svd[0].state == S_DOWN) { if (svd[1].pid == 0) _exit(EXIT_SUCCESS); - if (svd[1].want != W_EXIT) { - svd[1].want = W_EXIT; + if (svd[1].sd_want != W_EXIT) { + svd[1].sd_want = W_EXIT; /* stopservice(&svd[1]); */ update_status(&svd[1]); close(logpipe.wr);