Commit | Line | Data |
---|---|---|
dbb5dfe6 DG |
1 | /* |
2 | * Copyright (C) 2011 - David Goulet <dgoulet@efficios.com> | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify it | |
5 | * under the terms of the GNU General Public License as published by the Free | |
6 | * Software Foundation; only version 2 of the License. | |
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 | * | |
13 | * You should have received a copy of the GNU General Public License along with | |
14 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |
15 | * Place - Suite 330, Boston, MA 02111-1307, USA. | |
16 | */ | |
17 | ||
18 | #ifndef _COMPAT_FCNTL_H | |
19 | #define _COMPAT_FCNTL_H | |
20 | ||
21 | #include <fcntl.h> | |
22 | ||
23 | #define lttng_sync_file_range(fd, offset, nbytes, flags) \ | |
24 | compat_sync_file_range(fd, offset, nbytes, flags) | |
25 | ||
26 | #ifdef __linux__ | |
27 | ||
28 | int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes, | |
29 | unsigned int flags) | |
30 | { | |
31 | return sync_file_range(fd, offset, nbytes, flags); | |
32 | } | |
33 | ||
34 | #elif __FreeBSD__ | |
35 | ||
36 | /* | |
37 | * Possible flags under Linux. Simply nullify them and avoid wrapper. | |
38 | */ | |
39 | #define SYNC_FILE_RANGE_WAIT_AFTER 0 | |
40 | #define SYNC_FILE_RANGE_WAIT_BEFORE 0 | |
41 | #define SYNC_FILE_RANGE_WRITE 0 | |
42 | ||
43 | typedef long int off64_t; | |
44 | typedef off64_t loff_t; | |
45 | ||
46 | int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes, | |
47 | unsigned int flags) | |
48 | { | |
49 | return 0; | |
50 | } | |
51 | ||
52 | /* | |
53 | * Possible flags under Linux. Simply nullify them and avoid wrappers. | |
54 | */ | |
55 | #define SPLICE_F_MOVE 0 | |
56 | #define SPLICE_F_NONBLOCK 0 | |
57 | #define SPLICE_F_MORE 0 | |
58 | #define SPLICE_F_GIFT 0 | |
59 | ||
60 | ssize_t splice(int fd_in, loff_t *off_in, int fd_out, | |
61 | loff_t *off_out, size_t len, unsigned int flags) | |
62 | { | |
63 | return -ENOSYS; | |
64 | } | |
65 | ||
66 | #else | |
67 | #error "Please add support for your OS into compat/fcntl.h." | |
68 | #endif /* __linux__ , __FreeBSD__ */ | |
69 | ||
70 | #endif /* _COMPAT_FCNTL_H */ |