From: | "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx> |
Date: | Tue, 16 Aug 2005 14:28:47 +0200 |
You wrote in the commit message:
Make FILE an opaque type for normal operation (anything outside libc).
This means programs have to use the exported interface, they can neither
make static instances on the heap or access fields of their own.
That seems to break SUSv3: The following data types shall be defined through typedef: FILE A structure containing information about a file.
Maybe if one uses something like:
struct FILE { char opaque[SOME_SIZE]; };
I think, they just have generic ways to deal with objects and pointers.The reason why I haven't fixed ruby is that I don't have any idea what they use it for.
The generic pointer structure contains a field for the size of the pointee.
struct __real_FILE { all stuff... };
struct FILE { struct __real_FILE *_therealfile; };
FILE * fopen(...) { FILE *f;
f = malloc(_FILESIZE); f->_therealfile = (struct __real_FILE *)(f + 1); ... }
other_func(FILE *f) { struct __real_FILE *rf = f->_therealfile; ... }
fclose(FILE *f) { free((struct FILE *)f->_therealfile - 1); ... }
cheers simon -- Serve - BSD +++ RENT this banner advert +++ ASCII Ribbon /"\ Work - Mac +++ space for low $$$ NOW!1 +++ Campaign \ / Party Enjoy Relax | http://dragonflybsd.org Against HTML \ Dude 2c 2 the max ! http://golden-apple.biz Mail + News / \
Attachment:
PGP.sig
Description: This is a digitally signed message part