The Pedigree Project 0.1
memory-lock-contract-test/contract.h
1#ifndef MEMORY_LOCK_CONTRACT_H
2#define MEMORY_LOCK_CONTRACT_H
3
4#include <errno.h>
5#include <stdint.h>
6#include <stdio.h>
7
8#include <sys/types.h>
9
10#define CHECK(condition) \
11 do { \
12 if (!(condition)) { \
13 fprintf(stderr, "%s:%d: %s (errno=%d)\n", __FILE__, __LINE__, #condition, errno); \
14 failed = 1; \
15 goto out; \
16 } \
17 } while (0)
18
19extern size_t ml_page;
20int ml_limit(size_t bytes);
21int ml_unprivileged(void);
22int ml_resident(void* address, size_t pages, unsigned bits, const char* stage);
23int ml_reap(pid_t child, int milliseconds);
24int ml_send(int fd, char byte);
25int ml_receive(int fd, char byte);
26int ml_limits(void);
27int ml_ranges(void);
28int ml_managed(void);
29int ml_raw(void);
30int ml_lifetime(void);
31int ml_exec(int argc, char** argv);
32
33#endif