public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* The old libio patch for glibc 2.2
@ 1999-08-10 17:50 H.J. Lu
  1999-08-15 18:23 ` Ulrich Drepper
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 1999-08-10 17:50 UTC (permalink / raw)
  To: GNU C Library

The libio change in glibc 2.2 screwed up the binaries compiled against
glibc 2.0. This patch seems to work ok. But I don't know if it is the
best fix nor if it fixes all the old libio problems. Also I am not sure
if we should use versioning for _IO_setbuffer and _IO_setvbuf.

BTW, Ulrich, What happened to my patch

Sun Aug  8 10:56:43 1999  H.J. Lu  <hjl@gnu.org>

        * pwd/Makefile (otherlibs): Add necessary libraries if
        $(build-static-nss) is defined as "yes".
        * inet/Makefile (otherlibs): Likewise.

It is needed when nss is configured as static. The similar code is
in many other places.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---
Tue Aug 10 17:24:22 1999  H.J. Lu  <hjl@gnu.org>

	* stdio-common/vfprintf.c (ORIENT): Check for the old stream.
	(vfprintf): Likewise.
	* stdio-common/vfscanf.c (ORIENT): Likewise.
	* libio/genops.c (__underflow): Likewise.
	(__uflow): Likewise.
	* libio/iofputs.c (_IO_fputs): Likewise.
	* libio/ioftell.c (_IO_ftell): Likewise.
	* libio/iofwrite.c (_IO_fwrite): Likewise.
	* libio/ioputs.c (_IO_puts): Likewise.
	* libio/iosetbuffer.c (_IO_setbuffer): Likewise.
	* libio/iosetvbuf.c (_IO_setvbuf): Likewise.

Index: stdio-common/vfprintf.c
===================================================================
RCS file: /work/cvs/gnu/glibc/stdio-common/vfprintf.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 vfprintf.c
--- stdio-common/vfprintf.c	1999/08/08 17:02:14	1.1.1.1
+++ stdio-common/vfprintf.c	1999/08/11 00:15:53
@@ -76,7 +76,7 @@
   if (width > 0)							      \
     done += _IO_padn (s, (Padchar), width)
 #  define PUTC(C, F)	_IO_putc_unlocked (C, F)
-#  define ORIENT	if (_IO_fwide (s, -1) != -1) return -1
+#  define ORIENT	if (s->_vtable_offset == 0 && _IO_fwide (s, -1) != -1) return -1
 # else
 # include "_itowa.h"
 
@@ -1144,8 +1144,14 @@ vfprintf (FILE *s, const CHAR_T *format,
   ARGCHECK (s, format);
 
   /* Check for correct orientation.  */
+#ifdef USE_IN_LIBIO
+  if (s->_vtable_offset == 0
+      && _IO_fwide (s, sizeof (CHAR_T) == 1 ? -1 : 1)
+	 != (sizeof (CHAR_T) == 1 ? -1 : 1))
+#else
   if (_IO_fwide (s, sizeof (CHAR_T) == 1 ? -1 : 1)
       != (sizeof (CHAR_T) == 1 ? -1 : 1))
+#endif
     /* The stream is already oriented otherwise.  */
     return EOF;
 
Index: stdio-common/vfscanf.c
===================================================================
RCS file: /work/cvs/gnu/glibc/stdio-common/vfscanf.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 vfscanf.c
--- stdio-common/vfscanf.c	1999/08/08 17:02:15	1.1.1.1
+++ stdio-common/vfscanf.c	1999/08/11 00:14:53
@@ -84,7 +84,7 @@
 #  define ISDIGIT(Ch)	  iswdigit (Ch)
 #  define ISXDIGIT(Ch)	  iswxdigit (Ch)
 #  define TOLOWER(Ch)	  towlower (Ch)
-#  define ORIENT	  if (_IO_fwide (s, 1) != 1) return EOF
+#  define ORIENT	  if (s->_vtable_offset == 0 && _IO_fwide (s, 1) != 1) return EOF
 #  define __strtoll_internal	__wcstoll_internal
 #  define __strtoull_internal	__wcstoull_internal
 #  define __strtol_internal	__wcstol_internal
Index: libio/genops.c
===================================================================
RCS file: /work/cvs/gnu/glibc/libio/genops.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 genops.c
--- libio/genops.c	1999/08/08 17:01:39	1.1.1.1
+++ libio/genops.c	1999/08/10 23:31:55
@@ -282,7 +282,7 @@ int
 __underflow (fp)
      _IO_FILE *fp;
 {
-  if (_IO_fwide (fp, -1) != -1)
+  if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1)
     return EOF;
 
   if (_IO_in_put_mode (fp))
@@ -310,7 +310,7 @@ int
 __uflow (fp)
      _IO_FILE *fp;
 {
-  if (_IO_fwide (fp, -1) != -1)
+  if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1)
     return EOF;
 
   if (_IO_in_put_mode (fp))
Index: libio/iofputs.c
===================================================================
RCS file: /work/cvs/gnu/glibc/libio/iofputs.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 iofputs.c
--- libio/iofputs.c	1999/08/08 17:01:39	1.1.1.1
+++ libio/iofputs.c	1999/08/10 23:37:13
@@ -36,7 +36,7 @@ _IO_fputs (str, fp)
   CHECK_FILE (fp, EOF);
   _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
   _IO_flockfile (fp);
-  if (_IO_fwide (fp, -1) == -1
+  if ((fp->_vtable_offset != 0 || _IO_fwide (fp, -1) == -1)
       && _IO_sputn (fp, str, len) == len)
     result = 1;
   _IO_funlockfile (fp);
Index: libio/ioftell.c
===================================================================
RCS file: /work/cvs/gnu/glibc/libio/ioftell.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 ioftell.c
--- libio/ioftell.c	1999/08/08 17:01:39	1.1.1.1
+++ libio/ioftell.c	1999/08/10 23:42:01
@@ -38,7 +38,7 @@ _IO_ftell (fp)
   pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
   if (_IO_in_backup (fp))
     {
-      if (fp->_mode < 0)
+      if (fp->_vtable_offset != 0 || fp->_mode < 0)
 	pos -= fp->_IO_save_end - fp->_IO_save_base;
       else
 	/* XXX For now.  */
Index: libio/iofwrite.c
===================================================================
RCS file: /work/cvs/gnu/glibc/libio/iofwrite.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 iofwrite.c
--- libio/iofwrite.c	1999/08/08 17:01:39	1.1.1.1
+++ libio/iofwrite.c	1999/08/10 23:43:29
@@ -41,7 +41,7 @@ _IO_fwrite (buf, size, count, fp)
     return count;
   _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
   _IO_flockfile (fp);
-  if (_IO_fwide (fp, -1) == -1)
+  if (fp->_vtable_offset != 0 || _IO_fwide (fp, -1) == -1)
     written = _IO_sputn (fp, (const char *) buf, request);
   _IO_funlockfile (fp);
   _IO_cleanup_region_end (0);
Index: libio/ioputs.c
===================================================================
RCS file: /work/cvs/gnu/glibc/libio/ioputs.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 ioputs.c
--- libio/ioputs.c	1999/08/08 17:01:40	1.1.1.1
+++ libio/ioputs.c	1999/08/10 23:56:21
@@ -36,7 +36,8 @@ _IO_puts (str)
 			    _IO_stdout);
   _IO_flockfile (_IO_stdout);
 
-  if (_IO_fwide (_IO_stdout, -1) == -1
+  if ((_IO_stdout->_vtable_offset != 0
+       || _IO_fwide (_IO_stdout, -1) == -1)
       && _IO_sputn (_IO_stdout, str, len) == len
       && _IO_putc_unlocked ('\n', _IO_stdout) != EOF)
     result = len + 1;
Index: libio/iosetbuffer.c
===================================================================
RCS file: /work/cvs/gnu/glibc/libio/iosetbuffer.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 iosetbuffer.c
--- libio/iosetbuffer.c	1999/08/08 17:01:40	1.1.1.1
+++ libio/iosetbuffer.c	1999/08/10 23:45:55
@@ -38,7 +38,7 @@ _IO_setbuffer (fp, buf, size)
   if (!buf)
     size = 0;
   (void) _IO_SETBUF (fp, buf, size);
-  if (fp->_mode == 0)
+  if (fp->_vtable_offset == 0 && fp->_mode == 0)
     /* We also have to set the buffer using the wide char function.  */
     (*fp->_wide_data->_wide_vtable->__setbuf) (fp, buf, size);
   _IO_funlockfile (fp);
Index: libio/iosetvbuf.c
===================================================================
RCS file: /work/cvs/gnu/glibc/libio/iosetvbuf.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 iosetvbuf.c
--- libio/iosetvbuf.c	1999/08/08 17:01:40	1.1.1.1
+++ libio/iosetvbuf.c	1999/08/10 23:46:32
@@ -90,7 +90,7 @@ _IO_setvbuf (fp, buf, mode, size)
       goto unlock_return;
     }
   result = _IO_SETBUF (fp, buf, size) == NULL ? EOF : 0;
-  if (result == 0 && fp->_mode == 0)
+  if (result == 0 && fp->_vtable_offset == 0 && fp->_mode == 0)
     /* We also have to set the buffer using the wide char function.  */
     result = ((*fp->_wide_data->_wide_vtable->__setbuf) (fp, buf, size) == NULL
 	      ? EOF : 0);

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

* Re: The old libio patch for glibc 2.2
  1999-08-10 17:50 The old libio patch for glibc 2.2 H.J. Lu
@ 1999-08-15 18:23 ` Ulrich Drepper
  1999-08-16  6:57   ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Drepper @ 1999-08-15 18:23 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GNU C Library

