]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Wed, 12 Jul 2000 20:06:44 +0000 (20:06 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 12 Jul 2000 20:06:44 +0000 (20:06 +0000)
2000-07-12  Bruno Haible  <haible@clisp.cons.org>

* iconv/gconv_open.c (__gconv_open): Merge duplicated code.

2000-07-12  Bruno Haible  <haible@clisp.cons.org>

* iconv/gconv_builtin.c (__gconv_get_builtin_trans): Initialize
__modname.

2000-07-12  Bruno Haible  <haible@clisp.cons.org>

* iconv/gconv_open.c (__gconv_open): Initialize
result->__steps[cnt].__data.

2000-07-12  Mark Kettenis  <kettenis@gnu.org>

* nss/getent.c (services_keys): Pass port number in network byte
order in call to getservbyport.

2000-07-11  Andreas Jaeger  <aj@suse.de>

* stdlib/Makefile (test-canon-ARGS): Fix for building in the
source dir.
* intl/Makefile (do-gettext-test): Likewise.
* dirent/Makefile (opendir-tst1-ARGS): Likewise.

2000-07-11  Andreas Schwab  <schwab@suse.de>

* Makeconfig (run-program-prefix): New rule.
(built-program-cmd): Use run-program-prefix.

22 files changed:
ChangeLog
Makeconfig
dirent/Makefile
iconv/gconv_builtin.c
iconv/gconv_open.c
intl/Makefile
linuxthreads/ChangeLog
linuxthreads/Examples/ex8.c
linuxthreads/spinlock.c
linuxthreads/spinlock.h
locale/langinfo.h
localedata/Makefile
localedata/gen-locale.sh
localedata/sort-test.sh
localedata/tst-ctype.sh
localedata/tst-fmon.sh
localedata/tst-locale.sh
localedata/tst-mbswcs.sh
localedata/tst-rpmatch.sh
localedata/tst-trans.sh
nss/getent.c
stdlib/Makefile

index 17cdab9a82374d910bf73974d9f58545d38da074..d3d9d900ba5dcf96a83d6a2e5df7e796f7b9ad93 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2000-07-12  Bruno Haible  <haible@clisp.cons.org>
+
+       * iconv/gconv_open.c (__gconv_open): Merge duplicated code.
+
+2000-07-12  Bruno Haible  <haible@clisp.cons.org>
+
+       * iconv/gconv_builtin.c (__gconv_get_builtin_trans): Initialize
+       __modname.
+
+2000-07-12  Bruno Haible  <haible@clisp.cons.org>
+
+       * iconv/gconv_open.c (__gconv_open): Initialize
+       result->__steps[cnt].__data.
+
+2000-07-12  Mark Kettenis  <kettenis@gnu.org>
+
+       * nss/getent.c (services_keys): Pass port number in network byte
+       order in call to getservbyport.
+
+2000-07-11  Andreas Jaeger  <aj@suse.de>
+
+       * stdlib/Makefile (test-canon-ARGS): Fix for building in the
+       source dir.
+       * intl/Makefile (do-gettext-test): Likewise.
+       * dirent/Makefile (opendir-tst1-ARGS): Likewise.
+
+2000-07-11  Andreas Schwab  <schwab@suse.de>
+
+       * Makeconfig (run-program-prefix): New rule.
+       (built-program-cmd): Use run-program-prefix.
+
 2000-07-12  Ulrich Drepper  <drepper@redhat.com>
 
        * locale/langinfo.h: Make CRNCYSTR, RADIXCHAR, THOUSANDS_SEP, YESEXPR,
index 0395beee56ba7f6e60db333f0fbd91d2a5544657..da3c88f0e023f6a29d242acb89cdb4346b670780 100644 (file)
@@ -475,20 +475,18 @@ elf-objpfx = $(common-objpfx)elf/
 # How to run a program we just linked with our library.
 # The program binary is assumed to be $(word 2,$^).
 built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
-ifneq (yes,$(build-shared))
-built-program-cmd = $(built-program-file)
-else
+ifeq (yes,$(build-shared))
 comma = ,
 sysdep-library-path = \
 $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
                                       $(filter -Wl$(comma)-rpath-link=%,\
                                                $(sysdep-LDFLAGS)))))
-define built-program-cmd
-$(elf-objpfx)$(rtld-installed-name) \
-       --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-       $(built-program-file)
-endef
+run-program-prefix = $(elf-objpfx)$(rtld-installed-name) \
+                    --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path))
+else
+run-program-prefix =
 endif
+built-program-cmd = $(run-program-prefix) $(built-program-file)
 
 ifndef LD
 LD := ld -X
index fcd6dcdcc493516a9bc49bffb450c040f31d6481..c61f0bf6d2f67a4c6f1cd851aede675181983610 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
+# Copyright (C) 1991,92,93,94,95,96,97,98,99,2000 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
@@ -32,4 +32,4 @@ tests    := list tst-seekdir opendir-tst1
 
 include ../Rules
 
