DragonFly BSD
DragonFly bugs List (threaded) for 2005-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: include files bug?

From: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Tue, 16 Aug 2005 23:29:03 +0200
Mail-followup-to: bugs@crater.dragonflybsd.org

On Tue, Aug 16, 2005 at 05:45:03PM -0000, Andreas Hauser wrote:
> Maybe if you point me to the discussion in the archives, i can
> read up why this was necessary and what the pros and cons for
> this solution are.

The reason are two things:
(a) exporting the real FILE structure in stdio.h is bad, because
application programmers try to access it directly. That happened in the
past often enough to invent the hack of pointing to a second storage
e.g. for wchar buffer, mutex etc.
(b) It prevents applications from copying FILEs which would result in
segfaults or other corruptions if you try to use them.

I want to be able to change the internals of FILE in libc without
changing the external ABI. The way it is implemented is the safest
version to enforce programs not to mess with FILEs.

I don't think that sizeof(FILE) matters for garbage collectors with
water marks, because e.g. the IO buffers are normally managed by libc,
so they wouldn't be counted. Memory might be allocated internally e.g.
for getc / ungetc too.


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]