runit

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

commit 929d65f018a3e269ce80493795dcbb2a8ca49a86
parent 6979d531adb95c114f5cbb93b7222c3c0dfb6e10
Author: Gerrit Pape <pape@smarden.org>
Date:   Wed, 25 Sep 2002 10:17:37 +0000

  * man/runsv.8, man/runsvdir.8: new.
  * utmpset.c: setlock utmp and wtmp file.
0.5.4.

Diffstat:
MMakefile | 10+++++-----
Mdebian/changelog | 4++--
Mdebian/postinst | 2+-
Mdebian/rules | 38+++++++++++++++++++-------------------
Mdoc/install.html | 10+++++-----
Mdoc/replaceinit.html | 4++--
Metc/debian/2 | 6------
Metc/freebsd/2 | 6------
Metc/openbsd/2 | 6------
Mpackage/CHANGES | 5+++++
Mpackage/upgrade | 4++--
Msrc/runsv.c | 16+++++++++++-----
Msrc/runsvdir.c | 1+
Msrc/utmpset.c | 18++++++++++++++----
14 files changed, 67 insertions(+), 63 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,19 +1,19 @@ DESTDIR= -PACKAGE=runit-0.5.3 +PACKAGE=runit-0.5.4 DIRS=doc man etc package src -MANPAGES=man/runit.8 man/runit-init.8 man/svwaitdown.8 man/svwaitup.8 \ -man/utmpset.8 +MANPAGES=runit.8 runit-init.8 runsvdir.8 runsv.8 svwaitdown.8 svwaitup.8 \ +utmpset.8 all: clean .manpages $(PACKAGE).tar.gz .manpages: for i in $(MANPAGES); do \ - rman -S -f html -r '' < $$i | \ + rman -S -f html -r '' < man/$$i | \ sed -e 's}NAME="sect\([0-9]*\)" HREF="#toc[0-9]*">\(.*\)}NAME="sect\1">\2}g ; \ s}<A HREF="#toc">Table of Contents</A>}<a href="http://smarden.org/pape/">G. Pape</a><br><A HREF="index.html">runit</A><hr>}g ; \ s}<!--.*-->}}g' \ - > doc/`basename $$i`.html ; \ + > doc/$$i.html ; \ done ; \ touch .manpages diff --git a/debian/changelog b/debian/changelog @@ -1,8 +1,8 @@ -runit (0.5.3-1) sarge; urgency=low +runit (0.5.4-1) sarge; urgency=low * See /package/admin/runit/package/CHANGES. - -- Gerrit Pape <pape@smarden.org> Tue, 24 Sep 2002 13:18:59 +0200 + -- Gerrit Pape <pape@smarden.org> Wed, 25 Sep 2002 12:15:00 +0200 runit (0.5.2-1) sarge; urgency=low diff --git a/debian/postinst b/debian/postinst @@ -25,7 +25,7 @@ set -e case "$1" in configure) ( \ - cd /package/admin/runit-0.5.3 + cd /package/admin/runit-0.5.4 package/upgrade ) ;; diff --git a/debian/rules b/debian/rules @@ -23,15 +23,15 @@ build-stamp: # $(MAKE) #/usr/bin/docbook-to-man debian/runit.sgml > runit.1 - tar xfzvp runit-0.5.3.tar.gz + tar xfzvp runit-0.5.4.tar.gz ( \ - cd admin/runit-0.5.3 ; \ + cd admin/runit-0.5.4 ; \ echo 'diet gcc -O2 -Wall' > src/conf-cc ; \ echo 'diet gcc -s -Os -pipe' > src/conf-ld ; \ package/compile ; \ - echo "/package/admin/runit-0.5.3" > compile/home ; \ + echo "/package/admin/runit-0.5.4" > compile/home ; \ rm -f compile/src ; \ - ln -s /package/admin/runit-0.5.3/src compile/src ; \ + ln -s /package/admin/runit-0.5.4/src compile/src ; \ ) touch build-stamp @@ -58,40 +58,40 @@ install: build chmod 1755 debian/runit/package cp -a admin debian/runit/package/ - rm -rf debian/runit/package/admin/runit-0.5.3/compile - cp -a debian/runit/package/admin/runit-0.5.3/man . - rm -rf debian/runit/package/admin/runit-0.5.3/man - cp -a debian/runit/package/admin/runit-0.5.3/doc . - rm -rf debian/runit/package/admin/runit-0.5.3/doc - cp -a debian/runit/package/admin/runit-0.5.3/etc . - rm -rf debian/runit/package/admin/runit-0.5.3/etc - cp -a debian/runit/package/admin/runit-0.5.3/package . + rm -rf debian/runit/package/admin/runit-0.5.4/compile + cp -a debian/runit/package/admin/runit-0.5.4/man . + rm -rf debian/runit/package/admin/runit-0.5.4/man + cp -a debian/runit/package/admin/runit-0.5.4/doc . + rm -rf debian/runit/package/admin/runit-0.5.4/doc + cp -a debian/runit/package/admin/runit-0.5.4/etc . + rm -rf debian/runit/package/admin/runit-0.5.4/etc + cp -a debian/runit/package/admin/runit-0.5.4/package . # /etc/runit - cp -p admin/runit-0.5.3/etc/debian/[123] \ + cp -p admin/runit-0.5.4/etc/debian/[123] \ debian/runit/etc/runit/ - cp -p admin/runit-0.5.3/etc/debian/ctrlaltdel \ + cp -p admin/runit-0.5.4/etc/debian/ctrlaltdel \ debian/runit/etc/runit/ - cp -p admin/runit-0.5.3/etc/debian/getty-tty5/run \ + cp -p admin/runit-0.5.4/etc/debian/getty-tty5/run \ debian/runit/etc/runit/getty-5/run # runit programs - cp -p debian/runit/package/admin/runit-0.5.3/command/runit* \ + cp -p debian/runit/package/admin/runit-0.5.4/command/runit* \ debian/runit/sbin/ # cleanup - rm -rf debian/runit/package/admin/runit-0.5.3/compile + rm -rf debian/runit/package/admin/runit-0.5.4/compile # create debian/links rm -f debian/links for i in \ - `cat debian/runit/package/admin/runit-0.5.3/package/commands` ; \ + `cat debian/runit/package/admin/runit-0.5.4/package/commands` ; \ do \ echo "/package/admin/runit/command/$$i /command/$$i" \ >> debian/links ; \ done for i in \ - `cat debian/runit/package/admin/runit-0.5.3/package/commands` ; \ + `cat debian/runit/package/admin/runit-0.5.4/package/commands` ; \ do \ echo "/command/$$i /usr/local/bin/$$i" \ >> debian/links ; \ diff --git a/doc/install.html b/doc/install.html @@ -13,14 +13,14 @@ Check that you have the recent version of <a href="http://cr.yp.to/daemontools.html">daemontools</a> installed. <p> Download -<a href="runit-0.5.3.tar.gz">runit-0.5.3.tar.gz</a> into <tt>/package</tt> +<a href="runit-0.5.4.tar.gz">runit-0.5.4.tar.gz</a> into <tt>/package</tt> and unpack the archive <pre> # cd /package - # gunzip runit-0.5.3.tar - # tar -xpf runit-0.5.3.tar - # rm runit-0.5.3.tar - # cd admin/runit-0.5.3 + # gunzip runit-0.5.4.tar + # tar -xpf runit-0.5.4.tar + # rm runit-0.5.4.tar + # cd admin/runit-0.5.4 </pre> Compile and install the <i>runit</i> programs <pre> diff --git a/doc/replaceinit.html b/doc/replaceinit.html @@ -107,7 +107,7 @@ default Unix process no 1 <i>runit</i>. </pre> To report success: <pre> - # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.5.3@smarden.org + # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.5.4@smarden.org </pre> <hr> @@ -187,7 +187,7 @@ Use <b>init 6</b> to reboot and <b>init 0</b> to halt a system that runs <p> To report success: <pre> - # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.5.3@smarden.org + # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.5.4@smarden.org </pre> <h3>Step 5: Service migration</h3> The goal is to migrate all services from <i>/etc/rc.*</i> scheme to the diff --git a/etc/debian/2 b/etc/debian/2 @@ -2,11 +2,5 @@ PATH=/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin -exec </dev/null -exec >/dev/null -exec 2>/dev/null - -/command/svc -x /service/* - exec env - PATH=$PATH \ runsvdir /service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................' diff --git a/etc/freebsd/2 b/etc/freebsd/2 @@ -2,11 +2,5 @@ PATH=/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin -exec </dev/null -exec >/dev/null -exec 2>/dev/null - -/command/svc -x /service/* - exec env - PATH=$PATH \ runsvdir /service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................' diff --git a/etc/openbsd/2 b/etc/openbsd/2 @@ -2,11 +2,5 @@ PATH=/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin -exec </dev/null -exec >/dev/null -exec 2>/dev/null - -/command/svc -x /service/* - exec env - PATH=$PATH \ runsvdir /service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................' diff --git a/package/CHANGES b/package/CHANGES @@ -1,7 +1,12 @@ +runit 0.5.4 +Wed, 25 Sep 2002 12:13:46 +0200 + * man/runsv.8, man/runsvdir.8: new. + runit 0.5.3 Tue, 24 Sep 2002 12:14:02 +0200 * package/commands: remove rsv-status, rsv-control. * runsvdir.c, runsv.c: code cleanup. + * utmpset.c: setlock utmp and wtmp file. runit 0.5.2 Mon, 23 Sep 2002 16:25:07 +0200 diff --git a/package/upgrade b/package/upgrade @@ -7,9 +7,9 @@ test -d src || ( echo 'Wrong working directory.'; exit 1 ) here=`env - PATH=$PATH pwd` parent=`dirname $here` -echo 'Creating symlink runit -> runit-0.5.3...' +echo 'Creating symlink runit -> runit-0.5.4...' rm -f runit -ln -s runit-0.5.3 runit +ln -s runit-0.5.4 runit mv -f runit .. echo 'Making command links in /command...' diff --git a/src/runsv.c b/src/runsv.c @@ -92,12 +92,12 @@ void update_status(struct svdir *s) { char spid[FMT_ULONG]; if (s->islog) { - if ((fd =open_trunc("log/supervise/state")) == -1) - fatal("unable to open log/supervise/state"); + if ((fd =open_trunc("log/supervise/stat")) == -1) + fatal("unable to open log/supervise/stat"); } else { - if ((fd =open_trunc("supervise/state")) == -1) - fatal("unable to open supervise/state"); + if ((fd =open_trunc("supervise/stat")) == -1) + fatal("unable to open supervise/stat"); } buffer_init(&b, buffer_unixwrite, fd, bspace, sizeof bspace); spid[fmt_ulong(spid, (unsigned long)s->pid)] =0; @@ -113,7 +113,7 @@ void update_status(struct svdir *s) { break; } if (s->pid) { - buffer_puts(&b, " pid ("); + buffer_puts(&b, " (pid "); buffer_puts(&b, spid); buffer_puts(&b, ")"); } @@ -282,6 +282,12 @@ int ctrl(struct svdir *s, char c) { case 'i': /* sig int */ if (s->pid) kill(s->pid, SIGINT); break; + case '1': /* sig usr1 */ + if (s->pid) kill(s->pid, SIGUSR1); + break; + case '2': /* sig usr2 */ + if (s->pid) kill(s->pid, SIGUSR2); + break; } return(1); } diff --git a/src/runsvdir.c b/src/runsvdir.c @@ -7,6 +7,7 @@ #include "error.h" #include "wait.h" #include "env.h" +#include "open.h" #include "pathexec.h" #include "fd.h" #include "str.h" diff --git a/src/utmpset.c b/src/utmpset.c @@ -10,8 +10,10 @@ #include "str.h" #include "open.h" #include "byte.h" +#include "lock.h" #define USAGE " [-w] line" +#define FATAL "utmpset: fatal: " #define WARNING "utmpset: warning: " const char *progname; @@ -26,7 +28,10 @@ int utmp_logout(const char *line) { int ok =-1; if ((fd =open(_PATH_UTMP, O_RDWR, 0)) < 0) - return(-1); + strerr_die4sys(111, FATAL, "unable to open ", _PATH_UTMP, ": "); + if (lock_ex(fd) == -1) + strerr_die4sys(111, FATAL, "unable to lock: ", _PATH_UTMP, ": "); + while (read(fd, &ut, sizeof(struct utmp)) == sizeof(struct utmp)) { if (!ut.ut_name[0] || (str_diff(ut.ut_line, line) != 0)) continue; @@ -48,7 +53,10 @@ int wtmp_logout(const char *line) { struct utmp ut; if ((fd = open_append(_PATH_WTMP)) == -1) - return(-1); + strerr_die4sys(111, FATAL, "unable to open ", _PATH_WTMP, ": "); + if (lock_ex(fd) == -1) + strerr_die4sys(111, FATAL, "unable to lock ", _PATH_WTMP, ": "); + if (fstat(fd, &st) == -1) { close(fd); return(-1); @@ -91,10 +99,12 @@ int main (int argc, const char * const *argv, const char * const *envp) { if (! argv || ! *argv) usage(); if (utmp_logout(*argv) == -1) - strerr_die4sys(111, WARNING, "unable to utmp logout line ", *argv, ": "); + strerr_die4x(111, WARNING, "unable to logout line ", *argv, + " in utmp: no such entry"); if (wtmp) { if (wtmp_logout(*argv) == -1) - strerr_die4sys(111, WARNING, "unable to wtmp logout line ", *argv, ": "); + strerr_die4sys(111, WARNING, "unable to logout line ", *argv, + " in wtmp: "); } exit(0); }