cygwin support: only freebsd needs to typedef loff_t
[lttng-tools.git] / src / common / compat / fcntl.h
CommitLineData
dbb5dfe6
DG
1/*
2 * Copyright (C) 2011 - David Goulet <dgoulet@efficios.com>
3 *
d14d33bf
AM
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2 only,
6 * as published by the Free Software Foundation.
dbb5dfe6
DG
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
d14d33bf
AM
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
dbb5dfe6
DG
16 */
17
18#ifndef _COMPAT_FCNTL_H
19#define _COMPAT_FCNTL_H
20
21#include <fcntl.h>
1268b9d6 22#include <sys/types.h>
dbb5dfe6 23
1268b9d6
DG
24#ifdef __linux__
25
26extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
27 unsigned int flags);
dbb5dfe6
DG
28#define lttng_sync_file_range(fd, offset, nbytes, flags) \
29 compat_sync_file_range(fd, offset, nbytes, flags)
30
b1c900e9 31#elif (defined(__FreeBSD__) || defined(__CYGWIN__))
dbb5dfe6 32
15d3d5d8
MD
33#include <errno.h>
34
35typedef long long off64_t;
36#ifdef __FreeBSD__
1268b9d6 37typedef off64_t loff_t;
15d3d5d8 38#endif
dbb5dfe6 39
dbb5dfe6
DG
40
41/*
42 * Possible flags under Linux. Simply nullify them and avoid wrapper.
43 */
44#define SYNC_FILE_RANGE_WAIT_AFTER 0
45#define SYNC_FILE_RANGE_WAIT_BEFORE 0
46#define SYNC_FILE_RANGE_WRITE 0
47
dbb5dfe6
DG
48/*
49 * Possible flags under Linux. Simply nullify them and avoid wrappers.
50 */
51#define SPLICE_F_MOVE 0
52#define SPLICE_F_NONBLOCK 0
53#define SPLICE_F_MORE 0
54#define SPLICE_F_GIFT 0
55
1268b9d6
DG
56#define POSIX_FADV_DONTNEED 0
57
58static inline int lttng_sync_file_range(int fd, off64_t offset,
59 off64_t nbytes, unsigned int flags)
60{
61 return -ENOSYS;
62}
63
64static inline ssize_t splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out,
65 size_t len, unsigned int flags)
66{
67 return -ENOSYS;
68}
69
70static inline int posix_fadvise(int fd, off_t offset, off_t len, int advice)
dbb5dfe6
DG
71{
72 return -ENOSYS;
73}
74
75#else
7657ae75 76#error "Please add support for your OS."
c345f883 77#endif /* __linux__ , __FreeBSD__, __CYGWIN__ */
dbb5dfe6
DG
78
79#endif /* _COMPAT_FCNTL_H */
This page took 0.028501 seconds and 4 git commands to generate.