runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 545d6474057a42152e85e0511b29833a32adf150
parent a6740008c26f2c7a6c4a743ed364f561f8f3aa03
Author: Gerrit Pape <pape@smarden.org>
Date:   Mon,  2 Aug 2004 14:03:01 +0000

  * runsvdir.c:
    sleep one second before scanning if
    services dir mtime is now; loop while chdir to starting dir fails;
    rename log, loglen to rplog, rploglen.
  * etc/macosx/StartupItems/runit: use -x option to svwaitdown; timeout 14.

Diffstat:
Metc/macosx/StartupItems/runit | 2+-
Mpackage/CHANGES | 5++++-
Msrc/runsvdir.c | 32+++++++++++++++++---------------
3 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/etc/macosx/StartupItems/runit b/etc/macosx/StartupItems/runit @@ -12,7 +12,7 @@ StartService() { } StopService() { ConsoleMessage "Stopping runit service supervision" - svwaitdown -k -t34 /var/service/* + svwaitdown -xk -t14 /var/service/* } RestartService() { return 0 diff --git a/package/CHANGES b/package/CHANGES @@ -3,7 +3,10 @@ Sun, 01 Aug 2004 18:29:36 +0000 * doc/runlevels.html, doc/upgrade.html, doc/useinit.html, man/runsvdir.8, man/runsvchdir.8: minor changes in wording, notations. * runsvdir.c: check services dir again after one second until it's - unchanged (thx Eric Lammerts); loop while chdir to starting dir fails. + unchanged (thx Eric Lammerts); sleep one second before scanning if + services dir mtime is now; loop while chdir to starting dir fails; + rename log, loglen to rplog, rploglen. + * etc/macosx/StartupItems/runit: use -x option to svwaitdown; timeout 14. runit 1.0.3 Sat, 26 Jun 2004 14:50:41 +0000 diff --git a/src/runsvdir.c b/src/runsvdir.c @@ -33,8 +33,8 @@ struct { } sv[MAXSERVICES]; int svnum =0; int check =1; -char *log =0; -int loglen; +char *rplog =0; +int rploglen; int logpipe[2]; iopause_fd io[1]; struct taia stamplog; @@ -67,7 +67,7 @@ void runsv(int no, char *name) { prog[0] ="runsv"; prog[1] =name; prog[2] =0; - if (log) + if (rplog) if (fd_move(2, logpipe[1]) == -1) warn("unable to set filedescriptor for log service", 0); sig_uncatch(sig_hangup); @@ -138,7 +138,7 @@ void runsvdir() { } int setup_log() { - if ((loglen =str_len(log)) < 7) { + if ((rploglen =str_len(rplog)) < 7) { warn3x("log must have at least seven characters.", 0, 0); return(0); } @@ -179,9 +179,9 @@ int main(int argc, char **argv) { sig_catch(sig_hangup, s_hangup); svdir =*argv++; if (argv && *argv) { - log =*argv; + rplog =*argv; if (setup_log() != 1) { - log =0; + rplog =0; warn3x("log service disabled.", 0, 0); } } @@ -211,7 +211,7 @@ int main(int argc, char **argv) { warn3x("time warp: resetting time stamp.", 0, 0); taia_now(&stampcheck); taia_now(&now); - if (log) taia_now(&stamplog); + if (rplog) taia_now(&stamplog); } if (taia_less(&now, &stampcheck) == 0) { /* wait at least a second */ @@ -227,6 +227,8 @@ int main(int argc, char **argv) { dev =s.st_dev; ino =s.st_ino; check =0; + if (now.sec.x <= (4611686018427387914ULL +(uint64)mtime)) + sleep(1); runsvdir(); while (fchdir(curdir) == -1) { warn("unable to change directory, pausing", 0); @@ -241,7 +243,7 @@ int main(int argc, char **argv) { warn("unable to stat ", svdir); } - if (log) + if (rplog) if (taia_less(&now, &stamplog) == 0) { write(logpipe[1], ".", 1); taia_uint(&deadline, 900); @@ -251,20 +253,20 @@ int main(int argc, char **argv) { taia_add(&deadline, &now, &deadline); sig_block(sig_child); - if (log) + if (rplog) iopause(io, 1, &deadline, &now); else iopause(0, 0, &deadline, &now); sig_unblock(sig_child); - if (log && (io[0].revents | IOPAUSE_READ)) - while (read(logpipe[0], &ch, 1) > 0) { + if (rplog && (io[0].revents | IOPAUSE_READ)) + while (read(logpipe[0], &ch, 1) > 0) if (ch) { - for (i =6; i < loglen; i++) - log[i -1] =log[i]; - log[loglen -1] =ch; + for (i =6; i < rploglen; i++) + rplog[i -1] =rplog[i]; + rplog[rploglen -1] =ch; } - } + switch(exitsoon) { case 1: _exit(0);