On Mon, 30 Oct 2006 19:46:45 +0100 Casper.Dik at Sun.COM wrote: > >On 10/30/06, Roland Mainz <roland.mainz at nrubsig.org> wrote: > >> Attached is a small patch ("ksh93_libcmd_killglobalvars001.diff.txt") > >> for ast-ksh.2006-09-12 which significantly reduces the size of the > >> global variables in libcmd > >Why do you think the global variable size needs to be reduced? Is > >there anything especially bad when a program uses global variables?
> It's a Solaris rule: no variable or function in a library should be > visible unless defined as an interface. > But there's a bigger issue: any variable in a program > will be mapped to the libcmd variable of the same name, so > in essence libcmd steals a large chunk of user namespace and may > cause application breakage as a result. the libcmd coding style is for libcmd specific globals to be file static a typical example for each foo.c in libcmd is: typedef struct State_s { ... } State_t; static State_t state; where State_t and state is static private to foo.c any global declared/used other than file static is a bug and will be fixed when reported I believe the complaint about these globals is the .bss taken up by the aggregate dll/so -- Glenn Fowler -- AT&T Research, Florham Park NJ --