|
|
|
|
|
Description |
Implementation of the generic daemon functionality.
|
|
Synopsis |
|
|
|
|
Constants
|
|
|
/dev/null path.
|
|
Data types
|
|
|
Command line options structure.
| Constructors | DaemonOptions | | optShowHelp :: Bool | Just show the help
| optShowVer :: Bool | Just show the program version
| optDaemonize :: Bool | Whether to daemonize or not
| optPort :: Maybe Word16 | Override for the network port
| optDebug :: Bool | Enable debug messages
| optNoUserChecks :: Bool | Ignore user checks
| optBindAddress :: Maybe String | Override for the bind address
| optSyslogUsage :: Maybe SyslogUsage | Override for Syslog usage
|
|
|
|
|
|
Default values for the command line options.
|
|
|
Abrreviation for the option type.
|
|
|
Helper function for required arguments which need to be converted
as opposed to stored just as string.
|
|
Command line options
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Usage info.
|
|
|
:: [String] | The command line arguments
| -> String | The program name
| -> [OptType] | The supported command line options
| -> IO (DaemonOptions, [String]) | The resulting options
and leftover arguments
| Command line parser, using the Options structure.
|
|
|
|
Small wrapper over getArgs and parseOpts.
|
|
Daemon-related functions
|
|
|
PID file mode.
|
|
pidFileFlags :: OpenFileFlags | Source |
|
PID file open flags.
|
|
_writePidFile :: FilePath -> IO Fd | Source |
|
Writes a PID file and locks it.
|
|
formatIOError :: String -> IOError -> String | Source |
|
Helper to format an IOError.
|
|
|
Wrapper over _writePidFile that transforms IO exceptions into a
Bad value.
|
|
setupDaemonEnv :: FilePath -> FileMode -> IO () | Source |
|
Sets up a daemon's environment.
|
|
handleSigHup :: FilePath -> IO () | Source |
|
Signal handler for reopening log files.
|
|
setupDaemonFDs :: Maybe FilePath -> IO () | Source |
|
Sets up a daemon's standard file descriptors.
|
|
|
:: Int | The port we want
| -> Family | The cluster IP family
| -> Result (Family, SockAddr) | | Computes the default bind address for a given family.
|
|
|
resolveAddrHints :: Maybe AddrInfo | Source |
|
Default hints for the resolver
|
|
resolveAddr :: Int -> String -> IO (Result (Family, SockAddr)) | Source |
|
Resolves a numeric address.
|
|
|
:: DaemonOptions | Command line options
| -> Int | Default port for this daemon
| -> IO (Result (Family, SockAddr)) | | Based on the options, compute the socket address to use for the
daemon.
|
|
|
daemonize :: FilePath -> IO () -> IO () | Source |
|
Run an I/O action as a daemon.
WARNING: this only works in single-threaded mode (either using the
single-threaded runtime, or using the multi-threaded one but with
only one OS thread, i.e. -N1).
FIXME: this doesn't support error reporting and the prepfn
functionality.
|
|
|
Generic daemon startup.
|
|
|
Inner daemon function.
This is executed after daemonization.
|
|
Produced by Haddock version 2.6.0 |