From afdecae49f81065952da43bb2629fcdb64aad535 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 8 Dec 2005 15:04:23 +0000 Subject: Use internal versions --- libc/misc/dirent/dirfd.c | 3 ++- libc/misc/dirent/scandir.c | 2 ++ libc/misc/dirent/scandir64.c | 2 ++ libc/misc/fnmatch/fnmatch.c | 11 ++--------- libc/misc/ftw/ftw.c | 5 +++++ libc/misc/glob/glob.c | 10 +++++++--- libc/misc/internals/tempname.c | 2 ++ libc/misc/mntent/mntent.c | 1 + libc/misc/regex/regex_old.c | 5 +++-- libc/misc/time/ftime.c | 2 ++ libc/misc/time/time.c | 12 ++++++++++-- libc/misc/utmp/wtent.c | 2 ++ libc/misc/wordexp/wordexp.c | 6 ++++++ libc/pwd_grp/pwd_grp.c | 1 + libc/stdlib/malloc/malloc_debug.c | 2 ++ libc/stdlib/ptsname.c | 4 +++- libc/stdlib/unlockpt.c | 2 +- libc/termios/tcgetattr.c | 2 +- libc/termios/tcgetsid.c | 2 +- libc/termios/tcsetattr.c | 4 ++-- libc/termios/termios.c | 17 +++++++++-------- libc/termios/ttyname.c | 4 ++++ libc/unistd/daemon.c | 1 + libc/unistd/exec.c | 2 +- libc/unistd/getpass.c | 1 + libc/unistd/usershell.c | 1 + 26 files changed, 74 insertions(+), 32 deletions(-) (limited to 'libc') diff --git a/libc/misc/dirent/dirfd.c b/libc/misc/dirent/dirfd.c index b658b5a9c..48e955450 100644 --- a/libc/misc/dirent/dirfd.c +++ b/libc/misc/dirent/dirfd.c @@ -2,7 +2,7 @@ #include #include "dirstream.h" -int dirfd(DIR * dir) +int attribute_hidden __dirfd(DIR * dir) { if (!dir || dir->dd_fd == -1) { __set_errno(EBADF); @@ -11,3 +11,4 @@ int dirfd(DIR * dir) return dir->dd_fd; } +strong_alias(__dirfd,dirfd) diff --git a/libc/misc/dirent/scandir.c b/libc/misc/dirent/scandir.c index e80df58dc..cc76bed5e 100644 --- a/libc/misc/dirent/scandir.c +++ b/libc/misc/dirent/scandir.c @@ -21,6 +21,8 @@ */ #define qsort __qsort +#define opendir __opendir +#define closedir __closedir #include #include diff --git a/libc/misc/dirent/scandir64.c b/libc/misc/dirent/scandir64.c index 46b6d5cef..377f55fe6 100644 --- a/libc/misc/dirent/scandir64.c +++ b/libc/misc/dirent/scandir64.c @@ -21,6 +21,8 @@ */ #define qsort __qsort +#define opendir __opendir +#define closedir __closedir #include #ifdef __UCLIBC_HAS_LFS__ diff --git a/libc/misc/fnmatch/fnmatch.c b/libc/misc/fnmatch/fnmatch.c index 11bb3a112..44f1431c8 100644 --- a/libc/misc/fnmatch/fnmatch.c +++ b/libc/misc/fnmatch/fnmatch.c @@ -49,16 +49,9 @@ Cambridge, MA 02139, USA. */ # define ISUPPER(c) (ISASCII (c) && isupper (c)) -# ifndef errno -extern int errno; -# endif - /* Match STRING against the filename pattern PATTERN, returning zero if it matches, nonzero if not. */ -int fnmatch(pattern, string, flags) -const char *pattern; -const char *string; -int flags; +int attribute_hidden __fnmatch(const char *pattern, const char *string, int flags) { register const char *p = pattern, *n = string; register char c; @@ -228,5 +221,5 @@ int flags; # undef FOLD } - +strong_alias(__fnmatch,fnmatch) #endif /* _LIBC or not __GNU_LIBRARY__. */ diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c index 09a87e4be..30009def9 100644 --- a/libc/misc/ftw/ftw.c +++ b/libc/misc/ftw/ftw.c @@ -25,8 +25,13 @@ #define stpcpy __stpcpy #define tsearch __tsearch #define tdestroy __tdestroy +#define tfind __tfind #define fchdir __fchdir +#define chdir __chdir +#define dirfd __dirfd #define getcwd __getcwd +#define opendir __opendir +#define closedir __closedir #define _GNU_SOURCE #include diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c index 3fc20dbc2..d4a0b67ca 100644 --- a/libc/misc/glob/glob.c +++ b/libc/misc/glob/glob.c @@ -18,6 +18,7 @@ Cambridge, MA 02139, USA. */ #define strrchr __strrchr #define strcoll __strcoll #define qsort __qsort +#define fnmatch __fnmatch #include #include @@ -32,6 +33,9 @@ Cambridge, MA 02139, USA. */ #define _GNU_SOURCE #include +extern DIR *__opendir (__const char *__name) __nonnull ((1)) attribute_hidden; +extern int __closedir (DIR *__dirp) __nonnull ((1)) attribute_hidden; + extern __ptr_t (*__glob_opendir_hook) __P ((const char *directory)); extern void (*__glob_closedir_hook) __P ((__ptr_t stream)); extern const char *(*__glob_readdir_hook) __P ((__ptr_t stream)); @@ -397,7 +401,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) int meta; stream = (__glob_opendir_hook ? (*__glob_opendir_hook) (directory) - : (__ptr_t) opendir (directory)); + : (__ptr_t) __opendir (directory)); if (stream == NULL) { if ((errfunc != NULL && (*errfunc) (directory, errno)) || @@ -497,7 +501,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) if (__glob_closedir_hook) (*__glob_closedir_hook) (stream); else - (void) closedir ((DIR *) stream); + (void) __closedir ((DIR *) stream); errno = save; } return nfound == 0 ? GLOB_NOMATCH : 0; @@ -508,7 +512,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) if (__glob_closedir_hook) (*__glob_closedir_hook) (stream); else - (void) closedir ((DIR *) stream); + (void) __closedir ((DIR *) stream); errno = save; } while (names != NULL) diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index 99a8ac0d8..53500a7a6 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -32,6 +32,8 @@ */ #define open64 __open64 +#define mkdir __mkdir +#define gettimeofday __gettimeofday #include #include diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c index 81575a679..7e9febb1f 100644 --- a/libc/misc/mntent/mntent.c +++ b/libc/misc/mntent/mntent.c @@ -1,5 +1,6 @@ #define strtok_r __strtok_r #define strstr __strstr +#define atoi __atoi #include #include diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c index 1f9d37780..c86835e17 100644 --- a/libc/misc/regex/regex_old.c +++ b/libc/misc/regex/regex_old.c @@ -31,6 +31,7 @@ #define mbrtowc __mbrtowc #define wcrtomb __wcrtomb #define wcscoll __wcscoll +#define wctype __wctype #define iswctype __iswctype #define iswalnum __iswalnum @@ -5166,7 +5167,7 @@ PREFIX(re_search_2) (bufp, string1, size1, string2, size2, startpos, range, wchar_t *wcs_string1 = NULL, *wcs_string2 = NULL; /* We need the size of wchar_t buffers correspond to csize1, csize2. */ int wcs_size1 = 0, wcs_size2 = 0; - /* offset buffer for optimizatoin. See convert_mbs_to_wc. */ + /* offset buffer for optimization. See convert_mbs_to_wc. */ int *mbs_offset1 = NULL, *mbs_offset2 = NULL; /* They hold whether each wchar_t is binary data or not. */ char *is_binary = NULL; @@ -5696,7 +5697,7 @@ wcs_re_match_2_internal (bufp, cstring1, csize1, cstring2, csize2, pos, wchar_t *string1, *string2; /* We need the size of wchar_t buffers correspond to csize1, csize2. */ int size1, size2; - /* offset buffer for optimizatoin. See convert_mbs_to_wc. */ + /* offset buffer for optimization. See convert_mbs_to_wc. */ int *mbs_offset1, *mbs_offset2; #else /* BYTE */ static int diff --git a/libc/misc/time/ftime.c b/libc/misc/time/ftime.c index 24789c9eb..904763241 100644 --- a/libc/misc/time/ftime.c +++ b/libc/misc/time/ftime.c @@ -16,6 +16,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define gettimeofday __gettimeofday + #include #include diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index 59b3ef641..85a96f003 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -130,6 +130,7 @@ */ #define strnlen __strnlen +#define gettimeofday __gettimeofday #define _GNU_SOURCE #include @@ -147,8 +148,15 @@ extern void __tzset (void) __THROW attribute_hidden; +extern long int __strtol (__const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)) __wur attribute_hidden; + #ifdef __UCLIBC_HAS_XLOCALE__ #include +extern long int __strtol_l (__const char *__restrict __nptr, + char **__restrict __endptr, int __base, + __locale_t __loc) __THROW __nonnull ((1, 4)) __wur attribute_hidden; extern int __strncasecmp_l (__const char *__s1, __const char *__s2, size_t __n, __locale_t __loc) __THROW __attribute_pure__ __nonnull ((1, 2, 4)) attribute_hidden; @@ -1544,9 +1552,9 @@ char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char * __set_errno(0); if (!ISSPACE(*buf)) { /* Signal an error if whitespace. */ #ifdef TIME_T_IS_UNSIGNED - t = __XL(strtoul)(buf, &o, 10 __LOCALE_ARG); + t = __UCXL(strtoul)(buf, &o, 10 __LOCALE_ARG); #else - t = __XL(strtol)(buf, &o, 10 __LOCALE_ARG); + t = __UCXL(strtol)(buf, &o, 10 __LOCALE_ARG); #endif } if ((o == buf) || errno) { /* Not a number or overflow. */ diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c index 0900ef379..bfedeaa70 100644 --- a/libc/misc/utmp/wtent.c +++ b/libc/misc/utmp/wtent.c @@ -17,6 +17,8 @@ * write to the Free Software Foundation, Inc., 675 Mass Ave, * Cambridge, MA 02139, USA. */ +#define gettimeofday __gettimeofday + #include #include #include diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index d8bf785d3..8c54f8fc2 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -31,6 +31,12 @@ #define getpwuid_r __getpwuid_r #define execve __execve #define dup2 __dup2 +#define atoi __atoi +#define fnmatch __fnmatch +#if 0 +#define glob __glob +#define globfree __globfree +#endif #define _GNU_SOURCE #include diff --git a/libc/pwd_grp/pwd_grp.c b/libc/pwd_grp/pwd_grp.c index ced5051f8..2cc032ea3 100644 --- a/libc/pwd_grp/pwd_grp.c +++ b/libc/pwd_grp/pwd_grp.c @@ -19,6 +19,7 @@ */ #define setgroups __setgroups +#define strtoul __strtoul #define _GNU_SOURCE #include diff --git a/libc/stdlib/malloc/malloc_debug.c b/libc/stdlib/malloc/malloc_debug.c index b93b1eac6..b8f404621 100644 --- a/libc/stdlib/malloc/malloc_debug.c +++ b/libc/stdlib/malloc/malloc_debug.c @@ -11,6 +11,8 @@ * Written by Miles Bader */ +#define atoi __atoi + #include #include #include diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index 8cac95783..c79325ea3 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -17,6 +17,8 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define isatty __isatty + #define _ISOC99_SOURCE #include #include @@ -86,7 +88,7 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen) # error "__UNIX98PTY_ONLY__ enabled but TIOCGPTN ioctl not supported by your kernel." #endif #ifdef TIOCGPTN - if (ioctl (fd, TIOCGPTN, &ptyno) == 0) + if (__ioctl (fd, TIOCGPTN, &ptyno) == 0) { /* Buffer we use to print the number in. */ char numbuf[__BUFLEN_INT10TOSTR]; diff --git a/libc/stdlib/unlockpt.c b/libc/stdlib/unlockpt.c index 5dfea15d7..3f99c1c0b 100644 --- a/libc/stdlib/unlockpt.c +++ b/libc/stdlib/unlockpt.c @@ -32,7 +32,7 @@ unlockpt (int fd) int save_errno = errno; int unlock = 0; - if (ioctl (fd, TIOCSPTLCK, &unlock)) + if (__ioctl (fd, TIOCSPTLCK, &unlock)) { if (errno == EINVAL) { diff --git a/libc/termios/tcgetattr.c b/libc/termios/tcgetattr.c index 8a9448bd7..3fd6d29d6 100644 --- a/libc/termios/tcgetattr.c +++ b/libc/termios/tcgetattr.c @@ -37,7 +37,7 @@ int attribute_hidden __tcgetattr (int fd, struct termios *termios_p) struct __kernel_termios k_termios; int retval; - retval = ioctl (fd, TCGETS, &k_termios); + retval = __ioctl (fd, TCGETS, &k_termios); termios_p->c_iflag = k_termios.c_iflag; termios_p->c_oflag = k_termios.c_oflag; diff --git a/libc/termios/tcgetsid.c b/libc/termios/tcgetsid.c index 54d317724..e4ba87ac5 100644 --- a/libc/termios/tcgetsid.c +++ b/libc/termios/tcgetsid.c @@ -40,7 +40,7 @@ pid_t tcgetsid (int fd) int serrno = errno; int sid; - if (ioctl (fd, TIOCGSID, &sid) < 0) + if (__ioctl (fd, TIOCGSID, &sid) < 0) { if (errno == EINVAL) { diff --git a/libc/termios/tcsetattr.c b/libc/termios/tcsetattr.c index 2bf2d2a29..3afa1012c 100644 --- a/libc/termios/tcsetattr.c +++ b/libc/termios/tcsetattr.c @@ -83,14 +83,14 @@ int attribute_hidden __tcsetattr (int fd, int optional_actions, const struct ter __memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0], __KERNEL_NCCS * sizeof (cc_t)); - retval = ioctl (fd, cmd, &k_termios); + retval = __ioctl (fd, cmd, &k_termios); if (retval == 0 && cmd == TCSETS) { /* The Linux kernel has a bug which silently ignore the invalid c_cflag on pty. We have to check it here. */ int save = errno; - retval = ioctl (fd, TCGETS, &k_termios); + retval = __ioctl (fd, TCGETS, &k_termios); if (retval) { /* We cannot verify if the setting is ok. We don't return diff --git a/libc/termios/termios.c b/libc/termios/termios.c index dc0372fa3..680796e16 100644 --- a/libc/termios/termios.c +++ b/libc/termios/termios.c @@ -35,11 +35,12 @@ #ifdef L_isatty /* Return 1 if FD is a terminal, 0 if not. */ -int isatty(int fd) +int attribute_hidden __isatty(int fd) { struct termios term; return (tcgetattr (fd, &term) == 0); } +strong_alias(__isatty,isatty) #endif #ifdef L_tcdrain @@ -47,7 +48,7 @@ int isatty(int fd) int __libc_tcdrain (int fd) { /* With an argument of 1, TCSBRK waits for the output to drain. */ - return ioctl(fd, TCSBRK, 1); + return __ioctl(fd, TCSBRK, 1); } weak_alias(__libc_tcdrain, tcdrain) #endif @@ -56,7 +57,7 @@ weak_alias(__libc_tcdrain, tcdrain) /* Suspend or restart transmission on FD. */ int tcflow ( int fd, int action) { - return ioctl(fd, TCXONC, action); + return __ioctl(fd, TCXONC, action); } #endif @@ -64,7 +65,7 @@ int tcflow ( int fd, int action) /* Flush pending data on FD. */ int tcflush ( int fd, int queue_selector) { - return ioctl(fd, TCFLSH, queue_selector); + return __ioctl(fd, TCFLSH, queue_selector); } #endif @@ -76,12 +77,12 @@ int tcsendbreak( int fd, int duration) and an implementation-defined period if DURATION is nonzero. We define a positive DURATION to be number of milliseconds to break. */ if (duration <= 0) - return ioctl(fd, TCSBRK, 0); + return __ioctl(fd, TCSBRK, 0); #ifdef TCSBRKP /* Probably Linux-specific: a positive third TCSBRKP ioctl argument is defined to be the number of 100ms units to break. */ - return ioctl(fd, TCSBRKP, (duration + 99) / 100); + return __ioctl(fd, TCSBRKP, (duration + 99) / 100); #else /* ioctl can't send a break of any other duration for us. This could be changed to use trickery (e.g. lower speed and @@ -96,7 +97,7 @@ int tcsendbreak( int fd, int duration) /* Set the foreground process group ID of FD set PGRP_ID. */ int tcsetpgrp ( int fd, pid_t pgrp_id) { - return ioctl (fd, TIOCSPGRP, &pgrp_id); + return __ioctl (fd, TIOCSPGRP, &pgrp_id); } #endif @@ -106,7 +107,7 @@ pid_t attribute_hidden __tcgetpgrp ( int fd) { int pgrp; - if (ioctl (fd, TIOCGPGRP, &pgrp) < 0) + if (__ioctl (fd, TIOCGPGRP, &pgrp) < 0) return (pid_t) -1; return (pid_t) pgrp; } diff --git a/libc/termios/ttyname.c b/libc/termios/ttyname.c index 43005a63a..5a5d2a225 100644 --- a/libc/termios/ttyname.c +++ b/libc/termios/ttyname.c @@ -1,3 +1,7 @@ +#define opendir __opendir +#define closedir __closedir +#define isatty __isatty + #include #include #include diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c index cd8a9de9c..233dbbac4 100644 --- a/libc/unistd/daemon.c +++ b/libc/unistd/daemon.c @@ -25,6 +25,7 @@ #define dup2 __dup2 #define setsid __setsid +#define chdir __chdir #include #include diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c index 9793d9ad4..052728d83 100644 --- a/libc/unistd/exec.c +++ b/libc/unistd/exec.c @@ -205,7 +205,7 @@ int execlp(const char *file, const char *arg, ...) } while (--n); va_end(args); - n = execvp(file, (char *const *) argv); + n = __execvp(file, (char *const *) argv); EXEC_FREE(argv, size); diff --git a/libc/unistd/getpass.c b/libc/unistd/getpass.c index 2b2d252c2..8a23c99bf 100644 --- a/libc/unistd/getpass.c +++ b/libc/unistd/getpass.c @@ -19,6 +19,7 @@ #define setvbuf __setvbuf #define tcsetattr __tcsetattr #define tcgetattr __tcgetattr +#define fileno __fileno #include #include diff --git a/libc/unistd/usershell.c b/libc/unistd/usershell.c index 40c8b9e24..2e1f75d38 100644 --- a/libc/unistd/usershell.c +++ b/libc/unistd/usershell.c @@ -31,6 +31,7 @@ */ #define __fsetlocking __fsetlocking_internal +#define fileno __fileno #define _GNU_SOURCE #include -- cgit v1.2.3