| 1 | /* |
| 2 | * Copyright (C) 2011 David Goulet <dgoulet@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #define _LGPL_SOURCE |
| 9 | #include <common/compat/fcntl.h> |
| 10 | #include <common/macros.h> |
| 11 | #include <unistd.h> |
| 12 | |
| 13 | #ifdef __linux__ |
| 14 | |
| 15 | int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes, |
| 16 | unsigned int flags) |
| 17 | { |
| 18 | #ifdef HAVE_SYNC_FILE_RANGE |
| 19 | return sync_file_range(fd, offset, nbytes, flags); |
| 20 | #else |
| 21 | return fdatasync(fd); |
| 22 | #endif |
| 23 | } |
| 24 | |
| 25 | #endif /* __linux__ */ |