gfio: split some parts into gclient.c
[fio.git] / helpers.c
1 #include <stdlib.h>
2 #include <errno.h>
3 #include <sys/socket.h>
4 #include <sys/time.h>
5 #include <netinet/in.h>
6 #include <unistd.h>
7
8 #include "compiler/compiler.h"
9 #include "arch/arch.h"
10 #include "os/os.h"
11
12 int _weak fallocate(int fd, int mode, off_t offset, off_t len)
13 {
14         errno = ENOSYS;
15         return -1;
16 }
17
18 #ifndef __NR_fallocate
19 int _weak posix_fallocate(int fd, off_t offset, off_t len)
20 {
21         return 0;
22 }
23 #endif
24
25 int _weak inet_aton(const char *cp, struct in_addr *inp)
26 {
27         return 0;
28 }
29
30 int _weak clock_gettime(clockid_t clk_id, struct timespec *ts)
31 {
32         struct timeval tv;
33         int ret;
34
35         ret = gettimeofday(&tv, NULL);
36
37         ts->tv_sec = tv.tv_sec;
38         ts->tv_nsec = tv.tv_usec * 1000;
39
40         return ret;
41 }
42
43 #ifndef __NR_sync_file_range
44 int _weak sync_file_range(int fd, off64_t offset, off64_t nbytes,
45                            unsigned int flags)
46 {
47         errno = ENOSYS;
48         return -1;
49 }
50 #endif