Test-only fault-injection control block (see faultinject.c). More...
#include <sys/types.h>Go to the source code of this file.
Data Structures | |
| struct | fault_inject |
Functions | |
| void | fault_inject_reset (void) |
| int | faultinject_open_works (const char *scratch_path) |
| Is the LD_PRELOAD open() interposer active on this platform? | |
Variables | |
| struct fault_inject | fi |
Test-only fault-injection control block (see faultinject.c).
Usage in a test (LD_PRELOAD interposition is global, so arm narrowly): fault_inject_reset(); fi.open_armed = 1; fi.open_fail_after = 1; fi.open_errno = EMFILE; ... run only the operation under test ... fault_inject_reset();
fail_after = N: the next N armed calls succeed, call N+1 fails once.
| void fault_inject_reset | ( | void | ) |
| int faultinject_open_works | ( | const char * | scratch_path | ) |
Is the LD_PRELOAD open() interposer active on this platform?
Arms a one-shot open() failure and probes it against the given scratch path. Returns 1 if the injected failure fired (interception works), 0 otherwise (e.g. macOS two-level namespace, or the preload was not loaded). Leaves fi reset. Injection-dependent tests should gate on this and return TEST_SKIP when it is 0, so coverage stays honest per platform.
|
extern |