summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-10-12 22:52:46 -0400
committerJoe Crayne <joe@jerkface.net>2019-10-12 22:52:46 -0400
commit6fbbb28c21bd38c9ae27c9719dab1f9550dd1cb1 (patch)
treeefa94f61c0d182ddcfad3c33c749f7a28a31129d
parent1b82bb025ec2db0f1a01b0059358c3c4bef3983e (diff)
Added man page from upstream.HEADmaster
-rw-r--r--Makefile5
-rw-r--r--chpst.8265
2 files changed, 270 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 68ae2f9..ffdf021 100644
--- a/Makefile
+++ b/Makefile
@@ -6,3 +6,8 @@
6# hasshsgr.h 6# hasshsgr.h
7 7
8chpst: *.c 8chpst: *.c
9
10.PHONY: man
11
12man:
13 groff -Tascii -man chpst.8 | less
diff --git a/chpst.8 b/chpst.8
new file mode 100644
index 0000000..43c0b8d
--- /dev/null
+++ b/chpst.8
@@ -0,0 +1,265 @@
1.TH chpst 8
2.SH NAME
3chpst \- runs a program with a changed process state
4.SH SYNOPSIS
5.B chpst
6[\-vP012]
7[\-u
8.IR user ]
9[\-U
10.IR user ]
11[\-b
12.IR argv0 ]
13[-e
14.IR dir ]
15[\-/
16.IR root ]
17[\-n
18.IR inc ]
19[-l|-L
20.IR lock ]
21[-m
22.IR bytes ]
23[-d
24.IR bytes ]
25[-o
26.IR n ]
27[-p
28.IR n ]
29[-f
30.IR bytes ]
31[-c
32.IR bytes ]
33.I prog
34.SH DESCRIPTION
35.I prog
36consists of one or more arguments.
37.P
38.B chpst
39changes the process state according to the given options, and runs
40.IR prog .
41.SH OPTIONS
42.TP
43.B \-u \fI[:]user[:group]
44setuidgid.
45Set uid and gid to the
46.IR user 's
47uid and gid, as found in
48.IR /etc/passwd .
49If
50.I user
51is followed by a colon and a
52.IR group ,
53set the gid to
54.IR group 's
55gid, as found in
56.IR /etc/group ,
57instead of
58.IR user 's
59gid.
60If
61.I group
62consists of a colon-separated list of group names,
63.B chpst
64sets the group ids of all listed groups.
65If
66.I user
67is prefixed with a colon, the
68.I user
69and all
70.I group
71arguments are interpreted as uid and gids respectivly, and not looked up in
72the password or group file.
73All initial supplementary groups are removed.
74.TP
75.B \-U \fI[:]user[:group]
76envuidgid.
77Set the environment variables $UID and $GID to the
78.IR user 's
79uid and gid, as found in
80.IR /etc/passwd .
81If
82.I user
83is followed by a colon and a
84.IR group ,
85set $GID to the
86.IR group 's
87gid, as found in
88.IR /etc/group ,
89instead of
90.IR user 's
91gid.
92If
93.I user
94is prefixed with a colon, the
95.I user
96and
97.I group
98arguments are interpreted as uid and gid respectivly, and not looked up in
99the password or group file.
100.TP
101.B \-b \fIargv0
102argv0.
103Run
104.I prog
105with
106.I argv0
107as the 0th argument.
108.TP
109.B \-e \fIdir
110envdir.
111Set various environment variables as specified by files in the directory
112.IR dir :
113If
114.I dir
115contains a file named
116.I k
117whose first line is
118.IR v ,
119.B chpst
120removes the environment variable
121.I k
122if it exists, and then adds the environment variable
123.I k
124with the value
125.IR v .
126The name
127.I k
128must not contain =.
129Spaces and tabs at the end of
130.I v
131are removed, and nulls in
132.I v
133are changed to newlines.
134If the file
135.I k
136is empty (0 bytes long),
137.B chpst
138removes the environment variable
139.I k
140if it exists, without adding a new variable.
141.TP
142.B \-/ \fIroot
143chroot.
144Change the root directory to
145.I root
146before starting
147.IR prog .
148.TP
149.B \-n \fIinc
150nice.
151Add
152.I inc
153to the
154.BR nice (2)
155value before starting
156.IR prog .
157.I inc
158must be an integer, and may start with a minus or plus.
159.TP
160.B \-l \fIlock
161lock.
162Open the file
163.I lock
164for writing, and obtain an exclusive lock on it.
165.I lock
166will be created if it does not exist.
167If
168.I lock
169is locked by another process, wait until a new lock can be obtained.
170.TP
171.B \-L \fIlock
172The same as \-l, but fail immediately if
173.I lock
174is locked by another process.
175.TP
176.B \-m \fIbytes
177limit memory.
178Limit the data segment, stack segment, locked physical pages, and total of
179all segment per process to
180.I bytes
181bytes each.
182.TP
183.B \-d \fIbytes
184limit data segment.
185Limit the data segment per process to
186.I bytes
187bytes.
188.TP
189.B \-o \fIn
190limit open files.
191Limit the number of open file descriptors per process to
192.IR n .
193.TP
194.B \-p \fIn
195limit processes.
196Limit the number of processes per uid to
197.IR n .
198.TP
199.B \-f \fIbytes
200limit output size.
201Limit the output file size to
202.I bytes
203bytes.
204.TP
205.B \-c \fIbytes
206limit core size.
207Limit the core file size to
208.I bytes
209bytes.
210.TP
211.B \-v
212verbose.
213Print verbose messages to standard error.
214This includes warnings about limits unsupported by the system.
215.TP
216.B \-P
217pgrphack.
218Run
219.I prog
220in a new process group.
221.TP
222.B \-0
223Close standard input before starting
224.IR prog .
225.TP
226.B \-1
227Close standard output before starting
228.IR prog .
229.TP
230.B \-2
231Close standard error before starting
232.IR prog .
233.SH EXIT CODES
234.B chpst
235exits 100 when called with wrong options.
236It prints an error message and exits 111 if it has trouble changing the
237process state.
238Otherwise its exit code is the same as that of
239.IR prog .
240.SH EMULATION
241If
242.B chpst
243is called as
244.BR envdir ,
245.BR envuidgid ,
246.BR pgrphack ,
247.BR setlock ,
248.BR setuidgid ,
249or
250.BR softlimit ,
251it emulates the functionality of these programs from the daemontools package
252respectively.
253.SH SEE ALSO
254sv(8),
255runsv(8),
256setsid(2),
257runit(8),
258runit-init(8),
259runsvdir(8),
260runsvchdir(8)
261.P
262 http://smarden.org/runit/
263 http://cr.yp.to/daemontools.html
264.SH AUTHOR
265Gerrit Pape <pape@smarden.org>