1 /* vi: set sw=4 ts=4: */
3 * posix_fadvise64() for uClibc
4 * http://www.opengroup.org/onlinepubs/009695399/functions/posix_fadvise.html
6 * Copyright (C) 2000-2005 by Erik Andersen <andersen@codepoet.org>
8 * GNU Library General Public License (LGPL) version 2 or later.
16 #include <sys/types.h>
17 #include <sys/syscall.h>
20 #ifdef __UCLIBC_HAS_LFS__
21 #ifdef __NR_fadvise64_64
23 /* 64 bit implementation is cake ... or more like pie ... */
26 #define __NR_posix_fadvise64 __NR_fadvise64_64
27 _syscall4(int, posix_fadvise64, int, fd, __off64_t, offset,
28 __off64_t, len, int, advice);
30 /* 32 bit implementation is kind of a pita */
31 #elif __WORDSIZE == 32
33 #ifdef _syscall6 /* workaround until everyone has _syscall6() */
34 #define __NR___syscall_fadvise64_64 __NR_fadvise64_64
35 static inline _syscall6(int, __syscall_fadvise64_64, int, fd,
36 unsigned long, high_offset, unsigned long, low_offset,
37 unsigned long, high_len, unsigned long, low_len,
39 int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
41 return (__syscall_fadvise64_64(fd,
42 __LONG_LONG_PAIR(offset >> 32, offset & 0xffffffff),
43 __LONG_LONG_PAIR(len >> 32, len & 0xffffffff),
47 #warning _syscall6 has not been defined for your machine :(
48 #endif /* _syscall6 */
51 #error your machine is neither 32 bit or 64 bit ... it must be magical
54 #elif !defined __NR_fadvise64
55 /* This is declared as a strong alias in posix_fadvise.c if __NR_fadvise64
58 int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
63 #endif /* __NR_fadvise64_64 */
64 #endif /* __UCLIBC_HAS_LFS__ */