summaryrefslogtreecommitdiffstats
path: root/src/sighook.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/sighook.h')
-rw-r--r--src/sighook.h28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/sighook.h b/src/sighook.h
index 74d18c0..7149229 100644
--- a/src/sighook.h
+++ b/src/sighook.h
@@ -21,17 +21,19 @@ struct sighook;
enum sigflags {
/** Suppress the default action for this signal. */
SH_CONTINUE = 1 << 0,
+ /** Only run this hook once. */
+ SH_ONESHOT = 1 << 1,
};
/**
* A signal hook callback. Hooks are executed from a signal handler, so must
* only call async-signal-safe functions.
*
- * @param sig
+ * @sig
* The signal number.
- * @param info
+ * @info
* Additional information about the signal.
- * @param arg
+ * @arg
* An arbitrary pointer passed to the hook.
*/
typedef void sighook_fn(int sig, siginfo_t *info, void *arg);
@@ -39,13 +41,13 @@ typedef void sighook_fn(int sig, siginfo_t *info, void *arg);
/**
* Install a hook for a signal.
*
- * @param sig
+ * @sig
* The signal to hook.
- * @param fn
+ * @fn
* The function to call.
- * @param arg
+ * @arg
* An argument passed to the function.
- * @param flags
+ * @flags
* Flags for the new hook.
* @return
* The installed hook, or NULL on failure.
@@ -56,9 +58,9 @@ struct sighook *sighook(int sig, sighook_fn *fn, void *arg, enum sigflags flags)
* On a best-effort basis, invoke the given hook just before the program is
* abnormally terminated by a signal.
*
- * @param fn
+ * @fn
* The function to call.
- * @param arg
+ * @arg
* An argument passed to the function.
* @return
* The installed hook, or NULL on failure.
@@ -70,4 +72,12 @@ struct sighook *atsigexit(sighook_fn *fn, void *arg);
*/
void sigunhook(struct sighook *hook);
+/**
+ * Restore all signal handlers to their original dispositions (e.g. after fork()).
+ *
+ * @return
+ * 0 on success, -1 on failure.
+ */
+int sigreset(void);
+
#endif // BFS_SIGHOOK_H