summaryrefslogtreecommitdiff
path: root/libc/stdio
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/_stdio.h1
-rw-r--r--libc/stdio/fgets.c8
-rw-r--r--libc/stdio/fgetwc.c15
-rw-r--r--libc/stdio/fopen.c2
-rw-r--r--libc/stdio/fopen64.c1
-rw-r--r--libc/stdio/fputs.c8
-rw-r--r--libc/stdio/fputws.c10
-rw-r--r--libc/stdio/getwchar.c8
-rw-r--r--libc/stdio/old_vfprintf.c4
-rw-r--r--libc/stdio/popen.c4
-rw-r--r--libc/stdio/putwchar.c4
-rw-r--r--libc/stdio/scanf.c4
-rw-r--r--libc/stdio/vfprintf.c1
13 files changed, 44 insertions, 26 deletions
diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h
index 692dd9109..0badc9fd1 100644
--- a/libc/stdio/_stdio.h
+++ b/libc/stdio/_stdio.h
@@ -398,6 +398,7 @@ extern int __feof_unlocked(FILE *stream);
extern int __ferror_unlocked(FILE *stream);
extern int __fgetc_unlocked_internal(FILE *stream) attribute_hidden;
+extern int __getc_unlocked(FILE *stream) attribute_hidden;
extern char *__fgets_unlocked(char *__restrict s, int n,
FILE * __restrict stream) attribute_hidden;
diff --git a/libc/stdio/fgets.c b/libc/stdio/fgets.c
index 52c856f35..5baf63a58 100644
--- a/libc/stdio/fgets.c
+++ b/libc/stdio/fgets.c
@@ -58,15 +58,16 @@ char attribute_hidden *__fgets_unlocked(char *__restrict s, int n,
return NULL;
}
-weak_alias(__fgets_unlocked,fgets_unlocked);
+weak_alias(__fgets_unlocked,fgets_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fgets_unlocked,fgets);
+hidden_strong_alias(__fgets_unlocked,__fgets)
+weak_alias(__fgets_unlocked,fgets)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-char *fgets(char *__restrict s, int n,
+char attribute_hidden *__fgets(char *__restrict s, int n,
register FILE * __restrict stream)
{
char *retval;
@@ -80,5 +81,6 @@ char *fgets(char *__restrict s, int n,
return retval;
}
+strong_alias(__fgets,fgets)
#endif
diff --git a/libc/stdio/fgetwc.c b/libc/stdio/fgetwc.c
index cb200851b..45ff86b80 100644
--- a/libc/stdio/fgetwc.c
+++ b/libc/stdio/fgetwc.c
@@ -108,16 +108,17 @@ wint_t attribute_hidden __fgetwc_unlocked(register FILE *stream)
return wi;
}
-weak_alias(__fgetwc_unlocked,fgetwc_unlocked);
-weak_alias(__fgetwc_unlocked,getwc_unlocked);
+weak_alias(__fgetwc_unlocked,fgetwc_unlocked)
+weak_alias(__fgetwc_unlocked,getwc_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fgetwc_unlocked,fgetwc);
-weak_alias(__fgetwc_unlocked,getwc);
+hidden_strong_alias(__fgetwc_unlocked,__fgetwc)
+weak_alias(__fgetwc_unlocked,fgetwc)
+weak_alias(__fgetwc_unlocked,getwc)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-wint_t fgetwc(register FILE *stream)
+wint_t attribute_hidden __fgetwc(register FILE *stream)
{
wint_t retval;
__STDIO_AUTO_THREADLOCK_VAR;
@@ -130,7 +131,7 @@ wint_t fgetwc(register FILE *stream)
return retval;
}
-
-weak_alias(fgetwc,getwc);
+strong_alias(__fgetwc,fgetwc)
+weak_alias(__fgetwc,getwc)
#endif
diff --git a/libc/stdio/fopen.c b/libc/stdio/fopen.c
index f10c326aa..ad5d1aa92 100644
--- a/libc/stdio/fopen.c
+++ b/libc/stdio/fopen.c
@@ -9,8 +9,10 @@
#ifndef __DO_LARGEFILE
# define FILEDES_ARG (-1)
+#undef __fopen
#undef fopen
#else
+#undef __fopen64
#undef fopen64
#endif
diff --git a/libc/stdio/fopen64.c b/libc/stdio/fopen64.c
index 2aebd72eb..c65e9a4e9 100644
--- a/libc/stdio/fopen64.c
+++ b/libc/stdio/fopen64.c
@@ -9,6 +9,7 @@
#define __DO_LARGEFILE
#define __fopen __fopen64
+#undef fopen
#define fopen fopen64
#define FILEDES_ARG (-2)
#include "fopen.c"
diff --git a/libc/stdio/fputs.c b/libc/stdio/fputs.c
index 211fc1018..64e7fd57f 100644
--- a/libc/stdio/fputs.c
+++ b/libc/stdio/fputs.c
@@ -22,14 +22,15 @@ int attribute_hidden __fputs_unlocked(register const char * __restrict s,
return ((__fwrite_unlocked(s, 1, n, stream) == n) ? n : EOF);
}
-weak_alias(__fputs_unlocked,fputs_unlocked);
+weak_alias(__fputs_unlocked,fputs_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__fputs_unlocked,fputs);
+hidden_strong_alias(__fputs_unlocked,__fputs)
+weak_alias(__fputs_unlocked,fputs)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-int fputs(const char * __restrict s, register FILE * __restrict stream)
+int attribute_hidden __fputs(const char * __restrict s, register FILE * __restrict stream)
{
int retval;
__STDIO_AUTO_THREADLOCK_VAR;
@@ -42,5 +43,6 @@ int fputs(const char * __restrict s, register FILE * __restrict stream)
return retval;
}
+strong_alias(__fputs,fputs)
#endif
diff --git a/libc/stdio/fputws.c b/libc/stdio/fputws.c
index e83cc9fcb..74919d6ea 100644
--- a/libc/stdio/fputws.c
+++ b/libc/stdio/fputws.c
@@ -9,9 +9,6 @@
#include "_stdio.h"
-extern int __fputws_unlocked(const wchar_t *__restrict ws,
- FILE *__restrict stream) attribute_hidden;
-
#ifdef __DO_UNLOCKED
int attribute_hidden __fputws_unlocked(const wchar_t *__restrict ws,
@@ -24,12 +21,16 @@ int attribute_hidden __fputws_unlocked(const wchar_t *__restrict ws,
weak_alias(__fputws_unlocked,fputws_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
+hidden_strong_alias(__fputws_unlocked,__fputws)
weak_alias(__fputws_unlocked,fputws)
#endif
#elif defined __UCLIBC_HAS_THREADS__
-int fputws(const wchar_t *__restrict ws, register FILE *__restrict stream)
+extern int __fputws_unlocked(const wchar_t *__restrict ws,
+ FILE *__restrict stream) attribute_hidden;
+
+int attribute_hidden __fputws(const wchar_t *__restrict ws, register FILE *__restrict stream)
{
int retval;
__STDIO_AUTO_THREADLOCK_VAR;
@@ -42,5 +43,6 @@ int fputws(const wchar_t *__restrict ws, register FILE *__restrict stream)
return retval;
}
+strong_alias(__fputws,fputws)
#endif
diff --git a/libc/stdio/getwchar.c b/libc/stdio/getwchar.c
index 642162fed..90e5a032e 100644
--- a/libc/stdio/getwchar.c
+++ b/libc/stdio/getwchar.c
@@ -14,16 +14,18 @@ wint_t __getwchar_unlocked(void)
return __fgetwc_unlocked(stdin);
}
-weak_alias(__getwchar_unlocked,getwchar_unlocked);
+weak_alias(__getwchar_unlocked,getwchar_unlocked)
#ifndef __UCLIBC_HAS_THREADS__
-weak_alias(__getwchar_unlocked,getwchar);
+weak_alias(__getwchar_unlocked,getwchar)
#endif
#elif defined __UCLIBC_HAS_THREADS__
+extern wint_t __fgetwc (__FILE *__stream) attribute_hidden;
+
wint_t getwchar(void)
{
- return fgetwc(stdin);
+ return __fgetwc(stdin);
}
#endif
diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c
index 8b54ca849..ce6bde1a4 100644
--- a/libc/stdio/old_vfprintf.c
+++ b/libc/stdio/old_vfprintf.c
@@ -166,7 +166,7 @@
#ifdef __STDIO_BUFFERS
-#define PUTC(C,F) putc_unlocked((C),(F))
+#define PUTC(C,F) __putc_unlocked((C),(F))
#define OUTNSTR _outnstr
#define _outnstr(stream, string, len) __stdio_fwrite(string, len, stream)
@@ -199,7 +199,7 @@ static void _outnstr(FILE *stream, const unsigned char *s, size_t n)
static void putc_unlocked_sprintf(int c, __FILE_vsnprintf *f)
{
if (!__STDIO_STREAM_IS_FAKE_VSNPRINTF_NB(&f->f)) {
- putc_unlocked(c, &f->f);
+ __putc_unlocked(c, &f->f);
} else if (f->bufpos < f->bufend) {
*f->bufpos++ = c;
}
diff --git a/libc/stdio/popen.c b/libc/stdio/popen.c
index c3ee09381..f84a27a3c 100644
--- a/libc/stdio/popen.c
+++ b/libc/stdio/popen.c
@@ -19,6 +19,8 @@
#define dup2 __dup2
#define fdopen __fdopen
#define pipe __pipe
+#define vfork __vfork
+#define fork __fork
#include <stdio.h>
#include <stdlib.h>
@@ -109,7 +111,7 @@ FILE *popen(const char *command, const char *modes)
/* SUSv3 mandates an exit code of 127 for the child if the
* command interpreter can not be invoked. */
- _exit(127);
+ _exit_internal(127);
}
VFORK_UNLOCK;
diff --git a/libc/stdio/putwchar.c b/libc/stdio/putwchar.c
index 47bc173e1..471c63f7f 100644
--- a/libc/stdio/putwchar.c
+++ b/libc/stdio/putwchar.c
@@ -21,9 +21,11 @@ weak_alias(__putwchar_unlocked,putwchar);
#elif defined __UCLIBC_HAS_THREADS__
+extern int __fputc (int __c, FILE *__stream) attribute_hidden;
+
wint_t putwchar(wchar_t wc)
{
- return fputc(wc, stdout);
+ return __fputc(wc, stdout);
}
#endif
diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c
index 04f30e0a5..7fe11514d 100644
--- a/libc/stdio/scanf.c
+++ b/libc/stdio/scanf.c
@@ -595,7 +595,7 @@ typedef unsigned char __uchar_t;
#ifdef __UCLIBC_HAS_WCHAR__
#define GETC(SC) (SC)->sc_getc((SC))
#else /* __UCLIBC_HAS_WCHAR__ */
-#define GETC(SC) getc_unlocked((SC)->fp)
+#define GETC(SC) __getc_unlocked((SC)->fp)
#endif /* __UCLIBC_HAS_WCHAR__ */
#endif
@@ -959,7 +959,7 @@ int attribute_hidden __psfs_parse_spec(register psfs_t *psfs)
#ifdef L_vfscanf
static int sc_getc(register struct scan_cookie *sc)
{
- return (getc_unlocked)(sc->fp); /* Disable the macro. */
+ return (__getc_unlocked)(sc->fp); /* Disable the macro. */
}
static int scan_getwc(register struct scan_cookie *sc)
diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c
index 11fe926a0..bdbf0c788 100644
--- a/libc/stdio/vfprintf.c
+++ b/libc/stdio/vfprintf.c
@@ -95,6 +95,7 @@
#define mbsrtowcs __mbsrtowcs
#define btowc __btowc
#define wcrtomb __wcrtomb
+#define fputws __fputws
#define _ISOC99_SOURCE /* for ULLONG primarily... */
#define _GNU_SOURCE