diff options
| author | Ulrich Drepper <drepper@redhat.com> | 2000-07-12 20:06:44 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 2000-07-12 20:06:44 +0000 |
| commit | 9f835f5fb48eb6e173a7ca3c678595dba28c5e7a (patch) | |
| tree | 34f261d68fe97fc358f706dc8883ecfdfd450caf | |
| parent | 50a6564365575ba9d20a6cfde261ec5fcbb9ff35 (diff) | |
| download | glibc-9f835f5fb48eb6e173a7ca3c678595dba28c5e7a.tar.xz glibc-9f835f5fb48eb6e173a7ca3c678595dba28c5e7a.zip | |
Update.
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.
| -rw-r--r-- | ChangeLog | 31 | ||||
| -rw-r--r-- | Makeconfig | 14 | ||||
| -rw-r--r-- | dirent/Makefile | 4 | ||||
| -rw-r--r-- | iconv/gconv_builtin.c | 1 | ||||
| -rw-r--r-- | iconv/gconv_open.c | 76 | ||||
| -rw-r--r-- | intl/Makefile | 2 | ||||
| -rw-r--r-- | linuxthreads/ChangeLog | 7 | ||||
| -rw-r--r-- | linuxthreads/Examples/ex8.c | 2 | ||||
| -rw-r--r-- | linuxthreads/spinlock.c | 233 | ||||
| -rw-r--r-- | linuxthreads/spinlock.h | 15 | ||||
| -rw-r--r-- | locale/langinfo.h | 2 | ||||
| -rw-r--r-- | localedata/Makefile | 24 | ||||
| -rw-r--r-- | localedata/gen-locale.sh | 9 | ||||
| -rw-r--r-- | localedata/sort-test.sh | 5 | ||||
| -rwxr-xr-x | localedata/tst-ctype.sh | 4 | ||||
| -rwxr-xr-x | localedata/tst-fmon.sh | 13 | ||||
| -rwxr-xr-x | localedata/tst-locale.sh | 4 | ||||
| -rwxr-xr-x | localedata/tst-mbswcs.sh | 16 | ||||
| -rwxr-xr-x | localedata/tst-rpmatch.sh | 8 | ||||
| -rwxr-xr-x | localedata/tst-trans.sh | 5 | ||||
| -rw-r--r-- | nss/getent.c | 2 | ||||
| -rw-r--r-- | stdlib/Makefile | 2 |
22 files changed, 329 insertions, 150 deletions
@@ -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, diff --git a/Makeconfig b/Makeconfig index 0395beee56..da3c88f0e0 100644 --- a/Makeconfig +++ b/Makeconfig @@ -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 diff --git a/dirent/Makefile b/dirent/Makefile index fcd6dcdcc4..c61f0bf6d2 100644 --- a/dirent/Makefile +++ b/dirent/Makefile @@ -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 diff --git a/iconv/gconv_builtin.c b/iconv/gconv_builtin.c index 46cb0480fa..7a2072d904 100644 --- a/iconv/gconv_builtin.c +++ b/iconv/gconv_builtin.c @@ -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; diff --git a/iconv/gconv_open.c b/iconv/gconv_open.c index c54054a3e5..7a17b7005a 100644 --- a/iconv/gconv_open.c +++ b/iconv/gconv_open.c @@ -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) diff --git a/intl/Makefile b/intl/Makefile index 8a5f05c4ca..07108b19de 100644 --- a/intl/Makefile +++ b/intl/Makefile @@ -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 diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 9af0269f65..10639f79c4 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -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. diff --git a/linuxthreads/Examples/ex8.c b/linuxthreads/Examples/ex8.c index 89ad8ae5d5..1b9b335579 100644 --- a/linuxthreads/Examples/ex8.c +++ b/linuxthreads/Examples/ex8.c @@ -22,7 +22,7 @@ #include <stdlib.h> #include <pthread.h> #include <unistd.h> -#include <wait.h> +#include <sys/wait.h> enum { diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c index a63c6535c9..38d6b8ef30 100644 --- a/linuxthreads/spinlock.c +++ b/linuxthreads/spinlock.c @@ -24,6 +24,11 @@ #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) { |
