Tests: rework tracefile_count test to meet the tracefile count limit
[lttng-tools.git] / src / common / compat / fcntl.h
CommitLineData
dbb5dfe6 1/*
ab5be9fa 2 * Copyright (C) 2011 David Goulet <dgoulet@efficios.com>
dbb5dfe6 3 *
ab5be9fa 4 * SPDX-License-Identifier: GPL-2.0-only
dbb5dfe6 5 *
dbb5dfe6
DG
6 */
7
8#ifndef _COMPAT_FCNTL_H
9#define _COMPAT_FCNTL_H
10
11#include <fcntl.h>
4443d2b1 12#include <errno.h>
1268b9d6 13#include <sys/types.h>
dbb5dfe6 14
4443d2b1
MD
15#if (defined(__FreeBSD__) || defined(__CYGWIN__))
16typedef long long off64_t;
17#endif
18
a3a9e86d 19#if (defined(__FreeBSD__) || defined(__sun__))
4443d2b1
MD
20typedef off64_t loff_t;
21#endif
1268b9d6 22
4443d2b1 23#ifdef __linux__
1268b9d6
DG
24extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
25 unsigned int flags);
dbb5dfe6
DG
26#define lttng_sync_file_range(fd, offset, nbytes, flags) \
27 compat_sync_file_range(fd, offset, nbytes, flags)
28
4443d2b1 29#endif /* __linux__ */
dbb5dfe6 30
a3a9e86d 31#if (defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__))
dbb5dfe6
DG
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
4443d2b1
MD
39static 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
a3a9e86d 46#if (defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__sun__))
dbb5dfe6
DG
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
1268b9d6
DG
55static 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}
4443d2b1
MD
60#endif
61
62#ifdef __FreeBSD__
63#define POSIX_FADV_DONTNEED 0
1268b9d6
DG
64
65static inline int posix_fadvise(int fd, off_t offset, off_t len, int advice)
dbb5dfe6
DG
66{
67 return -ENOSYS;
68}
4443d2b1 69#endif
dbb5dfe6 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.102805 seconds and 5 git commands to generate.