netatalk  4.6.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
faultinject.h File Reference

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

Detailed Description

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.

Function Documentation

◆ fault_inject_reset()

void fault_inject_reset ( void )

◆ faultinject_open_works()

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.

Variable Documentation

◆ fi

struct fault_inject fi
extern