]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/common/sync_file_range.c
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / common / sync_file_range.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * sync_file_range() for uClibc
4  *
5  * Copyright (C) 2008 Bernhard Reutner-Fischer <uclibc@uclibc.org>
6  *
7  * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
8  */
9
10 #include <sys/syscall.h>
11 #if defined __UCLIBC_HAS_LFS__ && defined __USE_GNU
12 # include <bits/wordsize.h>
13 # include <endian.h>
14 # include <fcntl.h>
15 # include <cancel.h>
16
17 # ifdef __NR_sync_file_range2
18 #  undef __NR_sync_file_range
19 #  define __NR_sync_file_range __NR_sync_file_range2
20 # endif
21
22 # ifdef __NR_sync_file_range
23 static int __NC(sync_file_range)(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
24 {
25 #  if defined __powerpc__ && __WORDSIZE == 64
26         return INLINE_SYSCALL(sync_file_range, 4, fd, offset, nbytes, flags);
27 #  elif defined __mips__ && _MIPS_SIM == _ABIO32
28         return INLINE_SYSCALL(sync_file_range, 7, fd, 0,
29                         OFF64_HI_LO(offset), OFF64_HI_LO(nbytes), flags);
30 #  else
31         return INLINE_SYSCALL(sync_file_range, 6, fd,
32                         OFF64_HI_LO(offset), OFF64_HI_LO(nbytes), flags);
33 #  endif
34 }
35 CANCELLABLE_SYSCALL(int, sync_file_range, (int fd, off64_t offset, off64_t nbytes, unsigned int flags), (fd, offset, nbytes, flags))
36 # endif
37 #endif