From 5da06322c21e27d5bc60459ae2f80a80d2c8162b Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Tue, 15 Nov 2005 20:23:33 +0000 Subject: Hide more of stdio,getdents, use internal __raise --- libc/misc/dirent/dirstream.h | 4 ++-- libc/stdio/_READ.c | 2 +- libc/stdio/_WRITE.c | 2 +- libc/stdio/_adjust_pos.c | 2 +- libc/stdio/_fopen.c | 2 +- libc/stdio/_fpmaxtostr.c | 2 +- libc/stdio/_fwrite.c | 2 +- libc/stdio/_load_inttype.c | 2 +- libc/stdio/_rfill.c | 2 +- libc/stdio/_stdio.c | 2 +- libc/stdio/_stdio.h | 26 +++++++++++++------------- libc/stdio/_store_inttype.c | 2 +- libc/stdio/_trans2r.c | 4 ++-- libc/stdio/_trans2w.c | 4 ++-- libc/stdio/_wcommit.c | 2 +- libc/stdio/old_vfprintf.c | 6 +++--- libc/stdio/scanf.c | 20 ++++++++++---------- libc/stdio/vfprintf.c | 22 +++++++++++----------- libc/stdlib/abort.c | 3 ++- libc/sysdeps/linux/common/bits/uClibc_stdio.h | 4 +++- libc/sysdeps/linux/common/getdents.c | 2 +- libc/sysdeps/linux/common/getdents64.c | 6 +++--- 22 files changed, 63 insertions(+), 60 deletions(-) (limited to 'libc') diff --git a/libc/misc/dirent/dirstream.h b/libc/misc/dirent/dirstream.h index f51dee14e..a90ca6312 100644 --- a/libc/misc/dirent/dirstream.h +++ b/libc/misc/dirent/dirstream.h @@ -71,9 +71,9 @@ struct __dirstream { }; /* stream data from opendir() */ -extern ssize_t __getdents(int fd, char *buf, size_t count); +extern ssize_t __getdents(int fd, char *buf, size_t count) attribute_hidden; #ifdef __UCLIBC_HAS_LFS__ -extern ssize_t __getdents64 (int fd, char *buf, size_t count); +extern ssize_t __getdents64 (int fd, char *buf, size_t count) attribute_hidden; #endif #endif /* dirent.h */ diff --git a/libc/stdio/_READ.c b/libc/stdio/_READ.c index 7d3c38ce6..013ca0281 100644 --- a/libc/stdio/_READ.c +++ b/libc/stdio/_READ.c @@ -20,7 +20,7 @@ * NOT THREADSAFE! Assumes stream already locked if necessary. */ -size_t __stdio_READ(register FILE *stream, +size_t attribute_hidden __stdio_READ(register FILE *stream, unsigned char *buf, size_t bufsize) { ssize_t rv = 0; diff --git a/libc/stdio/_WRITE.c b/libc/stdio/_WRITE.c index d300d3919..877d055f7 100644 --- a/libc/stdio/_WRITE.c +++ b/libc/stdio/_WRITE.c @@ -28,7 +28,7 @@ * NOT THREADSAFE! Assumes stream already locked if necessary. */ -size_t __stdio_WRITE(register FILE *stream, +size_t attribute_hidden __stdio_WRITE(register FILE *stream, register const unsigned char *buf, size_t bufsize) { size_t todo; diff --git a/libc/stdio/_adjust_pos.c b/libc/stdio/_adjust_pos.c index bc48d32b7..bc6e90555 100644 --- a/libc/stdio/_adjust_pos.c +++ b/libc/stdio/_adjust_pos.c @@ -16,7 +16,7 @@ * If position is unrepresentable, set errno to EOVERFLOW. */ -int __stdio_adjust_position(register FILE * __restrict stream, +int attribute_hidden __stdio_adjust_position(register FILE * __restrict stream, register __offmax_t *pos) { __offmax_t oldpos; diff --git a/libc/stdio/_fopen.c b/libc/stdio/_fopen.c index f7f5bb626..8ab314612 100644 --- a/libc/stdio/_fopen.c +++ b/libc/stdio/_fopen.c @@ -27,7 +27,7 @@ /* Internal function -- reentrant (locks open file list) */ -FILE *_stdio_fopen(intptr_t fname_or_mode, +FILE attribute_hidden *_stdio_fopen(intptr_t fname_or_mode, register const char * __restrict mode, register FILE * __restrict stream, int filedes) { diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c index d382729d9..9ffa5493e 100644 --- a/libc/stdio/_fpmaxtostr.c +++ b/libc/stdio/_fpmaxtostr.c @@ -198,7 +198,7 @@ static const __fpmax_t exp16_table[] = { #define FPO_STR_WIDTH (0x80 | ' '); #define FPO_STR_PREC 'p' -ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, +ssize_t attribute_hidden _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, __fp_outfunc_t fp_outfunc) { #ifdef __UCLIBC_HAS_HEXADECIMAL_FLOATS__ diff --git a/libc/stdio/_fwrite.c b/libc/stdio/_fwrite.c index a706ba7e6..d9d0bc2a8 100644 --- a/libc/stdio/_fwrite.c +++ b/libc/stdio/_fwrite.c @@ -11,7 +11,7 @@ /* Either buffer data or (commit buffer if necessary and) write. */ -size_t __stdio_fwrite(const unsigned char * __restrict buffer, +size_t attribute_hidden __stdio_fwrite(const unsigned char * __restrict buffer, size_t bytes, register FILE * __restrict stream) { diff --git a/libc/stdio/_load_inttype.c b/libc/stdio/_load_inttype.c index 2dd559a53..e4dc61e9c 100644 --- a/libc/stdio/_load_inttype.c +++ b/libc/stdio/_load_inttype.c @@ -8,7 +8,7 @@ #include "_stdio.h" #include -uintmax_t _load_inttype(int desttype, register const void *src, int uflag) +uintmax_t attribute_hidden _load_inttype(int desttype, register const void *src, int uflag) { if (uflag >= 0) { /* unsigned */ #if LONG_MAX != INT_MAX diff --git a/libc/stdio/_rfill.c b/libc/stdio/_rfill.c index 145c1d78e..d61b1a9f9 100644 --- a/libc/stdio/_rfill.c +++ b/libc/stdio/_rfill.c @@ -19,7 +19,7 @@ * Side effects are those of _stdio_READ. */ -size_t __stdio_rfill(register FILE *__restrict stream) +size_t attribute_hidden __stdio_rfill(register FILE *__restrict stream) { size_t rv; diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c index 4aae3c418..c71de343d 100644 --- a/libc/stdio/_stdio.c +++ b/libc/stdio/_stdio.c @@ -162,7 +162,7 @@ int _stdio_openlist_delflag = 0; /* 2 if threading not initialized and 0 otherwise; */ int _stdio_user_locking = 2; -void __stdio_init_mutex(pthread_mutex_t *m) +void attribute_hidden __stdio_init_mutex(pthread_mutex_t *m) { static const pthread_mutex_t __stdio_mutex_initializer = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h index 31174750d..dfdaf259a 100644 --- a/libc/stdio/_stdio.h +++ b/libc/stdio/_stdio.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2005 Manuel Novoa III +/* Copyright (C) 2004-2005 Manuel Novoa III * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. * @@ -236,13 +236,13 @@ extern int __stdio_seek(FILE *stream, register __offmax_t *pos, int whence) attr /* Assume stream in valid writing state. Do not reset writing flag * or disble putc macro unless error. */ /* Should we assume that buffer is not empty to avoid a check? */ -extern size_t __stdio_wcommit(FILE *__restrict stream); +extern size_t __stdio_wcommit(FILE *__restrict stream) attribute_hidden; /* Remember to fail if at EOF! */ -extern size_t __stdio_rfill(FILE *__restrict stream); +extern size_t __stdio_rfill(FILE *__restrict stream) attribute_hidden; extern size_t __stdio_fwrite(const unsigned char *__restrict buffer, - size_t bytes, FILE *__restrict stream); + size_t bytes, FILE *__restrict stream) attribute_hidden; #else #define __stdio_fwrite(B,N,S) __stdio_WRITE((S),(B),(N)) @@ -250,14 +250,14 @@ extern size_t __stdio_fwrite(const unsigned char *__restrict buffer, #endif extern size_t __stdio_WRITE(FILE *stream, const unsigned char *buf, - size_t bufsize); -extern size_t __stdio_READ(FILE *stream, unsigned char *buf, size_t bufsize); + size_t bufsize) attribute_hidden; +extern size_t __stdio_READ(FILE *stream, unsigned char *buf, size_t bufsize) attribute_hidden; -extern int __stdio_trans2r(FILE *__restrict stream); -extern int __stdio_trans2w(FILE *__restrict stream); +extern int __stdio_trans2r(FILE *__restrict stream) attribute_hidden; +extern int __stdio_trans2w(FILE *__restrict stream) attribute_hidden; -extern int __stdio_trans2r_o(FILE *__restrict stream, int oflag); -extern int __stdio_trans2w_o(FILE *__restrict stream, int oflag); +extern int __stdio_trans2r_o(FILE *__restrict stream, int oflag) attribute_hidden; +extern int __stdio_trans2w_o(FILE *__restrict stream, int oflag) attribute_hidden; /**********************************************************************/ #ifdef __STDIO_BUFFERS @@ -361,7 +361,7 @@ extern int __fputc_unlocked(int c, FILE *stream); extern int __fflush_unlocked(FILE *stream); -extern int __stdio_adjust_position(FILE *__restrict stream, __offmax_t *pos); +extern int __stdio_adjust_position(FILE *__restrict stream, __offmax_t *pos) attribute_hidden; extern void __clearerr_unlocked(FILE *stream); extern int __feof_unlocked(FILE *stream); @@ -414,8 +414,8 @@ extern size_t _stdio_fread(unsigned char *buffer, size_t bytes, FILE *stream); extern FILE *_stdio_fopen(intptr_t fname_or_mode, - const char *__restrict mode, - FILE *__restrict stream, int filedes); + const char *__restrict mode, + FILE *__restrict stream, int filedes) attribute_hidden; #ifdef __UCLIBC_HAS_WCHAR__ extern size_t _wstdio_fwrite(const wchar_t *__restrict ws, size_t n, diff --git a/libc/stdio/_store_inttype.c b/libc/stdio/_store_inttype.c index 228e90619..82fb894c6 100644 --- a/libc/stdio/_store_inttype.c +++ b/libc/stdio/_store_inttype.c @@ -28,7 +28,7 @@ /* We assume int may be short or long, but short and long are different. */ -void _store_inttype(register void *dest, int desttype, uintmax_t val) +void attribute_hidden _store_inttype(register void *dest, int desttype, uintmax_t val) { if (desttype == __PA_FLAG_CHAR) { /* assume char not int */ *((unsigned char *) dest) = val; diff --git a/libc/stdio/_trans2r.c b/libc/stdio/_trans2r.c index 9afb75428..1f3930070 100644 --- a/libc/stdio/_trans2r.c +++ b/libc/stdio/_trans2r.c @@ -22,9 +22,9 @@ */ #ifdef __UCLIBC_HAS_WCHAR__ -int __stdio_trans2r_o(FILE * __restrict stream, int oflag) +int attribute_hidden __stdio_trans2r_o(FILE * __restrict stream, int oflag) #else -int __stdio_trans2r(FILE * __restrict stream) +int attribute_hidden __stdio_trans2r(FILE * __restrict stream) #endif { __STDIO_STREAM_VALIDATE(stream); diff --git a/libc/stdio/_trans2w.c b/libc/stdio/_trans2w.c index 7ab3403c0..e85f45a24 100644 --- a/libc/stdio/_trans2w.c +++ b/libc/stdio/_trans2w.c @@ -21,9 +21,9 @@ */ #ifdef __UCLIBC_HAS_WCHAR__ -int __stdio_trans2w_o(FILE * __restrict stream, int oflag) +int attribute_hidden __stdio_trans2w_o(FILE * __restrict stream, int oflag) #else -int __stdio_trans2w(FILE * __restrict stream) +int attribute_hidden __stdio_trans2w(FILE * __restrict stream) #endif { __STDIO_STREAM_VALIDATE(stream); diff --git a/libc/stdio/_wcommit.c b/libc/stdio/_wcommit.c index 71720e83f..a0b3219b1 100644 --- a/libc/stdio/_wcommit.c +++ b/libc/stdio/_wcommit.c @@ -14,7 +14,7 @@ * Side effects are those of _stdio_WRITE */ -size_t __stdio_wcommit(register FILE * __restrict stream) +size_t attribute_hidden __stdio_wcommit(register FILE * __restrict stream) { size_t bufsize; diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c index 23cb10f94..8caa3d66d 100644 --- a/libc/stdio/old_vfprintf.c +++ b/libc/stdio/old_vfprintf.c @@ -217,7 +217,7 @@ typedef void (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf); extern size_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, - __fp_outfunc_t fp_outfunc); + __fp_outfunc_t fp_outfunc) attribute_hidden; static void _charpad(FILE * __restrict stream, int padchar, size_t numpad) { @@ -261,8 +261,8 @@ static const char spec[] = "+-#0 "; /**********************************************************************/ -extern void _store_inttype(void *dest, int desttype, uintmax_t val); -extern uintmax_t _load_inttype(int desttype, const void *src, int uflag); +extern void _store_inttype(void *dest, int desttype, uintmax_t val) attribute_hidden; +extern uintmax_t _load_inttype(int desttype, const void *src, int uflag) attribute_hidden; /* * In order to ease translation to what arginfo and _print_info._flags expect, diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index d30eaebc0..5b932063c 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -648,16 +648,16 @@ typedef struct { /**********************************************************************/ extern void __init_scan_cookie(register struct scan_cookie *sc, - register FILE *fp); -extern int __scan_getc(register struct scan_cookie *sc); -extern void __scan_ungetc(register struct scan_cookie *sc); + register FILE *fp) attribute_hidden; +extern int __scan_getc(register struct scan_cookie *sc) attribute_hidden; +extern void __scan_ungetc(register struct scan_cookie *sc) attribute_hidden; #ifdef __UCLIBC_HAS_FLOATS__ extern int __scan_strtold(long double *ld, struct scan_cookie *sc); #endif /* __UCLIBC_HAS_FLOATS__ */ -extern int __psfs_parse_spec(psfs_t *psfs); -extern int __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc); +extern int __psfs_parse_spec(psfs_t *psfs) attribute_hidden; +extern int __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) attribute_hidden; /**********************************************************************/ #ifdef L___scan_cookie @@ -669,7 +669,7 @@ extern int __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc); static const char decpt_str[] = "."; #endif -void __init_scan_cookie(register struct scan_cookie *sc, +void attribute_hidden __init_scan_cookie(register struct scan_cookie *sc, register FILE *fp) { sc->fp = fp; @@ -710,7 +710,7 @@ void __init_scan_cookie(register struct scan_cookie *sc, } -int __scan_getc(register struct scan_cookie *sc) +int attribute_hidden __scan_getc(register struct scan_cookie *sc) { int c; @@ -758,7 +758,7 @@ int __scan_getc(register struct scan_cookie *sc) return sc->cc = sc->ungot_char; } -void __scan_ungetc(register struct scan_cookie *sc) +void attribute_hidden __scan_ungetc(register struct scan_cookie *sc) { ++sc->width; if (sc->ungot_flag == 2) { /* last was EOF */ @@ -784,7 +784,7 @@ static const unsigned char qual_chars[] = QUAL_CHARS; static const unsigned char spec_ranges[] = SPEC_RANGES; static const unsigned short spec_allowed[] = SPEC_ALLOWED_FLAGS; -int __psfs_parse_spec(register psfs_t *psfs) +int attribute_hidden __psfs_parse_spec(register psfs_t *psfs) { const unsigned char *p; const unsigned char *fmt0 = psfs->fmt; @@ -1743,7 +1743,7 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg) static const unsigned char spec_base[] = SPEC_BASE; static const unsigned char nil_string[] = "(nil)"; -int __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) +int attribute_hidden __psfs_do_numeric(psfs_t *psfs, struct scan_cookie *sc) { unsigned char *b; const unsigned char *p; diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c index a1f43faba..73bbe63d3 100644 --- a/libc/stdio/vfprintf.c +++ b/libc/stdio/vfprintf.c @@ -413,16 +413,16 @@ typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf); extern ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, - __fp_outfunc_t fp_outfunc); + __fp_outfunc_t fp_outfunc) attribute_hidden; #endif -extern int _ppfs_init(ppfs_t *ppfs, const char *fmt0); /* validates */ -extern void _ppfs_prepargs(ppfs_t *ppfs, va_list arg); /* sets posargptrs */ -extern void _ppfs_setargs(ppfs_t *ppfs); /* sets argptrs for current spec */ -extern int _ppfs_parsespec(ppfs_t *ppfs); /* parses specifier */ +extern int _ppfs_init(ppfs_t *ppfs, const char *fmt0) attribute_hidden; /* validates */ +extern void _ppfs_prepargs(ppfs_t *ppfs, va_list arg) attribute_hidden; /* sets posargptrs */ +extern void _ppfs_setargs(ppfs_t *ppfs) attribute_hidden; /* sets argptrs for current spec */ +extern int _ppfs_parsespec(ppfs_t *ppfs) attribute_hidden; /* parses specifier */ -extern void _store_inttype(void *dest, int desttype, uintmax_t val); -extern uintmax_t _load_inttype(int desttype, const void *src, int uflag); +extern void _store_inttype(void *dest, int desttype, uintmax_t val) attribute_hidden; +extern uintmax_t _load_inttype(int desttype, const void *src, int uflag) attribute_hidden; /**********************************************************************/ #ifdef L_parse_printf_format @@ -497,7 +497,7 @@ size_t parse_printf_format(register const char *template, /**********************************************************************/ #ifdef L__ppfs_init -int _ppfs_init(register ppfs_t *ppfs, const char *fmt0) +int attribute_hidden _ppfs_init(register ppfs_t *ppfs, const char *fmt0) { int r; @@ -587,7 +587,7 @@ int _ppfs_init(register ppfs_t *ppfs, const char *fmt0) #endif /**********************************************************************/ #ifdef L__ppfs_prepargs -void _ppfs_prepargs(register ppfs_t *ppfs, va_list arg) +void attribute_hidden _ppfs_prepargs(register ppfs_t *ppfs, va_list arg) { int i; @@ -606,7 +606,7 @@ void _ppfs_prepargs(register ppfs_t *ppfs, va_list arg) /**********************************************************************/ #ifdef L__ppfs_setargs -void _ppfs_setargs(register ppfs_t *ppfs) +void attribute_hidden _ppfs_setargs(register ppfs_t *ppfs) { #ifdef __va_arg_ptr register void **p = ppfs->argptr; @@ -820,7 +820,7 @@ printf_arginfo_function *_custom_printf_arginfo[MAX_USER_SPEC]; printf_function _custom_printf_handler[MAX_USER_SPEC]; #endif /* __UCLIBC_HAS_GLIBC_CUSTOM_PRINTF__ */ -extern int _ppfs_parsespec(ppfs_t *ppfs) +int attribute_hidden _ppfs_parsespec(ppfs_t *ppfs) { register const char *fmt; register const char *p; diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c index 77c2cdc69..6457836e8 100644 --- a/libc/stdlib/abort.c +++ b/libc/stdlib/abort.c @@ -81,6 +81,7 @@ static pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; #endif +extern int __raise (int __sig) __THROW attribute_hidden; /* Cause an abnormal program termination with core-dump */ void abort(void) { @@ -111,7 +112,7 @@ void abort(void) abort_it: UNLOCK; - raise(SIGABRT); + __raise(SIGABRT); LOCK; } diff --git a/libc/sysdeps/linux/common/bits/uClibc_stdio.h b/libc/sysdeps/linux/common/bits/uClibc_stdio.h index 18d3a2a65..b5e466f47 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_stdio.h +++ b/libc/sysdeps/linux/common/bits/uClibc_stdio.h @@ -374,7 +374,9 @@ extern struct __STDIO_FILE_STRUCT *_stdio_openlist; extern pthread_mutex_t _stdio_openlist_lock; extern int _stdio_openlist_delflag; extern int _stdio_user_locking; -extern void __stdio_init_mutex(pthread_mutex_t *m); +#ifdef _LIBC +extern void __stdio_init_mutex(pthread_mutex_t *m) attribute_hidden; +#endif #endif #endif diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c index 416ced4ea..623041866 100644 --- a/libc/sysdeps/linux/common/getdents.c +++ b/libc/sysdeps/linux/common/getdents.c @@ -44,7 +44,7 @@ struct kernel_dirent static inline _syscall3(int, __syscall_getdents, int, fd, unsigned char *, kdirp, size_t, count); -ssize_t __getdents (int fd, char *buf, size_t nbytes) +ssize_t attribute_hidden __getdents (int fd, char *buf, size_t nbytes) { struct dirent *dp; off_t last_offset = -1; diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c index 1b4b0c368..7b4c0d4ce 100644 --- a/libc/sysdeps/linux/common/getdents64.c +++ b/libc/sysdeps/linux/common/getdents64.c @@ -49,7 +49,7 @@ struct kernel_dirent64 static inline _syscall3(int, __syscall_getdents64, int, fd, unsigned char *, dirp, size_t, count); -ssize_t __getdents64 (int fd, char *buf, size_t nbytes) +ssize_t attribute_hidden __getdents64 (int fd, char *buf, size_t nbytes) { struct dirent64 *dp; off64_t last_offset = -1; @@ -104,8 +104,8 @@ ssize_t __getdents64 (int fd, char *buf, size_t nbytes) return (char *) dp - buf; } #else -ssize_t __getdents (int fd, char *buf, size_t nbytes); -ssize_t __getdents64 (int fd, char *buf, size_t nbytes) +extern ssize_t __getdents (int fd, char *buf, size_t nbytes) attribute_hidden; +ssize_t attribute_hidden __getdents64 (int fd, char *buf, size_t nbytes) { return(__getdents(fd, buf, nbytes)); } -- cgit v1.2.3