#define _GNU_SOURCE #include #include #include #include int main(int argc, char** argv) { if(argc != 2) { printf("usage:\n\t%s \n", argv[0]); return -1; } FILE *f = fopen(argv[1], "r"); if(!f) { printf("fopen failed %s\n", strerror(errno)); return -1; } int fd = fileno(f); int err = syncfs(fd); if(err < 0) { printf("syncfs failed %s\n", strerror(errno)); } return 0; }