Fio 1.43
[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 "os/os.h"
10
11 #ifndef __NR_fallocate
12 int __weak posix_fallocate(int fd, off_t offset, off_t len)
13 {
14         return 0;
15 }
16 #endif
17
18 int __weak inet_aton(const char *cp, struct in_addr *inp)
19 {
20         return 0;
21 }
22
23 int __weak clock_gettime(clockid_t clk_id, struct timespec *ts)
24 {
25         struct timeval tv;
26         int ret;
27
28         ret = gettimeofday(&tv, NULL);
29
30         ts->tv_sec = tv.tv_sec;
31         ts->tv_nsec = tv.tv_usec * 1000;
32
33         return ret;
34 }
35
36 #ifndef __NR_sync_file_range
37 int __weak sync_file_range(int fd, off64_t offset, off64_t nbytes,
38                            unsigned int flags)
39 {
40         errno = ENOSYS;
41         return -1;
42 }
43 #endif