-opendir-tst1-ARGS = --test-dir=${objdir}
+opendir-tst1-ARGS = --test-dir=${common-objpfx}dirent
index 46cb0480fa8eef3fca677683cae34187d19a47d8..7a2072d90481763c90180f216585a9a2247c9fef 100644 (file)
@@ -77,6 +77,7 @@ __gconv_get_builtin_trans (const char *name, struct __gconv_step *step)
   step->__end_fct = map[cnt].end;
   step->__counter = INT_MAX;
   step->__shlib_handle = NULL;
+  step->__modname = NULL;
 
   step->__min_needed_from = map[cnt].min_needed_from;
   step->__max_needed_from = map[cnt].max_needed_from;
index c54054a3e5280fd5f2fe094f1c33238bb19167c7..7a17b7005aded46c517d575e1b72b2fc517d3371 100644 (file)
@@ -184,14 +184,10 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
 
          /* Call all initialization functions for the transformation
             step implementations.  */
-         for (cnt = 0; cnt < nsteps - 1; ++cnt)
+         for (cnt = 0; cnt < nsteps; ++cnt)
            {
              size_t size;
 
-             /* If this is the last step we must not allocate an
-                output buffer.  */
-             result->__data[cnt].__flags = conv_flags;
-
              /* Would have to be done if we would not clear the whole
                  array above.  */
 #if 0
@@ -205,16 +201,6 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
              /* We use the `mbstate_t' member in DATA.  */
              result->__data[cnt].__statep = &result->__data[cnt].__state;
 
-             /* Allocate the buffer.  */
-             size = (GCONV_NCHAR_GOAL * steps[cnt].__max_needed_to);
-
-             result->__data[cnt].__outbuf = (char *) malloc (size);
-             if (result->__data[cnt].__outbuf == NULL)
-               goto bail;
-
-             result->__data[cnt].__outbufend =
-               result->__data[cnt].__outbuf + size;
-
              /* Now see whether we can use any of the transliteration
                 modules for this step.  */
              for (runp = trans; runp != NULL; runp = runp->next)
@@ -255,57 +241,33 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
                        }
                      break;
                    }
-           }
 
-         /* Now handle the last entry.  */
-         result->__data[cnt].__flags = conv_flags | __GCONV_IS_LAST;
-         /* Would have to be done if we would not clear the whole
-            array above.  */
-#if 0
-         result->__data[cnt].__invocation_counter = 0;
-         result->__data[cnt].__internal_use = 0;
-#endif
-         result->__data[cnt].__statep = &result->__data[cnt].__state;
+             result->__steps[cnt].__data = &result->__data[cnt];
 
-         /* Now see whether we can use the transliteration module
-            for this step.  */
-         for (runp = trans; runp != NULL; runp = runp->next)
-           for (n = 0; n < runp->ncsnames; ++n)
-             if (__strcasecmp (steps[cnt].__from_name, runp->csnames[n]) == 0)
+             /* If this is the last step we must not allocate an
+                output buffer.  */
+             if (cnt < nsteps - 1)
                {
-                 void *data = NULL;
-
-                 /* Match!  Now try the initializer.  */
-                 if (runp->trans_init_fct == NULL
-                     || (runp->trans_init_fct (data, steps[cnt].__to_name)
-                         == __GCONV_OK))
-                   {
-                     /* Append at the end of the list.  */
-                     struct __gconv_trans_data *newp;
-                     struct __gconv_trans_data *endp;
-                     struct __gconv_trans_data *lastp;
+                 result->__data[cnt].__flags = conv_flags;
 
-                     newp = (struct __gconv_trans_data *)
-                       malloc (sizeof (struct __gconv_trans_data));
-                     if (newp == NULL)
-                       goto bail;
+                 /* Allocate the buffer.  */
+                 size = (GCONV_NCHAR_GOAL * steps[cnt].__max_needed_to);
 
-                     newp->__trans_fct = runp->trans_fct;
-                     newp->__trans_context_fct = runp->trans_context_fct;
-                     newp->__trans_end_fct = runp->trans_end_fct;
+                 result->__data[cnt].__outbuf = (char *) malloc (size);
+                 if (result->__data[cnt].__outbuf == NULL)
+                   goto bail;
 
-                     lastp = NULL;
-                     for (endp = result->__data[cnt].__trans;
-                          endp != NULL; endp = endp->__next)
-                       lastp = endp;
+                 result->__data[cnt].__outbufend =
+                   result->__data[cnt].__outbuf + size;
+               }
+             else
+               {
+                 /* Handle the last entry.  */
+                 result->__data[cnt].__flags = conv_flags | __GCONV_IS_LAST;
 
-                     if (lastp == NULL)
-                       result->__data[cnt].__trans = newp;
-                     else
-                       lastp->__next = newp;
-                   }
                  break;
                }
+           }
        }
 
       if (res != __GCONV_OK)
index 8a5f05c4cae87086d3583d548d945c676d8d81b8..07108b19de708698130ab85f58a6565ceedcfe32 100644 (file)
@@ -51,7 +51,7 @@ ifneq ($(strip $(MSGFMT)),:)
 .PHONY: do-gettext-test
 tests: do-gettext-test
 do-gettext-test: tst-gettext.sh $(objpfx)tst-gettext
