X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ffailtest%2Ffailtest.h;fp=ccan%2Ffailtest%2Ffailtest.h;h=5c80bfeea82cf74302517c0569d146561a139c68;hp=b304917bc6b0eece40039d6390f91c4020117811;hb=67bbee5311280dbbf30debe7122d8722c710e3c3;hpb=4f2f6f1eba6cc2bcb0683c50269d1dbbe73ed167 diff --git a/ccan/failtest/failtest.h b/ccan/failtest/failtest.h index b304917b..5c80bfee 100644 --- a/ccan/failtest/failtest.h +++ b/ccan/failtest/failtest.h @@ -48,6 +48,7 @@ enum failtest_call_type { FAILTEST_WRITE, FAILTEST_FCNTL, FAILTEST_MMAP, + FAILTEST_LSEEK }; struct calloc_call { @@ -72,6 +73,10 @@ struct open_call { const char *pathname; int flags; mode_t mode; + bool always_save; + bool closed; + /* This is used for O_TRUNC opens on existing files. */ + struct contents_saved *saved; }; struct close_call { @@ -98,6 +103,9 @@ struct write_call { const void *buf; size_t count; off_t off; + bool is_pwrite; + struct failtest_call *opener; + struct contents_saved *saved; }; struct fcntl_call { @@ -119,6 +127,16 @@ struct mmap_call { int flags; int fd; off_t offset; + struct failtest_call *opener; + struct contents_saved *saved; +}; + +struct lseek_call { + ssize_t ret; + int fd; + off_t offset; + int whence; + off_t old_off; }; /** @@ -147,7 +165,9 @@ struct failtest_call { /* What we set errno to. */ int error; /* How do we clean this up? */ - void (*cleanup)(void *u); + void (*cleanup)(void *u, bool restore); + /* Should their program have cleaned up? */ + bool can_leak; /* Backtrace of call chain. */ void **backtrace; unsigned int backtrace_num; @@ -163,6 +183,7 @@ struct failtest_call { struct write_call write; struct fcntl_call fcntl; struct mmap_call mmap; + struct lseek_call lseek; } u; };