]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/xtensa/posix_fadvise64.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / xtensa / posix_fadvise64.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * posix_fadvise64() for Xtensa uClibc
4  *
5  * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
6  * Copyright (C) 2007 Tensilica Inc.
7  *
8  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
9  */
10
11 #include <features.h>
12 #include <unistd.h>
13 #include <errno.h>
14 #include <endian.h>
15 #include <stdint.h>
16 #include <sys/types.h>
17 #include <sys/syscall.h>
18 #include <fcntl.h>
19
20 #ifdef __UCLIBC_HAS_LFS__
21
22 int posix_fadvise64 (int fd, __off64_t offset, __off64_t len, int advice)
23 {
24 #ifdef __NR_fadvise64_64
25         INTERNAL_SYSCALL_DECL (err);
26         int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, advice,
27                                                                 __LONG_LONG_PAIR ((long) (offset >> 32),
28                                                                                                   (long) offset),
29                                                                 __LONG_LONG_PAIR ((long) (len >> 32),
30                                                                                                   (long) len));
31         if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
32                 return 0;
33         return INTERNAL_SYSCALL_ERRNO (ret, err);
34 #else
35         return ENOSYS;
36 #endif
37 }
38
39 #endif /* __UCLIBC_HAS_LFS__ */