#define CCAN_FAILTEST_H
#include <sys/types.h>
#include <stdbool.h>
+#include <fcntl.h>
#include <ccan/compiler/compiler.h>
/**
FAILTEST_PIPE,
FAILTEST_READ,
FAILTEST_WRITE,
+ FAILTEST_FCNTL,
};
struct calloc_call {
struct pipe_call {
int ret;
int fds[2];
+ bool closed[2];
};
struct read_call {
ssize_t ret;
+ off_t off;
int fd;
void *buf;
size_t count;
int fd;
const void *buf;
size_t count;
+ off_t off;
+};
+
+struct fcntl_call {
+ int ret;
+ int fd;
+ int cmd;
+ union {
+ struct flock fl;
+ long l;
+ int i;
+ } arg;
};
/**
bool fail;
/* What we set errno to. */
int error;
+ /* How do we clean this up? */
+ void (*cleanup)(void *u);
/* The actual call data. */
union {
struct calloc_call calloc;
struct pipe_call pipe;
struct read_call read;
struct write_call write;
+ struct fcntl_call fcntl;
} u;
};