Rich Felker | 1c76683 | 2011-04-20 15:20:22 -0400 | [diff] [blame] | 1 | #include <fcntl.h> |
| 2 | #include "syscall.h" |
Rich Felker | 1e7a581 | 2014-01-06 21:31:17 -0500 | [diff] [blame] | 3 | #include "libc.h" |
Rich Felker | 1c76683 | 2011-04-20 15:20:22 -0400 | [diff] [blame] | 4 | |
| 5 | int posix_fadvise(int fd, off_t base, off_t len, int advice) |
| 6 | { |
Rich Felker | 3dd27f3 | 2016-07-01 13:32:35 -0400 | [diff] [blame] | 7 | #if defined(SYSCALL_FADVISE_6_ARG) |
| 8 | /* Some archs, at least arm and powerpc, have the syscall |
| 9 | * arguments reordered to avoid needing 7 argument registers |
| 10 | * due to 64-bit argument alignment. */ |
| 11 | return -__syscall(SYS_fadvise, fd, advice, |
| 12 | __SYSCALL_LL_E(base), __SYSCALL_LL_E(len)); |
| 13 | #else |
Rich Felker | 804debe | 2016-06-29 17:45:40 -0400 | [diff] [blame] | 14 | return -__syscall(SYS_fadvise, fd, __SYSCALL_LL_O(base), |
Rich Felker | 0b6eb2d | 2011-09-21 20:11:10 -0400 | [diff] [blame] | 15 | __SYSCALL_LL_E(len), advice); |
Rich Felker | 3dd27f3 | 2016-07-01 13:32:35 -0400 | [diff] [blame] | 16 | #endif |
Rich Felker | 1c76683 | 2011-04-20 15:20:22 -0400 | [diff] [blame] | 17 | } |
Rich Felker | 1e7a581 | 2014-01-06 21:31:17 -0500 | [diff] [blame] | 18 | |
| 19 | LFS64(posix_fadvise); |