The Pedigree Project
0.1
src
user
applications
scheduling-contract-test
scheduling-contract-test/contract.h
1
#ifndef SCHEDULING_CONTRACT_H
2
#define SCHEDULING_CONTRACT_H
3
4
#include <errno.h>
5
#include <pthread.h>
6
#include <sched.h>
7
#include <stdatomic.h>
8
#include <stdint.h>
9
#include <stdio.h>
10
#include <time.h>
11
12
#include <sys/types.h>
13
14
#define SC_APP "/applications/scheduling-contract-test"
15
#define CHECK(condition) \
16
do { \
17
if (!(condition)) { \
18
fprintf(stderr, "%s:%d: %s (errno=%d)\n", __FILE__, __LINE__, #condition, errno); \
19
failed = 1; \
20
goto out; \
21
} \
22
} while (0)
23
24
struct
sc_peer
{
25
pid_t pid;
26
int
command, report;
27
};
28
#define SC_PEER_INITIALIZER {.pid = -1, .command = -1, .report = -1}
29
extern
cpu_set_t sc_allowed;
30
extern
int
sc_cpus[CPU_SETSIZE], sc_count;
31
extern
size_t
sc_bytes, sc_page;
32
extern
_Thread_local
unsigned
sc_tls;
33
int
sc_init(
int
expected);
34
int
sc_pin(pid_t tid,
int
cpu);
35
int
sc_mask(pid_t tid,
int
cpu);
36
int
sc_sample(
int
cpu);
37
int
sc_register_syscall(
long
number,
long
a,
long
b,
long
c,
long
* result);
38
int64_t sc_now(
void
);
39
int
sc_wait(atomic_uint* value,
unsigned
expected);
40
int
sc_wait_for_task_retirement(pid_t tid,
const
struct
timespec* expected_interval);
41
int
sc_read(
int
fd,
void
* buffer,
size_t
length);
42
int
sc_write(
int
fd,
const
void
* buffer,
size_t
length);
43
int
sc_send(
int
fd,
char
value);
44
int
sc_receive(
int
fd,
char
value);
45
int
sc_reap(pid_t pid,
int
milliseconds);
46
int
sc_spawn(
struct
sc_peer
*,
int
(*body)(
int
,
int
,
void
*),
void
*);
47
int
sc_join(
struct
sc_peer
*);
48
void
sc_cleanup(
struct
sc_peer
*);
49
int
sc_api(
void
);
50
int
sc_placement(
void
);
51
int
sc_wakeups(
void
);
52
int
sc_lifecycle(
void
);
53
int
sc_permissions(
void
);
54
int
sc_exec(
int
argc,
char
** argv);
55
int
sc_input(
void
);
56
int
sc_input_exec(
int
argc,
char
** argv);
57
#endif
sc_peer
Definition
scheduling-contract-test/contract.h:24
Generated on Tue Sep 22 2026 06:05:51 for The Pedigree Project by
1.9.8