Fix: consumerd: packet sent before channel rotation
[lttng-tools.git] / src / common / compat / fcntl.h
1 /*
2 * Copyright (C) 2011 David Goulet <dgoulet@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8 #ifndef _COMPAT_FCNTL_H
9 #define _COMPAT_FCNTL_H
10
11 #include <fcntl.h>
12 #include <errno.h>
13 #include <sys/types.h>
14
15 #if (defined(__FreeBSD__) || defined(__CYGWIN__))
16 typedef long long off64_t;
17 #endif
18
19 #if (defined(__FreeBSD__) || defined(__sun__))
20 typedef off64_t loff_t;
21 #endif
22
23 #ifdef __linux__
24 extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
25 unsigned int flags);
26 #define lttng_sync_file_range(fd, offset, nbytes, flags) \
27 compat_sync_file_range(fd, offset, nbytes, flags)
28
29 #endif /* __linux__ */
30
31 #if (defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__))
32 /*
33 * Possible flags under Linux. Simply nullify them and avoid wrapper.
34 */
35 #define SYNC_FILE_RANGE_WAIT_AFTER 0
36 #define SYNC_FILE_RANGE_WAIT_BEFORE 0
37 #define SYNC_FILE_RANGE_WRITE 0
38
39 static inline int lttng_sync_file_range(int fd, off64_t offset,
40 off64_t nbytes, unsigned int flags)
41 {
42 return -ENOSYS;
43 }
44 #endif
45
46 #if (defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__))
47 /*
48 * Possible flags under Linux. Simply nullify them and avoid wrappers.
49 */
50 #define SPLICE_F_MOVE 0
51 #define SPLICE_F_NONBLOCK 0
52 #define SPLICE_F_MORE 0
53 #define SPLICE_F_GIFT 0
54
55 static inline ssize_t splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out,
56 size_t len, unsigned int flags)
57 {
58 return -ENOSYS;
59 }
60 #endif
61
62 #ifdef __FreeBSD__
63 #define POSIX_FADV_DONTNEED 0
64
65 static inline int posix_fadvise(int fd, off_t offset, off_t len, int advice)
66 {
67 return -ENOSYS;
68 }
69 #endif
70
71 #if !(defined(__linux__) || defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__) || defined(__APPLE__))
72 #error "Please add support for your OS."
73 #endif /* __linux__ , __FreeBSD__, __CYGWIN__, __sun__, __APPLE__ */
74
75 #endif /* _COMPAT_FCNTL_H */
This page took 0.031088 seconds and 4 git commands to generate.