Commit a libc fix going by the current state of the version numbering

bikeshed in -arch.  It isn't quite over, but it has been well established
that this can be adjusted or refined.  But we do seem to have consensis
on a major bump of some sort.  After this, it should reasonably safe
to build world again.

This change is to get rid of __sF[] and use seperate __stdin/out/err
handles.  This means we can pad on extra bits onto the end of FILE
at will without going through this all over again.  __sF[] was evil
because it compiled the sizeof(FILE) into every stdio using program.

Asbestos suit on: check!
Peril sensitive sunglasses on: check!
*gulp!*
This commit is contained in:
Peter Wemm 2001-02-14 05:00:20 +00:00
parent 2fd7d53d36
commit ff9dc074b5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=72472
3 changed files with 17 additions and 14 deletions

View File

@ -131,7 +131,9 @@ typedef struct __sFILE {
} FILE;
__BEGIN_DECLS
extern FILE __sF[];
extern FILE __stdin;
extern FILE __stdout;
extern FILE __stderr;
__END_DECLS
#define __SLBF 0x0001 /* line buffered */
@ -194,9 +196,9 @@ __END_DECLS
#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.

View File

@ -7,7 +7,7 @@
# from CFLAGS below. To remove these strings from just the system call
# stubs, remove just -DSYSLIBC_RCS from CFLAGS.
LIB=c
SHLIB_MAJOR= 5
SHLIB_MAJOR= 5.20010213
SHLIB_MINOR= 0
CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS -I${.CURDIR}/include
AINC= -I${.CURDIR}/${MACHINE_ARCH}

View File

@ -59,20 +59,21 @@ int __sdidinit;
#define NDYNAMIC 10 /* add ten more whenever necessary */
#define std(flags, file) \
{0,0,0,flags,file,{0},0,__sF+file,__sclose,__sread,__sseek,__swrite}
/* p r w flags file _bf z cookie close read seek write */
#define std(handle, flags, file) \
FILE handle = {0,0,0,flags,file,{0},0,&handle,__sclose,__sread,__sseek,__swrite}
/* p r w flags file _bf z cookie close read seek write */
/* the usual - (stdin + stdout + stderr) */
static FILE usual[FOPEN_MAX - 3];
static struct glue uglue = { NULL, FOPEN_MAX - 3, usual };
FILE __sF[3] = {
std(__SRD, STDIN_FILENO), /* stdin */
std(__SWR, STDOUT_FILENO), /* stdout */
std(__SWR|__SNBF, STDERR_FILENO) /* stderr */
};
struct glue __sglue = { &uglue, 3, __sF };
std(__stdin, __SRD, STDIN_FILENO);
std(__stdout, __SWR, STDOUT_FILENO);
std(__stderr, __SWR|__SNBF, STDERR_FILENO);
static struct glue sglue2 = { &uglue, 1, &__stderr };
static struct glue sglue1 = { &sglue2, 1, &__stdout };
struct glue __sglue = { &sglue1, 1, &__stdin };
static struct glue *lastglue = &uglue;
static struct glue * moreglue __P((int));