-       $(SHELL) -e $< $(common-objpfx) $(objpfx)
+       $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
 endif
 endif
 endif
index 9af0269f655d92fe321df04476c71e9be9ea3857..10639f79c40bd11a71abf47afe1bf8c6d72c24c2 100644 (file)
@@ -1,3 +1,10 @@
+2000-07-12  Ulrich Drepper  <drepper@redhat.com>
+
+       * spinlock.c: Fix code for TEST_FOR_COMPARE_AND_SWAP being defined.
+       Add tests also to new alternative spinlock implementation.
+       * spinlock.h: Likewise.
+       Patch by Kaz Kylheku <kaz@ashi.footprints.net>.
+
 2000-07-06  Ulrich Drepper  <drepper@redhat.com>
 
        * Version: Export __sigaction.
index 89ad8ae5d52e33cb7a04211a3bc9ed34e4a94de1..1b9b335579a4b492d069709237758c17079cba6b 100644 (file)
@@ -22,7 +22,7 @@
 #include <stdlib.h>
 #include <pthread.h>
 #include <unistd.h>
-#include <wait.h>
+#include <sys/wait.h>
 
 enum
 {
index a63c6535c934a36f403c4f0b2adb89b9f03766f5..38d6b8ef3029ac508b72a27104ac59f3f2f0d125 100644 (file)
 #include "spinlock.h"
 #include "restart.h"
 
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
+static void __pthread_acquire(int * spinlock);
+#endif
+
+
 /* The status field of a spinlock is a pointer whose least significant
    bit is a locked flag.
 
@@ -59,10 +64,10 @@ void internal_function __pthread_lock(struct _pthread_fastlock * lock,
 #if defined TEST_FOR_COMPARE_AND_SWAP
   if (!__pthread_has_cas)
 #endif
-#if !defined HAS_COMPARE_AND_SWAP
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
   {
     __pthread_acquire(&lock->__spinlock);
-    return 0;
+    return;
   }
 #endif
 
@@ -147,7 +152,7 @@ int __pthread_unlock(struct _pthread_fastlock * lock)
 #if defined TEST_FOR_COMPARE_AND_SWAP
   if (!__pthread_has_cas)
 #endif
-#if !defined HAS_COMPARE_AND_SWAP
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
   {
     WRITE_MEMORY_BARRIER();
     lock->__spinlock = 0;
@@ -237,7 +242,9 @@ struct wait_node {
 };
 
 static long wait_node_free_list;
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
 static int wait_node_free_list_spinlock;
+#endif
 
 /* Allocate a new node from the head of the free list using an atomic
    operation, or else using malloc if that list is empty.  A fundamental
@@ -247,8 +254,33 @@ static int wait_node_free_list_spinlock;
 
 static struct wait_node *wait_node_alloc(void)
 {
+#if defined HAS_COMPARE_AND_SWAP
   long oldvalue, newvalue;
+#endif
+
+#if defined TEST_FOR_COMPARE_AND_SWAP
+  if (!__pthread_has_cas)
+#endif
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
+  {
+    struct wait_node *new_node = 0;
 
+    __pthread_acquire(&wait_node_free_list_spinlock);
+    if (wait_node_free_list != 0) {
+      new_node = (struct wait_node *) wait_node_free_list;
+      wait_node_free_list = (long) new_node->next;
+    }
+    WRITE_MEMORY_BARRIER();
+    wait_node_free_list_spinlock = 0;
+
+    if (new_node == 0)
+      return malloc(sizeof *wait_node_alloc());
+
+    return new_node;
+  }
+#endif
+
+#if defined HAS_COMPARE_AND_SWAP
   do {
     oldvalue = wait_node_free_list;
 
@@ -257,10 +289,10 @@ static struct wait_node *wait_node_alloc(void)
 
     newvalue = (long) ((struct wait_node *) oldvalue)->next;
     WRITE_MEMORY_BARRIER();
-  } while (! compare_and_swap(&wait_node_free_list, oldvalue, newvalue,
-                              &wait_node_free_list_spinlock));
+  } while (! __compare_and_swap(&wait_node_free_list, oldvalue, newvalue));
 
   return (struct wait_node *) oldvalue;
+#endif
 }
 
 /* Return a node to the head of the free list using an atomic
@@ -268,37 +300,53 @@ static struct wait_node *wait_node_alloc(void)
 
 static void wait_node_free(struct wait_node *wn)
 {
+#if defined HAS_COMPARE_AND_SWAP
   long oldvalue, newvalue;
+#endif
+
+#if defined TEST_FOR_COMPARE_AND_SWAP
+  if (!__pthread_has_cas)
+#endif
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
+  {
+    __pthread_acquire(&wait_node_free_list_spinlock);
+    wn->next = (struct wait_node *) wait_node_free_list;
+    wait_node_free_list = (long) wn;
+    WRITE_MEMORY_BARRIER();
+    wait_node_free_list_spinlock = 0;
+    return;
+  }
+#endif
 
+#if defined HAS_COMPARE_AND_SWAP
   do {
     oldvalue = wait_node_free_list;
     wn->next = (struct wait_node *) oldvalue;
     newvalue = (long) wn;
     WRITE_MEMORY_BARRIER();
-  } while (! compare_and_swap(&wait_node_free_list, oldvalue, newvalue,
-                              &wait_node_free_list_spinlock));
+  } while (! __compare_and_swap(&wait_node_free_list, oldvalue, newvalue));
+#endif
 }
 
+#if defined HAS_COMPARE_AND_SWAP
+
 /* Remove a wait node from the specified queue.  It is assumed
    that the removal takes place concurrently with only atomic insertions at the
    head of the queue. */
 
 static void wait_node_dequeue(struct wait_node **pp_head,
                              struct wait_node **pp_node,
-                             struct wait_node *p_node,
-                             int *spinlock)
+                             struct wait_node *p_node)
 {
-  long oldvalue, newvalue;
-
   /* If the node is being deleted from the head of the
      list, it must be deleted using atomic compare-and-swap.
      Otherwise it can be deleted in the straightforward way. */
 
   if (pp_node == pp_head) {
-    oldvalue = (long) p_node;
-    newvalue = (long) p_node->next;
-
-    if (compare_and_swap((long *) pp_node, oldvalue, newvalue, spinlock))
+    long oldvalue = (long) p_node;
+    long newvalue = (long) p_node->next;
+       
+    if (__compare_and_swap((long *) pp_node, oldvalue, newvalue))
       return;
 
     /* Oops! Compare and swap failed, which means the node is
@@ -314,12 +362,46 @@ static void wait_node_dequeue(struct wait_node **pp_head,
   return;
 }
 
+#endif
+
 void __pthread_alt_lock(struct _pthread_fastlock * lock,
                        pthread_descr self)
 {
-  struct wait_node wait_node;
+#if defined HAS_COMPARE_AND_SWAP
   long oldstatus, newstatus;
+#endif
+  struct wait_node wait_node;
+
+#if defined TEST_FOR_COMPARE_AND_SWAP
+  if (!__pthread_has_cas)
+#endif
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
+  {
+    int suspend_needed = 0;
+    __pthread_acquire(&lock->__spinlock);
+
+    if (lock->__status == 0)
+      lock->__status = 1;
+    else {
+      if (self == NULL)
+       self = thread_self();
+
+      wait_node.abandoned = 0;
+      wait_node.next = (struct wait_node *) lock->__status;
+      wait_node.thr = self = thread_self();
+      suspend_needed = 1;
+    }
 
+    WRITE_MEMORY_BARRIER();
+    lock->__spinlock = 0;
+
+    if (suspend_needed)
+      suspend (self);
+    return;
+  }
+#endif
+
+#if defined HAS_COMPARE_AND_SWAP
   do {
     oldstatus = lock->__status;
     if (oldstatus == 0) {
@@ -344,6 +426,7 @@ void __pthread_alt_lock(struct _pthread_fastlock * lock,
 
   if (oldstatus != 0)
     suspend(self);
+#endif
 }
 
 /* Timed-out lock operation; returns 0 to indicate timeout. */
@@ -351,8 +434,11 @@ void __pthread_alt_lock(struct _pthread_fastlock * lock,
 int __pthread_alt_timedlock(struct _pthread_fastlock * lock,
                            pthread_descr self, const struct timespec *abstime)
 {
+  long oldstatus;
+#if defined HAS_COMPARE_AND_SWAP
+  long newstatus;
+#endif
   struct wait_node *p_wait_node = wait_node_alloc();
-  long oldstatus, newstatus;
 
   /* Out of memory, just give up and do ordinary lock. */
   if (p_wait_node == 0) {
@@ -360,6 +446,32 @@ int __pthread_alt_timedlock(struct _pthread_fastlock * lock,
     return 1;
   }
 
+#if defined TEST_FOR_COMPARE_AND_SWAP
+  if (!__pthread_has_cas)
+#endif
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
+  {
+    __pthread_acquire(&lock->__spinlock);
+
+    if (lock->__status == 0)
+      lock->__status = 1;
+    else {
+      if (self == NULL)
+       self = thread_self();
+
+      p_wait_node->abandoned = 0;
+      p_wait_node->next = (struct wait_node *) lock->__status;
+      p_wait_node->thr = self = thread_self();
+    }
+
+    WRITE_MEMORY_BARRIER();
+    lock->__spinlock = 0;
+    oldstatus = 1; /* force suspend */
+    goto suspend;
+  }
+#endif
+
+#if defined HAS_COMPARE_AND_SWAP
   do {
     oldstatus = lock->__status;
     if (oldstatus == 0) {
@@ -376,6 +488,11 @@ int __pthread_alt_timedlock(struct _pthread_fastlock * lock,
     MEMORY_BARRIER();
   } while(! compare_and_swap(&lock->__status, oldstatus, newstatus,
                              &lock->__spinlock));
+#endif
+
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
+  suspend:
+#endif
 
   /* If we did not get the lock, do a timed suspend. If we wake up due
      to a timeout, then there is a race; the old lock owner may try
@@ -402,24 +519,50 @@ int __pthread_alt_timedlock(struct _pthread_fastlock * lock,
 
 void __pthread_alt_unlock(struct _pthread_fastlock *lock)
 {
-  long oldstatus;
   struct wait_node *p_node, **pp_node, *p_max_prio, **pp_max_prio;
   struct wait_node ** const pp_head = (struct wait_node **) &lock->__status;
   int maxprio;
 
+#if defined TEST_FOR_COMPARE_AND_SWAP
+  if (!__pthread_has_cas)
+#endif
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
+  {
+    __pthread_acquire(&lock->__spinlock);
+  }
+#endif
+
   while (1) {
 
   /* If no threads are waiting for this lock, try to just
      atomically release it. */
+#if defined TEST_FOR_COMPARE_AND_SWAP
+    if (!__pthread_has_cas)
+#endif
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
+    {
+      if (lock->__status == 0 || lock->__status == 1) {
+       lock->__status = 0;
+       break;
+      }
+    }
+#endif
 
-    oldstatus = lock->__status;
-    if (oldstatus == 0 || oldstatus == 1) {
-      if (compare_and_swap_with_release_semantics (&lock->__status, oldstatus,
-                                                  0, &lock->__spinlock))
-       return;
-      else
-       continue;
+#if defined TEST_FOR_COMPARE_AND_SWAP
+    else
+#endif
+
+#if defined HAS_COMPARE_AND_SWAP
+    {
+      long oldstatus = lock->__status;
+      if (oldstatus == 0 || oldstatus == 1) {
+       if (__compare_and_swap_with_release_semantics (&lock->__status, oldstatus, 0))
+         break;
+       else
+         continue;
+      }
     }
+#endif
 
     /* Process the entire queue of wait nodes. Remove all abandoned
        wait nodes and put them into the global free queue, and
@@ -435,7 +578,18 @@ void __pthread_alt_unlock(struct _pthread_fastlock *lock)
 
       if (p_node->abandoned) {
        /* Remove abandoned node. */
-       wait_node_dequeue(pp_head, pp_node, p_node, &lock->__spinlock);
+#if defined TEST_FOR_COMPARE_AND_SWAP
+       if (!__pthread_has_cas)
+#endif
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
+         *pp_node = p_node->next;
+#endif
+#if defined TEST_FOR_COMPARE_AND_SWAP
+       else
+#endif
+#if defined HAS_COMPARE_AND_SWAP
+         wait_node_dequeue(pp_head, pp_node, p_node);
+#endif
        wait_node_free(p_node);
        READ_MEMORY_BARRIER();
        p_node = *pp_node;
@@ -469,12 +623,33 @@ void __pthread_alt_unlock(struct _pthread_fastlock *lock)
        whole unlock operation. */
 
     if (!testandset(&p_max_prio->abandoned)) {
-      wait_node_dequeue(pp_head, pp_max_prio, p_max_prio, &lock->__spinlock);
+#if defined TEST_FOR_COMPARE_AND_SWAP
+      if (!__pthread_has_cas)
+#endif
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
+       *pp_max_prio = p_max_prio->next;
+#endif
+#if defined TEST_FOR_COMPARE_AND_SWAP
+      else
+#endif
+#if defined HAS_COMPARE_AND_SWAP
+       wait_node_dequeue(pp_head, pp_max_prio, p_max_prio);
+#endif
       WRITE_MEMORY_BARRIER();
       restart(p_max_prio->thr);
-      return;
+      break;
     }
   }
+
+#if defined TEST_FOR_COMPARE_AND_SWAP
+  if (!__pthread_has_cas)
+#endif
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
+  {
+    WRITE_MEMORY_BARRIER();
+    lock->__spinlock = 0;
+  }
+#endif
 }
 
 
@@ -486,8 +661,6 @@ int __pthread_has_cas = 0;
 
 #if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
 
-static void __pthread_acquire(int * spinlock);
-
 int __pthread_compare_and_swap(long * ptr, long oldval, long newval,
                                int * spinlock)
 {
index 6609ef71c95c321c6b92476d95111c2f92a0d63d..435271d8120c5a847dbe246a192b591042e3046e 100644 (file)
@@ -105,7 +105,7 @@ static inline int __pthread_trylock (struct _pthread_fastlock * lock)
 #if defined TEST_FOR_COMPARE_AND_SWAP
   if (!__pthread_has_cas)
 #endif
-#if !defined HAS_COMPARE_AND_SWAP
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
   {
     return (testandset(&lock->__spinlock) ? EBUSY : 0);
   }
@@ -140,13 +140,26 @@ static inline void __pthread_alt_init_lock(struct _pthread_fastlock * lock)
 
 static inline int __pthread_alt_trylock (struct _pthread_fastlock * lock)
 {
+#if defined HAS_COMPARE_AND_SWAP
   long oldstatus;
+#endif
+
+#if defined TEST_FOR_COMPARE_AND_SWAP
+  if (!__pthread_has_cas)
+#endif
+#if !defined HAS_COMPARE_AND_SWAP || defined TEST_FOR_COMPARE_AND_SWAP
+  {
+    return (testandset(&lock->__spinlock) ? EBUSY : 0);
+  }
+#endif
 
+#if defined HAS_COMPARE_AND_SWAP
   do {
     oldstatus = lock->__status;
     if (oldstatus != 0) return EBUSY;
   } while(! compare_and_swap(&lock->__status, 0, 1, &lock->__spinlock));
   return 0;
+#endif
 }
 
 /* Initializers for both lock variants */
index 2b777091bce345a85555dcee58425678790846a8..6425dec5924e9b823ed357a2ef23dc1bbf8531eb 100644 (file)
@@ -389,7 +389,7 @@ enum
 # define N_SIGN_POSN           __N_SIGN_POSN
 #endif
   _NL_MONETARY_CRNCYSTR,
-#define CRNCYSTR               __CRNCYSTR
+#define CRNCYSTR               _NL_MONETARY_CRNCYSTR
   __INT_P_CS_PRECEDES,
 #ifdef __USE_GNU
 # define INT_P_CS_PRECEDES     __INT_P_CS_PRECEDES
index c9905a5e1ac1fba05f72ec2fc4a770e2bb02f26e..cd6e39da9b340915096ca531cf2fd618e12a5cc5 100644 (file)
@@ -76,7 +76,6 @@ distribute := CHECKSUMS README SUPPORTED ChangeLog                    \
 include ../Makeconfig
 
 ifeq (no,$(cross-compiling))
-ifeq (yes,$(build-shared))
 locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl            \
                     tst_iswctype tst_iswdigit tst_iswgraph            \
                     tst_iswlower tst_iswprint tst_iswpunct            \
@@ -94,7 +93,6 @@ locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl            \
 
 tests = $(locale_test_suite)
 endif
-endif
 
 # Files to install.
 install-others := $(addprefix $(inst_i18ndir)/, $(charmaps) $(locales) \
@@ -117,7 +115,6 @@ CFLAGS-tst-trans.c = -Wno-format
 
 
 ifeq (no,$(cross-compiling))
-ifeq (yes,$(build-shared))
 # We have to generate locales
 LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \
           en_US.ISO-8859-1 ja_JP.EUC-JP
@@ -130,9 +127,9 @@ generated-dirs += $(LOCALES)
 # Dependency for the locale files.  We actually make it depend only on
 # one of the files.
 $(addprefix $(objpfx),$(CTYPE_FILES)): %: \
-  gen-locale.sh Makefile $(common-objpfx)locale/localedef \
+  gen-locale.sh $(common-objpfx)locale/localedef Makefile \
   $(addprefix charmaps/,$(CHARMAPS)) $(addprefix locales/,$(LOCALE_SRCS))
-       @$(SHELL) -e gen-locale.sh $(common-objpfx) $@
+       @$(SHELL) -e gen-locale.sh $(common-objpfx) '$(built-program-cmd)' $@
 
 $(addsuffix .out,$(addprefix $(objpfx),$(locale_test_suite))): %: \
   $(addprefix $(objpfx),$(CTYPE_FILES))
@@ -143,27 +140,26 @@ tests: do-collate-test do-tst-fmon do-tst-locale do-tst-rpmatch do-tst-trans \
        do-tst-mbswcs do-tst-ctype
 do-collate-test: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
                 $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
-       $(SHELL) -e $< $(common-objpfx) $(test-input)
+       $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(test-input)
 do-tst-fmon: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data do-collate-test \
             $(addprefix $(objpfx),$(CTYPE_FILES))
-       $(SHELL) -e $< $(common-objpfx) tst-fmon.data
-do-tst-locale: tst-locale.sh $(ld-test-srcs) \
+       $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' tst-fmon.data
+do-tst-locale: tst-locale.sh $(common-objpfx)locale/localedef $(ld-test-srcs) \
               $(addprefix $(objpfx),$(CTYPE_FILES))
-       $(SHELL) -e $< $(common-objpfx)
+       $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
 do-tst-rpmatch: tst-rpmatch.sh $(objpfx)tst-rpmatch do-tst-fmon \
                $(addprefix $(objpfx),$(CTYPE_FILES))
-       $(SHELL) -e $< $(common-objpfx)
+       $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
 do-tst-trans: tst-trans.sh $(objpfx)tst-trans \
              $(addprefix $(objpfx),$(CTYPE_FILES))
-       $(SHELL) -e $< $(common-objpfx)
+       $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)'
 do-tst-mbswcs: tst-mbswcs.sh $(objpfx)tst-mbswcs1 $(objpfx)tst-mbswcs2 \
               $(objpfx)tst-mbswcs3 $(objpfx)tst-mbswcs4 $(objpfx)tst-mbswcs5 \
               $(addprefix $(objpfx),$(CTYPE_FILES))
-       $(SHELL) -e $< $(common-objpfx)
+       $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)'
 do-tst-ctype: tst-ctype.sh $(objpfx)tst-ctype do-collate-test \
              $(addprefix $(objpfx),$(CTYPE_FILES))
-       $(SHELL) -e $< $(common-objpfx)
-endif
+       $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
 endif
 
 # Sometimes the whole collection of locale files should be installed.
index b68e364a1e46b85265c04959092355fc3a8dc515..386665ca02ed3f475e9c54efc0da778b9761a233 100644 (file)
@@ -19,6 +19,7 @@
 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 common_objpfx="$1"; shift
+localedef="$1"; shift
 locfile="$1"; shift
 
 generate_locale ()
@@ -27,8 +28,7 @@ generate_locale ()
     input=$2
     out=$3
     I18NPATH=. GCONV_PATH=${common_objpfx}iconvdata \
-    ${common_objpfx}elf/ld.so --library-path $common_objpfx \
-    ${common_objpfx}locale/localedef --quiet -c -f $charmap -i $input \
+    ${localedef} --quiet -c -f $charmap -i $input \
       ${common_objpfx}localedata/$out
 
     if [ $? -ne 0 ]; then
@@ -38,8 +38,9 @@ generate_locale ()
     fi
 }
 
-locale=`echo $locfile|sed 's|.*/\([^/.]*\)[.].*/LC_CTYPE|\1|'`
-charmap=`echo $locfile|sed 's|.*/[^/.]*[.]\(.*\)/LC_CTYPE|\1|'`
+locfile=`echo $locfile|sed 's|.*/\([^/]*/LC_CTYPE\)|\1|'`
+locale=`echo $locfile|sed 's|\([^.]*\)[.].*/LC_CTYPE|\1|'`
+charmap=`echo $locfile|sed 's|[^.]*[.]\(.*\)/LC_CTYPE|\1|'`
 
 echo "Generating locale $locale.$charmap: this might take a while..."
 generate_locale $charmap $locale $locale.$charmap
index 18dbcd5362798a933750f78703f39ff540621f91..6c2252461277fc96ec66ca2e821ec0e69ce5e63d 100644 (file)
@@ -1,6 +1,7 @@
 #! /bin/sh
 
 common_objpfx=$1; shift
+run_program_prefix=$1; shift
 lang=$*
 
 id=${PPID:-100}
@@ -11,13 +12,13 @@ status=0
 for l in $lang; do
   cns=`echo $l | sed 's/\(.*\)[.][^.]*/\1/'`
   LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}/iconvdata \
-   LC_ALL=$l ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+   LC_ALL=$l ${run_program_prefix} \
    ${common_objpfx}localedata/collate-test $id < $cns.in \
    > ${common_objpfx}localedata/$cns.out || status=1
   cmp -s $cns.in ${common_objpfx}localedata/$cns.out || status=1
 
   LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}/iconvdata \
-   LC_ALL=$l ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+   LC_ALL=$l ${run_program_prefix} \
    ${common_objpfx}localedata/xfrm-test $id < $cns.in \
    > ${common_objpfx}localedata/$cns.xout || status=1
   cmp -s $cns.in ${common_objpfx}localedata/$cns.xout || status=1
index a0d51dccbcc6acc65919b76e70ec4e396a364fa2..5b906a2188a7b52434014c2672c7b7d549bb6cbe 100755 (executable)
@@ -19,6 +19,7 @@
 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 common_objpfx=$1; shift
+tst_ctype=$1; shift
 status=0
 
 # Run the test programs.
@@ -30,8 +31,7 @@ for loc in de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 ja_JP.EUC-JP; do
     input=/dev/null
   fi
   LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-  LC_ALL=$loc ${common_objpfx}elf/ld.so --library-path $common_objpfx \
-    ${common_objpfx}localedata/tst-ctype < $input \
+  LC_ALL=$loc ${tst_ctype} < $input \
     >> ${common_objpfx}localedata/tst-ctype.out || status=1
 done
 
index 469d227afb2e6dcdf44c7ecdfd64066d4778213b..99c5cc68012b886932afdb9b429a142fdb51606b 100755 (executable)
@@ -25,7 +25,8 @@ case $1 in
 esac
 
 common_objpfx=$1
-datafile=$2
+run_program_prefix=$2
+datafile=$3
 
 here=`pwd`
 
@@ -37,19 +38,17 @@ for cns in `cd ./tst-fmon-locales && ls tstfmon_*`; do
     fn=charmaps/ISO-8859-1
     I18NPATH=. GCONV_PATH=${common_objpfx}iconvdata \
     LOCPATH=${common_objpfx}localedata LC_ALL=C LANGUAGE=C \
-    ${common_objpfx}elf/ld.so --library-path $common_objpfx \
-    ${common_objpfx}locale/localedef \
+    ${run_program_prefix} ${common_objpfx}locale/localedef \
     --quiet -i $cn -f $fn ${common_objpfx}localedata/$cns
 done
 
 # Run the tests.
-IFS="  "                # This is a TAB
-while read locale format value expect; do
+# There's a TAB for IFS
+while IFS="    " read locale format value expect; do
     if [ -n "$format" ]; then
        LOCPATH=${common_objpfx}localedata \
        GCONV_PATH=${common_objpfx}/iconvdata \
-       ${common_objpfx}elf/ld.so --library-path $common_objpfx \
-        ${common_objpfx}localedata/tst-fmon \
+       ${run_program_prefix} ${common_objpfx}localedata/tst-fmon \
            "$locale" "$format" "$value" "$expect"
        if [ $? -eq 0 ]; then
            if [ $DEBUG -eq 1 ]; then
index 79e5410958028e149bedbb31867e41ec159b5d2c..4d503114ee8a3b025c822d16f829a78c070dd5f3 100755 (executable)
@@ -20,6 +20,7 @@
 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 common_objpfx=$1; shift
+localedef=$1; shift
 
 test_locale ()
 {
@@ -32,8 +33,7 @@ test_locale ()
     fi
     I18NPATH=. GCONV_PATH=${common_objpfx}iconvdata \
     LOCPATH=${common_objpfx}localedata LC_ALL=C LANGUAGE=C \
-    ${common_objpfx}elf/ld.so --library-path $common_objpfx \
-    ${common_objpfx}locale/localedef --quiet -c -f $charmap -i $input \
+    ${localedef} --quiet -c -f $charmap -i $input \
       ${rep} ${common_objpfx}localedata/$out
 
     if [ $? -ne 0 ]; then
index 267ab48da217859e755efb49e942da9ec153937e..575ba1a579fa9e82b07f25a5419a6b47083fcc35 100755 (executable)
 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 common_objpfx=$1; shift
+run_program_prefix=$1; shift
 
 status=0
 
 # Run the test programs.
 LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
-  ${common_objpfx}localedata/tst-mbswcs1 \
+${run_program_prefix} ${common_objpfx}localedata/tst-mbswcs1 \
   > ${common_objpfx}localedata/tst-mbswcs.out || status=1
 
 LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
-  ${common_objpfx}localedata/tst-mbswcs2 \
+${run_program_prefix} ${common_objpfx}localedata/tst-mbswcs2 \
   >> ${common_objpfx}localedata/tst-mbswcs.out || status=1
 
 LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
-  ${common_objpfx}localedata/tst-mbswcs3 \
+${run_program_prefix} ${common_objpfx}localedata/tst-mbswcs3 \
   >> ${common_objpfx}localedata/tst-mbswcs.out || status=1
 
 LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
-  ${common_objpfx}localedata/tst-mbswcs4 \
+${run_program_prefix} ${common_objpfx}localedata/tst-mbswcs4 \
   >> ${common_objpfx}localedata/tst-mbswcs.out || status=1
 
 LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
-  ${common_objpfx}localedata/tst-mbswcs5 \
+${run_program_prefix} ${common_objpfx}localedata/tst-mbswcs5 \
   >> ${common_objpfx}localedata/tst-mbswcs.out || status=1
 
 exit $status
index dd6b8a135e2fb30647ad3cb052ee9dad13b2933a..d3eb593c719cfa92f3fb9d9f06189d606c322700 100755 (executable)
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 common_objpfx=$1
-IFS="&"
+tst_rpmatch=$2
+
 rc=0
-while read locale string result dummy; do
+while IFS=\& read locale string result dummy; do
     if [ "$locale" != "#" ]; then
        LOCPATH=${common_objpfx}localedata \
        GCONV_PATH=${common_objpfx}/iconvdata \
-       ${common_objpfx}elf/ld.so --library-path $common_objpfx \
-       ${common_objpfx}localedata/tst-rpmatch $locale $string $result \
+       ${tst_rpmatch} $locale $string $result \
        || exit 1
     fi
 done <<EOF
index 83079f533ae93bf3ed92318448b613437e825059..85bb1b1db39cc581edf26acb299451972e0696ff 100755 (executable)
 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 common_objpfx=$1
+run_program_prefix=$2
 
 # Generate the necessary locale data.
 I18NPATH=. GCONV_PATH=${common_objpfx}/iconvdata \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${run_program_prefix} \
 ${common_objpfx}locale/localedef --quiet \
 -i tests/trans.def -f charmaps/ISO-8859-1 \
 ${common_objpfx}localedata/tt_TT ||
@@ -30,7 +31,7 @@ exit 1
 
 # Run the test program.
 LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-LC_ALL=tt_TT ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+LC_ALL=tt_TT ${run_program_prefix} \
 ${common_objpfx}localedata/tst-trans > ${common_objpfx}localedata/tst-trans.out
 
 exit $?
index 02f2034efbbe333e3c10734576242c1cf40ac71b..d3a9fde1e1d094b519f154e6768550e8e6439ea1 100644 (file)
@@ -366,7 +366,7 @@ services_keys (int number, char *key[])
          *proto++ = '\0';
 
          if (isdigit (key[i][0]))
-           serv = getservbyport (atol (key[i]), proto);
+           serv = getservbyport (htons (atol (key[i])), proto);
          else
            serv = getservbyname (key[i], proto);
 
index 2427e617fc67d9e5e2b12d2f849c9dd42366b1ec..9eededd095cb95d4e12d8c19ddbdf45d835cb848 100644 (file)
@@ -127,7 +127,7 @@ clean-mpn:
 endif
 
 # Testdir has to be named stdlib and needs to be writable
-test-canon-ARGS = --test-dir=${objdir}/stdlib
+test-canon-ARGS = --test-dir=${common-objpfx}stdlib
 
 # Run a test on the header files we use.
 tests: $(objpfx)isomac