File: README

package info (click to toggle)
daemon 0.6.4-1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, squeeze, stretch, wheezy
  • size: 2,600 kB
  • ctags: 2,389
  • sloc: ansic: 28,824; sh: 3,036; perl: 594; makefile: 304
file content (836 lines) | stat: -rw-r--r-- 38,428 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
README
~~~~~~
daemon - turns other processes into daemons

DESCRIPTION
~~~~~~~~~~~
Daemon turns other processes into daemons. There are many tasks that need to
be performed to correctly set up a daemon process. This can be tedious.
Daemon performs these tasks for other processes. This is useful for writing
daemons in languages other than C, C++ or Perl (e.g. /bin/sh, Java).

If you want to write daemons in languages that can link against C functions
(e.g. C, C++), see libslack which contains the core functionality of daemon.

DETAILS
~~~~~~~
Daemon turns other processes into daemons. There are many tasks that need to
be performed to correctly set up a daemon process. This can be tedious.
Daemon performs these tasks for other processes.

The preparatory tasks that daemon performs for other processes are:

First revoke any setuid or setgid privileges that daemon may have been
installed with (by system administrators who laugh in the face of danger).

Process command line options.

Change the root directory if the --chroot option was supplied.

Change the process uid and gid if the --user option was supplied. Only
root can use this option. Note that the uid of daemon itself is changed,
rather than just changing the uid of the client process.

Read the configuration file (/etc/daemon.conf by default, or specified
by the --config option). Note: The root directory and the user must be
set before access to the configuration file can be attempted so neither
--chroot nor --user options may appear in the configuration file.

Disable core file generation to prevent security holes in daemons run by
root (unless the --core option is supplied).

Become a daemon process:

o If daemon was not invoked by init(8) or inetd(8):

  o Background the process to lose process group leadership.

  o Start a new process session.

  o Under SVR4, background the process again to lose process session
    leadership. This prevents the process from ever gaining a controlling
    terminal. This only happens when SVR4 is defined and
    NO_EXTRA_SVR4_FORK is not defined when libslack is compiled.
    Before doing this, ignore SIGHUP because when the session leader
    terminates, all processes in the foreground process group are sent a
    SIGHUP signal. Note that this code may not execute (e.g. when started
    by init(8) or inetd(8) or when either SVR4 was not defined or
    NO_EXTRA_SVR4_FORK was defined when libslack was compiled). This
    means that the client can't make any assumptions about the SIGHUP
    handler when daemon_init() returns.

o Change directory to the root directory so as not to hamper umounts.

o Clear the umask to enable explicit file creation modes.

o Close all open file descriptors. If daemon was invoked by inetd(8)
  stdin, stdout and stderr are left open since they are open to a
  socket.

o Open stdin, stdout and stderr to /dev/null in case something
  requires them to be open. Of course, this is not done if daemon was
  invoked by inetd(8).

o If the --name option is supplied, create and lock a file containing the
  process id of the daemon process. The presence of this locked file
  prevents two instances of a daemon with the same name from running at the
  same time.  The default location of the pidfile is /var/run for root or
  /tmp for ordinary users.

If the --umask option was supplied, set the umask to its argument.
Otherwise, set the umask to 022 to prevent accidentally creating group or
world writable files.

Set the current directory if the --chdir option was supplied.

Daemon then spawns the client command specified on its command line and
waits for it to terminate.

If the --syslog, --outlog and/or --errlog option were supplied, the client's
standard output and/or standard error are captured by daemon and sent to the
respective syslog destinations.

When the client terminates, daemon respawns it if the --respawn option is
supplied and the client terminated successfully after at least 600 seconds.
Otherwise daemon terminates.

If daemon receives a SIGTERM signal, it propagates the signal to the client
and then terminates.

Note: For security reasons, never install daemon with setuid or setgid
privileges. It is unnecessary. If you do, daemon will revert to the real
user and group for safety before doing anything else.

INSTALL
~~~~~~~
This version is only known to work on the following systems:

    Linux 2.6 (i386, x86_64, debian-5.0.4, ubuntu-10.04, fedora-13)
    Solaris 10 10/09 (i386, amd64)
    OpenSolaris 2009/06 (i386, amd64)
    OpenBSD 4.7 (i386, amd64)
    FreeBSD 8.0 (i386, amd64)
    NetBSD 5.0.2 (i386, amd64)
    MacOSX 10.{4,5,6} (i386, x86_64, ppc)
    kFreeBSD 20090729 (i386)

