Relicence all source and header files included in LGPL code
[lttng-tools.git] / src / common / compat / fcntl.h
... / ...
CommitLineData
1/*
2 * Copyright (C) 2011 David Goulet <dgoulet@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef _COMPAT_FCNTL_H
9#define _COMPAT_FCNTL_H
10
11#include <fcntl.h>
12#include <sys/types.h>
13
14#include <common/compat/errno.h>
15
16#if (defined(__CYGWIN__))
17typedef long long off64_t;
18#endif
19
20#if (defined(__FreeBSD__) || defined(__sun__))
21typedef off64_t loff_t;
22#endif
23
24#ifdef __linux__
25extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
26 unsigned int flags);
27#define lttng_sync_file_range(fd, offset, nbytes, flags) \
28 compat_sync_file_range(fd, offset, nbytes, flags)
29
30#endif /* __linux__ */
31
32#if (defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__))
33/*
34 * Possible flags under Linux. Simply nullify them and avoid wrapper.
35 */
36#define SYNC_FILE_RANGE_WAIT_AFTER 0
37#define SYNC_FILE_RANGE_WAIT_BEFORE 0
38#define SYNC_FILE_RANGE_WRITE 0
39
40static inline int lttng_sync_file_range(int fd, off64_t offset,
41 off64_t nbytes, unsigned int flags)
42{
43 return -ENOSYS;
44}
45#endif
46
47#if (defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__))
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
56static inline ssize_t splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out,
57 size_t len, unsigned int flags)
58{
59 return -ENOSYS;
60}
61#endif
62
63#if !(defined(__linux__) || defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__) || defined(__APPLE__))
64#error "Please add support for your OS."
65#endif /* __linux__ , __FreeBSD__, __CYGWIN__, __sun__, __APPLE__ */
66
67#endif /* _COMPAT_FCNTL_H */
This page took 0.023041 seconds and 4 git commands to generate.