11README
22~~~~~~
3- This contains the source for the daemon program and the prog library.
3+ This contains the source code to daemon and libslack.
4+
5+ daemon - turns other processes into daemons
46
57Daemon turns other processes into daemons. There are many tasks that need to
68be performed to correctly set up a daemon process. This can be tedious.
79Daemon performs these tasks for other processes. This is useful for writing
810daemons in languages other than C, C++ or Perl (e.g. /bin/sh).
911
10- The prog library contains the functionality of the daemon program in a
11- separately linkable form. This can be useful for writing daemons in
12- languages that can link against C functions (e.g. C, C++). The prog library
13- also contains many other general utility functions.
12+ libslack - A UNIX/C library of general utilities for programmers with slack
13+
14+ Libslack contains many modules of general utility (including the ability to
15+ become a daemon) in a separately linkable form. This can be useful for
16+ writing daemons in languages that can link against C functions (e.g. C, C++).
17+ Libslack also contains many other general utility functions. See the
18+ documentation for details.
1419
1520DESCRIPTION
1621~~~~~~~~~~~
@@ -21,7 +26,7 @@ Daemon performs these tasks for other processes.
2126The preparatory tasks that daemon performs for other processes are:
2227
2328o Disable core file generation to prevent security holes in daemons run by
24- root (unless the -core option is supplied).
29+ root (unless the -- core option is supplied).
2530
2631o If daemon was not invoked by init(8) or inetd(8):
2732
@@ -32,7 +37,7 @@ o If daemon was not invoked by init(8) or inetd(8):
3237 o Under SVR4, background the process again to lose process session
3338 leadership. This prevents the process from ever gaining a controlling
3439 terminal. This only happens when SVR4 is defined and
35- NO_EXTRA_SVR4_FORK is not defined when libprog is compiled.
40+ NO_EXTRA_SVR4_FORK is not defined when libslack is compiled.
3641
3742o Change to the root directory so as not to hamper umounts.
3843
@@ -46,56 +51,68 @@ o Open stdin, stdout and stderr to /dev/null in case something
4651 requires them to be open. Of course, this is not done if daemon was
4752 invoked by inetd(8).
4853
49- o If the -name option is supplied, create and lock a file containing the
54+ o If the -- name option is supplied, create and lock a file containing the
5055 process id of the daemon process. The presence of this locked file
5156 prevents two instances of a daemon with the same name from running at the
5257 same time.
5358
59+ If the --user option is supplied, daemon changes the user id (and possibly
60+ the group id). Only root can use this option.
61+
5462Daemon then spawns the client command specified on its command line and
55- waits for it to terminate. If the -syslog option is supplied, the client's
63+ waits for it to terminate. If the -- syslog option is supplied, the client's
5664standard output and error are captured by daemon and sent to the syslog
57- destination specified in the -syslog option.
65+ destination specified in the -- syslog option.
5866
59- When the client terminates, daemon spawns it again if the -respawn option is
67+ When the client terminates, daemon respawns it if the - -respawn option is
6068supplied and the client terminated successfully after at least 600 seconds.
6169Otherwise daemon terminates.
6270
6371If daemon receives a SIGTERM signal, it propagates the signal to the client
6472and then terminates.
6573
74+ Note: For security reasons, never install I<daemon> with setuid or setgid
75+ privileges. It is unnecessary. If you do, I<daemon> will revert to the real
76+ user and group for safety before doing anything else.
77+
6678INSTALL
6779~~~~~~~
6880Currently this is only known to work on Linux Redhat 6.0 and Solaris 2.6.
6981Compiling on Solaris 2.6 requires running conf/solaris in the source
70- directory. There isn't a real configure script so you will no doubt
71- encounter problems. An ANSI C and POSIX.1 environment will help greatly.
82+ directory. It is ready to compile on Linux as distributed so it is not
83+ necessary to run conf/linux. There isn't a real configure script so you will
84+ no doubt encounter problems on other systems. An ANSI C and POSIX
85+ environment will help greatly.
7286
73- If your system doesn't have snprintf(3) or GNU getopt_long_only (3),
74- uncomment the relevant lines in the prog /macros.mk file to include
75- them in the prog libary .
87+ If your system doesn't have snprintf(3), GNU getopt_long(3) or vsscanf (3),
88+ uncomment the relevant lines in the libslack /macros.mk file to include them
89+ in libslack .
7690
77- Requires perl to run the scripts in the conf directory.
78- Requires gcc to compile the source.
79- Requires pod2man (comes with perl) to make the manpages.
80- Requires pod2html (comes with perl) to make the html manpages.
81- Requires perl and GNU tar to make the distribution.
91+ If your system doesn't have POSIX 1003.2 compliant regex functions, either:
92+ install the GNU implementation, ftp://ftp.gnu.org/gnu/regex/regex-0.12.tar.gz
93+ [290K] (doesn't support internationalisation); or install Henry Spencer's
94+ implementation, ftp://ftp.zoo.toronto.edu/pub/regex.shar [157K].
95+
96+ If you really, really, really don't want the regular expression functions,
97+ uncomment REGEX_MISSING in libslack/macros.mk to enable the rest of the
98+ library to be compiled.
8299
83100To build and test:
84101
85- tar xzf daemon-0.2 .tar.gz
86- cd daemon-0.2
87- conf/<your-system> # if applicable (i.e. solaris)
102+ tar xzf daemon-0.3 .tar.gz
103+ cd daemon-0.3
104+ conf/<your-system> # if applicable (i.e. solaris)
88105 make depend
89106 make
90- make test
107+ make test # note: compiling the tests can take ages
91108
92- To install just the daemon program:
109+ To install just the daemon program and its manpage :
93110
94111 make install-daemon
95112
96- To install just the prog library :
113+ To install just libslack and its manpages :
97114
98- make install-prog
115+ make install-slack
99116
100117To install both:
101118
@@ -105,10 +122,25 @@ For more details:
105122
106123 make help
107124
125+ The manpage for daemon is daemon(1). There is one manpage for each module in
126+ libslack (rather than one for each function). They are conf(3), daemon(3),
127+ err(3), fifo(3), hsort(3), lim(3), list(3), log(3), map(3), mem(3), msg(3),
128+ net(3), opt(3), prog(3), prop(3), sig(3) and str(3). If necessary, the
129+ manpages getopt(3), snprintf(3) and vsscanf(3) are created as well.
130+
131+ REQUIREMENTS
132+ ~~~~~~~~~~~~
133+ Requires perl to run the scripts in the conf directory.
134+ Requires gcc to compile the source.
135+ Requires pod2man (comes with perl) to make the manpages.
136+ Requires pod2html (comes with perl) to make the html manpages.
137+ Requires perl and GNU tar to make the distribution.
138+ Requires POSIX 1003.2 compliant regex functions. See INSTALL.
139+
108140COPYING
109141~~~~~~~
110142daemon - turns other processes into daemons
111- Copyright (C) 1999 raf <raf2@zip.com.au >
143+ Copyright (C) 1999, 2000 raf <raf@raf.org >
112144
113145 This program is free software; you can redistribute it and/or modify
114146 it under the terms of the GNU General Public License as published by
@@ -125,8 +157,8 @@ Copyright (C) 1999 raf <raf2@zip.com.au>
125157 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
126158 or visit http://www.gnu.org/copyleft/gpl.html
127159
128- libprog - general utilities including the ability to become a daemon
129- Copyright (C) 1999 raf <raf2@zip.com.au >
160+ libslack - A UNIX/C library of general utilities for programmers with slack
161+ Copyright (C) 1999, 2000 raf <raf@raf.org >
130162
131163 This library is free software; you can redistribute it and/or modify
132164 it under the terms of the GNU General Public License as published by
@@ -145,6 +177,9 @@ Copyright (C) 1999 raf <raf2@zip.com.au>
145177
146178HISTORY
147179~~~~~~~
180+ 0.1
181+ - Initial version
182+
1481830.2
149184 - Decoupled core file prevention from daemon_init()
150185 into its own function, daemon_prevent_core()
@@ -171,15 +206,39 @@ HISTORY
171206 - Revert to real uid/gid if not same as effective uid/gid for safety
172207 - Added manpages
173208
174- 0.1
175- Initial version
209+ 0.3
210+ - Started using GNU getopt_long() instead of getopt_long_only()
211+ - Started ignoring /etc/daemon.conf if group or world writable
212+ - Added -DSVR4 in conf/solaris (doh!)
213+ - Added conditional compilation of debug functions
214+ - Added assert macro that calls dump()
215+ - Completed the daemon(1) manpage (common options weren't documented)
216+ - Fixed bug: SIG_IGN, SIG_DFL and nasty signals weren't treated specially
217+ - Made lists grow/shrink exponentially rather than linearly
218+ - Made maps grow as needed and use arbitrary hash functions and key types
219+ - Added multi-dimensional array allocator to the mem module
220+ - Added net module: clients/servers, expect/send, pack/unpack, mail
221+ - Added internal iterators and some more functions to list and map
222+ - Added examples sections to some libprog manpages
223+ - Added --user option
224+ - Added str module: decent strings + tr, regex, regsub, fmt, trim, lc, uc ...
225+ - Added vsscanf(3) implementation for systems that don't have it (e.g. solaris)
226+ - Renamed libprog to libslack (thanks, fred!)
227+ - Added socks.h
228+ - Added daemon_revoke_privileges(), daemon_file_is_safe() to daemon module
229+ - Moved revocation of setuid/setgid privileges to start for greater safety
230+ - Fixed bug: wasn't unlinking pidfile when client died of natural causes
231+ - Fixed bug: wasn't processing config file correctly
232+ - Included daemon(1) tests in distribution (not automatic, though)
176233
177234TODO
178235~~~~
179- - Add configure script
236+ - Add modules: tty/pty, timo, thr
237+ - Add pool, gc(?) to mem module
238+ - Use autoconf
239+ - Use libtool
180240
181241~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
182- URL: http://www.zip.com.au/~raf2/lib/software/daemon
183- Date: 19991223
184- Author: raf <raf2@zip.com.au>
185-
242+ URL: http://libslack.org/daemon/
243+ Date: 20000902
244+ Author: raf <raf@raf.org>
0 commit comments