summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libc-symbols.h6
-rw-r--r--libc/sysdeps/linux/common/fstat.c12
-rw-r--r--libc/sysdeps/linux/common/getdents.c15
-rw-r--r--libc/sysdeps/linux/common/getdents64.c6
-rw-r--r--libc/sysdeps/linux/common/lstat.c12
-rw-r--r--libc/sysdeps/linux/common/posix_fadvise.c7
-rw-r--r--libc/sysdeps/linux/common/sendfile.c6
-rw-r--r--libc/sysdeps/linux/common/stat.c12
8 files changed, 19 insertions, 57 deletions
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 85a2db7df..6b9731e80 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -177,6 +177,12 @@
# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
# define _strong_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+/* Same, but does not check for type match. Use sparingly.
+ Example: strong_alias(stat,stat64) may fail, this one works: */
+# define strong_alias_untyped(name, aliasname) \
+ _strong_alias_untyped(name, aliasname)
+# define _strong_alias_untyped(name, aliasname) \
+ extern __typeof (aliasname) aliasname __attribute__ ((alias (#name)));
/* This comes between the return type and function name in
a function definition to make that definition weak. */
diff --git a/libc/sysdeps/linux/common/fstat.c b/libc/sysdeps/linux/common/fstat.c
index 6d5cf8b9f..acc639bce 100644
--- a/libc/sysdeps/linux/common/fstat.c
+++ b/libc/sysdeps/linux/common/fstat.c
@@ -7,19 +7,11 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-/* need to hide the 64bit prototype or the strong_alias()
- * will fail when __NR_fstat64 doesnt exist */
-#define fstat64 __hidefstat64
-
#include <sys/syscall.h>
#include <unistd.h>
#include <sys/stat.h>
#include "xstatconv.h"
-#undef fstat64
-
-/* libc_hidden_proto(fstat) */
-
#define __NR___syscall_fstat __NR_fstat
static __inline__ _syscall2(int, __syscall_fstat, int, fd, struct kernel_stat *, buf)
@@ -37,8 +29,6 @@ int fstat(int fd, struct stat *buf)
libc_hidden_def(fstat)
#if ! defined __NR_fstat64 && defined __UCLIBC_HAS_LFS__
-extern __typeof(fstat) fstat64;
-/* libc_hidden_proto(fstat64) */
-strong_alias(fstat,fstat64)
+strong_alias_untyped(fstat,fstat64)
libc_hidden_def(fstat64)
#endif
diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c
index e1aa2a51f..6a38772e8 100644
--- a/libc/sysdeps/linux/common/getdents.c
+++ b/libc/sysdeps/linux/common/getdents.c
@@ -18,6 +18,11 @@
#include <bits/kernel_types.h>
#include <bits/kernel-features.h>
+#if !(defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 && __WORDSIZE == 64)
+/* If the condition above is met, __getdents is defined as an alias
+ * for __getdents64 (see getdents64.c). Otherwise...
+ */
+
/* With newer versions of linux, the getdents syscall returns d_type
* information after the name field.
*
@@ -42,7 +47,8 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes) attribute_hidden;
#define __NR___syscall_getdents __NR_getdents
static __always_inline _syscall3(int, __syscall_getdents, int, fd, unsigned char *, kdirp, size_t, count)
-#ifdef __ASSUME_GETDENTS32_D_TYPE
+#if defined __ASSUME_GETDENTS32_D_TYPE
+
ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
ssize_t retval;
@@ -72,9 +78,6 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
#elif ! defined __UCLIBC_HAS_LFS__ || ! defined __NR_getdents64
-/* Experimentally off - libc_hidden_proto(memcpy) */
-/* libc_hidden_proto(lseek) */
-
ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
struct dirent *dp;
@@ -136,8 +139,6 @@ attribute_hidden strong_alias(__getdents,__getdents64)
#elif __WORDSIZE == 32
-/* Experimentally off - libc_hidden_proto(memmove) */
-
extern __typeof(__getdents) __getdents64 attribute_hidden;
ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
@@ -165,3 +166,5 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
}
#endif
+
+#endif
diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c
index 1864ff4fc..37cb4c6f8 100644
--- a/libc/sysdeps/linux/common/getdents64.c
+++ b/libc/sysdeps/linux/common/getdents64.c
@@ -20,9 +20,6 @@
#if defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64
-/* Experimentally off - libc_hidden_proto(memcpy) */
-/* libc_hidden_proto(lseek64) */
-
# ifndef offsetof
# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
# endif
@@ -36,7 +33,6 @@ struct kernel_dirent64
char d_name[256];
};
-
# define __NR___syscall_getdents64 __NR_getdents64
static __inline__ _syscall3(int, __syscall_getdents64, int, fd, unsigned char *, dirp, size_t, count)
@@ -102,4 +98,4 @@ ssize_t __getdents64 (int fd, char *buf, size_t nbytes)
attribute_hidden strong_alias(__getdents64,__getdents)
#endif
-#endif /* __UCLIBC_HAS_LFS__ */
+#endif
diff --git a/libc/sysdeps/linux/common/lstat.c b/libc/sysdeps/linux/common/lstat.c
index 1adbdcf87..aa774473c 100644
--- a/libc/sysdeps/linux/common/lstat.c
+++ b/libc/sysdeps/linux/common/lstat.c
@@ -7,19 +7,11 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-/* need to hide the 64bit prototype or the strong_alias()
- * will fail when __NR_lstat64 doesnt exist */
-#define lstat64 __hidelstat64
-
#include <sys/syscall.h>
#include <unistd.h>
#include <sys/stat.h>
#include "xstatconv.h"
-#undef lstat64
-
-/* libc_hidden_proto(lstat) */
-
#define __NR___syscall_lstat __NR_lstat
static __inline__ _syscall2(int, __syscall_lstat,
const char *, file_name, struct kernel_stat *, buf)
@@ -38,8 +30,6 @@ int lstat(const char *file_name, struct stat *buf)
libc_hidden_def(lstat)
#if ! defined __NR_lstat64 && defined __UCLIBC_HAS_LFS__
-extern __typeof(lstat) lstat64;
-/* libc_hidden_proto(lstat64) */
-strong_alias(lstat,lstat64)
+strong_alias_untyped(lstat,lstat64)
libc_hidden_def(lstat64)
#endif
diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c
index a3f9c7653..c00b79e6c 100644
--- a/libc/sysdeps/linux/common/posix_fadvise.c
+++ b/libc/sysdeps/linux/common/posix_fadvise.c
@@ -8,15 +8,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-/* need to hide the 64bit prototype or the strong_alias()
- * will fail when __NR_fadvise64_64 doesnt exist */
-#define posix_fadvise64 __hideposix_fadvise64
-
#include <sys/syscall.h>
#include <fcntl.h>
-#undef posix_fadvise64
-
#ifdef __NR_fadvise64
#define __NR_posix_fadvise __NR_fadvise64
/* get rid of following conditional when
@@ -49,7 +43,6 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice)
#endif
#if defined __UCLIBC_HAS_LFS__ && (!defined __NR_fadvise64_64 || !defined _syscall6)
-extern __typeof(posix_fadvise) posix_fadvise64;
strong_alias(posix_fadvise,posix_fadvise64)
#endif
diff --git a/libc/sysdeps/linux/common/sendfile.c b/libc/sysdeps/linux/common/sendfile.c
index 0d2ebaaf6..89bab9f35 100644
--- a/libc/sysdeps/linux/common/sendfile.c
+++ b/libc/sysdeps/linux/common/sendfile.c
@@ -7,16 +7,10 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-/* need to hide the 64bit prototype or the strong_alias()
- * will fail when __NR_sendfile64 doesnt exist */
-#define sendfile64 __hidesendfile64
-
#include <sys/syscall.h>
#include <unistd.h>
#include <sys/sendfile.h>
-#undef sendfile64
-
#ifdef __NR_sendfile
_syscall4(ssize_t, sendfile, int, out_fd, int, in_fd, __off_t *, offset,
diff --git a/libc/sysdeps/linux/common/stat.c b/libc/sysdeps/linux/common/stat.c
index d563bcd88..a6ab291f2 100644
--- a/libc/sysdeps/linux/common/stat.c
+++ b/libc/sysdeps/linux/common/stat.c
@@ -7,19 +7,11 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-/* need to hide the 64bit prototype or the strong_alias()
- * will fail when __NR_stat64 doesnt exist */
-#define stat64 __hidestat64
-
#include <sys/syscall.h>
#include <unistd.h>
#include <sys/stat.h>
#include "xstatconv.h"
-#undef stat64
-
-/* libc_hidden_proto(stat) */
-
#define __NR___syscall_stat __NR_stat
#undef stat
static __inline__ _syscall2(int, __syscall_stat,
@@ -39,8 +31,6 @@ int stat(const char *file_name, struct stat *buf)
libc_hidden_def(stat)
#if ! defined __NR_stat64 && defined __UCLIBC_HAS_LFS__
-extern __typeof(stat) stat64;
-/* libc_hidden_proto(stat64) */
-strong_alias(stat,stat64)
+strong_alias_untyped(stat,stat64)
libc_hidden_def(stat64)
#endif