runit

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

commit cb40c83dc8a451a397899891e19ab3d024501a1a
parent 70f5d2a7a817ca1cbe74d1dfd4b41f36118826d5
Author: Gerrit Pape <pape@smarden.org>
Date:   Fri,  8 Aug 2003 10:17:22 +0000

0.11.0.

Diffstat:
MMakefile | 4++--
Mdebian/changelog | 7+++++++
Mdebian/rules | 36++++++++++++++++++------------------
Adoc/chpst.8.html | 126+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdoc/install.html | 12++++++------
Mdoc/replaceinit.html | 4++--
Mdoc/upgrade.html | 4++++
Mman/chpst.8 | 4++--
Mpackage/CHANGES | 4++--
Mpackage/upgrade | 4++--
Mpackage/versions | 1+
Dsrc/setuidgid.c | 33---------------------------------
12 files changed, 172 insertions(+), 67 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,9 +1,9 @@ DESTDIR= -PACKAGE=runit-0.10.0 +PACKAGE=runit-0.11.0 DIRS=doc man etc package src MANPAGES=runit.8 runit-init.8 runsvdir.8 runsv.8 svwaitdown.8 svwaitup.8 \ -utmpset.8 runsvchdir.8 runsvstat.8 runsvctrl.8 svlogd.8 +utmpset.8 runsvchdir.8 runsvstat.8 runsvctrl.8 svlogd.8 chpst.8 all: clean .manpages $(PACKAGE).tar.gz diff --git a/debian/changelog b/debian/changelog @@ -1,3 +1,10 @@ +runit (0.11.0-1) unstable; urgency=low + + * new upstream version: + * chpst: new; run a program with a changed process state. + + -- Gerrit Pape <pape@smarden.org> Fri, 8 Aug 2003 12:01:39 +0200 + runit (0.10.0-1) unstable; urgency=low * new upstream version. diff --git a/debian/rules b/debian/rules @@ -41,13 +41,13 @@ build-arch: configure-stamp build-arch-stamp build-arch-stamp: dh_testdir - tar xfzvp runit-0.10.0.tar.gz + tar xfzvp runit-0.11.0.tar.gz -gcc -v ( \ set -e; \ - cd admin/runit-0.10.0/src; \ - ln -s runit-0.10.0 runit; mv runit ../..; \ + cd admin/runit-0.11.0/src; \ + ln -s runit-0.11.0 runit; mv runit ../..; \ echo "$(CC) $(CFLAGS)" >conf-cc; \ echo "$(CC) $(LDFLAGS)" >conf-ld; \ $(MAKE); \ @@ -79,35 +79,35 @@ install: build dh_installdirs # runit - install -m0500 admin/runit-0.10.0/src/runit \ + install -m0500 admin/runit-0.11.0/src/runit \ $(CURDIR)/debian/runit/sbin/runit - install -m0500 admin/runit-0.10.0/src/runit-init \ + install -m0500 admin/runit-0.11.0/src/runit-init \ $(CURDIR)/debian/runit/sbin/runit-init - install -m0755 admin/runit-0.10.0/src/runsvdir \ + install -m0755 admin/runit-0.11.0/src/runsvdir \ $(CURDIR)/debian/runit/usr/bin/runsvdir - install -m0755 admin/runit-0.10.0/src/runsv \ + install -m0755 admin/runit-0.11.0/src/runsv \ $(CURDIR)/debian/runit/usr/bin/runsv - install -m0755 admin/runit-0.10.0/src/runsvchdir \ + install -m0755 admin/runit-0.11.0/src/runsvchdir \ $(CURDIR)/debian/runit/usr/sbin/runsvchdir - install -m0755 admin/runit-0.10.0/src/svlogd \ + install -m0755 admin/runit-0.11.0/src/svlogd \ $(CURDIR)/debian/runit/usr/bin/svlogd - install -m0755 admin/runit-0.10.0/src/svwaitdown \ + install -m0755 admin/runit-0.11.0/src/svwaitdown \ $(CURDIR)/debian/runit/usr/bin/svwaitdown - install -m0755 admin/runit-0.10.0/src/svwaitup \ + install -m0755 admin/runit-0.11.0/src/svwaitup \ $(CURDIR)/debian/runit/usr/bin/svwaitup - install -m0755 admin/runit-0.10.0/src/utmpset \ + install -m0755 admin/runit-0.11.0/src/utmpset \ $(CURDIR)/debian/runit/usr/sbin/utmpset - install -m0755 admin/runit-0.10.0/src/runsvstat \ + install -m0755 admin/runit-0.11.0/src/runsvstat \ $(CURDIR)/debian/runit/usr/bin/runsvstat - install -m0755 admin/runit-0.10.0/src/runsvctrl \ + install -m0755 admin/runit-0.11.0/src/runsvctrl \ $(CURDIR)/debian/runit/usr/bin/runsvctrl - install -m0755 admin/runit-0.10.0/src/setuidgid \ + install -m0755 admin/runit-0.11.0/src/setuidgid \ $(CURDIR)/debian/runit/usr/sbin/setuidgid - install -m0755 admin/runit-0.10.0/etc/debian/getty-tty5/run \ + install -m0755 admin/runit-0.11.0/etc/debian/getty-tty5/run \ $(CURDIR)/debian/runit/etc/runit/getty-5/run - install -m0755 admin/runit-0.10.0/etc/debian/getty-tty5/finish \ + install -m0755 admin/runit-0.11.0/etc/debian/getty-tty5/finish \ $(CURDIR)/debian/runit/etc/runit/getty-5/finish # lintian overrides @@ -146,7 +146,7 @@ binary-arch: build install # dh_installdocs -an # dh_installexamples -a dh_installman -a admin/runit/man/*.8 - dh_installchangelogs -a admin/runit-0.10.0/package/CHANGES + dh_installchangelogs -a admin/runit-0.11.0/package/CHANGES dh_strip -a # dh_link -a dh_compress -a diff --git a/doc/chpst.8.html b/doc/chpst.8.html @@ -0,0 +1,126 @@ + + + +<HTML> +<HEAD> +<TITLE>chpst(8) manual page</TITLE> +</HEAD> +<BODY bgcolor=white> +<a href="http://smarden.org/pape/">G. Pape</a><br><A HREF="index.html">runit</A><hr><P> + +<H2><A NAME="sect0">Name</A></H2> +chpst - runs a program with a changed process state +<H2><A NAME="sect1">Synopsis</A></H2> +<B>chpst</B> [-vP012] +[-u <I>user</I>] [-U <I>user</I>] [-e <I>dir</I>] [-l|-L <I>lock</I>] [-m <I>bytes</I>] [-o <I>n</I>] [-p <I>n</I>] [-f <I>bytes</I>] [-c +<I>bytes</I>] <I>prog</I> +<H2><A NAME="sect2">Description</A></H2> +<I>prog</I> consists of one or more arguments. <P> +<B>chpst</B> changes +the process state according to the given options, and runs <I>prog</I>. +<H2><A NAME="sect3">Options</A></H2> + +<DL> + +<DT><B>-u +<I>user[:group]</B> </I></DT> +<DD>setuidgid. Set uid and gid to the <I>user</I>'s uid and gid. If <I>user</I> +is followed by a colon and a <I>group</I>, set the gid to <I>group</I>'s gid instead of +<I>user</I>'s gid. All supplementary groups are removed. </DD> + +<DT><B>-U <I>user[:group]</B> </I></DT> +<DD>envuidgid. +Set the environment variables $UID and $GID to the <I>user</I>'s uid and gid. If +<I>user</I> is followed by a colon and a <I>group</I>, set $GID to the <I>group</I>'s gid instead +of <I>user</I>'s gid. </DD> + +<DT><B>-e <I>dir</B> </I></DT> +<DD>envdir. Set various environment variables as specified +by files in the directory <I>dir</I>: If <I>dir</I> contains a file named <I>k</I> whose first +line is <I>v</I>, <B>chpst</B> removes the environment variable <I>k</I> if it exists, and then +adds the environment variable <I>k</I> with the value <I>v</I>. The name <I>k</I> must not contain +=. Spaces and tabs at the end of <I>v</I> are removed, and nulls in <I>v</I> are changed +to newlines. If the file <I>k</I> is empty (0 bytes long), <B>chpst</B> removes the environment +variable <I>k</I> if it exists, without adding a new variable. </DD> + +<DT><B>-l <I>lock</B> </I></DT> +<DD>lock. Open +the file <I>lock</I> for writing, and obtain an exclusive lock on it. <I>lock</I> will +be created if it does not exist. If <I>lock</I> is locked by another process, wait +until a new lock can be obtained. </DD> + +<DT><B>-L <I>lock</B> </I></DT> +<DD>The same as -l, but fail immediately +if <I>lock</I> is locked by another process. </DD> + +<DT><B>-m <I>bytes</B> </I></DT> +<DD>limit memory. Limit the data +segment, stack segment, locked physical pages, and total of all segment +per process to <I>bytes</I> bytes each. </DD> + +<DT><B>-o <I>n</B> </I></DT> +<DD>limit open files. Limit the number of +open file descriptors per process to <I>n</I>. </DD> + +<DT><B>-p <I>n</B> </I></DT> +<DD>limit processes. Limit the number +of processes per uid to <I>n</I>. </DD> + +<DT><B>-f <I>bytes</B> </I></DT> +<DD>limit output size. Limit the output file +size to <I>bytes</I> bytes. </DD> + +<DT><B>-c <I>bytes</B> </I></DT> +<DD>limit core size. Limit the core file size to +<I>bytes</I> bytes. </DD> + +<DT><B>-v</B> </DT> +<DD>verbose. Print warnings about limits unsupported by the system +to standard error. </DD> + +<DT><B>-P</B> </DT> +<DD>pgrphack. Run <I>prog</I> in a new process group. </DD> + +<DT><B>-0</B> </DT> +<DD>Close standard +input before running <I>prog</I>. </DD> + +<DT><B>-1</B> </DT> +<DD>Close standard output before running <I>prog</I>. </DD> + +<DT><B>-2</B> +</DT> +<DD>Close standard error before running <I>prog</I>. </DD> +</DL> + +<H2><A NAME="sect4">Exit Codes</A></H2> +<B>chpst</B> exits 100 when +called with wrong options. It prints an error message and exits 111 if it +has trouble changing the process state. Otherwise its exit code is the same +as that of <I>prog</I>. +<H2><A NAME="sect5">Emulation</A></H2> +If <B>chpst</B> is called as <B><I>envdir</B>(8)</I>, <B><I>envuidgid</B>(8)</I>, +<B><I>pgrphack</B>(8)</I>, <B><I>setlock</B>(8)</I>, <B><I>setuidgid</B>(8)</I>, or <B><I>softlimit</B>(8)</I>, it emulates the +functionality of these programs from the daemontools package respectively. + +<H2><A NAME="sect6">See Also</A></H2> +<I>runsv(8)</I>, <I>runsvctrl(8)</I>, <I>runsvstat(8)</I>, <I>runsvdir(8)</I>, <I>setsid(2)</I> <P> + <I>http://smarden.org/runit/</I><BR> + <I>http://cr.yp.to/daemontools.html</I><BR> + +<H2><A NAME="sect7">Author</A></H2> +Gerrit Pape &lt;pape@smarden.org&gt; <P> + +<HR><P> +<A NAME="toc"><B>Table of Contents</B></A><P> +<UL> +<LI><A NAME="toc0" HREF="#sect0">Name</A></LI> +<LI><A NAME="toc1" HREF="#sect1">Synopsis</A></LI> +<LI><A NAME="toc2" HREF="#sect2">Description</A></LI> +<LI><A NAME="toc3" HREF="#sect3">Options</A></LI> +<LI><A NAME="toc4" HREF="#sect4">Exit Codes</A></LI> +<LI><A NAME="toc5" HREF="#sect5">Emulation</A></LI> +<LI><A NAME="toc6" HREF="#sect6">See Also</A></LI> +<LI><A NAME="toc7" HREF="#sect7">Author</A></LI> +</UL> +</BODY></HTML> diff --git a/doc/install.html b/doc/install.html @@ -17,14 +17,14 @@ If you don't have a <tt>/package</tt> directory, create it now: # chmod 1755 /package </pre> Download -<a href="runit-0.10.0.tar.gz">runit-0.10.0.tar.gz</a> into <tt>/package</tt> +<a href="runit-0.11.0.tar.gz">runit-0.11.0.tar.gz</a> into <tt>/package</tt> and unpack the archive <pre> # cd /package - # gunzip runit-0.10.0.tar - # tar -xpf runit-0.10.0.tar - # rm runit-0.10.0.tar - # cd admin/runit-0.10.0 + # gunzip runit-0.11.0.tar + # tar -xpf runit-0.11.0.tar + # rm runit-0.11.0.tar + # cd admin/runit-0.11.0 </pre> On MacOSX, do <pre> @@ -43,7 +43,7 @@ hierarchy, do: </pre> To report success: <pre> - # mail pape-runit-0.10.0@smarden.org &lt;compile/sysdeps + # mail pape-runit-0.11.0@smarden.org &lt;compile/sysdeps </pre> Refer to <a href="replaceinit.html">replacing init</a> for replacing <i>init</i> with <i>runit</i>, or to diff --git a/doc/replaceinit.html b/doc/replaceinit.html @@ -108,7 +108,7 @@ default Unix process no 1 <i>runit</i>. </pre> To report success: <pre> - # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.10.0@smarden.org + # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.11.0@smarden.org </pre> <hr> @@ -189,7 +189,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.10.0@smarden.org + # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.11.0@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/doc/upgrade.html b/doc/upgrade.html @@ -10,6 +10,10 @@ <h1>runit - upgrading from previous versions</h1> <hr> +<h3>0.10.0 to 0.11.0</h3> +This version introduces the new <a href="chpst.8.html">chpst</a> program, +which changes the process state as specified by command line options, and runs +another program with this process state. <h3>0.9.x to 0.10.0</h3> No further action from you is required. <h3>0.8.0 or 0.8.1 to 0.9.x</h3> diff --git a/man/chpst.8 b/man/chpst.8 @@ -114,8 +114,8 @@ is locked by another process. .TP .B \-m \fIbytes limit memory. -Limit the data segment, stack segment, and locked physical pages, per -process to +Limit the data segment, stack segment, locked physical pages, and total of +all segment per process to .I bytes bytes each. .TP diff --git a/package/CHANGES b/package/CHANGES @@ -1,9 +1,9 @@ runit 0.11.0 - +Fri, 08 Aug 2003 11:59:13 +0200 * uidgid.c, uidgid.h: new; get uid/gid by name. * chpst: new; run program with a changed process state (includes envdir, envuidgid, pgrphack, setlock, setuidgid, softlimit functionality). - XXX * setuidgid.c: remove; obsolete (replaced by chpst). + * setuidgid.c: remove; obsolete (replaced by chpst). runit 0.10.0 Sun, 22 Jun 2003 20:44:58 +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.10.0...' +echo 'Creating symlink runit -> runit-0.11.0...' rm -f runit -ln -s runit-0.10.0 runit +ln -s runit-0.11.0 runit mv -f runit .. echo 'Making command links in /command...' diff --git a/package/versions b/package/versions @@ -16,3 +16,4 @@ 0.9.4 0.9.5 0.10.0 +0.11.0 diff --git a/src/setuidgid.c b/src/setuidgid.c @@ -1,33 +0,0 @@ -#include <sys/types.h> -#include <pwd.h> -#include "prot.h" -#include "strerr.h" -#include "pathexec.h" - -#define USAGE " account child" -#define FATAL "setuidgid: fatal: " - -const char *progname; - -void fatal(char *m) { strerr_die3sys(111, FATAL, m, ": "); } -void usage() { strerr_die4x(100, "usage: ", progname, USAGE, "\n"); } - -int main(int argc, const char *const *argv, const char *const *envp) { - const char *account; - struct passwd *pw; - - progname =argv[0]; - - if (! (account =*++argv)) usage(); - if (! *++argv) usage(); - - if (! (pw =getpwnam(account))) - strerr_die3x(111, FATAL, "unknown account ", account); - - if (prot_gid(pw->pw_gid) == -1) fatal("unable to setgid"); - if (prot_uid(pw->pw_uid) == -1) fatal("unable to setuid"); - - pathexec_run(*argv, argv, envp); - strerr_die4sys(111, FATAL, "unable to run ", *argv, ": "); - return(1); -}