This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A patch for nscd


> 
> > nscd has its own get[a-z]*_r functions. But nscd uses the weak names
> > to call those functions. As the result of my get[a-z]*_r version
> > change, which makes get[a-z]*_r strong instead of weak, and a linker
> > bug fix, the strong versions of get[a-z]*_r in libc.so are used. Here
> > is a patch to use nscd's own get[a-z]*_r functions.
> 
> Why is 'get[a-z]*_r' strong?  Won't this affect static ISO C programs
> that define their own?

get.*_r is a weak aliase of __get[a-z]*_r. However, get.*_r is strong
in libc.so with my get.*_r version patch. The latest linker will pick
the strong version over the weak one even if the strong one is in
shared library and the weak one is in .o file.

Here is the updated patch. It seems to work for me now.


-- 
H.J. Lu (hjl@gnu.org)
---
Sun Jul 11 17:36:43 1999  H.J. Lu  <hjl@gnu.org>

	* nscd/grpcache.c: Add prefix "__" to get[a-z]*_r () to get
	nscd's own strong version of the get[a-z]*_r function.
	* nscd/hstcache.c: Likwise.
	* nscd/pwdcache.c: Likwise.

Index: nscd/grpcache.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/nscd/grpcache.c,v
retrieving revision 1.1.1.9
diff -u -p -r1.1.1.9 grpcache.c
--- nscd/grpcache.c	1999/06/27 01:14:33	1.1.1.9
+++ nscd/grpcache.c	1999/07/12 00:29:58
@@ -208,7 +208,7 @@ addgrbyname (struct database *db, int fd
   if (debug_level > 0)
     dbg_log (_("Haven't found \"%s\" in group cache!"), key);
 
-  while (getgrnam_r (key, &resultbuf, buffer, buflen, &grp) != 0
+  while (__getgrnam_r (key, &resultbuf, buffer, buflen, &grp) != 0
 	 && errno == ERANGE)
     {
       errno = 0;
@@ -236,7 +236,7 @@ addgrbygid (struct database *db, int fd,
   if (debug_level > 0)
     dbg_log (_("Haven't found \"%d\" in group cache!"), gid);
 
-  while (getgrgid_r (gid, &resultbuf, buffer, buflen, &grp) != 0
+  while (__getgrgid_r (gid, &resultbuf, buffer, buflen, &grp) != 0
 	 && errno == ERANGE)
     {
       errno = 0;
Index: nscd/hstcache.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/nscd/hstcache.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 hstcache.c
--- nscd/hstcache.c	1999/06/27 01:14:33	1.1.1.3
+++ nscd/hstcache.c	1999/07/12 16:11:27
@@ -296,8 +296,8 @@ addhstbyname (struct database *db, int f
   if (debug_level > 0)
     dbg_log (_("Haven't found \"%s\" in hosts cache!"), key);
 
-  while (gethostbyname2_r (key, AF_INET, &resultbuf, buffer, buflen, &hst,
-			   &h_errno) != 0
+  while (__gethostbyname2_r (key, AF_INET, &resultbuf, buffer, buflen,
+  			     &hst, &h_errno) != 0
 	 && h_errno == NETDB_INTERNAL
 	 && errno == ERANGE)
     {
@@ -329,8 +329,8 @@ addhstbyaddr (struct database *db, int f
 	       inet_ntop (AF_INET, key, buf, sizeof (buf)));
     }
 
-  while (gethostbyaddr_r (key, INADDRSZ, AF_INET, &resultbuf, buffer, buflen,
-			  &hst, &h_errno) != 0
+  while (__gethostbyaddr_r (key, INADDRSZ, AF_INET, &resultbuf, buffer,
+  			    buflen, &hst, &h_errno) != 0
 	 && h_errno == NETDB_INTERNAL
 	 && errno == ERANGE)
     {
@@ -363,8 +363,8 @@ addhstbynamev6 (struct database *db, int
 	       inet_ntop (AF_INET6, key, buf, sizeof (buf)));
     }
 
-  while (gethostbyname2_r (key, AF_INET6, &resultbuf, buffer, buflen, &hst,
-			   &h_errno) != 0
+  while (__gethostbyname2_r (key, AF_INET6, &resultbuf, buffer, buflen,
+  			     &hst, &h_errno) != 0
 	 && h_errno == NETDB_INTERNAL
 	 && errno == ERANGE)
     {
@@ -396,8 +396,8 @@ addhstbyaddrv6 (struct database *db, int
 	       inet_ntop (AF_INET6, key, buf, sizeof (buf)));
     }
 
-  while (gethostbyaddr_r (key, IN6ADDRSZ, AF_INET6, &resultbuf, buffer, buflen,
-			  &hst, &h_errno) != 0
+  while (__gethostbyaddr_r (key, IN6ADDRSZ, AF_INET6, &resultbuf,
+  			    buffer, buflen, &hst, &h_errno) != 0
 	 && h_errno == NETDB_INTERNAL
 	 && errno == ERANGE)
     {
Index: nscd/pwdcache.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/nscd/pwdcache.c,v
retrieving revision 1.1.1.6
diff -u -p -r1.1.1.6 pwdcache.c
--- nscd/pwdcache.c	1999/06/27 01:14:33	1.1.1.6
+++ nscd/pwdcache.c	1999/07/12 00:31:29
@@ -206,7 +206,7 @@ addpwbyname (struct database *db, int fd
   if (debug_level > 0)
     dbg_log (_("Haven't found \"%s\" in password cache!"), key);
 
-  while (getpwnam_r (key, &resultbuf, buffer, buflen, &pwd) != 0
+  while (__getpwnam_r (key, &resultbuf, buffer, buflen, &pwd) != 0
 	 && errno == ERANGE)
     {
       errno = 0;
@@ -234,7 +234,7 @@ addpwbyuid (struct database *db, int fd,
   if (debug_level > 0)
     dbg_log (_("Haven't found \"%d\" in password cache!"), uid);
 
-  while (getpwuid_r (uid, &resultbuf, buffer, buflen, &pwd) != 0
+  while (__getpwuid_r (uid, &resultbuf, buffer, buflen, &pwd) != 0
 	 && errno == ERANGE)
     {
       errno = 0;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]