]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Fri, 14 Dec 2001 22:17:03 +0000 (22:17 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 14 Dec 2001 22:17:03 +0000 (22:17 +0000)
* sysdeps/generic/strstr.c (strstr): Update.  New optimized version.

ChangeLog
linuxthreads/ChangeLog
linuxthreads/linuxthreads.texi
linuxthreads/man/pthread_atfork.man
sysdeps/generic/strstr.c

index 494741f98dd0684735fa89b05f6990a0f0a44bc1..e4a4d65407f76d43d635bb3f080baad70d375319 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2001-12-14  Ulrich Drepper  <drepper@redhat.com>
 
+       * sysdeps/generic/strstr.c (strstr): Update.  New optimized version.
+
        * crypt/md5.h: Define md5_uintptr.
 
 2001-12-13  Ulrich Drepper  <drepper@redhat.com>
index a926600e85e8d50b82d45bbe71b73ecc6a715e4c..2b55b8fcfba7b3cab63e1453a36d40f57c067d28 100644 (file)
@@ -1,3 +1,9 @@
+2001-12-14  Ulrich Drepper  <drepper@redhat.com>
+
+       * man/pthread_atfork.man: Adjust description of mutex handling
+       after fork for current implementation.
+       * linuxthreads.texi: Likewise [PR libc/2519].
+
 2001-12-13  Andreas Schwab  <schwab@suse.de>
 
        * specific.c (pthread_key_delete): Don't contact the thread
index 9513a67a6a2eca65e290ccf0babb690cf0ecc305..b4d83c9deef20c9afccddae3bcd3eade7137febb 100644 (file)
@@ -1395,12 +1395,10 @@ pocess image.
 To understand the purpose of @code{pthread_atfork}, recall that
 @code{fork} duplicates the whole memory space, including mutexes in
 their current locking state, but only the calling thread: other threads
-are not running in the child process. Thus, if a mutex is locked by a
-thread other than the thread calling @code{fork}, that mutex will remain
-locked forever in the child process, possibly blocking the execution of
-the child process. Or if some shared data, such as a linked list, was in the
-middle of being updated by a thread in the parent process, the child
-will get a copy of the incompletely updated data which it cannot use.
+are not running in the child process.  The mutexes are not usable after
+the @code{fork} and must be initialized with @code{pthread_mutex_init}
+in the child process.  This is a limitation of the current
+implementation and might or might not be present in future versions.
 
 To avoid this, install handlers with @code{pthread_atfork} as follows: have the
 @var{prepare} handler lock the mutexes (in locking order), and the
@@ -1627,4 +1625,3 @@ of a mapping of user threads to kernel threads.  It exists for source
 compatibility.  However, it will return the value that was set by the
 last call to @code{pthread_setconcurrency}.
 @end deftypefun
-
index 4d06a56f8b99e77c8a07dded9a1cb2fc38ef2c2d..b682bed3ac8e93cda187b1361920ca2966529cf1 100644 (file)
@@ -30,15 +30,10 @@ while the |parent| and |child| handlers are called in FIFO order
 To understand the purpose of !pthread_atfork!, recall that !fork!(2)
 duplicates the whole memory space, including mutexes in their current
 locking state, but only the calling thread: other threads are not
-running in the child process. Thus, if a mutex is locked by a thread
-other than the thread calling !fork!, that mutex will remain locked
-forever in the child process, possibly blocking the execution of the
-child process. To avoid this, install handlers with !pthread_atfork!
-as follows: the |prepare| handler locks the global mutexes (in locking
-order), and the |parent| and |child| handlers unlock them (in
-reverse order). Alternatively, |prepare| and |parent| can be set to
-!NULL! and |child| to a function that calls !pthread_mutex_init! on
-the global mutexes.
+running in the child process.  The mutexes are not usable after the
+!fork! and must be initialized with |pthread_mutex_init| in the child
+process.  This is a limitation of the current implementation and might
+or might not be present in future versions.
 
 .SH "RETURN VALUE"
 
index 1409fbdeb6cde95c11e6a3d58e3b0ac4a25cfdb2..ff295e0635a22e5b21ec3e3de22396d490025f92 100644 (file)
@@ -1,5 +1,5 @@
 /* Return the offset of one string within another.
-   Copyright (C) 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -43,85 +43,80 @@ strstr (phaystack, pneedle)
      const char *phaystack;
      const char *pneedle;
 {
-  register const unsigned char *haystack, *needle;
-  register chartype b, c;
+  const unsigned char *haystack, *needle;
+  chartype b;
+  const unsigned char *rneedle;
 
   haystack = (const unsigned char *) phaystack;
-  needle = (const unsigned char *) pneedle;
 
-  b = *needle;
-  if (b != '\0')
+  if (b = *(needle = (const unsigned char *) pneedle))
     {
-      haystack--;                              /* possible ANSI violation */
-      do
-       {
-         c = *++haystack;
-         if (c == '\0')
+      chartype c;
+      haystack--;              /* possible ANSI violation */
+
+      {
+       chartype a;
+       do
+         if (!(a = *++haystack))
            goto ret0;
-       }
-      while (c != b);
+       while (a != b);
+      }
 
-      c = *++needle;
-      if (c == '\0')
+      if (!(c = *++needle))
        goto foundneedle;
       ++needle;
       goto jin;
 
       for (;;)
-        {
-          register chartype a;
-         register const unsigned char *rhaystack, *rneedle;
-
-         do
-           {
-             a = *++haystack;
-             if (a == '\0')
-               goto ret0;
-             if (a == b)
-               break;
+       {
+         {
+           chartype a;
+           if (0)
+           jin:{
+               if ((a = *++haystack) == c)
+                 goto crest;
+             }
+           else
              a = *++haystack;
-             if (a == '\0')
-               goto ret0;
-shloop:
-             ;
-           }
-          while (a != b);
-
-jin:     a = *++haystack;
-         if (a == '\0')
-           goto ret0;
-
-         if (a != c)
-           goto shloop;
-
-         rhaystack = haystack-- + 1;
-         rneedle = needle;
-         a = *rneedle;
-
-         if (*rhaystack == a)
            do
              {
-               if (a == '\0')
-                 goto foundneedle;
-               ++rhaystack;
-               a = *++needle;
-               if (*rhaystack != a)
-                 break;
-               if (a == '\0')
-                 goto foundneedle;
-               ++rhaystack;
-               a = *++needle;
+               for (; a != b; a = *++haystack)
+                 {
+                   if (!a)
+                     goto ret0;
+                   if ((a = *++haystack) == b)
+                     break;
+                   if (!a)
+                     goto ret0;
+                 }
              }
-           while (*rhaystack == a);
-
-         needle = rneedle;             /* took the register-poor approach */
-
-         if (a == '\0')
-           break;
-        }
+           while ((a = *++haystack) != c);
+         }
+       crest:
+         {
+           chartype a;
+           {
+             const unsigned char *rhaystack;
+             if (*(rhaystack = haystack-- + 1) == (a = *(rneedle = needle)))
+               do
+                 {
+                   if (!a)
+                     goto foundneedle;
+                   if (*++rhaystack != (a = *++needle))
+                     break;
+                   if (!a)
+                     goto foundneedle;
+                 }
+               while (*++rhaystack == (a = *++needle));
+             needle = rneedle; /* took the register-poor aproach */
+           }
+           if (!a)
+             break;
+         }
+       }
     }
 foundneedle:
-  return (char*) haystack;
+  return (char *) haystack;
 ret0:
   return 0;
 }