From cc8ed39b240180b58810784f844e253263594ac3 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 5 Oct 1999 16:24:54 +0000 Subject: Initial revision --- util-linux/fdflush.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 util-linux/fdflush.c (limited to 'util-linux/fdflush.c') diff --git a/util-linux/fdflush.c b/util-linux/fdflush.c new file mode 100644 index 0000000..a15e9b3 --- /dev/null +++ b/util-linux/fdflush.c @@ -0,0 +1,36 @@ +#include "internal.h" +#include +#include +#include +#include +#include + +const char fdflush_usage[] = "fdflush device"; + +int +fdflush(const char *filename) +{ + int status; + int fd = open(filename, 0); + + if ( fd < 0 ) { + name_and_error(filename); + return 1; + } + + status = ioctl(fd, FDFLUSH, 0); + close(fd); + + if ( status != 0 ) { + name_and_error(filename); + return 1; + } + return 0; +} + + +int +fdflush_fn(const struct FileInfo * i) +{ + return fdflush(i->source); +} -- cgit v1.1