blob: a15e9b3f7f8fd24098fffcf55db85ef7e92cd844 [file] [log] [blame]
Eric Andersencc8ed391999-10-05 16:24:54 +00001#include "internal.h"
2#include <sys/ioctl.h>
3#include <linux/fd.h>
4#include <sys/types.h>
5#include <sys/stat.h>
6#include <fcntl.h>
7
8const char fdflush_usage[] = "fdflush device";
9
10int
11fdflush(const char *filename)
12{
13 int status;
14 int fd = open(filename, 0);
15
16 if ( fd < 0 ) {
17 name_and_error(filename);
18 return 1;
19 }
20
21 status = ioctl(fd, FDFLUSH, 0);
22 close(fd);
23
24 if ( status != 0 ) {
25 name_and_error(filename);
26 return 1;
27 }
28 return 0;
29}
30
31
32int
33fdflush_fn(const struct FileInfo * i)
34{
35 return fdflush(i->source);
36}