Shared Lib Question (ISC)
Jim Balter
jim at segue.segue.com
Mon May 20 19:50:45 AEST 1991
In article <519a6ad6.20b6d at apollo.HP.COM> goykhman_a at apollo.HP.COM (Alex Goykhman) writes:
> Fclose(NULL) is only defined within the context of a single process, all it
> needs to do is to go through the per-process fd table and and close every fd that
> remains open. It should be easy to implement this call as a part of a shared
> library, and I am not sure what kind of overhead you are referring to.
The subject at hand was global data, not ease of implementation. In order to
implement fclose(NULL), there must be a global pointer to the head of a list of
FILE's, or a global table of FILE's. Of course, given the global data, the
implementation is trivial. The fd table is in the u-structure and isn't really
relevant to a discussion of stdio routines (unless you want to provide a system
call to allow a shared lirbary to access global data saved in the u-structure;
a conceptually intresting but non-pragmatic approach). Note that I brought up
fclose(NULL) because it is contrary to jfh's point about pointers to state info
(FILE *) being explicitly passed to stdio routines.
The overhead referred to is the overhead of a wrapper routine to pass the
global data (maintained per-process) to the "real" routine in the shared
library. This was all pretty evident from a careful reading of the thread.
More information about the Comp.unix.internals
mailing list