summaryrefslogtreecommitdiff
path: root/src/fcntl/posix_fadvise.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2016-07-01 13:32:35 -0400
committerRich Felker <dalias@aerifal.cx>2016-07-01 13:32:35 -0400
commit3dd27f3aabf03b109c30648c3f7a209302deee7f (patch)
tree34358a549cba25f030303c9001bbdb7c81970394 /src/fcntl/posix_fadvise.c
parent3d98146146dbe138b380ea7d7f9b93139d768828 (diff)
downloadmusl-3dd27f3aabf03b109c30648c3f7a209302deee7f.tar.gz
fix posix_fadvise syscall args on powerpc, unify with arm fix
commit 6d38c9cf80f47623e5e48190046673bbd0dc410b provided an arm-specific version of posix_fadvise to address the alternate argument order the kernel expects on arm, but neglected to address that powerpc (32-bit) has the same issue. instead of having arch variant files in duplicate, simply put the alternate version in the top-level file under the control of a macro defined in syscall_arch.h.
Diffstat (limited to 'src/fcntl/posix_fadvise.c')
-rw-r--r--src/fcntl/posix_fadvise.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fcntl/posix_fadvise.c b/src/fcntl/posix_fadvise.c
index fc1562e2..c1a0ef5a 100644
--- a/src/fcntl/posix_fadvise.c
+++ b/src/fcntl/posix_fadvise.c
@@ -4,8 +4,16 @@
int posix_fadvise(int fd, off_t base, off_t len, int advice)
{
+#if defined(SYSCALL_FADVISE_6_ARG)
+ /* Some archs, at least arm and powerpc, have the syscall
+ * arguments reordered to avoid needing 7 argument registers
+ * due to 64-bit argument alignment. */
+ return -__syscall(SYS_fadvise, fd, advice,
+ __SYSCALL_LL_E(base), __SYSCALL_LL_E(len));
+#else
return -__syscall(SYS_fadvise, fd, __SYSCALL_LL_O(base),
__SYSCALL_LL_E(len), advice);
+#endif
}
LFS64(posix_fadvise);