| 1 |
/* COVERAGE: fdatasync fsync sync */ |
| 2 |
|
| 3 |
#include <unistd.h> |
| 4 |
#include <sys/types.h> |
| 5 |
#include <sys/stat.h> |
| 6 |
#include <fcntl.h> |
| 7 |
|
| 8 |
|
| 9 |
int main() |
| 10 |
{ |
| 11 |
int fd; |
| 12 |
|
| 13 |
fd = creat("foobar",S_IREAD|S_IWRITE); |
| 14 |
|
| 15 |
sync(); |
| 16 |
//staptest// sync () = 0 |
| 17 |
|
| 18 |
fsync(fd); |
| 19 |
//staptest// fsync (NNNN) = 0 |
| 20 |
|
| 21 |
fsync(-1); |
| 22 |
//staptest// fsync (-1) = -NNNN |
| 23 |
|
| 24 |
fdatasync(fd); |
| 25 |
//staptest// fdatasync (NNNN) = 0 |
| 26 |
|
| 27 |
fdatasync(-1); |
| 28 |
//staptest// fdatasync (-1) = -NNNN |
| 29 |
|
| 30 |
close(fd); |
| 31 |
|
| 32 |
return 0; |
| 33 |
} |