summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/common/sync_file_range.c
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2008-11-27 18:21:33 +0000
committerCarmelo Amoroso <carmelo.amoroso@st.com>2008-11-27 18:21:33 +0000
commit28c8634afdc1fa236679b49ab0d5a019379c6db1 (patch)
treefda9d6e124a32799b07247f8d38d0cc8f963cd4e /libc/sysdeps/linux/common/sync_file_range.c
parenteb38b2d34c32ed3089e2bf8935219a57f84ce7b3 (diff)
downloaduClibc-alpine-28c8634afdc1fa236679b49ab0d5a019379c6db1.tar.bz2
uClibc-alpine-28c8634afdc1fa236679b49ab0d5a019379c6db1.tar.xz
Synch with trunk @ 24165
Step 17: libc_hidden_proto removal (almost all). and other minor changes (inline keyword, extra character)
Diffstat (limited to 'libc/sysdeps/linux/common/sync_file_range.c')
-rw-r--r--libc/sysdeps/linux/common/sync_file_range.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/common/sync_file_range.c b/libc/sysdeps/linux/common/sync_file_range.c
new file mode 100644
index 000000000..7e2deff41
--- /dev/null
+++ b/libc/sysdeps/linux/common/sync_file_range.c
@@ -0,0 +1,33 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * sync_file_range() for uClibc
+ *
+ * Copyright (C) 2008 Bernhard Reutner-Fischer <uclibc@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sys/syscall.h>
+#if defined __USE_GNU
+#include <fcntl.h>
+
+#if defined __NR_sync_file_range && defined __UCLIBC_HAS_LFS__
+#define __NR___syscall_sync_file_range __NR_sync_file_range
+static __inline__ _syscall6(int, __syscall_sync_file_range, int, fd,
+ off_t, offset_hi, off_t, offset_lo,
+ off_t, nbytes_hi, off_t, nbytes_lo, unsigned int, flags)
+int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
+{
+ return __syscall_sync_file_range(fd,
+ __LONG_LONG_PAIR((long)(offset >> 32), (long)(offset & 0xffffffff)),
+ __LONG_LONG_PAIR((long)(nbytes >> 32), (long)(nbytes & 0xffffffff)),
+ flags);
+}
+#elif defined __UCLIBC_HAS_STUBS__
+int sync_file_range(int fd, __off64_t offset, __off64_t nbytes, unsigned int flags)
+{
+ __set_errno(ENOSYS);
+ return -1;
+}
+#endif
+#endif