summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-03-26 11:25:33 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-03-26 11:25:33 +0200
commit899a2731262c4321f44a0faecf4134f6b6eacc3d (patch)
treeb05956b31b77c122b2a748d4de762f144d6d1edb /libc/sysdeps/linux
parent3bcd031f97d61a8f732d865a0f4248aed2d191ab (diff)
stubs: unified from future
Future branch extends stubs with ret_enosys_stub. Resolve conflicts, and use superset of future and current master. Adjust posix_fadvise* accordingly. Upon future merge, pick this master version as the final state. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/common/posix_fadvise.c12
-rw-r--r--libc/sysdeps/linux/common/posix_fadvise64.c8
-rw-r--r--libc/sysdeps/linux/common/stubs.c153
-rw-r--r--libc/sysdeps/linux/powerpc/posix_fadvise.c6
-rw-r--r--libc/sysdeps/linux/powerpc/posix_fadvise64.c9
5 files changed, 111 insertions, 77 deletions
diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c
index 17831c201..84b7c40d0 100644
--- a/libc/sysdeps/linux/common/posix_fadvise.c
+++ b/libc/sysdeps/linux/common/posix_fadvise.c
@@ -15,21 +15,17 @@
#define __NR_posix_fadvise __NR_fadvise64
int posix_fadvise(int fd, off_t offset, off_t len, int advice)
{
+ int ret;
INTERNAL_SYSCALL_DECL(err);
- int ret = (int) (INTERNAL_SYSCALL(posix_fadvise, err, 5, fd,
+ ret = (int) (INTERNAL_SYSCALL(posix_fadvise, err, 5, fd,
__LONG_LONG_PAIR (offset >> 31, offset), len, advice));
if (INTERNAL_SYSCALL_ERROR_P (ret, err))
return INTERNAL_SYSCALL_ERRNO (ret, err);
return 0;
}
-#if defined __UCLIBC_HAS_LFS__ && !defined __NR_fadvise64_64
+# if defined __UCLIBC_HAS_LFS__ && !defined __NR_fadvise64_64
strong_alias(posix_fadvise,posix_fadvise64)
-#endif
+# endif
-#elif defined __UCLIBC_HAS_STUBS__
-int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, off_t len attribute_unused, int advice attribute_unused)
-{
- return ENOSYS;
-}
#endif
diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c
index e8a530fdf..fa9ff219f 100644
--- a/libc/sysdeps/linux/common/posix_fadvise64.c
+++ b/libc/sysdeps/linux/common/posix_fadvise64.c
@@ -58,13 +58,5 @@ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
#error your machine is neither 32 bit or 64 bit ... it must be magical
#endif
-#elif !defined __NR_fadvise64 && defined __UCLIBC_HAS_STUBS__
-/* This is declared as a strong alias in posix_fadvise.c if __NR_fadvise64
- * is defined.
- */
-int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
-{
- return ENOSYS;
-}
#endif /* __NR_fadvise64_64 */
#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
index 02cd72495..6afc8d93a 100644
--- a/libc/sysdeps/linux/common/stubs.c
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -6,31 +6,55 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
+/* Please keep the list sorted alphabetically, in ascending order
+ * of the stub name! */
+
#include <errno.h>
#include <bits/wordsize.h>
#include <sys/syscall.h>
#ifdef __UCLIBC_HAS_STUBS__
-static int enosys_stub(void) __attribute_used__;
-static int enosys_stub(void)
+__attribute_used__ static int enosys_stub(void)
{
__set_errno(ENOSYS);
return -1;
}
+__attribute_used__ static int ret_enosys_stub(void)
+{
+ return ENOSYS;
+}
+
#define make_stub(stub) \
link_warning(stub, #stub ": this function is not implemented") \
strong_alias(enosys_stub, stub)
+#define make_ret_stub(stub) \
+ link_warning(stub, #stub ": this function is not implemented") \
+ strong_alias(ret_enosys_stub, stub)
+
#ifndef __ARCH_USE_MMU__
# undef __NR_fork
#endif
+#ifdef __arm__
+# define __NR_fadvise64_64 __NR_arm_fadvise64_64
+# define __NR_fadvise64 __NR_arm_fadvise64_64
+#endif
+
+#ifdef __mips__
+# define __NR_fadvise64_64 __NR_fadvise64
+#endif
+
+#ifdef __xtensa__
+# define __NR_fadvise64 __NR_fadvise64_64
+#endif
+
#ifndef __UCLIBC_HAS_LFS__
-# undef __NR_fadvise64
-# undef __NR_fadvise64_64
+# undef __NR_readahead
# undef __NR_sync_file_range
+# undef __NR_splice
#endif
#if !defined __NR_accept && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
@@ -45,14 +69,6 @@ make_stub(accept4)
make_stub(arch_prctl)
#endif
-#if !defined __NR_capget && defined __UCLIBC_LINUX_SPECIFIC__
-make_stub(capget)
-#endif
-
-#if !defined __NR_capset && defined __UCLIBC_LINUX_SPECIFIC__
-make_stub(capset)
-#endif
-
#if !defined __NR_bdflush && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(bdflush)
#endif
@@ -61,11 +77,11 @@ make_stub(bdflush)
make_stub(bind)
#endif
-#ifndef __NR_capget
+#if !defined __NR_capget && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(capget)
#endif
-#ifndef __NR_capset
+#if !defined __NR_capset && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(capset)
#endif
@@ -81,15 +97,19 @@ make_stub(create_module)
make_stub(delete_module)
#endif
-#ifndef __NR_epoll_create
+#if !defined __NR_epoll_create && defined __UCLIBC_HAS_EPOLL__
make_stub(epoll_create)
#endif
-#ifndef __NR_epoll_ctl
+#if !defined __NR_epoll_ctl && defined __UCLIBC_HAS_EPOLL__
make_stub(epoll_ctl)
#endif
-#ifndef __NR_epoll_wait
+#if !defined __NR_epoll_pwait && defined __UCLIBC_HAS_EPOLL__
+make_stub(epoll_pwait)
+#endif
+
+#if !defined __NR_epoll_wait && defined __UCLIBC_HAS_EPOLL__
make_stub(epoll_wait)
#endif
@@ -97,10 +117,14 @@ make_stub(epoll_wait)
make_stub(eventfd)
#endif
-#ifndef __NR_fdatasync
+#if !defined __NR_fdatasync && !defined __NR_osf_fdatasync
make_stub(fdatasync)
#endif
+#ifndef __NR_fgetxattr
+make_stub(fgetxattr)
+#endif
+
#ifndef __NR_flistxattr
make_stub(flistxattr)
#endif
@@ -109,10 +133,6 @@ make_stub(flistxattr)
make_stub(fork)
#endif
-#ifndef __NR_fgetxattr
-make_stub(fgetxattr)
-#endif
-
#ifndef __NR_fremovexattr
make_stub(fremovexattr)
#endif
@@ -129,10 +149,6 @@ make_stub(fstatfs)
make_stub(get_kernel_syms)
#endif
-#if !defined __NR_getcpu && defined __UCLIBC_LINUX_SPECIFIC__ && ((defined __x86_64__ && !defined __UCLIBC_HAS_TLS__) || !defined __x86_64__)
-make_stub(sched_getcpu)
-#endif
-
#if !defined __NR_getpeername && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
make_stub(getpeername)
#endif
@@ -157,6 +173,10 @@ make_stub(getxattr)
make_stub(init_module)
#endif
+#if !defined __NR_inotify_add_watch && defined __UCLIBC_LINUX_SPECIFIC__
+make_stub(inotify_add_watch)
+#endif
+
#if !defined __NR_inotify_init && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(inotify_init)
#endif
@@ -165,10 +185,6 @@ make_stub(inotify_init)
make_stub(inotify_init1)
#endif
-#if !defined __NR_inotify_add_watch && defined __UCLIBC_LINUX_SPECIFIC__
-make_stub(inotify_add_watch)
-#endif
-
#if !defined __NR_inotify_rm_watch && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(inotify_rm_watch)
#endif
@@ -213,6 +229,13 @@ make_stub(madvise)
make_stub(modify_ldt)
#endif
+#ifndef __NR_openat
+make_stub(openat)
+# ifdef __UCLIBC_HAS_LFS__
+make_stub(openat64)
+# endif
+#endif
+
#if !defined __NR_personality && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(personality)
#endif
@@ -225,6 +248,18 @@ make_stub(pipe2)
make_stub(pivot_root)
#endif
+#if !defined __NR_fadvise64 && defined __UCLIBC_HAS_LFS__
+make_ret_stub(posix_fadvise)
+#endif
+
+#if !defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
+make_ret_stub(posix_fadvise64)
+#endif
+
+#ifndef __NR_madvise
+make_ret_stub(posix_madvise)
+#endif
+
#if !defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(ppoll)
#endif
@@ -233,6 +268,10 @@ make_stub(ppoll)
make_stub(prctl)
#endif
+#if !defined __NR_query_module && defined __UCLIBC_LINUX_MODULE_24__
+make_stub(query_module)
+#endif
+
#if !defined __NR_readahead && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(readahead)
#endif
@@ -241,10 +280,6 @@ make_stub(readahead)
make_stub(reboot)
#endif
-#if !defined __NR_query_module && defined __UCLIBC_LINUX_MODULE_24__
-make_stub(query_module)
-#endif
-
#if !defined __NR_recv && !defined __NR_socketcall && !defined __NR_recvfrom && defined __UCLIBC_HAS_SOCKET__
make_stub(recv)
#endif
@@ -265,10 +300,18 @@ make_stub(remap_file_pages)
make_stub(removexattr)
#endif
+#ifndef __NR_renameat
+make_stub(renameat)
+#endif
+
#if !defined __NR_sched_getaffinity && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(sched_getaffinity)
#endif
+#if !defined __NR_getcpu && defined __UCLIBC_LINUX_SPECIFIC__ && ((defined __x86_64__ && !defined __UCLIBC_HAS_TLS__) || !defined __x86_64__)
+make_stub(sched_getcpu)
+#endif
+
#if !defined __NR_sched_setaffinity && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(sched_setaffinity)
#endif
@@ -325,6 +368,15 @@ make_stub(shutdown)
make_stub(signalfd)
#endif
+#ifndef __NR_rt_sigtimedwait
+make_stub(sigtimedwait)
+make_stub(sigwaitinfo)
+#endif
+
+#ifndef __NR_rt_sigqueueinfo
+make_stub(sigqueue)
+#endif
+
#if !defined __NR_socket && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
make_stub(socket)
#endif
@@ -337,9 +389,9 @@ make_stub(socketcall)
make_stub(socketpair)
#endif
-#ifndef __NR_rt_sigtimedwait
-make_stub(sigtimedwait)
-make_stub(sigwaitinfo)
+#if !defined __NR_stime && !defined __NR_settimeofday
+make_stub(stime)
+make_stub(settimeofday)
#endif
#if !defined __NR_splice && defined __UCLIBC_LINUX_SPECIFIC__
@@ -354,6 +406,10 @@ make_stub(swapoff)
make_stub(swapon)
#endif
+#ifndef __NR_symlink
+make_stub(symlink)
+#endif
+
#if !defined __NR_sync_file_range && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(sync_file_range)
#endif
@@ -382,6 +438,19 @@ make_stub(timerfd_settime)
make_stub(timerfd_gettime)
#endif
+#ifndef __NR_utimensat
+make_stub(futimens)
+make_stub(utimensat)
+# ifndef __NR_lutimes
+make_stub(lutimes)
+# endif
+#endif
+
+#if !defined __NR_utime && !defined __NR_utimes
+/*make_stub(utime) obsoleted */
+make_stub(utimes)
+#endif
+
#if !defined __NR_umount && !defined __NR_umount2 && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(umount)
#endif
@@ -394,19 +463,11 @@ make_stub(umount2)
make_stub(unshare)
#endif
-#ifndef __NR_utimensat
-make_stub(futimens)
-make_stub(utimensat)
-# ifndef __NR_lutimes
-make_stub(lutimes)
-# endif
-#endif
-
#if !defined __NR_vhangup && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(vhangup)
#endif
-#ifndef __NR_vmsplice
+#if !defined __NR_vmsplice && defined __UCLIBC_LINUX_SPECIFIC__
make_stub(vmsplice)
#endif
diff --git a/libc/sysdeps/linux/powerpc/posix_fadvise.c b/libc/sysdeps/linux/powerpc/posix_fadvise.c
index ce3574f4e..7ceb8ce8f 100644
--- a/libc/sysdeps/linux/powerpc/posix_fadvise.c
+++ b/libc/sysdeps/linux/powerpc/posix_fadvise.c
@@ -27,10 +27,4 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice)
strong_alias(posix_fadvise,posix_fadvise64)
#endif
-#else
-int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, off_t len attribute_unused, int advice attribute_unused)
-{
-#warning This is not correct as far as SUSv3 is concerned.
- return ENOSYS;
-}
#endif
diff --git a/libc/sysdeps/linux/powerpc/posix_fadvise64.c b/libc/sysdeps/linux/powerpc/posix_fadvise64.c
index 2c7d207c6..d92071158 100644
--- a/libc/sysdeps/linux/powerpc/posix_fadvise64.c
+++ b/libc/sysdeps/linux/powerpc/posix_fadvise64.c
@@ -56,14 +56,5 @@ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise)
#error your machine is neither 32 bit or 64 bit ... it must be magical
#endif
-#elif !defined __NR_fadvise64
-/* This is declared as a strong alias in posix_fadvise.c if __NR_fadvise64
- * is defined.
- */
-int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise)
-{
-#warning This is not correct as far as SUSv3 is concerned.
- return ENOSYS;
-}
#endif /* __NR_fadvise64_64 */
#endif /* __UCLIBC_HAS_LFS__ */