Next: posix tcp-server-sockets, Previous: posix log-files, Up: posix [Index]
The library (vicare posix daemonisations)
implements facilities
that turn a running process into a daemon; it is build on top of
(vicare posix)
. A daemon process is a process that runs
in the background with no controlling process, usually to provide
networking service.
Process daemonisation is usually performed in the early phase of a process start up, before the any actual work is performed. The daemonisation involves forking a child process and exiting the parent process; this changes the ID of the surviving process.
The following bindings are exported by the library (vicare posix
daemonisations)
.
Turn the current process into a daemon. If successful: return a fixnum representing the new process group ID, else raise an exception. Follow this procedure:
1
assume this
process is already a daemon and return doing nothing else. 1
is
the ID of the init
process. getppid.
signal-bub-init
from
(vicare posix)
. signal-bub-init.
fork
from (vicare posix)
; exit the
parent process with status code 0. The daemon process is the
child. fork.
0
, 1
and 2
replacing them with the new file descriptor.
setsid
from (vicare
posix)
. setsid.
signal-bub-final
from
(vicare posix)
. signal-bub-final.
Next: posix tcp-server-sockets, Previous: posix log-files, Up: posix [Index]