The Pedigree Project 0.1
executable-file-contract-test/contract.h
1#ifndef EXECUTABLE_FILE_CONTRACT_H
2#define EXECUTABLE_FILE_CONTRACT_H
3
4#include <errno.h>
5#include <limits.h>
6#include <stdint.h>
7#include <stdio.h>
8
9#include <sys/types.h>
10
11#define CHECK(condition) \
12 do { \
13 if (!(condition)) { \
14 fprintf(stderr, "EXECUTABLE-FILE-CONTRACT: FAIL %s:%d: %s errno=%d\n", __FILE__, __LINE__, \
15 #condition, errno); \
16 failed = 1; \
17 goto out; \
18 } \
19 } while (0)
20
21extern size_t ef_page;
22extern char ef_directory[PATH_MAX];
23extern char ef_self[PATH_MAX];
24extern int ef_ext2;
25
26int ef_create(const char* name, char path[PATH_MAX]);
27int ef_copy(const char* source, const char* destination);
28int ef_receive(int fd, char expected);
29int ef_send(int fd, char value);
30int ef_reap(pid_t child);
31int ef_mutations(void);
32int ef_lifetime(void);
33int ef_conflicts(void);
34int ef_ordinary(void);
35int ef_library(void);
36int ef_load(const char* path, int version);
37
38#endif