|
libfiu (internal) 0.90
|
This header contains the control API. More...
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Defines | |
| #define | FIU_ONETIME 1 |
| Only fail once; the point of failure will be automatically disabled afterwards. | |
Typedefs | |
| typedef int | external_cb_t (const char *name, int *failnum, void **failinfo, unsigned int *flags) |
| Type of external callback functions. | |
Functions | |
| int | fiu_enable (const char *name, int failnum, void *failinfo, unsigned int flags) |
| Enables the given point of failure unconditionally. | |
| int | fiu_enable_random (const char *name, int failnum, void *failinfo, unsigned int flags, float probability) |
| Enables the given point of failure, with the given probability. | |
| int | fiu_enable_external (const char *name, int failnum, void *failinfo, unsigned int flags, external_cb_t *external_cb) |
| Enables the given point of failure, leaving the decision whether to fail or not to the given external function. | |
| int | fiu_enable_stack (const char *name, int failnum, void *failinfo, unsigned int flags, void *func, int func_pos_in_stack) |
| int | fiu_enable_stack_by_name (const char *name, int failnum, void *failinfo, unsigned int flags, const char *func_name, int func_pos_in_stack) |
| Enables the given point of failure, but only if 'func_name' is in the stack at 'func_pos_in_stack'. | |
| int | fiu_disable (const char *name) |
| Disables the given point of failure. | |
| int | fiu_rc_fifo (const char *basename) |
| Enables remote control over a named pipe. | |
| int | fiu_rc_string (const char *cmd, char **const error) |
| Applies a remote control command given via a string. | |
This header contains the control API.
It should be used for controlling the injection of failures, usually when writing tests.
Definition in file fiu-control.h.
| #define FIU_ONETIME 1 |
Only fail once; the point of failure will be automatically disabled afterwards.
Definition at line 21 of file fiu-control.h.
Referenced by fiu_fail(), and fiu_rc_string().
| typedef int external_cb_t(const char *name, int *failnum, void **failinfo, unsigned int *flags) |
Type of external callback functions.
They must return 0 to indicate not to fail, != 0 to indicate otherwise. Can modify failnum, failinfo and flags, in order to alter the values of the point of failure.
Definition at line 56 of file fiu-control.h.
| int fiu_enable | ( | const char * | name, |
| int | failnum, | ||
| void * | failinfo, | ||
| unsigned int | flags | ||
| ) |
Enables the given point of failure unconditionally.
| name | Name of the point of failure to enable. |
| failnum | What will fiu_fail() return, must be != 0. |
| failinfo | What will fiu_failinfo() return. |
| flags | Flags. |
Definition at line 469 of file fiu.c.
Referenced by fiu_rc_string().
Here is the call graph for this function:
Here is the caller graph for this function:| int fiu_enable_random | ( | const char * | name, |
| int | failnum, | ||
| void * | failinfo, | ||
| unsigned int | flags, | ||
| float | probability | ||
| ) |
Enables the given point of failure, with the given probability.
That makes it fail with the given probability.
| name | Name of the point of failure to enable. |
| failnum | What will fiu_fail() return, must be != 0. |
| failinfo | What will fiu_failinfo() return. |
| flags | Flags. |
| probability | Probability a fiu_fail() call will return failnum, between 0 (never fail) and 1 (always fail). As a special fast case, -1 can also be used to always fail. |
Definition at line 482 of file fiu.c.
Referenced by fiu_rc_string().
Here is the call graph for this function:
Here is the caller graph for this function:| int fiu_enable_external | ( | const char * | name, |
| int | failnum, | ||
| void * | failinfo, | ||
| unsigned int | flags, | ||
| external_cb_t * | external_cb | ||
| ) |
Enables the given point of failure, leaving the decision whether to fail or not to the given external function.
| name | Name of the point of failure to enable. |
| failnum | What will fiu_fail() return, must be != 0. |
| failinfo | What will fiu_failinfo() return. |
| flags | Flags. |
| external_cb | Function to call to determine whether to fail or not. |
Definition at line 496 of file fiu.c.
Here is the call graph for this function:| int fiu_enable_stack | ( | const char * | name, |
| int | failnum, | ||
| void * | failinfo, | ||
| unsigned int | flags, | ||
| void * | func, | ||
| int | func_pos_in_stack | ||
| ) |
Definition at line 511 of file fiu.c.
Referenced by fiu_enable_stack_by_name().
Here is the call graph for this function:
Here is the caller graph for this function:| int fiu_enable_stack_by_name | ( | const char * | name, |
| int | failnum, | ||
| void * | failinfo, | ||
| unsigned int | flags, | ||
| const char * | func_name, | ||
| int | func_pos_in_stack | ||
| ) |
Enables the given point of failure, but only if 'func_name' is in the stack at 'func_pos_in_stack'.
This function relies on GNU extensions such as backtrace() and dladdr(), so if your platform does not support them, it will always return failure.
It is exactly like fiu_enable_stack() but takes a function name, it will ask the dynamic linker to find the corresponding function pointer.
| name | Name of the point of failure to enable. |
| failnum | What will fiu_fail() return, must be != 0. |
| failinfo | What will fiu_failinfo() return. |
| flags | Flags. |
| func_name | Name of the function. |
| func_pos_in_stack | Position where we expect the function to be; use -1 for "any". Values other than -1 are not supported at the moment, but will be in the future. |
Definition at line 531 of file fiu.c.
Referenced by fiu_rc_string().
Here is the call graph for this function:
Here is the caller graph for this function:| int fiu_disable | ( | const char * | name | ) |
Disables the given point of failure.
That makes it NOT fail.
| name | Name of the point of failure to disable. |
Definition at line 546 of file fiu.c.
Referenced by fiu_rc_string().
Here is the call graph for this function:
Here is the caller graph for this function:| int fiu_rc_fifo | ( | const char * | basename | ) |
Enables remote control over a named pipe.
The name pipe path will begin with the given basename. "-$PID" will be appended to it to form the final path. After the process dies, the pipe will be removed. If the process forks, a new pipe will be created.
Once this function has been called, the fiu-ctrl utility can be used to control the points of failure externally.
| basename | Base path to use in the creation of the named pipes. |
Definition at line 323 of file fiu-rc.c.
Here is the call graph for this function:| int fiu_rc_string | ( | const char * | cmd, |
| char **const | error | ||
| ) |
Applies a remote control command given via a string.
The format of the string is not stable and is still subject to change. At the moment, this function is exported for consumption by the libfiu utilities.
| cmd,: | A zero-terminated string with the command to apply. |
| error,: | In case of an error, it will point to a human-readable error message. |
Definition at line 82 of file fiu-rc.c.
Referenced by rc_do_command().
Here is the call graph for this function:
Here is the caller graph for this function:
1.7.4