Welcome to mirror list, hosted at ThFree Co, Russian Federation.

fault-injection.h « include « criu - github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f33918de86fce48c292777721d423315719f4b7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef __CR_FAULT_INJECTION_H__
#define __CR_FAULT_INJECTION_H__
#include <stdbool.h>

enum faults {
	FI_NONE = 0,
	FI_DUMP_EARLY,
	FI_RESTORE_ROOT_ONLY,
	FI_DUMP_PAGES,
	FI_RESTORE_OPEN_LINK_REMAP,
	FI_PARASITE_CONNECT,
	FI_POST_RESTORE,
	/* not fatal */
	FI_VDSO_TRAMPOLINES = 127,
	FI_CHECK_OPEN_HANDLE = 128,
	FI_NO_MEMFD = 129,
	FI_NO_BREAKPOINTS = 130,
	FI_PARTIAL_PAGES = 131,
	FI_HUGE_ANON_SHMEM_ID = 132,
	FI_CANNOT_MAP_VDSO = 133,
	FI_CORRUPT_EXTREGS = 134,
	FI_MAX,
};

static inline bool __fault_injected(enum faults f, enum faults fi_strategy)
{
	/*
	 * Temporary workaround for Xen guests. Breakpoints degrade
	 * performance linearly, so until we find out the reason,
	 * let's disable them.
	 */
	if (f == FI_NO_BREAKPOINTS)
		return true;

	return fi_strategy == f;
}

#define FI_HUGE_ANON_SHMEM_ID_BASE (0xfffffffflu)

#ifndef CR_NOGLIBC

extern enum faults fi_strategy;
#define fault_injected(f) __fault_injected(f, fi_strategy)

extern int fault_injection_init(void);

#else /* CR_NOGLIBC */

extern bool fault_injected(enum faults f);

#endif

#endif