SigFn C interface.
More...
#include <stdint.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/time.h>
Go to the source code of this file.
|
typedef void(* | sigfn_handler_func) (int signum, void *userdata) |
| signal handler function type
|
|
|
DLL_EXPORT int | sigfn_handle (int signum, sigfn_handler_func handler, void *userdata) |
| attach handler to specific signal
|
|
DLL_EXPORT int | sigfn_ignore (int signum) |
| ignore a specific signal
|
|
DLL_EXPORT int | sigfn_reset (int signum) |
| reset a specific signal to its default behavior
|
|
DLL_EXPORT int | sigfn_wait (const int *signums, size_t count, int *received) |
| wait for any of the specified signals
|
|
DLL_EXPORT int | sigfn_wait_for (const int *signums, size_t count, int *received, const struct timeval *timeout) |
| wait for any of the specified signals with a timeout
|
|
DLL_EXPORT int | sigfn_wait_until (const int *signums, size_t count, int *received, const struct timeval *deadline) |
| wait for any of the specified signals until a deadline
|
|
DLL_EXPORT const char * | sigfn_error () |
| get the last error message
|
|
SigFn C interface.
- Author
- John R. Patek Sr.
◆ DLL_EXPORT
◆ sigfn_handler_func
typedef void(* sigfn_handler_func) (int signum, void *userdata) |
signal handler function type
- Parameters
-
signum | signal number |
userdata | pointer to user defined data, can be NULL |
◆ sigfn_error()
get the last error message
- Returns
- error message, NULL if the last operation was successful
◆ sigfn_handle()
attach handler to specific signal
- Parameters
-
signum | signal to be handled |
handler | function associated with this signal |
userdata | optional user data passed to the function |
- Returns
- 0 on success, -1 on error
◆ sigfn_ignore()
ignore a specific signal
- Parameters
-
- Returns
- 0 on success, -1 on error
◆ sigfn_reset()
reset a specific signal to its default behavior
- Parameters
-
- Returns
- 0 on success, -1 on error
◆ sigfn_wait()
DLL_EXPORT int sigfn_wait |
( |
const int * | signums, |
|
|
size_t | count, |
|
|
int * | received ) |
wait for any of the specified signals
- Parameters
-
signums | array of signal numbers |
count | number of signals in the array |
received | signal number that was received, can be NULL |
- Returns
- 0 on success, -1 on error
◆ sigfn_wait_for()
DLL_EXPORT int sigfn_wait_for |
( |
const int * | signums, |
|
|
size_t | count, |
|
|
int * | received, |
|
|
const struct timeval * | timeout ) |
wait for any of the specified signals with a timeout
- Parameters
-
signums | array of signal numbers |
count | number of signals in the array |
received | signal number that was received, can be NULL |
timeout | maximum time to wait |
- Returns
- 0 on success, -1 on error, 1 if timed out
◆ sigfn_wait_until()
DLL_EXPORT int sigfn_wait_until |
( |
const int * | signums, |
|
|
size_t | count, |
|
|
int * | received, |
|
|
const struct timeval * | deadline ) |
wait for any of the specified signals until a deadline
- Parameters
-
signums | array of signal numbers |
count | number of signals in the array |
received | signal number that was received, can be NULL |
deadline | time to stop waiting |
- Returns
- 0 on success, -1 on error, 1 if timed out