Clean-up: sessiond: cmd_enable_channel_internal
[lttng-tools.git] / src / common / compat / fcntl.h
CommitLineData
dbb5dfe6 1/*
ab5be9fa 2 * Copyright (C) 2011 David Goulet <dgoulet@efficios.com>
dbb5dfe6 3 *
c922647d 4 * SPDX-License-Identifier: LGPL-2.1-only
dbb5dfe6 5 *
dbb5dfe6
DG
6 */
7
8#ifndef _COMPAT_FCNTL_H
9#define _COMPAT_FCNTL_H
10
11#include <fcntl.h>
1268b9d6 12#include <sys/types.h>
dbb5dfe6 13
edf4b93e
MJ
14#include <common/compat/errno.h>
15
3306f57f 16#if (defined(__CYGWIN__))
4443d2b1
MD
17typedef long long off64_t;
18#endif
19
a3a9e86d 20#if (defined(__FreeBSD__) || defined(__sun__))
4443d2b1
MD
21typedef off64_t loff_t;
22#endif
1268b9d6 23
4443d2b1 24#ifdef __linux__
1268b9d6
DG
25extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
26 unsigned int flags);
dbb5dfe6
DG
27#define lttng_sync_file_range(fd, offset, nbytes, flags) \
28 compat_sync_file_range(fd, offset, nbytes, flags)
29
4443d2b1 30#endif /* __linux__ */
dbb5dfe6 31
a3a9e86d 32#if (defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__))
dbb5dfe6
DG
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
4eac90eb
MJ
40static inline int lttng_sync_file_range(
41 int fd __attribute__((unused)),
42 off64_t offset __attribute__((unused)),
43 off64_t nbytes __attribute__((unused)),
44 unsigned int flags __attribute__((unused)))
4443d2b1
MD
45{
46 return -ENOSYS;
47}
48#endif
49
a3a9e86d 50#if (defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__))
dbb5dfe6
DG
51/*
52 * Possible flags under Linux. Simply nullify them and avoid wrappers.
53 */
54#define SPLICE_F_MOVE 0
55#define SPLICE_F_NONBLOCK 0
56#define SPLICE_F_MORE 0
57#define SPLICE_F_GIFT 0
58
4eac90eb
MJ
59static inline ssize_t splice(
60 int fd_in __attribute__((unused)),
61 loff_t *off_in __attribute__((unused)),
62 int fd_out __attribute__((unused)),
63 loff_t *off_out __attribute__((unused)),
64 size_t len __attribute__((unused)),
65 unsigned int flags __attribute__((unused)))
1268b9d6
DG
66{
67 return -ENOSYS;
68}
4443d2b1
MD
69#endif
70
82513a40 71#if !(defined(__linux__) || defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__) || defined(__APPLE__))
7657ae75 72#error "Please add support for your OS."
82513a40 73#endif /* __linux__ , __FreeBSD__, __CYGWIN__, __sun__, __APPLE__ */
dbb5dfe6
DG
74
75#endif /* _COMPAT_FCNTL_H */
This page took 0.060529 seconds and 4 git commands to generate.