From owner-freebsd-current Sun Feb 11 17:29:55 2001 Delivered-To: freebsd-current@freebsd.org Received: from mobile.wemm.org (c1315225-a.plstn1.sfba.home.com [65.0.135.147]) by hub.freebsd.org (Postfix) with ESMTP id 8EE2437B401 for ; Sun, 11 Feb 2001 17:29:49 -0800 (PST) Received: from netplex.com.au (localhost [127.0.0.1]) by mobile.wemm.org (8.11.1/8.11.1) with ESMTP id f1C1IkU43227; Sun, 11 Feb 2001 17:18:46 -0800 (PST) (envelope-from peter@netplex.com.au) Message-Id: <200102120118.f1C1IkU43227@mobile.wemm.org> X-Mailer: exmh version 2.2 06/23/2000 with nmh-1.0.4 To: Matt Dillon Cc: Tor.Egge@fast.no, eischen@vigrid.com, bde@zeta.org.au, current@FreeBSD.ORG Subject: Re: HEADS UP: installworld gotchas In-Reply-To: <200102120101.f1C118r01457@earth.backplane.com> Date: Sun, 11 Feb 2001 17:18:46 -0800 From: Peter Wemm Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Matt Dillon wrote: > > : > : This is a major change to libc. The library maj must be bumped if you > : intend to change the sizeof(FILE), or every single third party applicatio n > : that uses stdio will break. > : > : -Matt > > Oh wait, is libc already bumped in current verses 4.2? If so then I gues s > we don't bump libc's maj. God help anyone using current though! > > -Matt I cant help but wonder why on earth we didn't have it like this from the start: Index: include/stdio.h =================================================================== RCS file: /home/ncvs/src/include/stdio.h,v retrieving revision 1.26 diff -u -r1.26 stdio.h --- include/stdio.h 2001/02/11 22:04:18 1.26 +++ include/stdio.h 2001/02/12 01:27:16 @@ -132,6 +132,9 @@ __BEGIN_DECLS extern FILE __sF[]; +extern FILE *__stdin; +extern FILE *__stdout; +extern FILE *__stderr; __END_DECLS #define __SLBF 0x0001 /* line buffered */ @@ -194,9 +197,9 @@ #define SEEK_END 2 /* set file offset to EOF plus offset */ #endif -#define stdin (&__sF[0]) -#define stdout (&__sF[1]) -#define stderr (&__sF[2]) +#define stdin __stdin +#define stdout __stdout +#define stderr __stderr /* * Functions defined in ANSI C standard. Index: lib/libc/stdio/findfp.c =================================================================== RCS file: /home/ncvs/src/lib/libc/stdio/findfp.c,v retrieving revision 1.10 diff -u -r1.10 findfp.c --- lib/libc/stdio/findfp.c 2001/02/11 22:06:40 1.10 +++ lib/libc/stdio/findfp.c 2001/02/12 01:27:16 @@ -75,6 +75,10 @@ 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; That compiles fine. The __stdin thing is in case somebody likes the idea of #undef stdin or #ifdef stdin for some reason. In fact, I can't imagine *any* reason not to do this. At least this would insulate us from future nasties in FILE size changes, and would have saved us in this case. Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message