net: set runstate to SETTING_UP while waiting for a connection
[fio.git] / helpers.c
... / ...
CommitLineData
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#ifndef FIO_HAVE_LINUX_FALLOCATE
13int _weak fallocate(int fd, int mode, off_t offset, off_t len)
14{
15 errno = ENOSYS;
16 return -1;
17}
18#endif
19
20#ifndef __NR_fallocate
21int _weak posix_fallocate(int fd, off_t offset, off_t len)
22{
23 return 0;
24}
25#endif
26
27int _weak inet_aton(const char *cp, struct in_addr *inp)
28{
29 return 0;
30}
31
32int _weak clock_gettime(clockid_t clk_id, struct timespec *ts)
33{
34 struct timeval tv;
35 int ret;
36
37 ret = gettimeofday(&tv, NULL);
38
39 ts->tv_sec = tv.tv_sec;
40 ts->tv_nsec = tv.tv_usec * 1000;
41
42 return ret;
43}
44
45#ifndef __NR_sync_file_range
46int _weak sync_file_range(int fd, off64_t offset, off64_t nbytes,
47 unsigned int flags)
48{
49 errno = ENOSYS;
50 return -1;
51}
52#endif