public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Re: A getxxx_r version patch
       [not found] <19990709213944.B199E3FC1@varesearch.com>
@ 1999-07-09 20:50 ` Ulrich Drepper
  0 siblings, 0 replies; 7+ messages in thread
From: Ulrich Drepper @ 1999-07-09 20:50 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GNU C Library

Thanks, it's in.

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: A getxxx_r version patch
  1999-07-10  5:43 ` Mark Kettenis
  1999-07-10  8:15   ` H.J. Lu
@ 1999-07-10  9:24   ` Ulrich Drepper
  1 sibling, 0 replies; 7+ messages in thread
From: Ulrich Drepper @ 1999-07-10  9:24 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: hjl, libc-hacker

Mark Kettenis <kettenis@wins.uva.nl> writes:

> 
>    if (ret != 0)
>      {
>        __set_errno (ret);
>        ret = -1;
>      }

This already happens.

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: A getxxx_r version patch
  1999-07-10  8:20     ` Thorsten Kukuk
@ 1999-07-10  8:28       ` H.J. Lu
  0 siblings, 0 replies; 7+ messages in thread
From: H.J. Lu @ 1999-07-10  8:28 UTC (permalink / raw)
  To: Thorsten Kukuk; +Cc: libc-hacker

> > > 
> > > I think you should also set errno since the new functions do not
> > > necessarily do this.  The whole point of having getXXbyYY_r returning
> > > the error value is avoiding the use of thread-specific data.
> > > 
> > 
> > I don't know what you mean. The new functions return "errno" in case
> > of errors. Why do you want to set "errno" with "errno"?
> 
> The old functions sets errno and returns -1. But POSIX only says,
> that the functions should return the errno value, and not setting errno.
> So if the next functions or a later version will only return the errno
> value, and doesn't set errno, your "old" functions will not longer work.
> 

My patch is based on the current implementation which does set errno.
If we ever change this, we can deal it later. BTW, if we have to do
that, it won't be the only place we have to change.

-- 
H.J. Lu (hjl@gnu.org)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: A getxxx_r version patch
  1999-07-10  8:15   ` H.J. Lu
@ 1999-07-10  8:20     ` Thorsten Kukuk
  1999-07-10  8:28       ` H.J. Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Thorsten Kukuk @ 1999-07-10  8:20 UTC (permalink / raw)
  To: H.J. Lu; +Cc: libc-hacker

On Sat, Jul 10, H.J. Lu wrote:

> > 
> >    Date: Fri, 9 Jul 1999 16:28:52 -0700 (PDT)
> >    From: hjl@varesearch.com (H.J. Lu)
> > 
> >    Since we changed the return value of getxxx_r, I added a new version
> >    for each function and kept the old one.
> > 
> > I think you should also set errno since the new functions do not
> > necessarily do this.  The whole point of having getXXbyYY_r returning
> > the error value is avoiding the use of thread-specific data.
> > 
> 
> I don't know what you mean. The new functions return "errno" in case
> of errors. Why do you want to set "errno" with "errno"?

The old functions sets errno and returns -1. But POSIX only says,
that the functions should return the errno value, and not setting errno.
So if the next functions or a later version will only return the errno
value, and doesn't set errno, your "old" functions will not longer work.

  Thorsten

-- 
Thorsten Kukuk      http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE GmbH           Deutschherrenstr. 15-19         90429 Nuernberg
Linux is like a Vorlon.  It is incredibly powerful, gives terse,
cryptic answers and has a lot of things going on in the background.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: A getxxx_r version patch
  1999-07-10  5:43 ` Mark Kettenis
@ 1999-07-10  8:15   ` H.J. Lu
  1999-07-10  8:20     ` Thorsten Kukuk
  1999-07-10  9:24   ` Ulrich Drepper
  1 sibling, 1 reply; 7+ messages in thread
From: H.J. Lu @ 1999-07-10  8:15 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: libc-hacker

> 
>    Date: Fri, 9 Jul 1999 16:28:52 -0700 (PDT)
>    From: hjl@varesearch.com (H.J. Lu)
> 
>    Since we changed the return value of getxxx_r, I added a new version
>    for each function and kept the old one.
> 
> I think you should also set errno since the new functions do not
> necessarily do this.  The whole point of having getXXbyYY_r returning
> the error value is avoiding the use of thread-specific data.
> 

I don't know what you mean. The new functions return "errno" in case
of errors. Why do you want to set "errno" with "errno"?

-- 
H.J. Lu (hjl@gnu.org)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: A getxxx_r version patch
  1999-07-09 16:28 H.J. Lu
@ 1999-07-10  5:43 ` Mark Kettenis
  1999-07-10  8:15   ` H.J. Lu
  1999-07-10  9:24   ` Ulrich Drepper
  0 siblings, 2 replies; 7+ messages in thread
