about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--linuxthreads/ChangeLog6
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h21
-rw-r--r--manual/string.texi23
-rw-r--r--nptl/ChangeLog6
5 files changed, 51 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 64bae1f182..6dd068304c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-07-14  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #266]
+	* manual/string.texi (l64a): Note that the static buffer is 7 bytes
+	long.  Rewrite example code so that it takes account l64a output
+	shorter than 6 characters.
+	Reported by Julian Graham <julian.graham@aya.yale.edu>.
+
 2004-07-14  Kaz  Kojima  <kkojima@rr.iij4u.or.jp>
 
 	* sysdeps/sh/dl-machine.h: Don't reset _dl_starting_up here.
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index ca061a943f..45a76743ad 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,9 @@
+2004-07-14  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+	* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
+	(__local_multiple_threads): Define for librt.
+	(SINGLE_THREAD_P): Likewise.
+
 2004-07-07  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/pthread/getcpuclockid.c (pthread_getcpuclockid): Allow
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h b/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
index 9fac494a9f..03c6fedbfe 100644
--- a/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
+++ b/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
@@ -99,6 +99,7 @@
 # else
 #  define __local_enable_asynccancel	__librt_enable_asynccancel
 #  define __local_disable_asynccancel	__librt_disable_asynccancel
+#  define __local_multiple_threads	__librt_multiple_threads
 # endif
 
 # if defined IS_IN_librt && defined PIC
@@ -183,7 +184,8 @@ extern int __local_multiple_threads attribute_hidden;
      1:
 
 #  else
-#   define SINGLE_THREAD_P \
+#   if !defined NOT_IN_libc || defined IS_IN_libpthread
+#    define SINGLE_THREAD_P \
 	mov r12,r2; \
 	mov.l 0f,r12; \
 	mova 0f,r0; \
@@ -197,6 +199,23 @@ extern int __local_multiple_threads attribute_hidden;
      0: .long _GLOBAL_OFFSET_TABLE_; \
      1: .long __local_multiple_threads@GOTOFF; \
      2:
+#   else
+#    define SINGLE_THREAD_P \
+	mov r12,r2; \
+	mov.l 0f,r12; \
+	mova 0f,r0; \
+	add r0,r12; \
+	mov.l 1f,r0; \
+	mov.l @(r0,r12),r0; \
+	mov.l @r0,r0; \
+	mov r2,r12; \
+	bra 2f; \
+	 tst r0,r0; \
+	.align 2; \
+     0: .long _GLOBAL_OFFSET_TABLE_; \
+     1: .long __local_multiple_threads@GOT; \
+     2:
+#   endif
 #  endif
 # endif
 
diff --git a/manual/string.texi b/manual/string.texi
index 344c360efb..21ab71461a 100644
--- a/manual/string.texi
+++ b/manual/string.texi
@@ -2296,7 +2296,7 @@ this task.
 @comment XPG
 @deftypefun {char *} l64a (long int @var{n})
 This function encodes a 32-bit input value using characters from the
-basic character set.  It returns a pointer to a 6 character buffer which
+basic character set.  It returns a pointer to a 7 character buffer which
 contains an encoded version of @var{n}.  To encode a series of bytes the
 user must copy the returned string to a destination buffer.  It returns
 the empty string if @var{n} is zero, which is somewhat bizarre but
@@ -2321,13 +2321,17 @@ encode (const void *buf, size_t len)
   /* @r{We know in advance how long the buffer has to be.} */
   unsigned char *in = (unsigned char *) buf;
   char *out = malloc (6 + ((len + 3) / 4) * 6 + 1);
-  char *cp = out;
+  char *cp = out, *p;
 
   /* @r{Encode the length.} */
   /* @r{Using `htonl' is necessary so that the data can be}
-     @r{decoded even on machines with different byte order.} */
+     @r{decoded even on machines with different byte order.}
+     @r{`l64a' can return a string shorter than 6 bytes, so }
+     @r{we pad it with encoding of 0 (}'.'@r{) at the end by }
+     @r{hand.} */
 
-  cp = mempcpy (cp, l64a (htonl (len)), 6);
+  p = stpcpy (cp, l64a (htonl (len)));
+  cp = mempcpy (p, "......", 6 - (p - cp));
 
   while (len > 3)
     @{
@@ -2336,12 +2340,8 @@ encode (const void *buf, size_t len)
       n = (n << 8) | *in++;
       n = (n << 8) | *in++;
       len -= 4;
-      if (n)
-        cp = mempcpy (cp, l64a (htonl (n)), 6);
-      else
-            /* @r{`l64a' returns the empty string for n==0, so we }
-               @r{must generate its encoding (}"......"@r{) by hand.} */
-        cp = stpcpy (cp, "......");
+      p = stpcpy (cp, l64a (htonl (n)));
+      cp = mempcpy (p, "......", 6 - (p - cp));
     @}
   if (len > 0)
     @{
@@ -2352,8 +2352,7 @@ encode (const void *buf, size_t len)
           if (--len > 0)
             n = (n << 8) | *in;
         @}
-      memcpy (cp, l64a (htonl (n)), 6);
-      cp += 6;
+      cp = stpcpy (cp, l64a (htonl (n)));
     @}
   *cp = '\0';
   return out;
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 5fdf2a612d..1b69d66e95 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,9 @@
+2004-07-14  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+	* sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
+	(__pthread_cond_timedwait): Check for invalid nanosecond in
+	timeout value.
+
 2004-07-07  Ulrich Drepper  <drepper@redhat.com>
 
 	* Makefile: Add rules to build and run tst-fini1.