logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

dsignal.h - Contains the API for serializing signals to a pipe for usage with select() or poll().

Author

Generated automatically by Doxygen for libdaemon from the source code. libdaemon Version 0.14 dsignal.h(3)

Detailed Description

Contains the API for serializing signals to a pipe for usage with select() or poll(). You should register all signals you wish to handle with select() in your main loop with daemon_signal_init() or daemon_signal_install(). After that you should sleep on the file descriptor returned by daemon_signal_fd() and get the next signal received with daemon_signal_next(). You should call daemon_signal_done() before exiting. Definition in file dsignal.h.

Function Documentation

voiddaemon_signal_done(void) Free resources of signal handling, should be called before daemon exit. Examplestestd.c. intdaemon_signal_fd(void) Return the file descriptor the daemon should select() on for reading. Whenever the descriptor is ready you should call daemon_signal_next() to get the next signal queued. Returns The file descriptor or negative on failure Examplestestd.c. intdaemon_signal_init(ints,...) Installs signal handlers for the specified signals. Parameterss,... The signals to install handlers for. The list should be terminated by 0 Returns zero on success, nonzero on failure Examplestestd.c. intdaemon_signal_install(ints) Install a signal handler for the specified signal. Parameterss The signalto install handler for Returns zero onsuccess,nonzero on failure intdaemon_signal_next(void) Return the next signal received. This function will not block. Instead it returns 0 if no signal is queued. Returns The next queued signal if one is queued, zero if none is queued, negative on failure. Examplestestd.c.

Name

dsignal.h - Contains the API for serializing signals to a pipe for usage with select() or poll().

Synopsis

Functions int daemon_signal_init (int s,...) Installs signal handlers for the specified signals. int daemon_signal_install (int s) Install a signal handler for the specified signal. void daemon_signal_done (void) Free resources of signal handling, should be called before daemon exit. int daemon_signal_next (void) Return the next signal received. int daemon_signal_fd (void) Return the file descriptor the daemon should select() on for reading.

See Also