dsignal.h(3)
π dsignal.h β the Library Functions Manual glow-up π
okay bestie, sit down, hydrate, and let me tell you about dsignal.h, a header from libdaemon that lives in the Library Functions Manual section (that's section 3, iykyk π«Ά).
β¨ NAME β¨
dsignal.h β contains the API for serializing signals to a pipe for usage with select() or poll().
like. it takes your messy little signals and pipes them somewhere you can actually watch. iconic behaviour fr fr π
πΈ 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.
π¦ Detailed Description π¦
Contains the API for serializing signals to a pipe for usage with select() or poll().
so here's the whole vibe, bestie: 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(). and you should call daemon_signal_done() before exiting. not optional. do not skip it. it's giving "cleanup is self care" π§β¨
Definition in file dsignal.h.
π Function Documentation π
π void daemon_signal_done (void)
Free resources of signal handling, should be called before daemon exit.
Examples
testd.c.
β int daemon_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
Examples
testd.c.
π₯ int daemon_signal_init (int s, ...)
Installs signal handlers for the specified signals.
Parameters
s,...β The signals to install handlers for. The list should be terminated by0
β οΈ hello?? do NOT forget that 0 at the end. that's the little periodt of the argument list, no cap. π«Ά
Returns
zero on success, nonzero on failure
Examples
testd.c.
π int daemon_signal_install (int s)
Install a signal handler for the specified signal.
Parameters
sβ The signalto install handler for
Returns
zero onsuccess,nonzero on failure
π§ int daemon_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.
Examples
testd.c.
π Author π
Generated automatically by Doxygen for libdaemon from the source code.
okay that's the whole page, you ate it, you understood it, you're basically a signal-handling main character now π
this little love letter came to you courtesy of libdaemon, Version 0.14, and it's thedsignal.h(3)page β so like, go calldaemon_signal_done()before you exit, bestie, mwah ππΈ
π¦ where this page comes from
- ubuntu noble: libdaemon-doc 0.14-7.1ubuntu4
- ubuntu questing: libdaemon-doc 0.14-7.1ubuntu4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms