]> git.ozlabs.org Git - ccan/blobdiff - ccan/failtest/failtest.h
failtest: generic cleanup hooks
[ccan] / ccan / failtest / failtest.h
index 5c57efcfe71284eaaa24e93ad74c54e0eae6316b..21bc9f7c59e342fd12dec4140314b252d364763c 100644 (file)
@@ -64,15 +64,18 @@ struct open_call {
        const char *pathname;
        int flags;
        mode_t mode;
+       int dup_fd;
 };
 
 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;
@@ -83,6 +86,11 @@ struct write_call {
        int fd;
        const void *buf;
        size_t count;
+       off_t off;
+       off_t old_filelen;
+       off_t saved_len;
+       void *saved_contents;
+       int dup_fd;
 };
 
 struct fcntl_call {
@@ -119,6 +127,8 @@ struct failtest_call {
        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;