Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-10-05 20:24:54 +0400
committerEric Andersen <andersen@codepoet.org>1999-10-05 20:24:54 +0400
commitcc8ed39b240180b58810784f844e253263594ac3 (patch)
tree15feebbb4be9a9168209609f48f0b100f9364420 /fdflush.c
Initial revision0_29alpha2
Diffstat (limited to 'fdflush.c')
-rw-r--r--fdflush.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/fdflush.c b/fdflush.c
new file mode 100644
index 000000000..a15e9b3f7
--- /dev/null
+++ b/fdflush.c
@@ -0,0 +1,36 @@
+#include "internal.h"
+#include <sys/ioctl.h>
+#include <linux/fd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+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);
+}