diff options
| author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-01-14 19:22:44 +0000 | 
|---|---|---|
| committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-01-14 19:22:44 +0000 | 
| commit | 9138bf01b3b21ce23cfdf15fce3f30bb9a1fbc61 (patch) | |
| tree | fb0ac2208e1a080dfae3f2ca5f1f90f568bf4165 /libc/sysdeps/linux/common | |
| parent | 6e3c1938ff129fb5385a963ec600111aa6228bdc (diff) | |
| download | uClibc-alpine-9138bf01b3b21ce23cfdf15fce3f30bb9a1fbc61.tar.bz2 uClibc-alpine-9138bf01b3b21ce23cfdf15fce3f30bb9a1fbc61.tar.xz  | |
Merge from trunk.
Diffstat (limited to 'libc/sysdeps/linux/common')
44 files changed, 209 insertions, 189 deletions
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index ee11899e7..d4efbaaad 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -14,6 +14,10 @@ ifeq ($(EXCLUDE_BRK),y)  CSRC:=$(filter-out sbrk.c,$(CSRC))  endif +ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) +CSRC:=$(filter-out fork.c,$(CSRC)) +endif +  COMMON_SSP:=ssp.c ssp-local.c  # full list diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c index 701877c06..ca9aff5e7 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl.c @@ -11,15 +11,18 @@  #include <stdarg.h>  #include <fcntl.h> +#undef __fcntl +  #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 -extern int __libc_fcntl64(int fd, int cmd, ...); +extern int __fcntl64(int fd, int cmd, ...) attribute_hidden;  #endif +#undef fcntl  #define __NR___syscall_fcntl __NR_fcntl  static inline  _syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg); -int __libc_fcntl(int fd, int cmd, ...) +int attribute_hidden __fcntl(int fd, int cmd, ...)  {  	long arg;  	va_list list; @@ -30,7 +33,7 @@ int __libc_fcntl(int fd, int cmd, ...)  	if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) {  #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 -		return __libc_fcntl64(fd, cmd, arg); +		return __fcntl64(fd, cmd, arg);  #else  		__set_errno(ENOSYS);  		return -1; @@ -38,8 +41,10 @@ int __libc_fcntl(int fd, int cmd, ...)  	}  	return (__syscall_fcntl(fd, cmd, arg));  } - -weak_alias(__libc_fcntl, fcntl) +strong_alias(__fcntl,fcntl) +weak_alias(__fcntl,__libc_fcntl)  #if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__ -weak_alias(__libc_fcntl, fcntl64) +hidden_strong_alias(__fcntl,__fcntl64) +weak_alias(__fcntl,fcntl64) +weak_alias(__fcntl,__libc_fcntl64)  #endif diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c index 7f9164b52..9231808e3 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl64.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c @@ -12,9 +12,10 @@  #include <fcntl.h>  #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 +#undef fcntl64  #define __NR___syscall_fcntl64 __NR_fcntl64  static inline _syscall3(int, __syscall_fcntl64, int, fd, int, cmd, long, arg); -int __libc_fcntl64(int fd, int cmd, ...) +int attribute_hidden __fcntl64(int fd, int cmd, ...)  {  	long arg;  	va_list list; @@ -25,6 +26,6 @@ int __libc_fcntl64(int fd, int cmd, ...)  	va_end(list);  	return (__syscall_fcntl64(fd, cmd, arg));  } - -weak_alias(__libc_fcntl64, fcntl64) +strong_alias(__fcntl64,fcntl64) +weak_alias(__fcntl64,__libc_fcntl64)  #endif diff --git a/libc/sysdeps/linux/common/_exit.c b/libc/sysdeps/linux/common/_exit.c index d0a4ee1d6..4e450bbc5 100644 --- a/libc/sysdeps/linux/common/_exit.c +++ b/libc/sysdeps/linux/common/_exit.c @@ -32,10 +32,12 @@  static inline _syscall1(void, __syscall_exit, int, status);  #endif -void attribute_noreturn _exit(int status) +#undef _exit +#undef _exit_internal +void attribute_noreturn attribute_hidden _exit_internal(int status)  {  	/* The loop is added only to keep gcc happy. */  	while(1)  		INLINE_SYSCALL(exit, 1, status);  } - +strong_alias(_exit_internal,_exit) diff --git a/libc/sysdeps/linux/common/bits/nan.h b/libc/sysdeps/linux/common/bits/nan.h index 6d88b551b..bae97f216 100644 --- a/libc/sysdeps/linux/common/bits/nan.h +++ b/libc/sysdeps/linux/common/bits/nan.h @@ -1,5 +1,5 @@  /* `NAN' constant for IEEE 754 machines. -   Copyright (C) 1992, 1996, 1997, 1999 Free Software Foundation, Inc. +   Copyright (C) 1992,1996,1997,1999,2004,2006 Free Software Foundation, Inc.     This file is part of the GNU C Library.     The GNU C Library is free software; you can redistribute it and/or @@ -24,11 +24,15 @@  /* IEEE Not A Number.  */ -#ifdef	__GNUC__ +#if __GNUC_PREREQ(3,3) + +# define NAN	(__builtin_nanf ("")) + +#elif defined __GNUC__  # define NAN \ -  (__extension__                                                            \ -   ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; })  \ +  (__extension__							      \ +   ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; })  \      { __l: 0x7fc00000UL }).__d)  #else @@ -42,7 +46,8 @@  #  define __nan_bytes		{ 0, 0, 0xc0, 0x7f }  # endif -static union { unsigned char __c[4]; float __d; } __nan_union = { __nan_bytes }; +static union { unsigned char __c[4]; float __d; } __nan_union +    __attribute_used__ = { __nan_bytes };  # define NAN	(__nan_union.__d)  #endif	/* GCC.  */ diff --git a/libc/sysdeps/linux/common/bits/statfs.h b/libc/sysdeps/linux/common/bits/statfs.h index 78c9bdbbc..e115c4d75 100644 --- a/libc/sysdeps/linux/common/bits/statfs.h +++ b/libc/sysdeps/linux/common/bits/statfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.     This file is part of the GNU C Library.     The GNU C Library is free software; you can redistribute it and/or @@ -20,12 +20,12 @@  # error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."  #endif -#include <bits/types.h>  /* for __fsid_t and __fsblkcnt_t*/ +#include <bits/types.h>  struct statfs    { -    int f_type; -    int f_bsize; +    __SWORD_TYPE f_type; +    __SWORD_TYPE f_bsize;  #ifndef __USE_FILE_OFFSET64      __fsblkcnt_t f_blocks;      __fsblkcnt_t f_bfree; @@ -40,25 +40,25 @@ struct statfs      __fsfilcnt64_t f_ffree;  #endif      __fsid_t f_fsid; -    int f_namelen; -    int f_spare[6]; +    __SWORD_TYPE f_namelen; +    __SWORD_TYPE f_spare[5];    };  #ifdef __USE_LARGEFILE64  struct statfs64    { -    int f_type; -    int f_bsize; +    __SWORD_TYPE f_type; +    __SWORD_TYPE f_bsize;      __fsblkcnt64_t f_blocks;      __fsblkcnt64_t f_bfree;      __fsblkcnt64_t f_bavail;      __fsfilcnt64_t f_files;      __fsfilcnt64_t f_ffree;      __fsid_t f_fsid; -    int f_namelen; -    int f_spare[6]; +    __SWORD_TYPE f_namelen; +    __SWORD_TYPE f_spare[5];    };  #endif -/* Tell code we have this member.  */ +/* Tell code we have these members.  */  #define _STATFS_F_NAMELEN diff --git a/libc/sysdeps/linux/common/bits/uClibc_ctype.h b/libc/sysdeps/linux/common/bits/uClibc_ctype.h index 7c2d412cf..dd723c77c 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_ctype.h +++ b/libc/sysdeps/linux/common/bits/uClibc_ctype.h @@ -134,17 +134,6 @@ enum {  #define __C_tolower(c) (__C_isupper(c) ? ((c) | 0x20) : (c))  #define __C_toupper(c) (__C_islower(c) ? ((c) ^ 0x20) : (c)) -#define __C_isxlower(c) \ -	(__C_isdigit(c) \ -	 || ((sizeof(c) == sizeof(char)) \ -		 ? (((unsigned char)(((c)) - 'a')) < 6) \ -		 : (((unsigned int)(((c)) - 'a')) < 6))) -#define __C_isxupper(c) \ -	(__C_isdigit(c) \ -	 || ((sizeof(c) == sizeof(char)) \ -		 ? (((unsigned char)(((c)) - 'A')) < 6) \ -		 : (((unsigned int)(((c)) - 'A')) < 6))) -  /**********************************************************************/  __BEGIN_DECLS @@ -171,14 +160,7 @@ extern int isascii(int c) __THROW;  extern int toascii(int c) __THROW;  #endif -/* The following are included for compatibility with older versions of - * uClibc; but now they're only visible if MISC funcctionality is requested. - * However, as they are locale-independent, the hidden macro versions are - * always present. */ -#ifdef __USE_MISC -extern int isxlower(int c) __THROW;	/* uClibc-specific. */ -extern int isxupper(int c) __THROW;	/* uClibc-specific. */ - +#if defined _LIBC && (defined NOT_IN_libc || defined IS_IN_libc)  /* isdigit() is really locale-invariant, so provide some small fast macros.   * These are uClibc-specific. */  #define __isdigit_char(C)    (((unsigned char)((C) - '0')) <= 9) @@ -202,20 +184,6 @@ extern int isxupper(int c) __THROW;	/* uClibc-specific. */  #define _toupper(c) ((c) ^ 0x20)  #define _tolower(c) ((c) | 0x20) - -/* For compatibility with older versions of uClibc.  Are these ever used? */ -#if 0 -#define __isxlower(c)	__C_isxlower(c)	/* uClibc-specific. */ -#define __isxupper(c)	__C_isxupper(c)	/* uClibc-specific. */ -#endif - -/* Apparently, glibc implements things as macros if __NO_CTYPE isn't defined. - * If we don't have locale support, we'll do the same.  Otherwise, we'll - * only use macros for the supported-locale-invariant cases. */ -#ifndef __UCLIBC_HAS_LOCALE__ - -#endif /*  __UCLIBC_HAS_LOCALE__ */ -  __END_DECLS  /**********************************************************************/ @@ -264,9 +232,6 @@ __END_DECLS  #define __ispunct(c)		__body(ispunct,c)  #define __isgraph(c)		__body(isgraph,c) -#define __isxlower(c)		__body(isxlower,c) -#define __isxupper(c)		__body(isxupper,c) -  #define __tolower(c)		__body(tolower,c)  #define __toupper(c)		__body(toupper,c) @@ -285,9 +250,6 @@ __END_DECLS  #define ispunct(c)			__ispunct(c)  #define isgraph(c)			__isgraph(c) -#define isxlower(c)			__isxlower(c) -#define isxupper(c)			__isxupper(c) -  #define tolower(c)			__tolower(c)  #define toupper(c)			__toupper(c) diff --git a/libc/sysdeps/linux/common/bits/uClibc_fpmax.h b/libc/sysdeps/linux/common/bits/uClibc_fpmax.h index 690f7b23b..27432a03e 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_fpmax.h +++ b/libc/sysdeps/linux/common/bits/uClibc_fpmax.h @@ -98,21 +98,23 @@ typedef float __fpmax_t;  #endif /* DECIMAL_DIG */ -extern __fpmax_t __strtofpmax(const char *str, char **endptr, int exp_adjust); +#if defined _LIBC && defined IS_IN_libc +extern __fpmax_t __strtofpmax(const char *str, char **endptr, int exp_adjust) attribute_hidden;  #ifdef __UCLIBC_HAS_XLOCALE__  extern __fpmax_t __strtofpmax_l(const char *str, char **endptr, int exp_adjust, -								__locale_t locale_arg); +								__locale_t locale_arg) attribute_hidden;  #endif  #ifdef __UCLIBC_HAS_WCHAR__  extern __fpmax_t __wcstofpmax(const wchar_t *wcs, wchar_t **endptr, -							  int exp_adjust); +							  int exp_adjust) attribute_hidden;  #ifdef __UCLIBC_HAS_XLOCALE__  extern __fpmax_t __wcstofpmax_l(const wchar_t *wcs, wchar_t **endptr, -								int exp_adjust, __locale_t locale_arg); +								int exp_adjust, __locale_t locale_arg) attribute_hidden;  #endif +#endif /* _LIBC */  #endif /* __UCLIBC_HAS_WCHAR__ */  /* The following checks in an __fpmax_t is either 0 or +/- infinity. diff --git a/libc/sysdeps/linux/common/bits/uClibc_locale.h b/libc/sysdeps/linux/common/bits/uClibc_locale.h index a6191a32d..fe574170f 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_locale.h +++ b/libc/sysdeps/linux/common/bits/uClibc_locale.h @@ -65,21 +65,20 @@  #define __LC_ALL			6  /**********************************************************************/ -/* #if defined(_LIBC) && !defined(__LOCALE_C_ONLY) */  #ifndef __LOCALE_C_ONLY -#ifdef _LIBC +#if defined _LIBC /* && (defined IS_IN_libc || defined NOT_IN_libc) */  #include <stddef.h>  #include <stdint.h>  #include <bits/uClibc_touplow.h> -#endif -#if defined(_LIBC) && !defined(__UCLIBC_GEN_LOCALE) +#ifndef __UCLIBC_GEN_LOCALE  #include <bits/uClibc_locale_data.h>  #endif +#endif -extern void _locale_set(const unsigned char *p); -extern void _locale_init(void); +/* extern void _locale_set(const unsigned char *p); */ +/* extern void _locale_init(void); */  enum {  	__ctype_encoding_7_bit,		/* C/POSIX */ @@ -101,7 +100,7 @@ enum {    * In particular, C/POSIX locale is '#' + "\x80\x01"}*LC_ALL + nul.    */ -#if defined(_LIBC) && !defined(__UCLIBC_GEN_LOCALE) +#if defined _LIBC && !defined __UCLIBC_GEN_LOCALE /* && (defined IS_IN_libc || defined NOT_IN_libc) */  typedef struct {  	uint16_t num_weights;  	uint16_t num_starters; @@ -319,14 +318,15 @@ typedef struct __uclibc_locale_struct {  extern __uclibc_locale_t __global_locale_data;  extern struct __uclibc_locale_struct * __global_locale; -#endif +#endif /* _LIBC */  typedef struct __uclibc_locale_struct *__locale_t; -#ifdef _LIBC +/* if we need to leave only _LIBC, then attribute_hidden is not usable */ +#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc)  extern int __locale_mbrtowc_l(wchar_t *__restrict dst,  							  const char *__restrict src, -							  __locale_t loc ); +							  __locale_t loc ) attribute_hidden;  #endif  #ifdef L_setlocale @@ -368,7 +368,7 @@ extern __locale_t __curlocale_set(__locale_t newloc);  #define __LOCALE_ARG      , locale_arg  #define __LOCALE_PTR      locale_arg -#else  /* defined(__UCLIBC_HAS_XLOCALE__) && defined(__STDLIB_DO_XLOCALE) */ +#else  /* defined(__UCLIBC_HAS_XLOCALE__) && defined(__UCLIBC_DO_XLOCALE) */  #define __XL(N) N  #define __XL_NPP(N) N @@ -377,10 +377,10 @@ extern __locale_t __curlocale_set(__locale_t newloc);  #define __LOCALE_ARG  #define __LOCALE_PTR      __UCLIBC_CURLOCALE -#endif /* defined(__UCLIBC_HAS_XLOCALE__) && defined(__STDLIB_DO_XLOCALE) */ +#endif /* defined(__UCLIBC_HAS_XLOCALE__) && defined(__UCLIBC_DO_XLOCALE) */  /**********************************************************************/ -#endif /* defined(_LIBC) && !defined(__LOCALE_C_ONLY) */ +#endif /* !defined(__LOCALE_C_ONLY) */  /**********************************************************************/  #endif /* _UCLIBC_LOCALE_H */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_pthread.h b/libc/sysdeps/linux/common/bits/uClibc_pthread.h index b757ef439..a3be2ca35 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_pthread.h +++ b/libc/sysdeps/linux/common/bits/uClibc_pthread.h @@ -16,7 +16,7 @@   *  02111-1307 USA.   */ -/* Supply prototypes for the (weak) thread functions used by the +/* Supply prototypes for the internal thread functions used by the   * uClibc library code.   */ @@ -24,17 +24,14 @@  #define _UCLIBC_PTHREAD_H  #ifndef _PTHREAD_H -#error Always include <pthread.h> rather than <bits/uClibc_pthread.h> +# error "Always include <pthread.h> rather than <bits/uClibc_pthread.h>"  #endif  extern int __pthread_mutex_init (pthread_mutex_t *__restrict __mutex,  								 __const pthread_mutexattr_t *__restrict -								 __mutex_attr) __THROW; - -extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex) __THROW; - -extern int __pthread_mutex_lock (pthread_mutex_t *__mutex) __THROW; - -extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROW; +								 __mutex_attr) attribute_hidden; +extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex) attribute_hidden; +extern int __pthread_mutex_lock (pthread_mutex_t *__mutex) attribute_hidden; +extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex) attribute_hidden;  #endif diff --git a/libc/sysdeps/linux/common/bits/uClibc_stdio.h b/libc/sysdeps/linux/common/bits/uClibc_stdio.h index 04844ac6a..d73da9de7 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_stdio.h +++ b/libc/sysdeps/linux/common/bits/uClibc_stdio.h @@ -397,8 +397,8 @@ struct __STDIO_FILE_STRUCT {   **********************************************************************/  #if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc) -extern void _stdio_init(void); -extern void _stdio_term(void); +extern void _stdio_init(void) attribute_hidden; +extern void _stdio_term(void) attribute_hidden;  #ifdef __STDIO_HAS_OPENLIST @@ -440,7 +440,7 @@ extern void __stdio_init_mutex(pthread_mutex_t *m) attribute_hidden;  extern int __fgetc_unlocked(FILE *__stream);  extern int __fputc_unlocked(int __c, FILE *__stream); -/* First define the default definitions.  They overriden below as necessary. */ +/* First define the default definitions.  They will be overwritten below as necessary. */  #define __FGETC_UNLOCKED(__stream)		(__fgetc_unlocked)((__stream))  #define __FGETC(__stream)				(fgetc)((__stream))  #define __GETC_UNLOCKED_MACRO(__stream)	(__fgetc_unlocked)((__stream)) diff --git a/libc/sysdeps/linux/common/chmod.c b/libc/sysdeps/linux/common/chmod.c index 631706672..bf368cf5e 100644 --- a/libc/sysdeps/linux/common/chmod.c +++ b/libc/sysdeps/linux/common/chmod.c @@ -13,7 +13,8 @@  #define __NR___syscall_chmod __NR_chmod  static inline _syscall2(int, __syscall_chmod, const char *, path, __kernel_mode_t, mode); -int chmod(const char *path, mode_t mode) +int attribute_hidden __chmod(const char *path, mode_t mode)  {  	return __syscall_chmod(path, mode);  } +strong_alias(__chmod,chmod) diff --git a/libc/sysdeps/linux/common/create_module.c b/libc/sysdeps/linux/common/create_module.c index a54f13be5..5a604d0dc 100644 --- a/libc/sysdeps/linux/common/create_module.c +++ b/libc/sysdeps/linux/common/create_module.c @@ -65,7 +65,7 @@ _syscall2(unsigned long, create_module, const char *, name, size_t, size);  #endif  #else /* !__NR_create_module */ -caddr_t create_module(const char *name, size_t size) +caddr_t create_module(const char *name attribute_unused, size_t size attribute_unused)  {  	__set_errno(ENOSYS);  	return (caddr_t)-1; diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c index e766799c0..899cbaf63 100644 --- a/libc/sysdeps/linux/common/fork.c +++ b/libc/sysdeps/linux/common/fork.c @@ -12,8 +12,9 @@  #ifdef __ARCH_HAS_MMU__  #ifdef __NR_fork -#define __NR___libc_fork __NR_fork -_syscall0(pid_t, __libc_fork); -weak_alias(__libc_fork, fork); +#define __NR___fork __NR_fork +attribute_hidden _syscall0(pid_t, __fork); +strong_alias(__fork,fork) +weak_alias(__fork,__libc_fork)  #endif  #endif diff --git a/libc/sysdeps/linux/common/fstat.c b/libc/sysdeps/linux/common/fstat.c index 208227a7e..979a0db1d 100644 --- a/libc/sysdeps/linux/common/fstat.c +++ b/libc/sysdeps/linux/common/fstat.c @@ -15,6 +15,8 @@  #include "xstatconv.h"  #define __NR___syscall_fstat __NR_fstat +#undef __fstat +#undef fstat  static inline _syscall2(int, __syscall_fstat, int, fd, struct kernel_stat *, buf);  int attribute_hidden __fstat(int fd, struct stat *buf) @@ -31,5 +33,6 @@ int attribute_hidden __fstat(int fd, struct stat *buf)  strong_alias(__fstat,fstat)  #if ! defined __NR_fstat64 && defined __UCLIBC_HAS_LFS__ -weak_alias(fstat,fstat64) +hidden_strong_alias(__fstat,__fstat64) +weak_alias(__fstat,fstat64)  #endif diff --git a/libc/sysdeps/linux/common/fstat64.c b/libc/sysdeps/linux/common/fstat64.c index 87621beab..e1e9dff5c 100644 --- a/libc/sysdeps/linux/common/fstat64.c +++ b/libc/sysdeps/linux/common/fstat64.c @@ -19,6 +19,7 @@  static inline _syscall2(int, __syscall_fstat64,  		int, filedes, struct kernel_stat64 *, buf); +#undef fstat64  int attribute_hidden __fstat64(int fd, struct stat64 *buf)  {  	int result; diff --git a/libc/sysdeps/linux/common/fsync.c b/libc/sysdeps/linux/common/fsync.c index 96764dbe2..e6f610751 100644 --- a/libc/sysdeps/linux/common/fsync.c +++ b/libc/sysdeps/linux/common/fsync.c @@ -12,4 +12,4 @@  #define __NR___libc_fsync __NR_fsync  _syscall1(int, __libc_fsync, int, fd); -weak_alias(__libc_fsync, fsync); +weak_alias(__libc_fsync, fsync) diff --git a/libc/sysdeps/linux/common/get_kernel_syms.c b/libc/sysdeps/linux/common/get_kernel_syms.c index 92a105ebd..a1ab3a552 100644 --- a/libc/sysdeps/linux/common/get_kernel_syms.c +++ b/libc/sysdeps/linux/common/get_kernel_syms.c @@ -13,7 +13,7 @@ struct kernel_sym;  #ifdef __NR_get_kernel_syms  _syscall1(int, get_kernel_syms, struct kernel_sym *, table);  #else -int get_kernel_syms(struct kernel_sym *table) +int get_kernel_syms(struct kernel_sym *table attribute_unused)  {  	__set_errno(ENOSYS);  	return -1; diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c index 71134af09..a44647d67 100644 --- a/libc/sysdeps/linux/common/getcwd.c +++ b/libc/sysdeps/linux/common/getcwd.c @@ -2,6 +2,7 @@  #define opendir __opendir  #define closedir __closedir +#define readdir __readdir  #include <stdlib.h>  #include <errno.h> @@ -42,7 +43,7 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path  	int slow_search = (sizeof(ino_t) != sizeof(d->d_ino));  #endif -	if (stat(path_buf, &st) < 0) { +	if (__stat(path_buf, &st) < 0) {  		goto oops;  	}  #ifdef FAST_DIR_SEARCH_POSSIBLE @@ -74,7 +75,7 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path  			    goto oops;  			}  			__strcpy(ptr + 1, d->d_name); -			if (stat(path_buf, &st) < 0) +			if (__stat(path_buf, &st) < 0)  				continue;  			if (st.st_ino == this_ino && st.st_dev == this_dev) {  				closedir(dp); @@ -100,7 +101,7 @@ static char *recurser(char *path_buf, int path_size, dev_t root_dev, ino_t root_  	dev_t this_dev;  	ino_t this_ino; -	if (stat(path_buf, &st) < 0) { +	if (__stat(path_buf, &st) < 0) {  	    if (errno != EFAULT)  		goto oops;  	    return 0; @@ -139,7 +140,7 @@ int __syscall_getcwd(char * buf, unsigned long size)      len = -1;      /* get stat for root to have a valid parameters for the terminating condition */ -    if (stat("/", &st) < 0) { +    if (__stat("/", &st) < 0) {  	/* root dir not found! */  	return -1;      } diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c index 25b77fe39..4db513a62 100644 --- a/libc/sysdeps/linux/common/getdents.c +++ b/libc/sysdeps/linux/common/getdents.c @@ -75,7 +75,7 @@ ssize_t attribute_hidden __getdents (int fd, char *buf, size_t nbytes)  	    /* Our heuristic failed.  We read too many entries.  Reset  	       the stream.  */  	    assert (last_offset != -1); -	    lseek(fd, last_offset, SEEK_SET); +	    __lseek(fd, last_offset, SEEK_SET);  	    if ((char *) dp == buf) {  		/* The buffer the user passed in is too small to hold even diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c index d6410262d..f65e9e70b 100644 --- a/libc/sysdeps/linux/common/getdents64.c +++ b/libc/sysdeps/linux/common/getdents64.c @@ -80,7 +80,7 @@ ssize_t attribute_hidden __getdents64 (int fd, char *buf, size_t nbytes)  	    /* Our heuristic failed.  We read too many entries.  Reset  	       the stream.  */  	    assert (last_offset != -1); -	    lseek64(fd, last_offset, SEEK_SET); +	    __lseek64(fd, last_offset, SEEK_SET);  	    if ((char *) dp == buf) {  		/* The buffer the user passed in is too small to hold even diff --git a/libc/sysdeps/linux/common/getdirname.c b/libc/sysdeps/linux/common/getdirname.c index d791f34a3..a4285322b 100644 --- a/libc/sysdeps/linux/common/getdirname.c +++ b/libc/sysdeps/linux/common/getdirname.c @@ -42,11 +42,11 @@ get_current_dir_name (void)  	pwd = __getenv ("PWD");  	if (pwd != NULL  #if defined __UCLIBC_HAS_LFS__ -		&& stat64 (".", &dotstat) == 0 -		&& stat64 (pwd, &pwdstat) == 0 +		&& __stat64 (".", &dotstat) == 0 +		&& __stat64 (pwd, &pwdstat) == 0  #else -		&& stat (".", &dotstat) == 0 -		&& stat (pwd, &pwdstat) == 0 +		&& __stat (".", &dotstat) == 0 +		&& __stat (pwd, &pwdstat) == 0  #endif  		&& pwdstat.st_dev == dotstat.st_dev  		&& pwdstat.st_ino == dotstat.st_ino) diff --git a/libc/sysdeps/linux/common/getgroups.c b/libc/sysdeps/linux/common/getgroups.c index c863489b9..83d92627e 100644 --- a/libc/sysdeps/linux/common/getgroups.c +++ b/libc/sysdeps/linux/common/getgroups.c @@ -10,7 +10,9 @@  #define sysconf __sysconf  #include "syscalls.h" +#include <stdlib.h>  #include <unistd.h> +#include <grp.h>  #define MIN(a,b) (((a)<(b))?(a):(b)) @@ -18,21 +20,30 @@  static inline _syscall2(int, __syscall_getgroups,  		int, size, __kernel_gid_t *, list); -int attribute_hidden __getgroups(int n, gid_t * groups) +int attribute_hidden __getgroups(int size, gid_t groups[])  { -	if (unlikely(n < 0)) { +	if (unlikely(size < 0)) { +ret_error:  		__set_errno(EINVAL);  		return -1;  	} else {  		int i, ngids; -		__kernel_gid_t kernel_groups[n = MIN(n, sysconf(_SC_NGROUPS_MAX))]; +		__kernel_gid_t *kernel_groups; -		ngids = __syscall_getgroups(n, kernel_groups); -		if (n != 0 && ngids > 0) { +		size = MIN(size, sysconf(_SC_NGROUPS_MAX)); +		kernel_groups = (__kernel_gid_t *)malloc(sizeof(*kernel_groups) * size); +		if (size && kernel_groups == NULL) +			goto ret_error; + +		ngids = __syscall_getgroups(size, kernel_groups); +		if (size != 0 && ngids > 0) {  			for (i = 0; i < ngids; i++) {  				groups[i] = kernel_groups[i];  			}  		} + +		if (kernel_groups) +			free(kernel_groups);  		return ngids;  	}  } diff --git a/libc/sysdeps/linux/common/getpgid.c b/libc/sysdeps/linux/common/getpgid.c index e8057b132..8de8516dc 100644 --- a/libc/sysdeps/linux/common/getpgid.c +++ b/libc/sysdeps/linux/common/getpgid.c @@ -16,4 +16,4 @@ pid_t __getpgid(pid_t pid)  {  	return (__syscall_getpgid(pid));  } -weak_alias(__getpgid, getpgid); +weak_alias(__getpgid, getpgid) diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c index 046f2a8c2..55200d369 100644 --- a/libc/sysdeps/linux/common/llseek.c +++ b/libc/sysdeps/linux/common/llseek.c @@ -25,7 +25,7 @@  #include <features.h>  #undef __OPTIMIZE__  /* We absolutely do _NOT_ want interfaces silently - *  *  * renamed under us or very bad things will happen... */ + * renamed under us or very bad things will happen... */  #ifdef __USE_FILE_OFFSET64  # undef __USE_FILE_OFFSET64  #endif @@ -33,7 +33,7 @@  #include <sys/types.h>  #include <sys/syscall.h> - +#undef lseek64  #if defined __NR__llseek && defined __UCLIBC_HAS_LFS__  #ifndef INLINE_SYSCALL @@ -43,20 +43,20 @@ static inline _syscall5(int, __syscall_llseek, int, fd, off_t, offset_hi,  		off_t, offset_lo, loff_t *, result, int, whence);  #endif -loff_t __libc_lseek64(int fd, loff_t offset, int whence) +loff_t attribute_hidden __lseek64(int fd, loff_t offset, int whence)  {  	loff_t result;  	return(loff_t)(INLINE_SYSCALL (_llseek, 5, fd, (off_t) (offset >> 32),   				(off_t) (offset & 0xffffffff), &result, whence) ?: result);  }  #else -extern __off_t __libc_lseek(int fildes, off_t offset, int whence); -loff_t __libc_lseek64(int fd, loff_t offset, int whence) +extern __off_t __lseek(int fildes, off_t offset, int whence) attribute_hidden; +loff_t __lseek64(int fd, loff_t offset, int whence)  { -	return(loff_t)(__libc_lseek(fd, (off_t) (offset & 0xffffffff), whence)); +	return(loff_t)(__lseek(fd, (off_t) (offset & 0xffffffff), whence));  }  #endif -weak_alias(__libc_lseek64, _llseek); -weak_alias(__libc_lseek64, llseek); -weak_alias(__libc_lseek64, lseek64); - +strong_alias(__lseek64,lseek64) +//strong_alias(__lseek64,_llseek) +//strong_alias(__lseek64,llseek) +weak_alias(__lseek64,__libc_lseek64) diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c index 03288c706..4eb51d322 100644 --- a/libc/sysdeps/linux/common/lseek.c +++ b/libc/sysdeps/linux/common/lseek.c @@ -10,6 +10,9 @@  #include "syscalls.h"  #include <unistd.h> -#define __NR___libc_lseek __NR_lseek -_syscall3(__off_t, __libc_lseek, int, fildes, __off_t, offset, int, whence); -weak_alias(__libc_lseek, lseek); +#define __NR___lseek __NR_lseek +#undef __lseek +#undef lseek +attribute_hidden _syscall3(__off_t, __lseek, int, fildes, __off_t, offset, int, whence); +strong_alias(__lseek,lseek) +weak_alias(__lseek,__libc_lseek) diff --git a/libc/sysdeps/linux/common/lstat.c b/libc/sysdeps/linux/common/lstat.c index 8cacd4e78..69d663d51 100644 --- a/libc/sysdeps/linux/common/lstat.c +++ b/libc/sysdeps/linux/common/lstat.c @@ -15,6 +15,8 @@  #include "xstatconv.h"  #define __NR___syscall_lstat __NR_lstat +#undef __lstat +#undef lstat  static inline _syscall2(int, __syscall_lstat,  		const char *, file_name, struct kernel_stat *, buf); diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c index f3ae083f1..80268d2a1 100644 --- a/libc/sysdeps/linux/common/lstat64.c +++ b/libc/sysdeps/linux/common/lstat64.c @@ -16,6 +16,7 @@  #include "xstatconv.h"  #define __NR___syscall_lstat64 __NR_lstat64 +#undef lstat64  static inline _syscall2(int, __syscall_lstat64, const char *, file_name,  		  struct kernel_stat64 *, buf); diff --git a/libc/sysdeps/linux/common/mmap64.c b/libc/sysdeps/linux/common/mmap64.c index 804d6af50..f0380b1ad 100644 --- a/libc/sysdeps/linux/common/mmap64.c +++ b/libc/sysdeps/linux/common/mmap64.c @@ -55,13 +55,12 @@  __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset)  { -    if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len)) -    { -	__set_errno (EINVAL); -	return MAP_FAILED; -    } +	if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len)) { +		__set_errno (EINVAL); +		return MAP_FAILED; +	} -    return mmap (addr, len, prot, flags, fd, (off_t) offset); +	return mmap (addr, len, prot, flags, fd, (off_t) offset);  }  #else @@ -77,11 +76,11 @@ static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,  __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset)  { -    if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) { -	__set_errno (EINVAL); -	return MAP_FAILED; -    } -    return(__syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT))); +	if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) { +		__set_errno (EINVAL); +		return MAP_FAILED; +	} +	return(__syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT)));  }  #endif diff --git a/libc/sysdeps/linux/common/modify_ldt.c b/libc/sysdeps/linux/common/modify_ldt.c index 16df10c98..618681ad3 100644 --- a/libc/sysdeps/linux/common/modify_ldt.c +++ b/libc/sysdeps/linux/common/modify_ldt.c @@ -11,5 +11,5 @@  #ifdef __NR_modify_ldt  _syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount); -weak_alias(modify_ldt, __modify_ldt); +weak_alias(modify_ldt, __modify_ldt)  #endif diff --git a/libc/sysdeps/linux/common/msync.c b/libc/sysdeps/linux/common/msync.c index a821a936a..8de9f346e 100644 --- a/libc/sysdeps/linux/common/msync.c +++ b/libc/sysdeps/linux/common/msync.c @@ -13,4 +13,4 @@  #define __NR___libc_msync __NR_msync  _syscall3(int, __libc_msync, void *, addr, size_t, length, int, flags); -weak_alias(__libc_msync, msync); +weak_alias(__libc_msync, msync) diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c index 90e990a4f..648f7d053 100644 --- a/libc/sysdeps/linux/common/open.c +++ b/libc/sysdeps/linux/common/open.c @@ -14,6 +14,8 @@  #include <string.h>  #include <sys/param.h> +#undef __open +#undef open  #define __NR___syscall_open __NR_open  static inline _syscall3(int, __syscall_open, const char *, file,  		int, flags, __kernel_mode_t, mode); diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c index c1cd47141..f577d9507 100644 --- a/libc/sysdeps/linux/common/open64.c +++ b/libc/sysdeps/linux/common/open64.c @@ -28,6 +28,7 @@  #ifdef __UCLIBC_HAS_LFS__  /* Open FILE with access OFLAG.  If OFLAG includes O_CREAT,     a third argument is the file protection.  */ +#undef open64  int attribute_hidden __open64 (const char *file, int oflag, ...)  {    int mode = 0; diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c index 52fc35700..5662a440c 100644 --- a/libc/sysdeps/linux/common/posix_fadvise.c +++ b/libc/sysdeps/linux/common/posix_fadvise.c @@ -20,12 +20,12 @@  _syscall4(int, posix_fadvise, int, fd, off_t, offset,            off_t, len, int, advice); -#if defined __UCLIBC_HAS_LFS__ && !defined __NR_fadvise64_64 -weak_alias(posix_fadvise, posix_fadvise64); +#if defined __UCLIBC_HAS_LFS__ && (!defined __NR_fadvise64_64 || !defined _syscall6) +weak_alias(posix_fadvise, posix_fadvise64)  #endif  #else -int posix_fadvise(int fd, off_t offset, off_t len, int advice) +int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, off_t len attribute_unused, int advice attribute_unused)  {  	__set_errno(ENOSYS);  	return -1; diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c index 05eff4bc9..7183ac9a7 100644 --- a/libc/sysdeps/linux/common/pread_write.c +++ b/libc/sysdeps/linux/common/pread_write.c @@ -100,25 +100,25 @@ static ssize_t __fake_pread_write(int fd, void *buf,  	/* Since we must not change the file pointer preserve the   	 * value so that we can restore it later.  */ -	if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) +	if ((old_offset=__lseek(fd, 0, SEEK_CUR)) == (off_t) -1)  		return -1;  	/* Set to wanted position.  */ -	if (lseek (fd, offset, SEEK_SET) == (off_t) -1) +	if (__lseek (fd, offset, SEEK_SET) == (off_t) -1)  		return -1;  	if (do_pwrite==1) {  		/* Write the data.  */ -		result = write(fd, buf, count); +		result = __write(fd, buf, count);  	} else {  		/* Read the data.  */ -		result = read(fd, buf, count); +		result = __read(fd, buf, count);  	}  	/* Now we have to restore the position.  If this fails we   	 * have to return this as an error.  */  	save_errno = errno; -	if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) +	if (__lseek(fd, old_offset, SEEK_SET) == (off_t) -1)  	{  		if (result == -1)  			__set_errno(save_errno); @@ -138,24 +138,24 @@ static ssize_t __fake_pread_write64(int fd, void *buf,  	/* Since we must not change the file pointer preserve the   	 * value so that we can restore it later.  */ -	if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) +	if ((old_offset=__lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1)  		return -1;  	/* Set to wanted position.  */ -	if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1)  +	if (__lseek64(fd, offset, SEEK_SET) == (off64_t) -1)   		return -1;                                 	if (do_pwrite==1) {  		/* Write the data.  */ -		result = write(fd, buf, count); +		result = __write(fd, buf, count);  	} else {  		/* Read the data.  */ -		result = read(fd, buf, count); +		result = __read(fd, buf, count);  	}  	/* Now we have to restore the position. */  	save_errno = errno; -	if (lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) { +	if (__lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) {  		if (result == -1)  			__set_errno (save_errno);  		return -1; diff --git a/libc/sysdeps/linux/common/query_module.c b/libc/sysdeps/linux/common/query_module.c index 09c1a56e8..853b9ed94 100644 --- a/libc/sysdeps/linux/common/query_module.c +++ b/libc/sysdeps/linux/common/query_module.c @@ -12,8 +12,8 @@  _syscall5(int, query_module, const char *, name, int, which,  		  void *, buf, size_t, bufsize, size_t *, ret);  #else -int query_module(const char *name, int which, -				 void *buf, size_t bufsize, size_t * ret) +int query_module(const char *name attribute_unused, int which attribute_unused, +				 void *buf attribute_unused, size_t bufsize attribute_unused, size_t * ret attribute_unused)  {  	__set_errno(ENOSYS);  	return -1; diff --git a/libc/sysdeps/linux/common/sbrk.c b/libc/sysdeps/linux/common/sbrk.c index 028370e99..d8507335b 100644 --- a/libc/sysdeps/linux/common/sbrk.c +++ b/libc/sysdeps/linux/common/sbrk.c @@ -21,27 +21,27 @@  /* Defined in brk.c.  */  extern void *__curbrk; -extern int brk (void *addr); +extern int __brk (void *addr) attribute_hidden;  /* Extend the process's data space by INCREMENT.     If INCREMENT is negative, shrink data space by - INCREMENT.     Return start of new space allocated, or -1 for errors.  */ -void * sbrk (intptr_t increment) +void attribute_hidden * __sbrk (intptr_t increment)  {      void *oldbrk;      if (__curbrk == NULL) -	if (brk (0) < 0)		/* Initialize the break.  */ +	if (__brk (0) < 0)		/* Initialize the break.  */  	    return (void *) -1;      if (increment == 0)  	return __curbrk;      oldbrk = __curbrk; -    if (brk (oldbrk + increment) < 0) +    if (__brk (oldbrk + increment) < 0)  	return (void *) -1;      return oldbrk;  } - +strong_alias(__sbrk,sbrk) diff --git a/libc/sysdeps/linux/common/setgroups.c b/libc/sysdeps/linux/common/setgroups.c index 96428edb3..49d85156f 100644 --- a/libc/sysdeps/linux/common/setgroups.c +++ b/libc/sysdeps/linux/common/setgroups.c @@ -10,6 +10,7 @@  #define sysconf __sysconf  #include "syscalls.h" +#include <stdlib.h>  #include <unistd.h>  #include <grp.h> @@ -17,23 +18,33 @@  static inline _syscall2(int, __syscall_setgroups,  		size_t, size, const __kernel_gid_t *, list); -int attribute_hidden __setgroups(size_t n, const gid_t * groups) +int attribute_hidden __setgroups(size_t size, const gid_t *groups)  { -	if (n > (size_t) sysconf(_SC_NGROUPS_MAX)) { +	if (size > (size_t) sysconf(_SC_NGROUPS_MAX)) { +ret_error:  		__set_errno(EINVAL);  		return -1;  	} else {  		size_t i; -		__kernel_gid_t kernel_groups[n]; +		__kernel_gid_t *kernel_groups = NULL; -		for (i = 0; i < n; i++) { +		if (size) { +			kernel_groups = (__kernel_gid_t *)malloc(sizeof(*kernel_groups) * size); +			if (kernel_groups == NULL) +				goto ret_error; +		} + +		for (i = 0; i < size; i++) {  			kernel_groups[i] = (groups)[i];  			if (groups[i] != (gid_t) ((__kernel_gid_t) groups[i])) { -				__set_errno(EINVAL); -				return -1; +				goto ret_error;  			}  		} -		return (__syscall_setgroups(n, kernel_groups)); + +		i = __syscall_setgroups(size, kernel_groups); +		if (kernel_groups) +			free(kernel_groups); +		return i;  	}  }  strong_alias(__setgroups,setgroups) diff --git a/libc/sysdeps/linux/common/ssp-local.c b/libc/sysdeps/linux/common/ssp-local.c index 091c34c5d..11ae654c8 100644 --- a/libc/sysdeps/linux/common/ssp-local.c +++ b/libc/sysdeps/linux/common/ssp-local.c @@ -23,7 +23,7 @@  #include <features.h> -extern void __stack_chk_fail (void) attribute_noreturn; +extern void __stack_chk_fail_internal (void) attribute_noreturn;  /* On some architectures, this helps needless PIC pointer setup     that would be needed just for the __stack_chk_fail call.  */ @@ -31,5 +31,5 @@ extern void __stack_chk_fail (void) attribute_noreturn;  void attribute_noreturn attribute_hidden  __stack_chk_fail_local (void)  { -  __stack_chk_fail (); +  __stack_chk_fail_internal ();  } diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index 05e53c29d..9efcd1a89 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -39,7 +39,7 @@  #include <signal.h>  #include <sys/syslog.h> -static __always_inline void block_signals(void) +static void block_signals(void)  {  	struct sigaction sa;  	sigset_t mask; @@ -57,7 +57,7 @@ static __always_inline void block_signals(void)  	sigaction(SSP_SIGTYPE, &sa, NULL);  } -static __always_inline void ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3) +static void ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3)  {  	__write(fd, msg1, __strlen(msg1));  	__write(fd, msg2, __strlen(msg2)); @@ -68,52 +68,50 @@ static __always_inline void ssp_write(int fd, const char *msg1, const char *msg2  	closelog();  } -static __always_inline attribute_noreturn void terminate(void) +static attribute_noreturn void terminate(void)  {  	(void) kill(__getpid(), SSP_SIGTYPE); -	_exit(127); +	_exit_internal(127);  }  void attribute_noreturn __stack_smash_handler(char func[], int damaged __attribute__ ((unused)));  void attribute_noreturn __stack_smash_handler(char func[], int damaged)  { -	extern char *__progname;  	static const char message[] = ": stack smashing attack in function ";  	block_signals(); -	ssp_write(STDERR_FILENO, __progname, message, func); +	ssp_write(STDERR_FILENO, __uclibc_progname, message, func);  	/* The loop is added only to keep gcc happy. */  	while(1)  		terminate();  } -void attribute_noreturn __stack_chk_fail(void) +void attribute_noreturn attribute_hidden __stack_chk_fail_internal(void)  { -	extern char *__progname;  	static const char msg1[] = "stack smashing detected: ";  	static const char msg3[] = " terminated";  	block_signals(); -	ssp_write(STDERR_FILENO, msg1, __progname, msg3); +	ssp_write(STDERR_FILENO, msg1, __uclibc_progname, msg3);  	/* The loop is added only to keep gcc happy. */  	while(1)  		terminate();  } +strong_alias(__stack_chk_fail_internal,__stack_chk_fail)  #if 0  void attribute_noreturn __chk_fail(void)  { -	extern char *__progname;  	static const char msg1[] = "buffer overflow detected: ";  	static const char msg3[] = " terminated";  	block_signals(); -	ssp_write(STDERR_FILENO, msg1, __progname, msg3); +	ssp_write(STDERR_FILENO, msg1, __uclibc_progname, msg3);  	/* The loop is added only to keep gcc happy. */  	while(1) diff --git a/libc/sysdeps/linux/common/stat.c b/libc/sysdeps/linux/common/stat.c index cefbd5f8e..7e7fe6bec 100644 --- a/libc/sysdeps/linux/common/stat.c +++ b/libc/sysdeps/linux/common/stat.c @@ -14,6 +14,8 @@  #include "xstatconv.h"  #define __NR___syscall_stat __NR_stat +#undef __stat +#undef stat  static inline _syscall2(int, __syscall_stat,  		const char *, file_name, struct kernel_stat *, buf); @@ -31,5 +33,6 @@ int attribute_hidden __stat(const char *file_name, struct stat *buf)  strong_alias(__stat,stat)  #if ! defined __NR_stat64 && defined __UCLIBC_HAS_LFS__ -weak_alias(stat,stat64) +hidden_strong_alias(__stat,__stat64) +weak_alias(__stat,stat64)  #endif diff --git a/libc/sysdeps/linux/common/stat64.c b/libc/sysdeps/linux/common/stat64.c index d539906dd..f46e52e98 100644 --- a/libc/sysdeps/linux/common/stat64.c +++ b/libc/sysdeps/linux/common/stat64.c @@ -19,6 +19,7 @@  static inline _syscall2(int, __syscall_stat64,  		const char *, file_name, struct kernel_stat64 *, buf); +#undef stat64  int attribute_hidden __stat64(const char *file_name, struct stat64 *buf)  {  	int result; diff --git a/libc/sysdeps/linux/common/vfork.c b/libc/sysdeps/linux/common/vfork.c index ba4f042ca..d0a4d9a0e 100644 --- a/libc/sysdeps/linux/common/vfork.c +++ b/libc/sysdeps/linux/common/vfork.c @@ -2,7 +2,10 @@  #include <unistd.h>  #include <sys/types.h> -pid_t vfork(void) +extern __pid_t __fork (void) __THROW attribute_hidden; + +pid_t attribute_hidden __vfork(void)  { -    return fork(); +    return __fork();  } +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/common/write.c b/libc/sysdeps/linux/common/write.c index d3b5fab93..8a1d57a82 100644 --- a/libc/sysdeps/linux/common/write.c +++ b/libc/sysdeps/linux/common/write.c @@ -17,5 +17,5 @@ weak_alias(__write,__libc_write)  #if 0  /* Stupid libgcc.a from gcc 2.95.x uses __write in pure.o   * which is a blatent GNU libc-ism... */ -weak_alias(__libc_write, __write); +weak_alias(__libc_write, __write)  #endif  | 
