Subject: Re: src/gnu/usr.bin/egcs/common
To: None <>
From: Todd Vierling <>
List: tech-userlevel
Date: 12/25/1999 23:52:56
: The point is, this offset depends on sizeof(FILE)!  The application's
: compiled-in idea of sizeof(FILE) must match the layout of the __sF
: array, or you're screwed.

I'd like to extend (Bill's?) proposal of __sL a little further; names are
somewhat moot and used only for example.

struct __sFILEext {
	pthread_mutex_t __smutex;
	...mutex lock AND FUTURE EXPANSION, which can be resized...

typedef struct __sFILE {
	...contents of __sFILE as seen today...
	struct __sFILEext __Fext;

Now, an extra flag here would indicate something very special:

#define __SEXC 0x8000 /* __sFILEext must be found through cookie */

This indicates that the cookie contains, as its first memory element, a
pointer to the __sFILEext structure.  The expression to find the fields in
__sFILEext would be:

#define __sext(f) ((f->_flags & __SEXC) ? \
	*(struct __sFILEext **)(f->_cookie) : &(f->__Fext))

Now, we can get to the mutex:


This way, the stdio FILE structures would be taken care of, without losing
binary compatibility, or changing how the cookie works for ordinary
funopen()-allocated FILEs.

-- Todd Vierling (