From d68fdbb8a3bd3c75b68eda51aed5dff88620d391 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 30 May 2002 07:53:59 +0000 Subject: Fixup some silly bugs I added earlier -Erik --- libc/sysdeps/linux/common/syscalls.c | 77 +++++++++++++++++------------------- 1 file changed, 37 insertions(+), 40 deletions(-) (limited to 'libc/sysdeps/linux/common') diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c index b3498f406..0f0da975d 100644 --- a/libc/sysdeps/linux/common/syscalls.c +++ b/libc/sysdeps/linux/common/syscalls.c @@ -198,6 +198,10 @@ _syscall3(int, lchown, const char *, path, uid_t, owner, gid_t, group); #define __NR___libc_lseek __NR_lseek _syscall3(__off_t, __libc_lseek, int, fildes, __off_t, offset, int, whence); weak_alias(__libc_lseek, lseek) +#ifndef __NR__llseek +weak_alias(__libc_lseek, llseek) +weak_alias(__libc_lseek, lseek64) +#endif #endif //#define __NR_getpid 20 @@ -309,15 +313,16 @@ unsigned int alarm (unsigned int seconds) #ifdef __NR_pause #define __NR___libc_pause __NR_pause _syscall0(int, __libc_pause); +weak_alias(__libc_pause, pause) #else #include int __libc_pause (void) { return(__sigpause(sigblock(0), 0)); } -#endif weak_alias(__libc_pause, pause) #endif +#endif //#define __NR_utime 30 #ifdef L_utime @@ -350,6 +355,8 @@ int utime(const char *file, const struct utimbuf *times) #ifdef __NR_utimes _syscall2(int, utimes, const char *, file, const struct timeval *, tvp); #else +#include +#include int utimes (const char *file, const struct timeval tvp[2]) { struct utimbuf buf, *times; @@ -782,6 +789,16 @@ _syscall2(int, setgroups, size_t, size, const gid_t *, list); #endif //#define __NR_select 82 +#ifdef L_select +//Used as a fallback if _newselect isn't available... +#ifndef _NR__newselect +#include +extern int select(int n, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout); +_syscall5(int, select, int, n, fd_set *, readfds, fd_set *, writefds, + fd_set *, exceptfds, struct timeval *, timeout); +#endif +#endif //#define __NR_symlink 83 #ifdef L_symlink @@ -976,6 +993,10 @@ int stat(const char *file_name, struct libc_stat *buf) { return(__xstat(0, file_name, buf)); } +#if ! defined __NR_stat64 && defined __UCLIBC_HAVE_LFS__ +weak_alias(stat, stat64); +weak_alias(__xstat, __xstat64); +#endif #endif //#define __NR_lstat 107 @@ -1001,6 +1022,10 @@ int lstat(const char *file_name, struct libc_stat *buf) { return(__lxstat(0, file_name, buf)); } +#if ! defined __NR_lstat64 && defined __UCLIBC_HAVE_LFS__ +weak_alias(lstat, lstat64); +weak_alias(__lxstat, __lxstat64); +#endif #endif //#define __NR_fstat 108 @@ -1026,6 +1051,10 @@ int fstat(int filedes, struct libc_stat *buf) { return(__fxstat(0, filedes, buf)); } +#if ! defined __NR_fstat64 && defined __UCLIBC_HAVE_LFS__ +weak_alias(fstat, fstat64); +weak_alias(__fxstat, __fxstat64); +#endif #endif //#define __NR_olduname 109 @@ -1212,7 +1241,7 @@ _syscall1(int, setfsgid, gid_t, gid); //#define __NR__llseek 140 #ifdef L__llseek #ifdef __UCLIBC_HAVE_LFS__ -#ifdef _NR_llseek +#ifdef __NR__llseek extern int _llseek(int fd, __off_t offset_hi, __off_t offset_lo, __loff_t *result, int whence); @@ -1231,10 +1260,6 @@ __loff_t __libc_lseek64(int fd, __loff_t offset, int whence) } weak_alias(__libc_lseek64, llseek); weak_alias(__libc_lseek64, lseek64); -#else -extern __off_t __libc_lseek(int fildes, __off_t offset, int whence); -weak_alias(__libc_lseek, llseek); -weak_alias(__libc_lseek, lseek64); #endif #endif #endif @@ -1247,19 +1272,15 @@ _syscall3(int, getdents, int, fd, char *, dirp, size_t, count); #endif //#define __NR__newselect 142 -#if defined L__newselect || defined L_select -#include +#ifdef L__newselect +//Used in preference to select when available... #ifdef _NR__newselect +#include extern int _newselect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); _syscall5(int, _newselect, int, n, fd_set *, readfds, fd_set *, writefds, fd_set *, exceptfds, struct timeval *, timeout); weak_alias(_newselect, select); -#else -extern int select(int n, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout); -_syscall5(int, select, int, n, fd_set *, readfds, fd_set *, writefds, - fd_set *, exceptfds, struct timeval *, timeout); #endif #endif @@ -1632,9 +1653,8 @@ int getrlimit (__rlimit_resource_t resource, struct rlimit *rlimits) //#define __NR_stat64 195 #ifdef L___stat64 -#ifdef __UCLIBC_HAVE_LFS__ +#if defined __NR_stat64 && defined __UCLIBC_HAVE_LFS__ #include -#ifdef __NR_stat64 #include "statfix64.h" #define __NR___stat64 __NR_stat64 extern int __stat64(const char *file_name, struct kernel_stat64 *buf); @@ -1655,21 +1675,13 @@ int stat64(const char *file_name, struct libc_stat64 *buf) { return(__xstat64(0, file_name, buf)); } -#else -struct stat; -extern int stat(const char *file_name, struct stat *buf); -extern int __xstat(int version, const char * file_name, struct stat *cstat); -weak_alias(stat, stat64); -weak_alias(__xstat, __xstat64); -#endif #endif /* __UCLIBC_HAVE_LFS__ */ #endif //#define __NR_lstat64 196 #ifdef L___lstat64 -#ifdef __UCLIBC_HAVE_LFS__ +#if defined __NR_lstat64 && defined __UCLIBC_HAVE_LFS__ #include -#ifdef __NR_lstat64 #include "statfix64.h" #define __NR___lstat64 __NR_lstat64 extern int __lstat64(const char *file_name, struct kernel_stat64 *buf); @@ -1690,21 +1702,13 @@ int lstat64(const char *file_name, struct libc_stat64 *buf) { return(__lxstat64(0, file_name, buf)); } -#else -struct stat; -extern int lstat(const char *file_name, struct stat *buf); -extern int __lxstat(int version, const char * file_name, struct stat * cstat); -weak_alias(lstat, lstat64); -weak_alias(__lxstat, __lxstat64); -#endif #endif /* __UCLIBC_HAVE_LFS__ */ #endif //#define __NR_fstat64 197 #ifdef L___fstat64 -#ifdef __UCLIBC_HAVE_LFS__ +#if defined __NR_fstat64 && defined __UCLIBC_HAVE_LFS__ #include -#ifdef __NR_fstat64 #include "statfix64.h" #define __NR___fstat64 __NR_fstat64 extern int __fstat64(int filedes, struct kernel_stat64 *buf); @@ -1725,13 +1729,6 @@ int fstat64(int filedes, struct libc_stat64 *buf) { return(__fxstat64(0, filedes, buf)); } -#else -struct stat; -extern int fstat(int filedes, struct stat *buf); -extern int __fxstat(int version, int fd, struct stat * cstat); -weak_alias(fstat, fstat64); -weak_alias(__fxstat, __fxstat64); -#endif #endif /* __UCLIBC_HAVE_LFS__ */ #endif -- cgit v1.2.3