]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/xtensa/posix_fadvise.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / xtensa / posix_fadvise.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * posix_fadvise() 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 <sys/syscall.h>
12 #include <fcntl.h>
13
14 int posix_fadvise (int fd, off_t offset, off_t len, int advice)
15 {
16 #ifdef __NR_fadvise64_64
17         INTERNAL_SYSCALL_DECL (err);
18         int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, advice,
19                                                                 __LONG_LONG_PAIR ((long) (offset >> 31),
20                                                                                                   (long) offset),
21                                                                 __LONG_LONG_PAIR ((long) (len >> 31),
22                                                                                                   (long) len));
23         if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
24                 return 0;
25         return INTERNAL_SYSCALL_ERRNO (ret, err);
26 #else
27         return ENOSYS;
28 #endif
29 }