summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/findfp.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-02-12 02:50:30 +0000
committerpeter <peter@FreeBSD.org>2001-02-12 02:50:30 +0000
commit06fa9251928cf6d03b94f299b9da94f0b504fbee (patch)
tree42990fbd4d5ef4bda5e2555a6b0df3786cb8686f /lib/libc/stdio/findfp.c
parent74ebcffc621e62b347e441ee161f014c4f4b0bf7 (diff)
downloadFreeBSD-src-06fa9251928cf6d03b94f299b9da94f0b504fbee.zip
FreeBSD-src-06fa9251928cf6d03b94f299b9da94f0b504fbee.tar.gz
Take advantage of the current libc sizeof(FILE) breakage (__sF[]) and
try a hopefully more robust stdin/stdout/stderr. This costs an indirect pointer fetch, but saves us from changes in 'FILE'. The __stdin stuff is there to not pollute application name space if the application does not use <stdio.h> and also in case something depended on the current behavior where stdin etc was a #define. Reviewed by: eischen, dillon
Diffstat (limited to 'lib/libc/stdio/findfp.c')
-rw-r--r--lib/libc/stdio/findfp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libc/stdio/findfp.c b/lib/libc/stdio/findfp.c
index f307e3e..7723813 100644
--- a/lib/libc/stdio/findfp.c
+++ b/lib/libc/stdio/findfp.c
@@ -75,6 +75,10 @@ FILE __sF[3] = {
struct glue __sglue = { &uglue, 3, __sF };
static struct glue *lastglue = &uglue;
+FILE *__stdin = &__sF[0];
+FILE *__stdout = &__sF[1];
+FILE *__stderr = &__sF[2];
+
static struct glue * moreglue __P((int));
static spinlock_t thread_lock = _SPINLOCK_INITIALIZER;
OpenPOWER on IntegriCloud