diff options
Diffstat (limited to 'libc/misc')
-rw-r--r-- | libc/misc/ftw/ftw.c | 1 | ||||
-rw-r--r-- | libc/misc/mntent/mntent.c | 11 | ||||
-rw-r--r-- | libc/misc/statfs/internal_statvfs.c | 15 | ||||
-rw-r--r-- | libc/misc/syslog/syslog.c | 5 | ||||
-rw-r--r-- | libc/misc/time/time.c | 45 | ||||
-rw-r--r-- | libc/misc/utmp/utent.c | 47 | ||||
-rw-r--r-- | libc/misc/wchar/wchar.c | 8 | ||||
-rw-r--r-- | libc/misc/wordexp/wordexp.c | 3 |
8 files changed, 79 insertions, 56 deletions
diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c index 6bd36d749..09a87e4be 100644 --- a/libc/misc/ftw/ftw.c +++ b/libc/misc/ftw/ftw.c @@ -26,6 +26,7 @@ #define tsearch __tsearch #define tdestroy __tdestroy #define fchdir __fchdir +#define getcwd __getcwd #define _GNU_SOURCE #include <features.h> diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c index 35767280e..81575a679 100644 --- a/libc/misc/mntent/mntent.c +++ b/libc/misc/mntent/mntent.c @@ -14,7 +14,7 @@ static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; #define UNLOCK __pthread_mutex_unlock(&mylock) /* Reentrant version of getmntent. */ -struct mntent *getmntent_r (FILE *filep, +struct mntent attribute_hidden *__getmntent_r (FILE *filep, struct mntent *mnt, char *buff, int bufsize) { char *cp, *ptrptr; @@ -61,6 +61,7 @@ struct mntent *getmntent_r (FILE *filep, return mnt; } +strong_alias(__getmntent_r,getmntent_r) struct mntent *getmntent(FILE * filep) { @@ -75,7 +76,7 @@ struct mntent *getmntent(FILE * filep) abort(); } - tmp = getmntent_r(filep, &mnt, buff, BUFSIZ); + tmp = __getmntent_r(filep, &mnt, buff, BUFSIZ); UNLOCK; return(tmp); } @@ -97,14 +98,16 @@ char *hasmntopt(const struct mntent *mnt, const char *opt) return strstr(mnt->mnt_opts, opt); } -FILE *setmntent(const char *name, const char *mode) +FILE attribute_hidden *__setmntent(const char *name, const char *mode) { return fopen(name, mode); } +strong_alias(__setmntent,setmntent) -int endmntent(FILE * filep) +int attribute_hidden __endmntent(FILE * filep) { if (filep != NULL) fclose(filep); return 1; } +strong_alias(__endmntent,endmntent) diff --git a/libc/misc/statfs/internal_statvfs.c b/libc/misc/statfs/internal_statvfs.c index 8f7e386c4..4e25edc3f 100644 --- a/libc/misc/statfs/internal_statvfs.c +++ b/libc/misc/statfs/internal_statvfs.c @@ -17,6 +17,13 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +extern FILE *__setmntent (__const char *__file, __const char *__mode) __THROW attribute_hidden; +extern struct mntent *__getmntent_r (FILE *__restrict __stream, + struct mntent *__restrict __result, + char *__restrict __buffer, + int __bufsize) __THROW attribute_hidden; +extern int __endmntent (FILE *__stream) __THROW attribute_hidden; + /* Now fill in the fields we have information for. */ buf->f_bsize = fsbuf.f_bsize; /* Linux does not support f_frsize, so set it to the full block size. */ @@ -57,15 +64,15 @@ struct mntent mntbuf; FILE *mtab; - mtab = setmntent ("/proc/mounts", "r"); + mtab = __setmntent ("/proc/mounts", "r"); if (mtab == NULL) - mtab = setmntent (_PATH_MOUNTED, "r"); + mtab = __setmntent (_PATH_MOUNTED, "r"); if (mtab != NULL) { char tmpbuf[1024]; - while (getmntent_r (mtab, &mntbuf, tmpbuf, sizeof (tmpbuf))) + while (__getmntent_r (mtab, &mntbuf, tmpbuf, sizeof (tmpbuf))) { struct stat fsst; @@ -102,7 +109,7 @@ } /* Close the file. */ - endmntent (mtab); + __endmntent (mtab); } __set_errno (save_errno); diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index 5605aecf1..129b2036e 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -31,9 +31,7 @@ * SUCH DAMAGE. */ -#define time __time #define ctime __ctime -#define sigaction __sigaction_internal #define __FORCE_GLIBC #define _GNU_SOURCE @@ -84,6 +82,7 @@ #include <ctype.h> #include <signal.h> +extern time_t __time (time_t *__timer) attribute_hidden; #ifdef __UCLIBC_HAS_THREADS__ # include <pthread.h> @@ -172,7 +171,7 @@ __vsyslog( int pri, const char *fmt, va_list ap ) * no longer than 64 characters plus length of the LogTag. So it's * safe to test only LogTag and use normal sprintf everywhere else. */ - (void)time(&now); + (void)__time(&now); stdp = p = tbuf + sprintf(tbuf, "<%d>%.15s ", pri, ctime(&now) + 4); if (LogTag) { if (__strlen(LogTag) < sizeof(tbuf) - 64) diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index 65b925cf6..59b3ef641 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -145,8 +145,21 @@ #include <locale.h> #include <bits/uClibc_uintmaxtostr.h> +extern void __tzset (void) __THROW attribute_hidden; + #ifdef __UCLIBC_HAS_XLOCALE__ #include <xlocale.h> +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; +extern size_t __strftime_l (char *__restrict __s, size_t __maxsize, + __const char *__restrict __format, + __const struct tm *__restrict __tp, + __locale_t __loc) __THROW attribute_hidden; + +extern char *__strptime_l (__const char *__restrict __s, + __const char *__restrict __fmt, struct tm *__tp, + __locale_t __loc) __THROW attribute_hidden; #endif #ifndef __isleap @@ -552,7 +565,7 @@ struct tm attribute_hidden *__localtime_r(register const time_t *__restrict time { TZLOCK; - tzset(); + __tzset(); __time_localtime_tzi(timer, result, _time_tzinfo); @@ -752,12 +765,13 @@ time_t timegm(struct tm *timeptr) #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -size_t strftime(char *__restrict s, size_t maxsize, +size_t attribute_hidden __strftime(char *__restrict s, size_t maxsize, const char *__restrict format, const struct tm *__restrict timeptr) { return __strftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE); } +strong_alias(__strftime,strftime) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -957,7 +971,7 @@ static int load_field(int k, const struct tm *__restrict timeptr) #warning TODO: Check multibyte format string validity. #endif -size_t __XL(strftime)(char *__restrict s, size_t maxsize, +size_t attribute_hidden __UCXL(strftime)(char *__restrict s, size_t maxsize, const char *__restrict format, const struct tm *__restrict timeptr __LOCALE_PARAM ) { @@ -977,7 +991,7 @@ size_t __XL(strftime)(char *__restrict s, size_t maxsize, unsigned char mod; unsigned char code; - tzset(); /* We'll, let's get this out of the way. */ + __tzset(); /* We'll, let's get this out of the way. */ lvl = 0; p = format; @@ -1240,7 +1254,7 @@ size_t __XL(strftime)(char *__restrict s, size_t maxsize, goto LOOP; } -__XL_ALIAS(strftime) +__UCXL_ALIAS(strftime) #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1258,11 +1272,12 @@ __XL_ALIAS(strftime) #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -char *strptime(const char *__restrict buf, const char *__restrict format, +char attribute_hidden *__strptime(const char *__restrict buf, const char *__restrict format, struct tm *__restrict tm) { return __strptime_l(buf, format, tm, __UCLIBC_CURLOCALE); } +strong_alias(__strptime,strptime) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1408,7 +1423,7 @@ static const unsigned char spec[] = { #define MAX_PUSH 4 -char *__XL(strptime)(const char *__restrict buf, const char *__restrict format, +char attribute_hidden *__UCXL(strptime)(const char *__restrict buf, const char *__restrict format, struct tm *__restrict tm __LOCALE_PARAM) { register const char *p; @@ -1501,7 +1516,7 @@ char *__XL(strptime)(const char *__restrict buf, const char *__restrict format, do { --j; o = __XL(nl_langinfo)(i+j __LOCALE_ARG); - if (!__XL(strncasecmp)(buf,o,__strlen(o) __LOCALE_ARG) && *o) { + if (!__UCXL(strncasecmp)(buf,o,__strlen(o) __LOCALE_ARG) && *o) { do { /* Found a match. */ ++buf; } while (*++o); @@ -1618,7 +1633,7 @@ char *__XL(strptime)(const char *__restrict buf, const char *__restrict format, return NULL; } -__XL_ALIAS(strptime) +__UCXL_ALIAS(strptime) #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1787,7 +1802,7 @@ static char *read_TZ_file(char *buf) #endif /* __UCLIBC_HAS_TZ_FILE__ */ -void tzset(void) +void attribute_hidden __tzset(void) { register const char *e; register char *s; @@ -1974,7 +1989,7 @@ void tzset(void) #endif TZUNLOCK; } - +strong_alias(__tzset,tzset) #endif /**********************************************************************/ /* #ifdef L_utime */ @@ -2176,7 +2191,7 @@ time_t attribute_hidden _time_mktime(struct tm *timeptr, int store_on_success) TZLOCK; - tzset(); + __tzset(); t = _time_mktime_tzi(timeptr, store_on_success, _time_tzinfo); @@ -2316,7 +2331,7 @@ time_t attribute_hidden _time_mktime_tzi(struct tm *timeptr, int store_on_succes extern size_t __wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, __const wchar_t *__restrict __format, __const struct tm *__restrict __timeptr, - __locale_t __loc) __THROW; + __locale_t __loc) __THROW attribute_hidden; size_t wcsftime(wchar_t *__restrict s, size_t maxsize, const wchar_t *__restrict format, @@ -2327,7 +2342,7 @@ size_t wcsftime(wchar_t *__restrict s, size_t maxsize, #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -size_t __XL(wcsftime)(wchar_t *__restrict s, size_t maxsize, +size_t attribute_hidden __UCXL(wcsftime)(wchar_t *__restrict s, size_t maxsize, const wchar_t *__restrict format, const struct tm *__restrict timeptr __LOCALE_PARAM ) { @@ -2335,7 +2350,7 @@ size_t __XL(wcsftime)(wchar_t *__restrict s, size_t maxsize, return 0; /* always fail */ } -__XL_ALIAS(wcsftime) +__UCXL_ALIAS(wcsftime) #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index e03d4528f..374b53b93 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -37,29 +37,7 @@ static struct utmp static_utmp; static const char default_file_name[] = _PATH_UTMP; static const char *static_ut_name = (const char *) default_file_name; - - -static struct utmp *__getutent(int utmp_fd) - -{ - if (utmp_fd == -1) { - setutent(); - } - if (utmp_fd == -1) { - return NULL; - } - - LOCK; - if (__read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) != sizeof(struct utmp)) - { - return NULL; - } - - UNLOCK; - return &static_utmp; -} - -void setutent(void) +void attribute_hidden __setutent(void) { int ret; @@ -87,6 +65,26 @@ bummer: UNLOCK; return; } +strong_alias(__setutent,setutent) + +static struct utmp *__getutent(int utmp_fd) +{ + if (utmp_fd == -1) { + __setutent(); + } + if (utmp_fd == -1) { + return NULL; + } + + LOCK; + if (__read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) != sizeof(struct utmp)) + { + return NULL; + } + + UNLOCK; + return &static_utmp; +} void endutent(void) { @@ -148,8 +146,6 @@ struct utmp *getutline(const struct utmp *utmp_entry) return NULL; } -extern struct utmp *__getutid (__const struct utmp *__id) attribute_hidden; - struct utmp *pututline (const struct utmp *utmp_entry) { LOCK; @@ -190,4 +186,3 @@ int utmpname (const char *new_ut_name) UNLOCK; return 0; } - diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 1691e00e0..1a16fc9d6 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -1267,7 +1267,7 @@ static int find_codeset(const char *name) int codeset; for (s = __iconv_codesets ; *s ; s += *s) { - if (!strcasecmp(s+2, name)) { + if (!__strcasecmp(s+2, name)) { return s[1]; } } @@ -1280,7 +1280,7 @@ static int find_codeset(const char *name) s = __LOCALE_DATA_CODESET_LIST; do { ++codeset; /* Increment codeset first. */ - if (!strcasecmp(__LOCALE_DATA_CODESET_LIST+*s, name)) { + if (!__strcasecmp(__LOCALE_DATA_CODESET_LIST+*s, name)) { return codeset; } } while (*++s); @@ -1618,7 +1618,7 @@ int main(int argc, char **argv) break; } do { - if ((s = __strchr(opt_chars,*p)) == NULL) { + if ((s = strchr(opt_chars,*p)) == NULL) { USAGE: s = basename(progname); fprintf(stderr, @@ -1695,7 +1695,7 @@ int main(int argc, char **argv) } } if (ni) { /* still bytes in buffer! */ - __memmove(ibuf, pi, ni); + memmove(ibuf, pi, ni); } } diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index 9cdeaf162..d8bf785d3 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -27,7 +27,10 @@ #define waitpid __waitpid #define kill __kill #define getuid __getuid +#define getpwnam_r __getpwnam_r +#define getpwuid_r __getpwuid_r #define execve __execve +#define dup2 __dup2 #define _GNU_SOURCE #include <sys/cdefs.h> |