For these systems, just run the "config" script in the source directory. It
will run the appropriate script in the "conf" directory for the current host.

Note: There isn't a real configure script so you will no doubt encounter
problems on other systems. An ISO C and POSIX/XPG4 environment will help
greatly. If your system doesn't have snprintf(3), GNU getopt_long(3),
vsscanf(3), strcasecmp(3), strncasecmp(3), strlcpy(3) or strlcat(3),
uncomment the relevant lines in the libslack/config.h file to include them
in libslack.

If your system doesn't have POSIX 1003.2 compliant regex functions, or they
are buggy, either: install the GNU implementation,
ftp://ftp.gnu.org/gnu/regex/regex-0.12.tar.gz [290K]
(doesn't support internationalisation);
or install Henry Spencer's implementation,
ftp://ftp.zoo.toronto.edu/pub/regex.shar [157K].

If you really, really, really don't want the regular expression functions,
uncomment HAVE_REGEX_H in libslack/config.h to enable the rest of the str
module to be compiled.

If you have a linux-2.2.x system, you must have LinuxThreads-0.8 or
LinuxThreads-0.9 and the latest corresponding version of glibc.
If you have a linux-2.4.x system, you must have at least glibc-2.2.1
and glibc-linuxthreads-2.2.1. They are available from
http://ftp.gnu.org/pub/gnu/glibc/. Older versions can be used but
they have some very nasty bugs.

First, uninstall any previous version:

    cd /usr/local/src/daemon-0.6.3
    make uninstall

To build and test:

    tar xzf daemon-0.6.4.tar.gz
    cd daemon-0.6.4
    ./config          # iff linux, solaris, openbsd, freebsd, netbsd or macosx
    make              # must be gnu make
    make test         # only tests libslack. to test daemon, see test/README

To install daemon and its manpage (in /usr/local by default):

    make install

To install into somewhere other than /usr/local:

    make PREFIX=/opt/daemon install

To install an empty /etc/daemon.conf file:

    make install-daemon-conf

To uninstall daemon:

    make uninstall

To install libslack and its manpages (into /usr/local by default):

    make install-slack

To uninstall libslack:

    make uninstall-slack

For more details:

    make help

The manpage for daemon is daemon(1). There is one manpage for each module in
libslack (as well as a symlink for each function). The module manpages are
agent(3), coproc(3), daemon(3), err(3), fio(3), hsort(3), lim(3), link(3),
list(3), locker(3), map(3), mem(3), msg(3), net(3), prog(3), prop(3),
pseudo(3), sig(3) and str(3). If necessary, the manpages getopt(3),
snprintf(3) and vsscanf(3) are created as well.

BINARY PACKAGES
~~~~~~~~~~~~~~~
Some binary packages are available on daemon's website:

To install from the Fedora RPM binary package (into /usr by default):

    rpm -i daemon-0.6.4-1.x86_64.rpm # or
    rpm -i daemon-0.6.4-1.i686.rpm

To install from the OpenBSD binary package (into /usr/local by default):

    mv daemon-0.6.4-openbsd-amd64.tgz daemon-0.6.4.tgz # or
    mv daemon-0.6.4-openbsd-i386.tgz  daemon-0.6.4.tgz
    # then
    pkg_add daemon-0.6.4.tar.gz

To install from the FreeBSD binary package (into /usr/local by default):

    pkg_add daemon-0.6.4-freebsd-amd64.tbz # or
    pkg_add daemon-0.6.4-freebsd-i386.tbz

To install from the NetBSD binary package (into /usr/local by default):

    pkg_add daemon-0.6.4-netbsd-amd64.tgz # or
    pkg_add daemon-0.6.4-netbsd-i386.tgz

To install from the Mac OS X binary package (into /usr/local by default):

    cd /usr/local
    tar xzf /usr/local/src/daemon-0.6.4-macosx-universal.tar.gz # or
    tar xzf /usr/local/src/daemon-0.6.4-macosx-x86_64.tar.gz # or
    tar xzf /usr/local/src/daemon-0.6.4-macosx-i386.tar.gz # or
    tar xzf /usr/local/src/daemon-0.6.4-macosx-powerpc.tar.gz

To install from the Solaris10 binary package (into /usr/local by default):

    gunzip daemon-0.6.4-solaris-amd64.pkg.gz
    pkgadd -d daemon-0.6.4-solaris-amd64.pkg

or

    gunzip daemon-0.6.4-solaris-i386.pkg.gz
    pkgadd -d daemon-0.6.4-solaris-i386.pkg

On debian/ubuntu systems you should be able to:

    apt-get install daemon

REQUIREMENTS
~~~~~~~~~~~~
Requires GNU make to compile.
Requires perl to run the scripts in the conf directory.
Requires perl to install per-function manpage links.
Requires an ISO C compiler like gcc to compile the source.
Requires pod2man (comes with perl) to make the manpages.
Requires pod2html (comes with perl) to make the html manpages.
Requires POSIX 1003.2 compliant regex functions. See INSTALL.
Requires libpthread. See INSTALL.

PLATFORM NOTES
~~~~~~~~~~~~~~
These platform notes are quite old and probably mostly irrelevant.

Linux
~~~~~
Linux 2.2 always returns 0.0.0.0 on getsockopt(IP_MULTICAST_IF) so
net_multicast_get_interface() always returns 0 under Linux 2.2. Linux 2.4
does not have this bug.

Make sure you have a recent glibc (at least 2.1.3) and libpthread (at least
0.8) (See INSTALL).

Linux 2.2 and 2.4 have a bug-like feature in poll(2). It always times out
10ms later than specified. Libslack corrects for this as best as it can (if
> 10ms -= 10ms) but it's not good enough when you need timers with a
granularity of 10ms. In this case, you have to use
agent_create_with_select() instead of agent_create() under Linux because
select() doesn't have this bug. However, scalable I/O is impossible with
select(). So, if you need timers with a granularity of 10ms *and* scalable
I/O, you need an agent that uses select() in one thread for the timers and
separate agents that use poll() in other threads for the I/O.

Solaris
~~~~~~~
Solaris (at least 2.6 and 2.7) doesn't return the hardware address or index
of network interfaces from ioctl() with a SIOCGIFINDEX command argument.
Libslack fills in the index in net_interfaces().

UNIX domain datagram sockets aren't supported very nicely. An actual
filesystem entry is needed for the client and it must be unlinked after use.
It's also possible for a malicious local user to deny a client access to the
server. The solution is to always use UNIX domain stream sockets.

Solaris has an inadequate snprintf() function so libslack provides it's own
implementation. When configured for Solaris, this snprintf() function will
format exactly like the system's sprintf() function, even though it has
incorrect behaviour with respect to the ISO C standard. I thought this was
better than having thousands of module tests apparently "fail".

OpenBSD
~~~~~~~
Has the same UNIX domain datagram socket problem as Solaris.

FreeBSD
~~~~~~~
Has the same UNIX domain datagram socket problem as Solaris.
Can't lock fifos so fifo_open() can't guarantee a unique reader.

Mac OS X
~~~~~~~~
Probably has the same UNIX domain datagram problem as Solaris.

COPYING
~~~~~~~
daemon - turns other processes into daemons
Copyright (C) 1999-2010 raf <raf@raf.org>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    or visit http://www.gnu.org/copyleft/gpl.html

libslack - A UNIX/C library of general utilities for programmers with Slack
Copyright (C) 1999-2010 raf <raf@raf.org>

    This library is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    or visit http://www.gnu.org/copyleft/gpl.html

$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $
$OpenBSD: strlcat.c,v 1.5 2001/01/13 16:17:24 millert Exp $
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions
    are met:
    1. Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.
    3. The name of the author may not be used to endorse or promote products
       derived from this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
    THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

MAILING LISTS
~~~~~~~~~~~~~
If you'd like to be kept up to date with daemon releases or have questions
or suggestions, you can join one or more of the following (extremely low
volume) mailing lists (@libslack.org).

    daemon-announce (Announcements)
    daemon-users    (User forum)
    daemon-dev      (Development forum)

To subscribe to any of these mailing lists, send a mail message to
<listname>-request@libslack.org with "subscribe" as the message body.

E.g. 

    $ echo subscribe | mail daemon-announce-request@libslack.org
    $ echo subscribe | mail daemon-users-request@libslack.org
    $ echo subscribe | mail daemon-dev-request@libslack.org

Or you can send a mail message to majordomo@libslack.org with subscribe
listname in the message body. This way, you can include multiple subscribe
commands to subscribe to multiple lists at the same time. 

E.g. 

    $ mail majordomo@libslack.org
    subscribe daemon-announce
    subscribe daemon-users
    subscribe daemon-dev
    .

A digest version of each mailing list is also available. Subscribe to
digests as above but append -digest to the listname.

E.g. 

    $ echo subscribe | mail daemon-announce-digest-request@libslack.org
    $ echo subscribe | mail daemon-users-digest-request@libslack.org
    $ echo subscribe | mail daemon-dev-digest-request@libslack.org

Or 

    $ mail majordomo@libslack.org
    subscribe daemon-announce-digest
    subscribe daemon-users-digest
    subscribe daemon-dev-digest

Note that these are all extremely low volume mailing lists so there's not
much use for the digest lists.

REFERENCES
~~~~~~~~~~
Advanced Programming in the UNIX Environment
W. Richard Stevens
Addison-Wesley Professional Computing Series, 1992

UNIX Network Programming
W. Richard Stevens
Prentice Hall Software Series, 1990

UNIX System V Network Programming
Stephen A. Rago
Addison-Wesley Professional Computing Series, 1993

TCP/IP Illustrated Volume 1, The Protocols
W. Richard Stevens
Addison-Wesley Professional Computing Series, 1994

UNIX Network Programming Volume 1, Networking APIs: Sockets and XTI
W. Richard Stevens
Prentice Hall Software Series, 1998

The Practice of Programming
Brian W. Kernighan and Rob Pike,
Addison-Wesley Professional Computing Series, 1999

Multithreaded Programming with Pthreads
Bil Lewis and Daniel J. Berg
Sun Microsystem Press/Prentice Hall, 1998

Effective TCP/IP Programming
Jon C. Snader
Addison-Wesley, 2000

Design Patterns - Elements of Reusable Object-Oriented Software
Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides
Addison-Wesley Professional Computing Series, 1995

The Standard C Library
P. J. Plauger
Prentice Hall, 1992

The Discipline and Method Architecture for Reusable Libraries
Kiem-Phong Vo
Software - Practice & Experience, v.30, pp.107-128, 2000
http://www.research.att.com/sw/tools/sfio/dm-spe.ps

strlcpy and strlcat--Consistent, Safe, String Copy and Concatenation
Todd C. Miller and Theo De Raadt
Proceedings of the FREENIX Track: 1999 USENIX Annual Technical Conference
http://www.usenix.org/events/usenix99/millert.html

The Perl manpages
Larry Wall
http://www.perl.com/

Practical UNIX and Internet Security
Simson Garfinkel and Gene Spafford
O'Reilly, 1996

Interconnections - Bridges, Routers, Switches and Internetworking Protocols
Radia Perlman
Addison-Wesley Professional Computing Series, 2000

MT-Disciplined
raf
http://raf.org/papers/mt-disciplined.html, 2001

I/O Event Handling Under Linux
Richard Gooch
http://www.atnf.csiro.au/~rgooch/linux/docs/io-events.html, 1999

Scalable kernel performance for Internet servers under realistic loads
Gaurav Banga and Jeffrey C. Mogul
Proceeding of the Refereed Papers Track: 1998 USENIX Annual Technical Conference
http://www.usenix.org/publications/library/proceedings/usenix98/banga.html

TCP Buffering and Performance Over An ATM Network
Purdue Technical Report CSD-TR 94-026 (Revision)
Journal of Internetworking: Research and Experience, Vol. 6 (1), Pages 1-13
Douglas E. Comer and John C. Lin
ftp://gwen.cs.purdue.edu/pub/lin/TCP.atm.ps.Z, 1994

Experimental and Simulation Performance Results of TCP/IP over High-Speed ATM over ACTS
Charalambos, C.; Lazarou, G.; Frost, V.; Evans, J.; Jonkman, R.
Information and Telecommunication Technology Center,
Department of Electrical Engineering & Computer Science,
The University of Kansas
http://acts.lerc.nasa.gov/library/docs/gsn/charalambous.pdf

Revelation X: The "Bob" Apocryphon
Translated by The Subgenius Foundation,
Edited by Reverend Ivan Stang,
Simon & Schuster, 1994

HISTORY
~~~~~~~
0.1 (19991020)
    - Initial version

0.2 (19991223)
    - Decoupled core file prevention from daemon_init()
      into its own function, daemon_prevent_core()
    - Decoupled signal handling from daemon_init()
    - Cached daemon_started_by_init() and daemon_started_by_inetd() results
    - Fixed bug when formatting --help message
    - Added some modules to libprog: conf, list, hsort, map, prop
    - Added timestamps to msg_out_file()
    - Included source to GNU getopt_long_only() (if necessary)
    - Added hdr.h to allow non-ANSI compilers to parse libprog's headers
    - Moved libprog to a subdirectory using a "Whole Project" Makefile
    - Converted "Whole Project" Makefile into "Scalable" Makefiles
    - Added verbosity functions to libprog(prog)
    - Added -core option to allow core file generation
    - Added -respawn option to allow client respawn if death not too sudden
    - Added -syslog option to redirect client stdout and stderr to syslog
    - Added -log option to specify where daemon stdout and stderr are sent
    - Fixed bug when constructing data for GNU getopt_long_only()
    - Fixed bugs in the options table for libprog(prog)
    - Changed help message format: separated option chunks by a blank line
    - Fixed bug when obtaining names associated with syslog constants
    - Added -Config option and /etc/daemon.conf handling
    - Added pathetic conf/linux and conf/solaris scripts
    - Revert to real uid/gid if not same as effective uid/gid for safety
    - Added manpages

0.3 (20000902)
    - Started using GNU getopt_long() instead of getopt_long_only()
    - Started ignoring /etc/daemon.conf if group or world writable
    - Added -DSVR4 in conf/solaris (doh!)
    - Added conditional compilation of debug functions
    - Added assert macro that calls dump()
    - Completed the daemon(1) manpage (common options weren't documented)
    - Fixed bug: SIG_IGN, SIG_DFL and nasty signals weren't treated specially
    - Made lists grow/shrink exponentially rather than linearly
    - Made maps grow as needed and use arbitrary hash functions and key types
    - Added multi-dimensional array allocator to the mem module
    - Added net module: clients/servers, expect/send, pack/unpack, mail
    - Added internal iterators and some more functions to list and map
    - Added examples sections to some libprog manpages
    - Added --user option
    - Added str module: decent strings + tr, regex, regsub, fmt, trim, lc, uc ...
    - Added vsscanf(3) implementation for systems that don't have it (e.g. solaris)
    - Renamed libprog to libslack (thanks, fred!)
    - Added socks.h
    - Added daemon_revoke_privileges(), daemon_file_is_safe() to daemon module
    - Moved revocation of setuid/setgid privileges to start for greater safety
    - Fixed bug: wasn't unlinking pidfile when client died of natural causes
    - Fixed bug: wasn't processing config file correctly
    - Included daemon(1) tests in distribution (not automatic, though)

0.4 (20010215)
    - Fixed memory usage bugs
    - Added daemon demo directory (previously, the incomplete "test" directory)
    - Changed net server/client functions to use service name else port number
    - Fixed security bug: daemon_file_is_safe() wasn't following symlinks (doh!)
    - Changed -d and -v options to take optional arguments (both default to 1)
    - Renamed daemon_file_is_safe() to daemon_path_is_safe()
    - Added daemon_absolute_path() to daemon module
    - Added memory pool functions to mem module
    - Fixed bug: optional option arguments were handled in dodgy C
    - Made supplied snprintf() POSIX compliant (was using getpagesize())
    - Removed conf module (Added daemon_parse_config() to daemon module)
    - Removed net_chat(), rfc822_localtime(), rfc822_gmtime() (not useful enough)
    - Added secure memory/pool functions to mem module
    - Fixed Makefile bug: $(CCFLAGS) for daemon and libslack weren't separate
    - Added fgetline() to fifo module (reads a line with any line ending)
    - Added str_fgetline() to str module (like fgetline but handles any length)
    - Renamed fifo module to fio
    - Fixed Makefile bug: wasn't uninstalling everything properly
    - Changed net_send() to take a timeout argument like next_expect() does
    - Added strlcpy(), strlcat(), strcasecmp() and strncasecmp() to str module
    - Changed debug levels used by daemon(1) from 8 and 9 to 1 and 2
    - Renamed conf/solaris to solaris-gcc and added solaris-cc for sun workshop
    - Fixed bug: -n and -u options together failed to unlink pidfiles
    - Fixed security bug: wasn't clearing supplementary groups with -u option
    - Added support for root and user pidfiles in separate directories
    - Added make rpm rpm-daemon rpm-slack (with Edward Avis ed at membled.com)
    - Added installation of manpages for each function (link to module manpage)
    - Added libslack(3) overview manpage
    - Added list_break(), map_break()
    - Renamed assert() to check() for obvious reasons
    - Renamed re funcs in str module: s/regex/regexpr/g
    - Added thread module and made everything MT-Safe or MT-Disciplined
    - Added relative index/range semantics to string functions
    - Added make deb deb-daemon deb-slack (debian binary packages)
    - Added make pkg pkg-daemon pkg-slack (solaris binary packages)
    - Added setsockopt(SO_REUSEADDR) for net servers
    - Changed net server/client API to allow optional setsockopt(RCVBUF/SNDBUF)
    - Added REFERENCES section to README file
    - Stopped net_expect/net_send from interfering with SIGALRM/alarm/setitimer
    - Added read_timeout(), write_timeout() and rw_timeout() to fio module
    - Changed net_read() and net_write() to take a timeout argument
    - Added '?' field size specifier to unpack() (for packet length fields)
    - Added libslack-config administration utility
    - Renamed sockaddr typedef to sockaddr_t
    - Changed net_client to take a timeout parameter
    - Fixed fd leak in error handling code in net server/client functions
    - Fixed bug: str_regsub() didn't handle empty string matches at all
    - Changed str_regexpr_split() to take cflags and eflags arguments
    - Changed all *_destroy macros to functions that take address of pointer
    - Changed mem_resize macro so client must explicitly provide address of mem
    - Changed all *_destroy_t typedefs to *_release_t
    - Added make [un]install-{daemon|slack}-html (not part of make [un]install)
    - Temporarily removed snprintf module (not MT-Safe, not essential)
    - Merged lognames module into msg module
    - Merged opt module into prog module
    - Renamed _* functions in err module to *f (not ANSI compliant)
    - Removed MANIFEST

0.5 (20011109)
    - Fixed Makefile bug: decoupled libslack optlevel from module test optlevel
    - Fixed API bug: str_length_unlocked() was static
    - Fixed API bug: prop_locker() prototype wasn't in prop.h
    - Added prop_clear() to prop module
    - Added octal/hex and error handling to command line integer option handling
    - Fixed bug: check() just called dump() without testing the condition first
    - Added variants of six standard C string functions with more useful APIs
    - Added thread module tests (and locker timing tests)
    - Changed locker function return values (now same as pthread return values)
    - Improved speed of lockers (now overhead = 1 test + 1 deref + 1 offset)
    - Changed item/length/size, bin/hex/oct functions to return -1 on error
    - Changed error returns to consistently set errno (str, list, map)
    - Added set_errnull() to err module
    - Added relative index/range semantics to list functions (same as with str)
    - Changed fifo_open() to take writefd return arg to prevent fd leaks
    - Simplified mem_resize() assuming ISO C compliant realloc()
    - Added internal ISO C compliant realloc() for systems that don't have it
    - Fixed bug: optval/optlen for getsockopt(SO_ERROR) not initialised
    - Fixed inode leak: fifo_open() didn't unlink fifo created on error
    - Removed thread_init(), thread_setcancel() and barriers from thread module
    - Renamed thread module to locker (decoupled thread safety)
    - Stopped daemon_revoke_privileges() from clearing supplementary group list
    - Added initgroups(3) when handling --user=user (with no specific ".group")
    - Added --chroot, --chdir and --umask options
    - Changed default umask to 022 for safety
    - Added support for "debug sections" to debug messaging
    - Added daemon_become_user() to daemon module
    - Added "_unlocked" versions of functions in str, list and map modules
    - Renamed "_locked" functions to "_with_locker" to avoid confusion
    - Fixed bug: removed highly dubious synchronisation from internal iterators
    - Added read locked iterators
    - Added alert functions to prog, err and msg modules
    - Systematically corrected function prototype typos in manpages
    - Added net_options() to net module (sets multiple socket options)
    - Added soundex() to str module
    - Removed caching and mutex locks in daemon_started_by_init/inetd()
    - Added ignoring SIGHUP before losing session leadership in daemon_init()
    - Improved IPv6 support in net module (i.e. can now bind to IPv6 wildcard)
    - Added support for UNIX domain sockets to net module
    - Increased socket listen queue length from 5 to 1024
    - Fixed bug: net service port selection only used numeric port arg
    - Added handling of name lookup returning multiple addresses for net clients
    - Added default host to net client functions (i.e. null host == loopback)
    - Changed net_create_server() and net_create_client() to take sockopt list
    - Added support for net clients binding to a specific local port
    - Added net_gethostbyname() and net_getservbyname() to net module
    - Made net server and client functions threadsafe
    - Added socket option notes to net module manpage (from W. Richard Stevens)
    - Added protocol design notes to net module manpage (from Radia Perlman)
    - Added sendfd() and recvfd() to net module (send/recv open file descriptor)
    - Replaced ioctl() with fcntl() in nonblock functions
    - Added --outlog and --errlog options
    - Fixed/simplified sigchld handling (was overcomplicated and flaky)
    - Added support for net client/server service argument being numeric
    - Added link module (singly/doubly linked lists and "growable" freelists)
    - Added agent module (poll/select plus hierarchical timing wheel scheduler)
    - Added net_interfaces() to net module (retrieve list of network interfaces)
    - Added support for IPv4 and IPv6 multicasting to net module
    - Added Reliability over UDP functions to net module (net_rudp_transact())
    - Added Type of Service (TOS) functions to net module
    - Changed net_pack/net_unpack functions to take a timeout arg
    - Added nap() function to fio module (subsecond sleep)
    - Added threadsafe snprintf() function for systems that don't have it
    - Added asprintf() to str module for systems that don't have it
    - Added config.h to simplify compile commands (prelude to autoconf)
    - Removed thread_attr_{init,set}() (not useful enough or portable enough)
    - Ported to OpenBSD 2.9
    - Added pseudo module (pseudo terminals by Tatu Ylonen from openssh)
    - Added coproc module (coprocesses with or without a pseudo terminal)
    - Changed syslog functions to take a priority parameter
    - Added --force option to daemon (respawn even when client crashes)
    - Added make obsd obsd-daemon obsd-slack (openbsd binary packages)
    - Added libslack-config --uninstall
    - Proofread all of the doco (just once)
    - Added setting appropriate TOS values in mail()
    - Fixed validation of relative index/range values in str/list modules
    - Added relative index semantics to list_item()
    - Added read locked versions of map_apply() and list_apply()
    - Added make dist-html-daemon and dist-html-slack (manpages as html.tar.gz)

0.6 (20020916)
    - Added HEADER FILES section to libslack(3) manpage
    - Added #include <slack/std.h> to example sections of module manpages
    - Added conf/freebsd (mmoraes at teleias.com)
    - Added tools/prefix utility (add prefix to all libslack identifiers)
    - Added manpage for tools/analyse-debug-locker utility
    - Separated stdout and stderr in coproc_open() and coproc_close()
    - Changed coproc open functions to take action() and data arguments
    - Started using libslack's coproc functions to run client
    - Added chdir to chroot directory (mmoraes at teleias.com)
    - Added --env option (mmoraes at teleias.com)
    - Changed restart behaviour to be like init(8)
    - Added --acceptable option
    - Added --attempts option (mmoraes at teleias.com)
    - Added --delay option
    - Added --limit option
    - Removed --force option (no longer meaningful)
    - Added --foreground option (suggested by mh+daemon at zugschlus.de)
    - Added --pty option
    - Exposed daemon_pidfile()
    - Added daemon_is_running()
    - Added daemon_stop()
    - Added --running option
    - Added --stop option
    - Added --unsafe option
    - Added --safe option
    - Fixed bug: config file parsing could produce garbage options
    - Replaced demo directory with test directory
    - Added support for sending client stdout/stderr directly to a file
    - Renamed --syslog to --output (-s to -o)
    - Renamed --outlog to --stdout (-o to -O)
    - Renamed --errlog to --stderr (-e to -E)
    - Renamed --log to --errlog
    - Added --dbglog option
    - Renamed sighandler_t to signal_handler_t (glibc clash - gdr at gno.org)
    - Ported to Solaris 8
    - Split Solaris configuration scripts into conf/solaris[68]-[g]cc
    - Added support for installing gzipped manpages
    - Added --inherit option
    - Added make daemon.conf (just an empty default)
    - Stopped installing libslack as well by default
    - Added daemon.conf(5) manpage (just a symlink to daemon(1))
    - Added make [un]install-daemon-conf (not by default)
    - Added Debian source package generation
    - Stopped generating debian package (until it's a shared library)
    - Added make fbsd fbsd-daemon fbsd-slack (freebsd binary packages)
    - Added --command option (suggested by mh+daemon at zugschlus.de)
    - Added support for absolute path in daemon_pidfile()
    - Added --pidfiles, --pidfile options (suggested by mh+daemon at zugschlus.de)
    - Added daemon_getpid()
    - Added --restart option (suggested by mh+daemon at zugschlus.de)
    - Added support for ~/.daemonrc
    - Added --noconfig option
    - Added check for dubious characters in daemon names
    - Added libslack-config --upgrade option
    - Added lame ./config script that just calls existing lame conf/* scripts

0.6.1 (20030901)
    - Fixed bug: --noconfig option broken (spotted by paolo at telmap.com)
    - Fixed bug: --command option broken (spotted by paolo at telmap.com)
    - Fixed bug: exit too quickly on sigterm (spotted by stodden at cs.tum.edu)
    - Set prog name to --name argument, if any (for syslog message prefix)

0.6.2 (20040102)
    - Fixed bug: --stop during spawn delay wasn't acted upon
    - Fixed API bug: <slack/lib.h> didn't include <slack/coproc.h>
    - Fixed bug: -lm wasn't in `libslack-config --libs` on Solaris
    - Changed --restart: reset spawn burst counters (for stodden at peppermind.de)
    - Changed daemon_path_is_safe() to give an explanation when unsafe
    - Added explanations when rejecting unsafe config files and executables
    - Fixed bug: reset agent state to IDLE when interrupted (bte at kamash.com)
    - Trim unquoted leading spaces from property values (with bte at kamash.com)
    - Also trim only unquoted trailing spaces from property names
    - Added tools/migrate-properties utility (preserves old propfile behaviour)
    - Fixed bug: ownership partially lost in map_resize (with bte at kamash.com)
    - Fixed bug: mem_resize was broken since libslack-0.4 (bte at kamash.com)
    - Fixed DOC bug: stated the importance of including <slack/lib.h> first
    - Cleaned up error messages (now that prog name is set to --name argument)
    - Added sections to libslack(3) features list (coproc+pty, low level api)
    - Fixed bug: if select() failed (unlikely), coproc wasn't closed properly
    - Fixed bug: when tty_raw() failed (unlikely), it returned the wrong value
    - Added many examples to the manpages (there are now 91 runnable examples)
    - Added tools/check-examples to verify that all examples work
    - Fixed bug: str_fgetline() returned empty string rather than null on eof
    - Fixed bug: cstrstr() didn't always work due to a typo 
    - Added sections to libslack(3) features list (documentation, testing)
    - Added intel solaris8 binary package
    - Ported to Mac OS X (Darwin) 10.3.2
    - Added make osx osx-daemon osx-slack (macosx binary packages)
    - Added pid to --running output (requested by rubinson at email.arizona.edu)
    - Dropped support for K&R clients (suggested by skaller at ozemail.com.au)
    - Added hsort_closure(3) (suggested by skaller at maxtal.com.au)
    - Added make slack.swig (generate a SWIG input file for libslack)

0.6.3 (20040806)
    - Fixed bug: --acceptable was broken (chris at edesix.com)

0.6.4 (20100612)
    - Added more debug statements
    - Fixed typographical errors in documentation
    - Fixed bug: need double-fork on Linux (spotted by Joey Hess joeyh at debian.org)
    - Updated makefiles to work with recent versions of GNU make
    - Updated to avoid new warnings in recent versions of gcc
    - Fixed pidfile race condition (with Hilko Bengen bengen at hilluzination.de)
    - Fixed bug in message for --verbose --running when --pidfile[s] also used
    - Don't strip if $DEB_BUILD_OPTIONS contains nostrip (for Julien Danjou acid at debian.org)
    - Made --running work when readonly (spotted by Thomas Koch thomas at koch.ro)
    - Stopped modifying --user argument so ps output looks right (for Hilko Bengen)
    - Made --user use ":" (but still accept ".") (for Lars Wirzenius lars at catalyst.net.nz)
    - Ported to GNU/kFreeBSD (with Cyril Brulebois cyril.brulebois at enst-bretagne.fr)
    - Added --idiot option (for Andras Korn korn-debbugs at chardonnay.math.bme.hu)
    - Added example/daemon.initd script (inspired by Javier Fern�ndez-Sanguino Pe�a jfs at computer.org)
    - Ported to NetBSD
    - Added make nbsd nbsd-daemon nbsd-slack (netbsd binary packages)
    - Ported to Solaris10 and OpenSolaris
    - Tested on ubuntu-10.04, debian-5.0.4, fedora-13 (x86_64, i386)
    - Tested on solaris-10-200910, opensolaris-200906 (amd64, i386)
    - Tested on openbsd-4.7, freebsd-8.0, netbsd-5.0.2 (amd64, i386)
    - Tested on macosx-10.{4,5,6} (x86_64, i386, ppc)
    - Tested on kfreebsd-20090729 (i386)
    - Updated make rpm sol obsd fbsd osx to continue working

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
URL: http://libslack.org/daemon/
Date: 20100612
Author: raf <raf@raf.org>