The Pedigree Project
0.1
src
user
applications
fanotify-handle-contract-test
fanotify-handle-contract-test/contract.h
1
#ifndef FANOTIFY_HANDLE_CONTRACT_H
2
#define FANOTIFY_HANDLE_CONTRACT_H
3
4
#include <errno.h>
5
#include <fcntl.h>
6
#include <stdint.h>
7
#include <stdio.h>
8
9
#include <sys/fanotify.h>
10
#include <sys/types.h>
11
12
#define FH_APP "/applications/fanotify-handle-contract-test"
13
#define FH_QUEUE_LIMIT 256
14
#define CHECK(condition) \
15
do { \
16
if (!(condition)) { \
17
fprintf(stderr, "%s:%d: %s (errno=%d)\n", __FILE__, __LINE__, #condition, errno); \
18
failed = 1; \
19
goto out; \
20
} \
21
} while (0)
22
23
struct
fh_handle
{
24
unsigned
handle_bytes;
25
int
handle_type;
26
unsigned
char
bytes[128];
27
};
28
struct
fh_file
{
29
int
fd, mount_id;
30
char
path[192];
31
struct
fh_handle
handle;
32
};
33
struct
fh_record
{
34
uint64_t mask;
35
int
pid;
36
unsigned
char
fsid[8];
37
struct
fh_handle
handle;
38
};
39
40
extern
size_t
fh_page;
41
int64_t fh_now(
void
);
42
void
fh_pause(
int
milliseconds);
43
int
fh_wait(
volatile
int
* flag,
int
milliseconds);
44
int
fh_reap(pid_t child,
int
milliseconds);
45
int
fh_send(
int
fd,
char
byte
);
46
int
fh_receive(
int
fd,
char
byte
);
47
int
fh_read_all(
int
fd,
void
* buffer,
size_t
length);
48
int
fh_write_all(
int
fd,
const
void
* buffer,
size_t
length);
49
int
fh_send_fd(
int
socket,
int
fd);
50
int
fh_receive_fd(
int
socket);
51
int
fh_readable(
int
fd,
int
milliseconds);
52
int
fh_export(
int
fd,
struct
fh_handle
* handle,
int
* mount_id);
53
int
fh_equal(
const
struct
fh_handle
* first,
const
struct
fh_handle
* second);
54
int
fh_create(
struct
fh_file
* file);
55
void
fh_close(
struct
fh_file
* file);
56
int
fh_group(
int
nonblock);
57
int
fh_mark(
int
group,
const
struct
fh_file
* file,
unsigned
flags, uint64_t mask);
58
int
fh_modify(
const
struct
fh_file
* file);
59
size_t
fh_record_size(
const
struct
fh_handle
* handle);
60
int
fh_parse(
const
void
* bytes,
size_t
length,
struct
fh_record
* record);
61
int
fh_take(
int
group,
const
struct
fh_handle
* shape,
struct
fh_record
* record);
62
int
fh_event(
int
group,
const
struct
fh_file
* file, uint64_t mask, pid_t pid);
63
int
fh_drain(
int
group);
64
int
fh_handles(
void
);
65
int
fh_admission(
void
);
66
int
fh_events(
void
);
67
int
fh_queue(
void
);
68
int
fh_lifetime(
void
);
69
int
fh_waits(
void
);
70
int
fh_exec(
int
argc,
char
** argv);
71
int
fh_persistence(
const
char
* base,
const
char
* token,
int
write_stage);
72
73
#endif
fh_file
Definition
fanotify-handle-contract-test/contract.h:28
fh_handle
Definition
fanotify-handle-contract-test/contract.h:23
fh_record
Definition
fanotify-handle-contract-test/contract.h:33
Generated on Tue Sep 22 2026 06:05:51 for The Pedigree Project by
1.9.8