Hi,
I'm working as a subcontractor for a company currently switching its
code from LynxOS 4.0 to Linux 2.6 + debian unstable. Currrently RT
performances are not a problem, code size is mainly due to dynamic
library bloat and required use of mlockall system call (to avoid page
fault by loading the single big RT application in memory).
This application use libconfuse to parse configuration files and
unfortunatelu the function "cfg_tilde_expand" is causing the import of
dynamic library (lid_nss_compat and libnss_files) because of the use of
getpwnam and getpwuid. These two functions end up doing dlopen from file
nsswitch.c in the gnu c library adding several MB by side effect.
Attached file compilation shwos this problem :
gcc -static -o t2 t2.c
/tmp/ccmFcWgr.o(.text+0x18): In function `main':
: warning: Using 'getpwnam' in statically linked applications requires
at runtime the shared libraries from the glibc version used for linking
Of course I have several option to fix this :
1) Add and && defined(IMPORT_DYNAMIC_LIBRARY) at the _WIN32 #ifdef
2) recode this functions that do real parsing of /etc/passwd file
whatever nsswitch.conf tell them,
What do you think about this? Would you take a patch for solution 2)?
Have a nice day,
------------------------------------------------------------------------
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
main()
{
struct passwd *passEntry;
passEntry = getpwnam ("root");
if (passEntry != NULL)
printf("shell for root = %s\n", passEntry->pw_shell);
return 0;
}