[Top][All Lists]

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

[Confuse-devel] confuse 2.4 and static linking

From: Eric Valette
Subject: [Confuse-devel] confuse 2.4 and static linking
Date: Mon, 15 Nov 2004 10:14:27 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041007 Debian/1.7.3-5


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,

  /  `                          Eric Valette
 /--   __  o _.                 6 rue Paul Le Flem
(___, / (_(_(__                 35740 Pace

Tel: +33 (0)2 99 85 26 76       Fax: +33 (0)2 99 85 26 76
E-mail: address@hidden

#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>

  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]