confuse-devel
[Top][All Lists]
Advanced

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

Re: [Confuse-devel] confuse 2.4 and static linking


From: Martin Hedenfalk
Subject: Re: [Confuse-devel] confuse 2.4 and static linking
Date: Mon, 15 Nov 2004 15:39:20 +0100
User-agent: Mozilla Thunderbird 0.7.3 (X11/20040803)

Hi Eric,

Since this is a special case I will not include a replacement function for parsing /etc/passwd in the main sources. If you decide to do such a patch, you are more than welcome to post it on this mailing list. I can also link to it or place a copy on the libconfuse webpage. I can't maintain it though.

Depending on your requirements, perhaps it would suffice to use the $HOME environment variable to expand ~/paths?

thank you
/martin hedenfalk

Eric Valette wrote:
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;
}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]