hjl@varesearch.com (H.J. Lu) writes:

> The libio change in glibc 2.2 screwed up the binaries compiled against
> glibc 2.0. This patch seems to work ok. But I don't know if it is the
> best fix nor if it fixes all the old libio problems.

I would prefer to use versioning buf the duplication of the cost is
too expensive so I went with your patches.

> Also I am not sure if we should use versioning for _IO_setbuffer and
> _IO_setvbuf.

I don't think so.

> BTW, Ulrich, What happened to my patch
> 
> Sun Aug  8 10:56:43 1999  H.J. Lu  <hjl@gnu.org>
> 
>         * pwd/Makefile (otherlibs): Add necessary libraries if
>         $(build-static-nss) is defined as "yes".
>         * inet/Makefile (otherlibs): Likewise.

I don't like this patch and have to think about it more.

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

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

* Re: The old libio patch for glibc 2.2
  1999-08-15 18:23 ` Ulrich Drepper
@ 1999-08-16  6:57   ` H.J. Lu
  1999-08-16  9:01     ` Ulrich Drepper
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 1999-08-16  6:57 UTC (permalink / raw)
  To: drepper; +Cc: libc-hacker

> 
> hjl@varesearch.com (H.J. Lu) writes:
> 
> > The libio change in glibc 2.2 screwed up the binaries compiled against
> > glibc 2.0. This patch seems to work ok. But I don't know if it is the
> > best fix nor if it fixes all the old libio problems.
> 
> I would prefer to use versioning buf the duplication of the cost is
> too expensive so I went with your patches.
> 
> > Also I am not sure if we should use versioning for _IO_setbuffer and
> > _IO_setvbuf.
> 
> I don't think so.
> 

Shouldn't that be more consistent? You used versioning on some
functions, oldiofsetpos64.c, oldiofsetpos.c, oldiofgetpos64.c,
and oldiofgetpos.c, for the libio change.


H.J.

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

* Re: The old libio patch for glibc 2.2
  1999-08-16  6:57   ` H.J. Lu
@ 1999-08-16  9:01     ` Ulrich Drepper
  0 siblings, 0 replies; 4+ messages in thread
From: Ulrich Drepper @ 1999-08-16  9:01 UTC (permalink / raw)
  To: H.J. Lu; +Cc: libc-hacker

hjl@lucon.org (H.J. Lu) writes:

> Shouldn't that be more consistent? You used versioning on some
> functions, oldiofsetpos64.c, oldiofsetpos.c, oldiofgetpos64.c,
> and oldiofgetpos.c, for the libio change.

This has a different reason which has nothing to do with the test we
are talking about.

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

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

end of thread, other threads:[~1999-08-16  9:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-10 17:50 The old libio patch for glibc 2.2 H.J. Lu
1999-08-15 18:23 ` Ulrich Drepper
1999-08-16  6:57   ` H.J. Lu
1999-08-16  9:01     ` 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).