The Pedigree Project 0.1
uts-namespace-contract-test/contract.h
1#ifndef UTS_NAMESPACE_CONTRACT_H
2#define UTS_NAMESPACE_CONTRACT_H
3
4#include <errno.h>
5#include <stdint.h>
6#include <stdio.h>
7
8#include <sys/types.h>
9
10#define NS_APP "/applications/uts-namespace-contract-test"
11#define CHECK(condition) \
12 do { \
13 if (!(condition)) { \
14 fprintf(stderr, "%s:%d: %s (errno=%d)\n", __FILE__, __LINE__, #condition, errno); \
15 failed = 1; \
16 goto out; \
17 } \
18 } while (0)
19
21 dev_t device;
22 ino_t inode;
23};
24struct ns_peer {
25 pid_t pid;
26 int command, report;
27};
28#define NS_PEER_INITIALIZER {.pid = -1, .command = -1, .report = -1}
29
30extern size_t ns_page;
31int64_t ns_now(void);
32int ns_reap(pid_t pid, int milliseconds);
33int ns_read(int fd, void* buffer, size_t length);
34int ns_write(int fd, const void* buffer, size_t length);
35int ns_send(int fd, char value);
36int ns_receive(int fd, char value);
37int ns_spawn(struct ns_peer* peer, int (*body)(int, int, void*), void* argument);
38int ns_join(struct ns_peer* peer);
39void ns_cleanup(struct ns_peer* peer);
40int ns_fd_identity(int fd, struct ns_identity* identity);
41int ns_path_identity(const char* path, struct ns_identity* identity);
42int ns_same(struct ns_identity left, struct ns_identity right);
43int ns_set(const char* host, const char* domain);
44int ns_expect(const char* host, const char* domain);
45int ns_send_fd(int socket, int fd);
46int ns_receive_fd(int socket);
47int ns_names(void);
48int ns_membership(void);
49int ns_proc(void);
50int ns_lifetime(void);
51int ns_admission(void);
52int ns_exec(int argc, char** argv);
53
54#endif