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


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

Re: libio/genops.c: list_all_lock


"Jeff Bailey" <Jbailey@phn.ca> writes:

> Somewhere between 2.0.109 and 2.0.111, you updated libio/genops.c with the list_all_lock variable.  This is broken for the NO_THREADS case and results in the following:

Right.  Please use the appended patch I just checked in.

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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: genops.c
===================================================================
RCS file: /glibc/cvsfiles/libc/libio/genops.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -d -u -p -r1.29 -r1.30
--- genops.c	1998/12/31 18:06:46	1.29
+++ genops.c	1999/01/28 11:35:41	1.30
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU IO Library.
 
    This library is free software; you can redistribute it and/or
@@ -31,7 +31,9 @@
 #endif
 #include <string.h>
 
+#ifdef _IO_MTSAFE_IO
 static _IO_lock_t list_all_lock = _IO_lock_initializer;
+#endif
 
 void
 _IO_un_link (fp)
@@ -39,8 +41,10 @@ _IO_un_link (fp)
 {
   if (fp->_flags & _IO_LINKED)
     {
+#ifdef _IO_MTSAFE_IO
       _IO_FILE **f;
       _IO_lock_lock (list_all_lock);
+#endif
       for (f = &_IO_list_all; *f != NULL; f = &(*f)->_chain)
 	{
 	  if (*f == fp)
@@ -49,7 +53,9 @@ _IO_un_link (fp)
 	      break;
 	    }
 	}
+#ifdef _IO_MTSAFE_IO
       _IO_lock_unlock (list_all_lock);
+#endif
       fp->_flags &= ~_IO_LINKED;
     }
 }
@@ -61,10 +67,14 @@ _IO_link_in (fp)
     if ((fp->_flags & _IO_LINKED) == 0)
       {
 	fp->_flags |= _IO_LINKED;
+#ifdef _IO_MTSAFE_IO
 	_IO_lock_lock (list_all_lock);
+#endif
 	fp->_chain = _IO_list_all;
 	_IO_list_all = fp;
+#ifdef _IO_MTSAFE_IO
 	_IO_lock_unlock (list_all_lock);
+#endif
       }
 }
 


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