1#ifndef FILE_LOCK_CONTRACT_H
2#define FILE_LOCK_CONTRACT_H
11#define CHECK(condition) \
14 fprintf(stderr, "%s:%d: %s (errno=%d)\n", __FILE__, __LINE__, #condition, errno); \
19#define LOCK_APP "/applications/file-lock-contract-test"
20enum { FL_FLOCK, FL_CLASSIC, FL_OFD };
23void fl_pause(
int milliseconds);
24int fl_wait(
volatile int* flag,
int milliseconds);
25int fl_reap(pid_t child,
int milliseconds);
26int fl_byte(
int socket,
char expected);
27int fl_send_fd(
int socket,
int fd);
28int fl_receive_fd(
int socket);
29int fl_file(
char path[128],
const char* directory);
30int fl_record(
int fd,
int command,
short type,
short whence, off_t start, off_t length);
31int fl_lock(
int fd,
int kind,
short type,
int blocking);
32int fl_query(
int fd,
int command, off_t start, off_t length,
short type, off_t expected_start,
33 off_t expected_length, pid_t owner);
34int file_lock_flock(
void);
35int file_lock_records(
void);
36int file_lock_lifetime(
void);
37int file_lock_blocking(
void);
38int file_lock_creation(
void);
39int file_lock_exec(
int argc,
char** argv);