From: Mark Kettenis @ 1999-07-10  5:43 UTC (permalink / raw)
  To: hjl; +Cc: libc-hacker

   Date: Fri, 9 Jul 1999 16:28:52 -0700 (PDT)
   From: hjl@varesearch.com (H.J. Lu)

   Since we changed the return value of getxxx_r, I added a new version
   for each function and kept the old one.

I think you should also set errno since the new functions do not
necessarily do this.  The whole point of having getXXbyYY_r returning
the error value is avoiding the use of thread-specific data.

So instead of:

   if (ret != 0)
     ret = -1;

we should use

   if (ret != 0)
     {
       __set_errno (ret);
       ret = -1;
     }

Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

* A getxxx_r version patch
@ 1999-07-09 16:28 H.J. Lu
  1999-07-10  5:43 ` Mark Kettenis
  0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 1999-07-09 16:28 UTC (permalink / raw)
  To: GNU C Library

Since we changed the return value of getxxx_r, I added a new version
for each function and kept the old one.

-- 
H.J. Lu (hjl@gnu.org)
--
Fri Jul  9 14:36:25 1999  H.J. Lu  <hjl@gnu.org>

	* Versions.def (GLIBC_2.1.2): Added.

	* nss/getXXent_r.c: Make the new ABI GLIBC_2.1.2 and keep the
	old one as GLIBC_2.0.
	* nss/getXXbyYY_r.c: Likewise.

	* grp/Versions (getgrent_r, getgrgid_r, getgrnam_r): Added to
	GLIBC_2.1.2.
	* inet/Versions (getaliasbyname_r, getaliasent_r,
	gethostbyaddr_r, gethostbyname2_r, gethostbyname_r,
	gethostent_r, getnetbyaddr_r, getnetbyname_r, getnetent_r,
	getnetgrent_r, getprotobyname_r, getprotobynumber_r,
	getprotoent_r, getrpcbyname_r, getrpcbynumber_r, getrpcent_r,
	getservbyname_r): Likewise.
	* pwd/Versions (getpwent_r, getpwuid_r): Likewise.
	* shadow/Versions (getspent_r, getspnam_r): Likewise.

Index: Versions.def
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/Versions.def,v
retrieving revision 1.1.1.5
diff -u -p -r1.1.1.5 Versions.def
--- Versions.def	1999/05/10 15:33:17	1.1.1.5
+++ Versions.def	1999/07/09 20:35:29
@@ -5,6 +5,7 @@ libc {
   GLIBC_2.0
   GLIBC_2.1 GLIBC_2.0
   GLIBC_2.1.1 GLIBC_2.1
+  GLIBC_2.1.2 GLIBC_2.1.1
 }
 libcrypt {
   GLIBC_2.0
Index: nss/getXXent_r.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/nss/getXXent_r.c,v
retrieving revision 1.1.1.10
diff -u -p -r1.1.1.10 getXXent_r.c
--- nss/getXXent_r.c	1999/06/27 01:14:34	1.1.1.10
+++ nss/getXXent_r.c	1999/07/09 21:08:58
@@ -290,5 +290,33 @@ INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYP
   *result = status == NSS_STATUS_SUCCESS ? resbuf : NULL;
   return status == NSS_STATUS_SUCCESS ? 0 : errno;
 }
+#if defined SHARED && DO_VERSIONING
+#define OLD(name) OLD1 (name)
+#define OLD1(name) __old_##name
+
+int
+OLD (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen,
+			 LOOKUP_TYPE **result H_ERRNO_PARM)
+{
+  int ret = INTERNAL (REENTRANT_GETNAME) (resbuf, buffer, buflen,
+					  result H_ERRNO_VAR);
+
+  if (ret != 0)
+    ret = -1;
+
+  return ret;
+}
+
+#define do_symbol_version(real, name, version) \
+  symbol_version(real, name, version)
+do_symbol_version(OLD (REENTRANT_GETNAME), REENTRANT_GETNAME,
+		  GLIBC_2.0);
+
+#define do_default_symbol_version(real, name, version) \
+  default_symbol_version(real, name, version)
+do_default_symbol_version(INTERNAL (REENTRANT_GETNAME),
+			  REENTRANT_GETNAME, GLIBC_2.1.2);
+#else
 #define do_weak_alias(n1, n2) weak_alias (n1, n2)
 do_weak_alias (INTERNAL (REENTRANT_GETNAME), REENTRANT_GETNAME)
+#endif
Index: nss/getXXbyYY_r.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/nss/getXXbyYY_r.c,v
retrieving revision 1.1.1.15
diff -u -p -r1.1.1.15 getXXbyYY_r.c
--- nss/getXXbyYY_r.c	1999/06/27 01:14:33	1.1.1.15
+++ nss/getXXbyYY_r.c	1999/07/09 21:09:05
@@ -208,5 +208,32 @@ done:
   return status == NSS_STATUS_SUCCESS ? 0 : errno;
 }
 
+#if defined SHARED && DO_VERSIONING
+#define OLD(name) OLD1 (name)
+#define OLD1(name) __old_##name
+
+int
+OLD (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
+		      size_t buflen, LOOKUP_TYPE **result H_ERRNO_PARM)
+{
+  int ret = INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, resbuf, buffer,
+  				       buflen, result H_ERRNO_VAR);
+
+  if (ret != 0)
+    ret = -1;
+
+  return ret;
+}
+
+#define do_symbol_version(real, name, version) \
+  symbol_version(real, name, version)
+do_symbol_version(OLD (REENTRANT_NAME), REENTRANT_NAME, GLIBC_2.0);
+
+#define do_default_symbol_version(real, name, version) \
+  default_symbol_version(real, name, version)
+do_default_symbol_version(INTERNAL (REENTRANT_NAME), REENTRANT_NAME,
+			  GLIBC_2.1.2);
+#else
 #define do_weak_alias(n1, n2) weak_alias (n1, (n2))
 do_weak_alias (INTERNAL (REENTRANT_NAME), REENTRANT_NAME)
+#endif
Index: grp/Versions
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/grp/Versions,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 Versions
--- grp/Versions	1998/08/11 22:26:48	1.1.1.2
+++ grp/Versions	1999/07/09 20:30:13
@@ -20,4 +20,8 @@ libc {
     # p*
     putgrent;
   }
+  GLIBC_2.1.2 {
+    # g*
+    getgrent_r; getgrgid_r; getgrnam_r;
+  }
 }
Index: inet/Versions
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/inet/Versions,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 Versions
--- inet/Versions	1998/12/05 16:05:36	1.1.1.2
+++ inet/Versions	1999/07/09 20:31:55
@@ -54,4 +54,12 @@ libc {
     # i*
     if_freenameindex; if_indextoname; if_nameindex; if_nametoindex;
   }
+  GLIBC_2.1.2 {
+    # g*
+    getaliasbyname_r; getaliasent_r; gethostbyaddr_r; gethostbyname2_r;
+    gethostbyname_r; gethostent_r; getnetbyaddr_r; getnetbyname_r;
+    getnetent_r; getnetgrent_r; getprotobyname_r; getprotobynumber_r;
+    getprotoent_r; getrpcbyname_r; getrpcbynumber_r; getrpcent_r;
+    getservbyname_r;
+  }
 }
Index: pwd/Versions
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/pwd/Versions,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Versions
--- pwd/Versions	1998/07/15 00:20:03	1.1.1.1
+++ pwd/Versions	1999/07/09 20:25:45
@@ -12,4 +12,8 @@ libc {
     # p*
     putpwent; setpwent;
   }
+  GLIBC_2.1.2 {
+    # g*
+    getpwent_r; getpwuid_r;
+  }
 }
Index: shadow/Versions
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/shadow/Versions,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Versions
--- shadow/Versions	1998/07/15 00:20:09	1.1.1.1
+++ shadow/Versions	1999/07/09 20:29:55
@@ -24,4 +24,8 @@ libc {
     # u*
     ulckpwdf;
   }
+  GLIBC_2.1.2 {
+    # g*
+    getspent_r; getspnam_r;
+  }
 }


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1999-07-10  9:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <19990709213944.B199E3FC1@varesearch.com>
1999-07-09 20:50 ` A getxxx_r version patch Ulrich Drepper
1999-07-09 16:28 H.J. Lu
1999-07-10  5:43 ` Mark Kettenis
1999-07-10  8:15   ` H.J. Lu
1999-07-10  8:20     ` Thorsten Kukuk
1999-07-10  8:28       ` H.J. Lu
1999-07-10  9:24   ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).