]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/common/sync_file_range.c
Inital import
[l4.git] / l4 / pkg / 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, see the file COPYING.LIB in this tarball.
8  */
9
10 #include <sys/syscall.h>
11 #if defined __USE_GNU
12 #include <fcntl.h>
13
14 #if defined __NR_sync_file_range && defined __UCLIBC_HAS_LFS__
15 #define __NR___syscall_sync_file_range __NR_sync_file_range
16 static __inline__ _syscall6(int, __syscall_sync_file_range, int, fd,
17                 off_t, offset_hi, off_t, offset_lo,
18                 off_t, nbytes_hi, off_t, nbytes_lo, unsigned int, flags)
19 int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
20 {
21         return __syscall_sync_file_range(fd,
22                 __LONG_LONG_PAIR((long)(offset >> 32), (long)(offset & 0xffffffff)),
23                 __LONG_LONG_PAIR((long)(nbytes >> 32), (long)(nbytes & 0xffffffff)),
24                 flags);
25 }
26 #elif defined __UCLIBC_HAS_STUBS__
27 int sync_file_range(int fd, __off64_t offset, __off64_t nbytes, unsigned int flags)
28 {
29         __set_errno(ENOSYS);
30         return -1;
31 }
32 #endif
33 #endif