The Pedigree Project
0.1
src
user
applications
transfer-contract-test
transfer-contract-test/contract.h
1
#ifndef TRANSFER_CONTRACT_H
2
#define TRANSFER_CONTRACT_H
3
#include <errno.h>
4
#include <fcntl.h>
5
#include <pthread.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, "%s:%d: %s (errno=%d)\n", __FILE__, __LINE__, #condition, errno); \
15
failed = 1; \
16
goto out; \
17
} \
18
} while (0)
19
enum
{ TF_SENDFILE, TF_COPY_RANGE, TF_CHUNK = 65536, TF_FILLER = -1 };
20
struct
tf_file
{
21
int
fd;
22
char
path[128];
23
};
24
struct
tf_transfer
{
25
int
kind, input, output;
26
off_t *input_offset, *output_offset;
27
size_t
count;
28
volatile
int
ready, gate, done;
29
ssize_t result;
30
int
error;
31
int64_t started, finished;
32
};
33
int64_t tf_now(
void
);
34
void
tf_pause(
int
milliseconds);
35
int
tf_wait(
volatile
int
* flag,
int
milliseconds);
36
int
tf_reap(pid_t child,
int
milliseconds);
37
unsigned
char
tf_pattern(
size_t
offset,
int
seed);
38
int
tf_create(
struct
tf_file
* file,
const
char
* directory,
size_t
bytes,
int
seed);
39
void
tf_destroy(
struct
tf_file
* file);
40
int
tf_verify(
int
fd, off_t offset,
size_t
length,
size_t
source_offset,
int
seed);
41
int
tf_socket_read(
int
fd,
size_t
length,
size_t
source_offset,
int
seed);
42
ssize_t tf_saturate(
int
fd);
43
ssize_t tf_copy(
int
kind,
int
input, off_t* input_offset,
int
output, off_t* output_offset,
44
size_t
count);
45
void
* tf_worker(
void
* argument);
46
void
tf_diagnostic(
const
struct
tf_transfer
* transfer);
47
int
tf_join(pthread_t thread,
struct
tf_transfer
* transfer);
48
int
transfer_file_copy(
void
);
49
int
transfer_offsets(
void
);
50
int
transfer_stream(
void
);
51
int
transfer_lifetime(
void
);
52
int
transfer_races(
void
);
53
#endif
tf_file
Definition
transfer-contract-test/contract.h:20
tf_transfer
Definition
transfer-contract-test/contract.h:24
Generated on Tue Sep 29 2026 04:30:13 for The Pedigree Project by
1.9.8