diff options
48 files changed, 342 insertions, 208 deletions
diff --git a/Makefile.in b/Makefile.in index 2515880c8..8f65678dd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -93,6 +93,9 @@ headers: include/bits/uClibc_config.h $(RM) include/bits/sysnum.h; \ mv -f include/bits/sysnum.h.new include/bits/sysnum.h; \ fi +ifeq ($(UCLIBC_HAS_LOCALE),y) + $(MAKE) locale_headers +endif pregen: headers diff --git a/extra/locale/Makefile.in b/extra/locale/Makefile.in index 0b17ffb1e..deaa74110 100644 --- a/extra/locale/Makefile.in +++ b/extra/locale/Makefile.in @@ -38,7 +38,8 @@ locale_OBJ := $(locale_OUT)/locale_data.o CFLAGS-locale_data.c := -D__WCHAR_ENABLED -I$(locale_OUT) -I$(locale_DIR) -headers-$(UCLIBC_HAS_LOCALE) += locale_headers +# produces a loop +#headers-$(UCLIBC_HAS_LOCALE) += locale_headers libc-a-$(UCLIBC_HAS_LOCALE) += $(locale_OBJ) libc-so-$(UCLIBC_HAS_LOCALE) += $(locale_OBJ:.o=.os) diff --git a/include/libc-internal.h b/include/libc-internal.h index 469f5eba5..feb27b812 100644 --- a/include/libc-internal.h +++ b/include/libc-internal.h @@ -120,6 +120,16 @@ #ifndef __ASSEMBLER__ # ifdef IS_IN_libc +# define __UC(N) __ ## N +# define __UC_ALIAS(N) strong_alias( __ ## N , N ) +# if defined __UCLIBC_HAS_XLOCALE__ && defined __UCLIBC_DO_XLOCALE +# define __UCXL(N) __ ## N ## _l +# define __UCXL_ALIAS(N) strong_alias ( __ ## N ## _l , N ## _l ) +# else +# define __UCXL(N) __UC(N) +# define __UCXL_ALIAS(N) __UC_ALIAS(N) +# endif + # include <bits/types.h> # ifndef __ssize_t_defined @@ -132,6 +142,9 @@ typedef __ssize_t ssize_t; # include <bits/sigset.h> +/* sources are built w/ _GNU_SOURCE, this gets undefined */ +extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen); + /* prototypes for internal use, please keep these in sync w/ updated headers */ /* #include <fcntl.h> */ extern int __open(__const char *__file, int __oflag, ...) attribute_hidden; @@ -151,6 +164,8 @@ extern char *__strncpy (char *__restrict __dest, extern char *__strchr (__const char *__s, int __c) attribute_hidden; extern int __strncmp (__const char *__s1, __const char *__s2, size_t __n) attribute_hidden; extern char *__strdup (__const char *__s) attribute_hidden; +extern int __strcasecmp (__const char *__s1, __const char *__s2) attribute_hidden; +extern int __strncasecmp (__const char *__s1, __const char *__s2, size_t __n) attribute_hidden; /* #include <unistd.h> */ extern ssize_t __read(int __fd, void *__buf, size_t __nbytes) attribute_hidden; @@ -158,6 +173,9 @@ extern ssize_t __write(int __fd, __const void *__buf, size_t __n) attribute_hidd extern int __close(int __fd) attribute_hidden; extern __pid_t __getpid (void) attribute_hidden; +/* #include <stdio.h> */ +extern void __perror (__const char *__s) attribute_hidden; + /* #include <stdlib.h> */ extern char *__getenv (__const char *__name) attribute_hidden; diff --git a/include/wchar.h b/include/wchar.h index ed83ccc4a..bd6447b96 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -180,13 +180,9 @@ extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2, extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, __locale_t __loc) __THROW; -extern int __wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, - __locale_t __loc) __THROW; extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n, __locale_t __loc) __THROW; -extern int __wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, - size_t __n, __locale_t __loc) __THROW; #endif /* __UCLIBC_HAS_XLOCALE__ */ #endif @@ -210,16 +206,12 @@ __END_NAMESPACE_C99 LC_COLLATE category of the given locale. */ extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2, __locale_t __loc) __THROW; -extern int __wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2, - __locale_t __loc) __THROW; /* Transform S2 into array pointed to by S1 such that if wcscmp is applied to two transformed strings the result is the as applying `wcscoll' to the original strings. */ extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, size_t __n, __locale_t __loc) __THROW; -extern size_t __wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, - size_t __n, __locale_t __loc) __THROW; #endif /* __UCLIBC_HAS_XLOCALE__ */ @@ -466,58 +458,34 @@ extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr, extern long int wcstol_l (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc) __THROW; -extern long int __wcstol_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, int __base, - __locale_t __loc) __THROW; extern unsigned long int wcstoul_l (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc) __THROW; -extern unsigned long int __wcstoul_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, - int __base, __locale_t __loc) __THROW; __extension__ extern long long int wcstoll_l (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc) __THROW; -__extension__ -extern long long int __wcstoll_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, - int __base, __locale_t __loc) __THROW; __extension__ extern unsigned long long int wcstoull_l (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc) __THROW; -__extension__ -extern unsigned long long int __wcstoull_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, - int __base, __locale_t __loc) - __THROW; #ifdef __UCLIBC_HAS_FLOATS__ extern double wcstod_l (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, __locale_t __loc) __THROW; -extern double __wcstod_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, __locale_t __loc) - __THROW; extern float wcstof_l (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, __locale_t __loc) __THROW; -extern float __wcstof_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, __locale_t __loc) - __THROW; extern long double wcstold_l (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, __locale_t __loc) __THROW; -extern long double __wcstold_l (__const wchar_t *__restrict __nptr, - wchar_t **__restrict __endptr, - __locale_t __loc) __THROW; #endif /* __UCLIBC_HAS_FLOATS__ */ #endif /* __UCLIBC_HAS_XLOCALE__ */ #endif /* GNU */ @@ -763,10 +731,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, __const wchar_t *__restrict __format, __const struct tm *__restrict __tp, __locale_t __loc) __THROW; -extern size_t __wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, - __const wchar_t *__restrict __format, - __const struct tm *__restrict __tp, - __locale_t __loc) __THROW; #endif /* __UCLIBC_HAS_XLOCALE__ */ # endif diff --git a/include/wctype.h b/include/wctype.h index 688c1fd46..266ffab38 100644 --- a/include/wctype.h +++ b/include/wctype.h @@ -48,7 +48,6 @@ typedef unsigned int wint_t; # ifdef __USE_ISOC99 __USING_NAMESPACE_C99(wint_t) # endif -__END_NAMESPACE_C99 # endif /* Constant expression of type `wint_t' whose value does not correspond @@ -322,23 +321,6 @@ extern wctrans_t wctrans_l (__const char *__property, __locale_t __locale) extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc, __locale_t __locale) __THROW; -extern int __iswalnum_l(wint_t __wc, __locale_t __locale) __THROW; -extern int __iswalpha_l(wint_t __wc, __locale_t __locale) __THROW; -extern int __iswblank_l(wint_t __wc, __locale_t __locale) __THROW; -extern int __iswcntrl_l(wint_t __wc, __locale_t __locale) __THROW; -extern int __iswdigit_l(wint_t __wc, __locale_t __locale) __THROW; -extern int __iswgraph_l(wint_t __wc, __locale_t __locale) __THROW; -extern int __iswlower_l(wint_t __wc, __locale_t __locale) __THROW; -extern int __iswprint_l(wint_t __wc, __locale_t __locale) __THROW; -extern int __iswpunct_l(wint_t __wc, __locale_t __locale) __THROW; -extern int __iswspace_l(wint_t __wc, __locale_t __locale) __THROW; -extern int __iswupper_l(wint_t __wc, __locale_t __locale) __THROW; -extern int __iswxdigit_l(wint_t __wc, __locale_t __locale) __THROW; -extern wint_t __towlower_l(wint_t __wc, __locale_t __locale) __THROW; -extern wint_t __towupper_l(wint_t __wc, __locale_t __locale) __THROW; -extern int __iswctype_l(wint_t __wc, wctype_t __desc, __locale_t __locale) __THROW; -extern wctrans_t __wctrans_l(const char *__property, __locale_t __locale) __THROW; -extern wint_t __towctrans_l(wint_t __wc, wctrans_t __desc, __locale_t __locale) __THROW; # endif /* Use GNU. */ __END_DECLS 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> diff --git a/libc/pwd_grp/pwd_grp.c b/libc/pwd_grp/pwd_grp.c index 601568599..ced5051f8 100644 --- a/libc/pwd_grp/pwd_grp.c +++ b/libc/pwd_grp/pwd_grp.c @@ -18,6 +18,8 @@ * */ +#define setgroups __setgroups + #define _GNU_SOURCE #include <features.h> #include <stdio.h> @@ -38,6 +40,15 @@ #include <pthread.h> #endif +extern int __getspnam_r (__const char *__name, struct spwd *__result_buf, + char *__buffer, size_t __buflen, + struct spwd **__result) attribute_hidden; + +extern int __getpwuid_r (__uid_t __uid, + struct passwd *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct passwd **__restrict __result) attribute_hidden; + /**********************************************************************/ /* Sizes for staticly allocated buffers. */ @@ -73,7 +84,7 @@ extern int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data, /**********************************************************************/ #ifdef L_fgetpwent_r -int fgetpwent_r(FILE *__restrict stream, struct passwd *__restrict resultbuf, +int attribute_hidden __fgetpwent_r(FILE *__restrict stream, struct passwd *__restrict resultbuf, char *__restrict buffer, size_t buflen, struct passwd **__restrict result) { @@ -87,12 +98,13 @@ int fgetpwent_r(FILE *__restrict stream, struct passwd *__restrict resultbuf, return rv; } +strong_alias(__fgetpwent_r,fgetpwent_r) #endif /**********************************************************************/ #ifdef L_fgetgrent_r -int fgetgrent_r(FILE *__restrict stream, struct group *__restrict resultbuf, +int attribute_hidden __fgetgrent_r(FILE *__restrict stream, struct group *__restrict resultbuf, char *__restrict buffer, size_t buflen, struct group **__restrict result) { @@ -106,12 +118,13 @@ int fgetgrent_r(FILE *__restrict stream, struct group *__restrict resultbuf, return rv; } +strong_alias(__fgetgrent_r,fgetgrent_r) #endif /**********************************************************************/ #ifdef L_fgetspent_r -int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, +int attribute_hidden __fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, char *__restrict buffer, size_t buflen, struct spwd **__restrict result) { @@ -125,6 +138,7 @@ int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, return rv; } +strong_alias(__fgetspent_r,fgetspent_r) #endif /**********************************************************************/ @@ -134,13 +148,18 @@ int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, /**********************************************************************/ #ifdef L_fgetpwent +extern int __fgetpwent_r (FILE *__restrict __stream, + struct passwd *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct passwd **__restrict __result) attribute_hidden; + struct passwd *fgetpwent(FILE *stream) { static char buffer[PWD_BUFFER_SIZE]; static struct passwd resultbuf; struct passwd *result; - fgetpwent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); + __fgetpwent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -148,13 +167,18 @@ struct passwd *fgetpwent(FILE *stream) /**********************************************************************/ #ifdef L_fgetgrent +extern int __fgetgrent_r (FILE *__restrict __stream, + struct group *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct group **__restrict __result) attribute_hidden; + struct group *fgetgrent(FILE *stream) { static char buffer[GRP_BUFFER_SIZE]; static struct group resultbuf; struct group *result; - fgetgrent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); + __fgetgrent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -162,13 +186,17 @@ struct group *fgetgrent(FILE *stream) /**********************************************************************/ #ifdef L_fgetspent +extern int __fgetspent_r (FILE *__stream, struct spwd *__result_buf, + char *__buffer, size_t __buflen, + struct spwd **__result) attribute_hidden; + struct spwd *fgetspent(FILE *stream) { static char buffer[PWD_BUFFER_SIZE]; static struct spwd resultbuf; struct spwd *result; - fgetspent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); + __fgetspent_r(stream, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -176,7 +204,7 @@ struct spwd *fgetspent(FILE *stream) /**********************************************************************/ #ifdef L_sgetspent_r -int sgetspent_r(const char *string, struct spwd *result_buf, +int attribute_hidden __sgetspent_r(const char *string, struct spwd *result_buf, char *buffer, size_t buflen, struct spwd **result) { int rv = ERANGE; @@ -203,6 +231,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf, DONE: return rv; } +strong_alias(__sgetspent_r,sgetspent_r) #endif /**********************************************************************/ @@ -212,9 +241,10 @@ int sgetspent_r(const char *string, struct spwd *result_buf, #endif #ifdef L_getpwnam_r -#define GETXXKEY_R_FUNC getpwnam_r +#define GETXXKEY_R_FUNC_HIDDEN __getpwnam_r +#define GETXXKEY_R_FUNC getpwnam_r #define GETXXKEY_R_PARSER __parsepwent -#define GETXXKEY_R_ENTTYPE struct passwd +#define GETXXKEY_R_ENTTYPE struct passwd #define GETXXKEY_R_TEST(ENT) (!__strcmp((ENT)->pw_name, key)) #define DO_GETXXKEY_R_KEYTYPE const char *__restrict #define DO_GETXXKEY_R_PATHNAME _PATH_PASSWD @@ -222,9 +252,10 @@ int sgetspent_r(const char *string, struct spwd *result_buf, #endif #ifdef L_getgrnam_r -#define GETXXKEY_R_FUNC getgrnam_r +#define GETXXKEY_R_FUNC_HIDDEN __getgrnam_r +#define GETXXKEY_R_FUNC getgrnam_r #define GETXXKEY_R_PARSER __parsegrent -#define GETXXKEY_R_ENTTYPE struct group +#define GETXXKEY_R_ENTTYPE struct group #define GETXXKEY_R_TEST(ENT) (!__strcmp((ENT)->gr_name, key)) #define DO_GETXXKEY_R_KEYTYPE const char *__restrict #define DO_GETXXKEY_R_PATHNAME _PATH_GROUP @@ -232,9 +263,10 @@ int sgetspent_r(const char *string, struct spwd *result_buf, #endif #ifdef L_getspnam_r -#define GETXXKEY_R_FUNC getspnam_r +#define GETXXKEY_R_FUNC_HIDDEN __getspnam_r +#define GETXXKEY_R_FUNC getspnam_r #define GETXXKEY_R_PARSER __parsespent -#define GETXXKEY_R_ENTTYPE struct spwd +#define GETXXKEY_R_ENTTYPE struct spwd #define GETXXKEY_R_TEST(ENT) (!__strcmp((ENT)->sp_namp, key)) #define DO_GETXXKEY_R_KEYTYPE const char *__restrict #define DO_GETXXKEY_R_PATHNAME _PATH_SHADOW @@ -242,9 +274,10 @@ int sgetspent_r(const char *string, struct spwd *result_buf, #endif #ifdef L_getpwuid_r -#define GETXXKEY_R_FUNC getpwuid_r +#define GETXXKEY_R_FUNC_HIDDEN __getpwuid_r +#define GETXXKEY_R_FUNC getpwuid_r #define GETXXKEY_R_PARSER __parsepwent -#define GETXXKEY_R_ENTTYPE struct passwd +#define GETXXKEY_R_ENTTYPE struct passwd #define GETXXKEY_R_TEST(ENT) ((ENT)->pw_uid == key) #define DO_GETXXKEY_R_KEYTYPE uid_t #define DO_GETXXKEY_R_PATHNAME _PATH_PASSWD @@ -252,9 +285,10 @@ int sgetspent_r(const char *string, struct spwd *result_buf, #endif #ifdef L_getgrgid_r -#define GETXXKEY_R_FUNC getgrgid_r +#define GETXXKEY_R_FUNC_HIDDEN __getgrgid_r +#define GETXXKEY_R_FUNC getgrgid_r #define GETXXKEY_R_PARSER __parsegrent -#define GETXXKEY_R_ENTTYPE struct group +#define GETXXKEY_R_ENTTYPE struct group #define GETXXKEY_R_TEST(ENT) ((ENT)->gr_gid == key) #define DO_GETXXKEY_R_KEYTYPE gid_t #define DO_GETXXKEY_R_PATHNAME _PATH_GROUP @@ -270,7 +304,7 @@ struct passwd *getpwuid(uid_t uid) static struct passwd resultbuf; struct passwd *result; - getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result); + __getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -278,13 +312,17 @@ struct passwd *getpwuid(uid_t uid) /**********************************************************************/ #ifdef L_getgrgid +extern int __getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct group **__restrict __result) attribute_hidden; + struct group *getgrgid(gid_t gid) { static char buffer[GRP_BUFFER_SIZE]; static struct group resultbuf; struct group *result; - getgrgid_r(gid, &resultbuf, buffer, sizeof(buffer), &result); + __getgrgid_r(gid, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -306,8 +344,8 @@ int getspuid_r(uid_t uid, struct spwd *__restrict resultbuf, char pwd_buff[PWD_BUFFER_SIZE]; *result = NULL; - if (!(rv = getpwuid_r(uid, &password, pwd_buff, sizeof(pwd_buff), &pp))) { - rv = getspnam_r(password.pw_name, resultbuf, buffer, buflen, result); + if (!(rv = __getpwuid_r(uid, &password, pwd_buff, sizeof(pwd_buff), &pp))) { + rv = __getspnam_r(password.pw_name, resultbuf, buffer, buflen, result); } return rv; @@ -334,13 +372,18 @@ struct spwd *getspuid(uid_t uid) /**********************************************************************/ #ifdef L_getpwnam +extern int __getpwnam_r (__const char *__restrict __name, + struct passwd *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct passwd **__restrict __result) attribute_hidden; + struct passwd *getpwnam(const char *name) { static char buffer[PWD_BUFFER_SIZE]; static struct passwd resultbuf; struct passwd *result; - getpwnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); + __getpwnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -348,13 +391,18 @@ struct passwd *getpwnam(const char *name) /**********************************************************************/ #ifdef L_getgrnam +extern int __getgrnam_r (__const char *__restrict __name, + struct group *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct group **__restrict __result) attribute_hidden; + struct group *getgrnam(const char *name) { static char buffer[GRP_BUFFER_SIZE]; static struct group resultbuf; struct group *result; - getgrnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); + __getgrnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -368,7 +416,7 @@ struct spwd *getspnam(const char *name) static struct spwd resultbuf; struct spwd *result; - getspnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); + __getspnam_r(name, &resultbuf, buffer, sizeof(buffer), &result); return result; } @@ -384,7 +432,7 @@ int getpw(uid_t uid, char *buf) if (!buf) { __set_errno(EINVAL); - } else if (!getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result)) { + } else if (!__getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result)) { if (sprintf(buf, "%s:%s:%lu:%lu:%s:%s:%s\n", resultbuf.pw_name, resultbuf.pw_passwd, (unsigned long)(resultbuf.pw_uid), @@ -434,7 +482,7 @@ void endpwent(void) } -int getpwent_r(struct passwd *__restrict resultbuf, +int attribute_hidden __getpwent_r(struct passwd *__restrict resultbuf, char *__restrict buffer, size_t buflen, struct passwd **__restrict result) { @@ -462,6 +510,7 @@ int getpwent_r(struct passwd *__restrict resultbuf, return rv; } +strong_alias(__getpwent_r,getpwent_r) #endif /**********************************************************************/ @@ -488,7 +537,7 @@ void endgrent(void) UNLOCK; } -int getgrent_r(struct group *__restrict resultbuf, +int attribute_hidden __getgrent_r(struct group *__restrict resultbuf, char *__restrict buffer, size_t buflen, struct group **__restrict result) { @@ -516,6 +565,7 @@ int getgrent_r(struct group *__restrict resultbuf, return rv; } +strong_alias(__getgrent_r,getgrent_r) #endif /**********************************************************************/ @@ -542,7 +592,7 @@ void endspent(void) UNLOCK; } -int getspent_r(struct spwd *resultbuf, char *buffer, +int attribute_hidden __getspent_r(struct spwd *resultbuf, char *buffer, size_t buflen, struct spwd **result) { int rv; @@ -569,10 +619,15 @@ int getspent_r(struct spwd *resultbuf, char *buffer, return rv; } +strong_alias(__getspent_r,getspent_r) #endif /**********************************************************************/ #ifdef L_getpwent + +extern int __getpwent_r (struct passwd *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct passwd **__restrict __result) attribute_hidden; struct passwd *getpwent(void) { @@ -580,7 +635,7 @@ struct passwd *getpwent(void) static struct passwd pwd; struct passwd *result; - getpwent_r(&pwd, line_buff, sizeof(line_buff), &result); + __getpwent_r(&pwd, line_buff, sizeof(line_buff), &result); return result; } @@ -588,13 +643,17 @@ struct passwd *getpwent(void) /**********************************************************************/ #ifdef L_getgrent +extern int __getgrent_r (struct group *__restrict __resultbuf, + char *__restrict __buffer, size_t __buflen, + struct group **__restrict __result) attribute_hidden; + struct group *getgrent(void) { static char line_buff[GRP_BUFFER_SIZE]; static struct group gr; struct group *result; - getgrent_r(&gr, line_buff, sizeof(line_buff), &result); + __getgrent_r(&gr, line_buff, sizeof(line_buff), &result); return result; } @@ -602,13 +661,16 @@ struct group *getgrent(void) /**********************************************************************/ #ifdef L_getspent +extern int __getspent_r (struct spwd *__result_buf, char *__buffer, + size_t __buflen, struct spwd **__result) attribute_hidden; + struct spwd *getspent(void) { static char line_buff[PWD_BUFFER_SIZE]; static struct spwd spwd; struct spwd *result; - getspent_r(&spwd, line_buff, sizeof(line_buff), &result); + __getspent_r(&spwd, line_buff, sizeof(line_buff), &result); return result; } @@ -616,13 +678,17 @@ struct spwd *getspent(void) /**********************************************************************/ #ifdef L_sgetspent +extern int __sgetspent_r (__const char *__string, struct spwd *__result_buf, + char *__buffer, size_t __buflen, + struct spwd **__result) attribute_hidden; + struct spwd *sgetspent(const char *string) { static char line_buff[PWD_BUFFER_SIZE]; static struct spwd spwd; struct spwd *result; - sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result); + __sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result); return result; } diff --git a/libc/pwd_grp/pwd_grp_internal.c b/libc/pwd_grp/pwd_grp_internal.c index 0552c680b..8520cf45b 100644 --- a/libc/pwd_grp/pwd_grp_internal.c +++ b/libc/pwd_grp/pwd_grp_internal.c @@ -55,7 +55,7 @@ /**********************************************************************/ #ifdef GETXXKEY_R_FUNC -int GETXXKEY_R_FUNC(DO_GETXXKEY_R_KEYTYPE key, +int attribute_hidden GETXXKEY_R_FUNC_HIDDEN(DO_GETXXKEY_R_KEYTYPE key, GETXXKEY_R_ENTTYPE *__restrict resultbuf, char *__restrict buffer, size_t buflen, GETXXKEY_R_ENTTYPE **__restrict result) @@ -89,9 +89,11 @@ int GETXXKEY_R_FUNC(DO_GETXXKEY_R_KEYTYPE key, return rv; } +strong_alias(GETXXKEY_R_FUNC_HIDDEN,GETXXKEY_R_FUNC) #endif /**********************************************************************/ +#undef GETXXKEY_R_FUNC_HIDDEN #undef GETXXKEY_R_FUNC #undef GETXXKEY_R_PARSER #undef GETXXKEY_R_ENTTYPE diff --git a/libc/signal/sigfillset.c b/libc/signal/sigfillset.c index 143fd5cad..84862cfa2 100644 --- a/libc/signal/sigfillset.c +++ b/libc/signal/sigfillset.c @@ -30,7 +30,7 @@ __sigfillset_internal (sigset_t *set) return -1; } - memset (set, 0xff, sizeof (sigset_t)); + __memset (set, 0xff, sizeof (sigset_t)); /* If the implementation uses a cancellation signal don't set the bit. */ #ifdef SIGCANCEL diff --git a/libc/stdio/perror.c b/libc/stdio/perror.c index 26a0cebd9..d69ccd5c3 100644 --- a/libc/stdio/perror.c +++ b/libc/stdio/perror.c @@ -11,7 +11,7 @@ #warning CONSIDER: Increase buffer size for error message (non-%m case)? #endif -void perror(register const char *s) +void attribute_hidden __perror(register const char *s) { /* If the program is calling perror, it's a safe bet that printf and * friends are used as well. It is also possible that the calling @@ -34,3 +34,4 @@ void perror(register const char *s) } #endif } +strong_alias(__perror,perror) diff --git a/libc/stdio/popen.c b/libc/stdio/popen.c index 2e9985a39..00c2d7bb1 100644 --- a/libc/stdio/popen.c +++ b/libc/stdio/popen.c @@ -16,6 +16,7 @@ #define waitpid __waitpid #define execl __execl +#define dup2 __dup2 #include <stdio.h> #include <stdlib.h> diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index 98db1c3ac..c70cae4a1 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -47,6 +47,8 @@ #define mbsrtowcs __mbsrtowcs #define mbrtowc __mbrtowc #define ungetc __ungetc +#define ungetwc __ungetwc +#define wcrtomb __wcrtomb #define _ISOC99_SOURCE /* for LLONG_MAX primarily... */ #define _GNU_SOURCE diff --git a/libc/stdio/ungetwc.c b/libc/stdio/ungetwc.c index cf4b9c488..c6a99dd9d 100644 --- a/libc/stdio/ungetwc.c +++ b/libc/stdio/ungetwc.c @@ -12,7 +12,7 @@ * as reset stream->__ungot_width[1] for use by _stdio_adjpos(). */ -wint_t ungetwc(wint_t c, register FILE *stream) +wint_t attribute_hidden __ungetwc(wint_t c, register FILE *stream) { __STDIO_AUTO_THREADLOCK_VAR; @@ -46,3 +46,4 @@ wint_t ungetwc(wint_t c, register FILE *stream) return c; } +strong_alias(__ungetwc,ungetwc) diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c index e3f389a6b..5275f53f7 100644 --- a/libc/stdio/vfprintf.c +++ b/libc/stdio/vfprintf.c @@ -93,6 +93,8 @@ #define wcsnlen __wcsnlen #define wcsrtombs __wcsrtombs #define mbsrtowcs __mbsrtowcs +#define btowc __btowc +#define wcrtomb __wcrtomb #define _ISOC99_SOURCE /* for ULLONG primarily... */ #define _GNU_SOURCE diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index d4e99a035..8cac95783 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -62,7 +62,7 @@ extern const char _ptyname2[]; /* Store at most BUFLEN characters of the pathname of the slave pseudo terminal associated with the master FD is open on in BUF. Return 0 on success, otherwise an error number. */ -int ptsname_r (int fd, char *buf, size_t buflen) +int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen) { int save_errno = errno; #if !defined __UNIX98PTY_ONLY__ @@ -179,6 +179,7 @@ int ptsname_r (int fd, char *buf, size_t buflen) errno = save_errno; return 0; } +strong_alias(__ptsname_r,ptsname_r) /* Return the pathname of the pseudo terminal slave assoicated with the master FD is open on, or NULL on errors. @@ -188,5 +189,5 @@ ptsname (int fd) { static char buffer[sizeof (_PATH_DEVPTS) + 20]; - return ptsname_r (fd, buffer, sizeof (buffer)) != 0 ? NULL : buffer; + return __ptsname_r (fd, buffer, sizeof (buffer)) != 0 ? NULL : buffer; } diff --git a/libc/stdlib/realpath.c b/libc/stdlib/realpath.c index 7266ba4c6..88677f7a7 100644 --- a/libc/stdlib/realpath.c +++ b/libc/stdlib/realpath.c @@ -13,6 +13,9 @@ * GNU Library Public License for more details. */ +#define readlink __readlink +#define getcwd __getcwd + #ifdef HAVE_CONFIG_H #include <config.h> #endif diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 04c85d32f..09524d013 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -36,6 +36,7 @@ #define mbsrtowcs __mbsrtowcs #define mbrtowc __mbrtowc #define mbrlen __mbrlen +#define wcrtomb __wcrtomb #define _ISOC99_SOURCE /* for ULLONG primarily... */ #define _GNU_SOURCE diff --git a/libc/stdlib/unix_grantpt.c b/libc/stdlib/unix_grantpt.c index 1f1c4df5c..e087d18c8 100644 --- a/libc/stdlib/unix_grantpt.c +++ b/libc/stdlib/unix_grantpt.c @@ -22,6 +22,7 @@ #define getuid __getuid #define setrlimit __setrlimit #define waitpid __waitpid +#define dup2 __dup2 #include <assert.h> #include <errno.h> @@ -43,7 +44,7 @@ #define vfork fork #endif -extern int ptsname_r (int fd, char *buf, size_t buflen); +extern int __ptsname_r (int fd, char *buf, size_t buflen) attribute_hidden; /* Return the result of ptsname_r in the buffer pointed to by PTS, which should be of length BUF_LEN. If it is too long to fit in @@ -61,7 +62,7 @@ pts_name (int fd, char **pts, size_t buf_len) if (buf_len) { - rv = ptsname_r (fd, buf, buf_len); + rv = __ptsname_r (fd, buf, buf_len); if (rv != 0 || memchr (buf, '\0', buf_len)) /* We either got an error, or we succeeded and the diff --git a/libc/string/arm/strcmp.S b/libc/string/arm/strcmp.S index 6913906ee..4e2e3f5b5 100644 --- a/libc/string/arm/strcmp.S +++ b/libc/string/arm/strcmp.S @@ -29,6 +29,8 @@ * by Erik Andersen <andersen@codepoet.org> */ +#include <locale.h> + .global strcmp .set strcmp,__strcmp .text @@ -48,5 +50,7 @@ __strcmp: mov pc, lr .size __strcmp,.-__strcmp -.weak strcoll ; strcoll = strcmp -.global __strcoll ; __strcoll = strcoll +#ifdef __LOCALE_C_ONLY +.weak __strcoll ; __strcoll = __strcmp +.global strcoll ; .set strcoll,__strcoll +#endif diff --git a/libc/string/generic/strtok_r.c b/libc/string/generic/strtok_r.c index 6daa68124..56eb64bb9 100644 --- a/libc/string/generic/strtok_r.c +++ b/libc/string/generic/strtok_r.c @@ -36,10 +36,7 @@ x = strtok_r(NULL, "=", &sp); // x = NULL // s = "abc\0-def\0" */ -char attribute_hidden *__strtok_r (s, delim, save_ptr) - char *s; - const char *delim; - char **save_ptr; +char attribute_hidden *__strtok_r (char *s, const char *delim, char **save_ptr) { char *token; diff --git a/libc/string/strcmp.c b/libc/string/strcmp.c index 654ca302a..5cdbe6f73 100644 --- a/libc/string/strcmp.c +++ b/libc/string/strcmp.c @@ -13,7 +13,7 @@ strong_alias(__strcmp, strcmp) #ifdef __LOCALE_C_ONLY weak_alias(__strcmp, __strcoll) -strong_alias(__strcoll, strcoll) +weak_alias(__strcmp, strcoll) #endif #undef L_strcmp diff --git a/libc/string/strlcpy.c b/libc/string/strlcpy.c index ebf135490..24786c31a 100644 --- a/libc/string/strlcpy.c +++ b/libc/string/strlcpy.c @@ -12,7 +12,8 @@ strong_alias(__strlcpy, strlcpy) #ifdef __LOCALE_C_ONLY -weak_alias(strlcpy, strxfrm) +weak_alias(__strlcpy, __strxfrm) +strong_alias(__strxfrm, strxfrm) #endif #undef L_strlcpy diff --git a/libc/string/wcscmp.c b/libc/string/wcscmp.c index 5501a4dac..505148140 100644 --- a/libc/string/wcscmp.c +++ b/libc/string/wcscmp.c @@ -14,7 +14,7 @@ strong_alias(__wcscmp, wcscmp) #ifdef __LOCALE_C_ONLY weak_alias(__wcscmp, __wcscoll) -strong_alias(__wcscoll, wcscoll) +weak_alias(__wcscmp, wcscoll) #endif #undef L_strcmp diff --git a/libc/string/wstring.c b/libc/string/wstring.c index f1aaf9c8d..b7c0d0124 100644 --- a/libc/string/wstring.c +++ b/libc/string/wstring.c @@ -65,6 +65,11 @@ extern size_t __strnlen (__const char *__string, size_t __maxlen) attribute_hidd extern char *__strpbrk (__const char *__s, __const char *__accept) attribute_hidden; extern size_t __strspn (__const char *__s, __const char *__accept) attribute_hidden; extern char *__strsignal (int __sig) attribute_hidden; +extern char *__strtok_r (char *__restrict __s, + __const char *__restrict __delim, + char **__restrict __save_ptr) attribute_hidden; +extern size_t __strlcpy(char *__restrict dst, const char *__restrict src, + size_t n) attribute_hidden; #ifdef WANT_WIDE extern wchar_t *__wcsdup (__const wchar_t *__s) attribute_hidden; @@ -73,6 +78,22 @@ extern wchar_t *__wcscpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src) attribute_hidden; extern size_t __wcsspn (__const wchar_t *__wcs, __const wchar_t *__accept) attribute_hidden; extern wchar_t *__wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept) attribute_hidden; +extern int __wcscmp (__const wchar_t *__s1, __const wchar_t *__s2) attribute_hidden; +extern size_t __wcsxfrm (wchar_t *__restrict __s1, + __const wchar_t *__restrict __s2, size_t __n) attribute_hidden; +#endif +#ifdef __UCLIBC_HAS_XLOCALE__ +extern int __strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l) attribute_hidden; +extern size_t __strxfrm_l (char *__dest, __const char *__src, size_t __n, __locale_t __l) attribute_hidden; +extern int __strcasecmp_l (__const char *__s1, __const char *__s2, __locale_t __loc) attribute_hidden; +extern int __strncasecmp_l (__const char *__s1, __const char *__s2, size_t __n, __locale_t __loc) attribute_hidden; +extern int __wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, __locale_t __loc) attribute_hidden; +extern int __wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n, __locale_t __loc) attribute_hidden; +extern int __wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2, __locale_t __loc) attribute_hidden; +extern size_t __wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2, size_t __n, __locale_t __loc) attribute_hidden; +#ifdef __UCLIBC_DO_XLOCALE +extern wint_t __towlower_l(wint_t __wc, __locale_t __locale) __THROW; +#endif #endif /**********************************************************************/ @@ -1236,6 +1257,7 @@ strong_alias(__ffs, ffs) #if defined(L_wcscasecmp) || defined(L_wcscasecmp_l) #define strcasecmp wcscasecmp +#define __strcasecmp __wcscasecmp #define strcasecmp_l wcscasecmp_l #define __strcasecmp_l __wcscasecmp_l #ifdef __UCLIBC_DO_XLOCALE @@ -1257,14 +1279,15 @@ strong_alias(__ffs, ffs) #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -int strcasecmp(register const Wchar *s1, register const Wchar *s2) +int attribute_hidden __strcasecmp(register const Wchar *s1, register const Wchar *s2) { return __strcasecmp_l(s1, s2, __UCLIBC_CURLOCALE); } +strong_alias(__strcasecmp,strcasecmp) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -int __XL(strcasecmp)(register const Wchar *s1, register const Wchar *s2 +int attribute_hidden __UCXL(strcasecmp)(register const Wchar *s1, register const Wchar *s2 __LOCALE_PARAM ) { #ifdef WANT_WIDE @@ -1288,8 +1311,7 @@ int __XL(strcasecmp)(register const Wchar *s1, register const Wchar *s2 return r; #endif } - -__XL_ALIAS(strcasecmp) +__UCXL_ALIAS(strcasecmp) #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1300,6 +1322,7 @@ __XL_ALIAS(strcasecmp) #if defined(L_wcsncasecmp) || defined(L_wcsncasecmp_l) #define strncasecmp wcsncasecmp +#define __strncasecmp __wcsncasecmp #define strncasecmp_l wcsncasecmp_l #define __strncasecmp_l __wcsncasecmp_l #ifdef __UCLIBC_DO_XLOCALE @@ -1321,14 +1344,15 @@ __XL_ALIAS(strcasecmp) #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -int strncasecmp(register const Wchar *s1, register const Wchar *s2, size_t n) +int attribute_hidden __strncasecmp(register const Wchar *s1, register const Wchar *s2, size_t n) { return __strncasecmp_l(s1, s2, n, __UCLIBC_CURLOCALE); } +strong_alias(__strncasecmp,strncasecmp) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -int __XL(strncasecmp)(register const Wchar *s1, register const Wchar *s2, +int attribute_hidden __UCXL(strncasecmp)(register const Wchar *s1, register const Wchar *s2, size_t n __LOCALE_PARAM ) { #ifdef WANT_WIDE @@ -1355,8 +1379,7 @@ int __XL(strncasecmp)(register const Wchar *s1, register const Wchar *s2, return r; #endif } - -__XL_ALIAS(strncasecmp) +__UCXL_ALIAS(strncasecmp) #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -2583,9 +2606,11 @@ void psignal(int signum, register const char *message) #if defined(L_strxfrm) || defined(L_strxfrm_l) #define wcscoll strcoll +#define __wcscoll __strcoll #define wcscoll_l strcoll_l #define __wcscoll_l __strcoll_l #define wcsxfrm strxfrm +#define __wcsxfrm __strxfrm #define wcsxfrm_l strxfrm_l #define __wcsxfrm_l __strxfrm_l @@ -2601,15 +2626,17 @@ void psignal(int signum, register const char *message) #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) -int wcscoll (const Wchar *s0, const Wchar *s1) +int attribute_hidden __wcscoll (const Wchar *s0, const Wchar *s1) { - return wcscoll_l(s0, s1, __UCLIBC_CURLOCALE ); + return __wcscoll_l(s0, s1, __UCLIBC_CURLOCALE ); } +strong_alias(__wcscoll,wcscoll) -size_t wcsxfrm(Wchar *__restrict ws1, const Wchar *__restrict ws2, size_t n) +size_t attribute_hidden __wcsxfrm(Wchar *__restrict ws1, const Wchar *__restrict ws2, size_t n) { - return wcsxfrm_l(ws1, ws2, n, __UCLIBC_CURLOCALE ); + return __wcsxfrm_l(ws1, ws2, n, __UCLIBC_CURLOCALE ); } +strong_alias(__wcsxfrm,wcsxfrm) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -3047,14 +3074,14 @@ static void next_weight(col_state_t *cs, int pass __LOCALE_PARAM ) } while (1); } -int __XL(wcscoll) (const Wchar *s0, const Wchar *s1 __LOCALE_PARAM ) +int attribute_hidden __UCXL(wcscoll) (const Wchar *s0, const Wchar *s1 __LOCALE_PARAM ) { col_state_t ws[2]; int pass; if (!CUR_COLLATE->num_weights) { /* C locale */ #ifdef WANT_WIDE - return wcscmp(s0, s1); + return __wcscmp(s0, s1); #else /* WANT_WIDE */ return __strcmp(s0, s1); #endif /* WANT_WIDE */ @@ -3080,12 +3107,11 @@ int __XL(wcscoll) (const Wchar *s0, const Wchar *s1 __LOCALE_PARAM ) return 0; } - -__XL_ALIAS(wcscoll) +__UCXL_ALIAS(wcscoll) #ifdef WANT_WIDE -size_t __XL(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t *__restrict ws2, +size_t attribute_hidden __UCXL(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t *__restrict ws2, size_t n __LOCALE_PARAM ) { col_state_t cs; @@ -3093,7 +3119,7 @@ size_t __XL(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t *__restrict ws2, int pass; if (!CUR_COLLATE->num_weights) { /* C locale */ - return wcsxfrm(ws1, ws2, n); + return __wcsxfrm(ws1, ws2, n); } #ifdef __UCLIBC_MJN3_ONLY__ @@ -3123,7 +3149,7 @@ size_t __XL(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t *__restrict ws2, return count-1; } -__XL_ALIAS(wcsxfrm) +__UCXL_ALIAS(wcsxfrm) #else /* WANT_WIDE */ @@ -3167,7 +3193,7 @@ static size_t store(unsigned char *s, size_t count, size_t n, __uwchar_t weight) return r; } -size_t __XL(strxfrm)(char *__restrict ws1, const char *__restrict ws2, size_t n +size_t attribute_hidden __UCXL(strxfrm)(char *__restrict ws1, const char *__restrict ws2, size_t n __LOCALE_PARAM ) { col_state_t cs; @@ -3175,7 +3201,7 @@ size_t __XL(strxfrm)(char *__restrict ws1, const char *__restrict ws2, size_t n int pass; if (!CUR_COLLATE->num_weights) { /* C locale */ - return strlcpy(ws1, ws2, n); + return __strlcpy(ws1, ws2, n); } #ifdef __UCLIBC_MJN3_ONLY__ @@ -3205,7 +3231,7 @@ size_t __XL(strxfrm)(char *__restrict ws1, const char *__restrict ws2, size_t n return count-1; } -__XL_ALIAS(strxfrm) +__UCXL_ALIAS(strxfrm) #endif /* WANT_WIDE */ diff --git a/libc/sysdeps/linux/arm/ioperm.c b/libc/sysdeps/linux/arm/ioperm.c index f887d54f1..d69d475d6 100644 --- a/libc/sysdeps/linux/arm/ioperm.c +++ b/libc/sysdeps/linux/arm/ioperm.c @@ -33,6 +33,8 @@ the area affected (this is a kernel limitation). So we now just enable all the ports all of the time. */ +#define readlink __readlink + #include <errno.h> #include <fcntl.h> #include <stdio.h> diff --git a/libc/sysdeps/linux/common/dup2.c b/libc/sysdeps/linux/common/dup2.c index a5a832f6f..71164aa0b 100644 --- a/libc/sysdeps/linux/common/dup2.c +++ b/libc/sysdeps/linux/common/dup2.c @@ -9,4 +9,6 @@ #include "syscalls.h" #include <unistd.h> -_syscall2(int, dup2, int, oldfd, int, newfd); +#define __NR___dup2 __NR_dup2 +attribute_hidden _syscall2(int, __dup2, int, oldfd, int, newfd); +strong_alias(__dup2,dup2) diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c index d007993eb..4a1ea093e 100644 --- a/libc/sysdeps/linux/common/getcwd.c +++ b/libc/sysdeps/linux/common/getcwd.c @@ -153,7 +153,7 @@ int __syscall_getcwd(char * buf, unsigned long size) #endif -char *getcwd(char *buf, size_t size) +char attribute_hidden *__getcwd(char *buf, size_t size) { int ret; char *path; @@ -185,4 +185,4 @@ char *getcwd(char *buf, size_t size) free (path); return NULL; } - +strong_alias(__getcwd,getcwd) diff --git a/libc/sysdeps/linux/common/getdirname.c b/libc/sysdeps/linux/common/getdirname.c index 486ee9335..d791f34a3 100644 --- a/libc/sysdeps/linux/common/getdirname.c +++ b/libc/sysdeps/linux/common/getdirname.c @@ -17,6 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define getcwd __getcwd + #include <features.h> #include <unistd.h> #include <sys/stat.h> diff --git a/libc/sysdeps/linux/common/getgroups.c b/libc/sysdeps/linux/common/getgroups.c index 402d87e66..c863489b9 100644 --- a/libc/sysdeps/linux/common/getgroups.c +++ b/libc/sysdeps/linux/common/getgroups.c @@ -18,7 +18,7 @@ static inline _syscall2(int, __syscall_getgroups, int, size, __kernel_gid_t *, list); -int getgroups(int n, gid_t * groups) +int attribute_hidden __getgroups(int n, gid_t * groups) { if (unlikely(n < 0)) { __set_errno(EINVAL); @@ -36,3 +36,4 @@ int getgroups(int n, gid_t * groups) return ngids; } } +strong_alias(__getgroups,getgroups) diff --git a/libc/sysdeps/linux/common/getsid.c b/libc/sysdeps/linux/common/getsid.c index 4bb539cd2..3e9c2d8ba 100644 --- a/libc/sysdeps/linux/common/getsid.c +++ b/libc/sysdeps/linux/common/getsid.c @@ -13,7 +13,8 @@ #define __NR___syscall_getsid __NR_getsid static inline _syscall1(__kernel_pid_t, __syscall_getsid, __kernel_pid_t, pid); -pid_t getsid(pid_t pid) +pid_t attribute_hidden __getsid(pid_t pid) { return (__syscall_getsid(pid)); } +strong_alias(__getsid,getsid) diff --git a/libc/sysdeps/linux/common/readlink.c b/libc/sysdeps/linux/common/readlink.c index 8ebb5eaa9..45db1a64f 100644 --- a/libc/sysdeps/linux/common/readlink.c +++ b/libc/sysdeps/linux/common/readlink.c @@ -9,4 +9,6 @@ #include "syscalls.h" #include <unistd.h> -_syscall3(int, readlink, const char *, path, char *, buf, size_t, bufsiz); +#define __NR___readlink __NR_readlink +attribute_hidden _syscall3(int, __readlink, const char *, path, char *, buf, size_t, bufsiz); +strong_alias(__readlink,readlink) diff --git a/libc/sysdeps/linux/common/setsid.c b/libc/sysdeps/linux/common/setsid.c index 0e2e2a31e..b3e1e8706 100644 --- a/libc/sysdeps/linux/common/setsid.c +++ b/libc/sysdeps/linux/common/setsid.c @@ -9,4 +9,6 @@ #include "syscalls.h" #include <unistd.h> -_syscall0(pid_t, setsid); +#define __NR___setsid __NR_setsid +attribute_hidden _syscall0(pid_t, __setsid); +strong_alias(__setsid,setsid) diff --git a/libc/sysdeps/linux/powerpc/ioctl.c b/libc/sysdeps/linux/powerpc/ioctl.c index 7058d44ee..a522ff6d4 100644 --- a/libc/sysdeps/linux/powerpc/ioctl.c +++ b/libc/sysdeps/linux/powerpc/ioctl.c @@ -16,6 +16,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define tcsetattr __tcsetattr +#define tcgetattr __tcgetattr + #include <stdarg.h> #include <termios.h> #include <unistd.h> diff --git a/libc/termios/tcgetattr.c b/libc/termios/tcgetattr.c index 1f1f0562b..8a9448bd7 100644 --- a/libc/termios/tcgetattr.c +++ b/libc/termios/tcgetattr.c @@ -32,7 +32,7 @@ #include "kernel_termios.h" /* Put the state of FD into *TERMIOS_P. */ -int tcgetattr (int fd, struct termios *termios_p) +int attribute_hidden __tcgetattr (int fd, struct termios *termios_p) { struct __kernel_termios k_termios; int retval; @@ -75,4 +75,4 @@ int tcgetattr (int fd, struct termios *termios_p) return retval; } - +strong_alias(__tcgetattr,tcgetattr) diff --git a/libc/termios/tcgetsid.c b/libc/termios/tcgetsid.c index 5e4addece..54d317724 100644 --- a/libc/termios/tcgetsid.c +++ b/libc/termios/tcgetsid.c @@ -16,6 +16,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define getsid __getsid +#define tcgetpgrp __tcgetpgrp + #include <errno.h> #include <termios.h> #include <sys/ioctl.h> diff --git a/libc/termios/tcsetattr.c b/libc/termios/tcsetattr.c index 76d73796e..2bf2d2a29 100644 --- a/libc/termios/tcsetattr.c +++ b/libc/termios/tcsetattr.c @@ -47,7 +47,7 @@ /* Set the state of FD to *TERMIOS_P. */ -int tcsetattr (int fd, int optional_actions, const struct termios *termios_p) +int attribute_hidden __tcsetattr (int fd, int optional_actions, const struct termios *termios_p) { struct __kernel_termios k_termios; unsigned long int cmd; @@ -114,3 +114,4 @@ int tcsetattr (int fd, int optional_actions, const struct termios *termios_p) return retval; } +strong_alias(__tcsetattr,tcsetattr) diff --git a/libc/termios/termios.c b/libc/termios/termios.c index cf3bd9bc6..dc0372fa3 100644 --- a/libc/termios/termios.c +++ b/libc/termios/termios.c @@ -23,6 +23,8 @@ much more current. */ +#define tcgetattr __tcgetattr + #include <errno.h> #include <stddef.h> #include <sys/ioctl.h> @@ -100,7 +102,7 @@ int tcsetpgrp ( int fd, pid_t pgrp_id) #ifdef L_tcgetpgrp /* Return the foreground process group ID of FD. */ -pid_t tcgetpgrp ( int fd) +pid_t attribute_hidden __tcgetpgrp ( int fd) { int pgrp; @@ -108,6 +110,7 @@ pid_t tcgetpgrp ( int fd) return (pid_t) -1; return (pid_t) pgrp; } +strong_alias(__tcgetpgrp,tcgetpgrp) #endif /* This is a gross hack around a kernel bug. If the cfsetispeed functions is @@ -143,7 +146,7 @@ speed_t cfgetispeed (const struct termios *termios_p) #ifdef L_cfsetospeed /* Set the output baud rate stored in *TERMIOS_P to SPEED. */ -int cfsetospeed (struct termios *termios_p, speed_t speed) +int attribute_hidden __cfsetospeed (struct termios *termios_p, speed_t speed) { if ((speed & ~CBAUD) != 0 && (speed < B57600 || speed > B460800)) @@ -157,6 +160,7 @@ int cfsetospeed (struct termios *termios_p, speed_t speed) return 0; } +strong_alias(__cfsetospeed,cfsetospeed) #endif #ifdef L_cfsetispeed @@ -164,7 +168,7 @@ int cfsetospeed (struct termios *termios_p, speed_t speed) * Although for Linux there is no difference between input and output * speed, the numerical 0 is a special case for the input baud rate. It * should set the input baud rate to the output baud rate. */ -int cfsetispeed ( struct termios *termios_p, speed_t speed) +int attribute_hidden __cfsetispeed ( struct termios *termios_p, speed_t speed) { if ((speed & ~CBAUD) != 0 && (speed < B57600 || speed > B460800)) @@ -184,9 +188,14 @@ int cfsetispeed ( struct termios *termios_p, speed_t speed) return 0; } +strong_alias(__cfsetispeed,cfsetispeed) #endif #ifdef L_cfsetspeed + +extern int __cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW attribute_hidden; +extern int __cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW attribute_hidden; + struct speed_struct { speed_t value; @@ -278,14 +287,14 @@ int cfsetspeed (struct termios *termios_p, speed_t speed) for (cnt = 0; cnt < sizeof (speeds) / sizeof (speeds[0]); ++cnt) if (speed == speeds[cnt].internal) { - cfsetispeed (termios_p, speed); - cfsetospeed (termios_p, speed); + __cfsetispeed (termios_p, speed); + __cfsetospeed (termios_p, speed); return 0; } else if (speed == speeds[cnt].value) { - cfsetispeed (termios_p, speeds[cnt].internal); - cfsetospeed (termios_p, speeds[cnt].internal); + __cfsetispeed (termios_p, speeds[cnt].internal); + __cfsetospeed (termios_p, speeds[cnt].internal); return 0; } diff --git a/libc/termios/ttyname.c b/libc/termios/ttyname.c index 15093f8a5..43005a63a 100644 --- a/libc/termios/ttyname.c +++ b/libc/termios/ttyname.c @@ -26,13 +26,6 @@ */ #define TTYNAME_BUFLEN 32 -char *ttyname(int fd) -{ - static char name[TTYNAME_BUFLEN]; - - return ttyname_r(fd, name, TTYNAME_BUFLEN) ? NULL : name; -} - static const char dirlist[] = /* 12345670123 */ "\010/dev/vc/\0" /* Try /dev/vc first (be devfs compatible) */ @@ -41,7 +34,7 @@ static const char dirlist[] = "\011/dev/pts/\0" /* and try /dev/pts next */ "\005/dev/\0"; /* and try walking through /dev last */ -int ttyname_r(int fd, char *ubuf, size_t ubuflen) +int attribute_hidden __ttyname_r(int fd, char *ubuf, size_t ubuflen) { struct dirent *d; struct stat st; @@ -116,3 +109,11 @@ int ttyname_r(int fd, char *ubuf, size_t ubuflen) return rv; } +strong_alias(__ttyname_r,ttyname_r) + +char *ttyname(int fd) +{ + static char name[TTYNAME_BUFLEN]; + + return __ttyname_r(fd, name, TTYNAME_BUFLEN) ? NULL : name; +} diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c index 3c54ad234..cd8a9de9c 100644 --- a/libc/unistd/daemon.c +++ b/libc/unistd/daemon.c @@ -23,6 +23,9 @@ * Original copyright notice is retained at the end of this file. */ +#define dup2 __dup2 +#define setsid __setsid + #include <stdio.h> #include <features.h> #include <fcntl.h> diff --git a/libc/unistd/getpass.c b/libc/unistd/getpass.c index 2af8f00a1..2b2d252c2 100644 --- a/libc/unistd/getpass.c +++ b/libc/unistd/getpass.c @@ -17,6 +17,8 @@ Boston, MA 02111-1307, USA. */ #define setvbuf __setvbuf +#define tcsetattr __tcsetattr +#define tcgetattr __tcgetattr #include <stdio.h> #include <string.h> diff --git a/utils/Makefile.in b/utils/Makefile.in index f29721bb1..b0bf2c31f 100644 --- a/utils/Makefile.in +++ b/utils/Makefile.in @@ -65,7 +65,7 @@ utils: $(utils_OBJ) $(utils_ICONV_OBJ) $(utils_OBJ): $(utils_OUT)/% : $(utils_DIR)/%.c | $(libc) $(compile.u) -$(utils_OUT)/iconv.c: $(top_srcdir)libc/misc/wchar/wchar.c | $(libc) +$(utils_OUT)/iconv: $(top_srcdir)libc/misc/wchar/wchar.c | $(libc) $(compile.u) hostutils: $(hostutils_OBJ) |