about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--linuxthreads/ChangeLog12
-rw-r--r--linuxthreads/spinlock.c10
-rw-r--r--linuxthreads/spinlock.h35
-rw-r--r--localedata/ChangeLog5
-rw-r--r--localedata/locales/pt_BR58
-rw-r--r--malloc/memusage.c (renamed from malloc/memprof.c)22
-rwxr-xr-xmalloc/memusage.sh (renamed from malloc/memprof.sh)54
-rw-r--r--malloc/memusagestat.c (renamed from malloc/memprofstat.c)4
9 files changed, 135 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog
index b13c850099..0383fe1919 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2000-06-19  Ulrich Drepper  <drepper@redhat.com>
 
+	* malloc/Makefile: Change all references to memprof into memusage.
+	* malloc/memprof.c: Rename to...
+	* malloc/memusage.c: ...this.  New file.
+	* malloc/memprof.sh: Rename to...
+	* malloc/memusage.sh: ...this.  New file.
+	* malloc/memprofstat.c: Rename to...
+	* malloc/memusagestat.c: ...this.  New file.
+
 	* elf/sprof.c (print_version): Update year.
 
 	* elf/sprof.c (load_shobj): Don't always add load address to dynamic
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 0402c0fdfe..b79ee3f43e 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,15 @@
+2000-06-19  H.J. Lu  <hjl@gnu.org>
+
+	* spinlock.h (HAS_COMPARE_AND_SWAP): Defined if
+	HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS is defined.
+	(compare_and_swap_with_release_semantics): New. Default to
+	compare_and_swap if HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
+	is not defined.
+
+	* spinlock.c (__pthread_unlock): Call
+	compare_and_swap_with_release_semantics () instead of
+	compare_and_swap ().
+
 2000-06-19  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/pthread/timer_create.c: Use _set_errno instead of assigning
diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c
index 3f5b8233b0..60d056aada 100644
--- a/linuxthreads/spinlock.c
+++ b/linuxthreads/spinlock.c
@@ -95,7 +95,9 @@ again:
     /* No threads are waiting for this lock.  Please note that we also
        enter this case if the lock is not taken at all.  If this wouldn't
        be done here we would crash further down.  */
-    if (! compare_and_swap(&lock->__status, oldstatus, 0, &lock->__spinlock))
+    if (! compare_and_swap_with_release_semantics (&lock->__status,
+						   oldstatus, 0,
+						   &lock->__spinlock))
       goto again;
     return 0;
   }
@@ -126,9 +128,9 @@ again:
     /* If max prio thread is at head, remove it with compare-and-swap
        to guard against concurrent lock operation */
     thr = (pthread_descr) oldstatus;
-    if (! compare_and_swap(&lock->__status,
-                           oldstatus, (long)(thr->p_nextlock),
-                           &lock->__spinlock))
+    if (! compare_and_swap_with_release_semantics
+	    (&lock->__status, oldstatus, (long)(thr->p_nextlock),
+	     &lock->__spinlock))
       goto again;
   } else {
     /* No risk of concurrent access, remove max prio thread normally */
diff --git a/linuxthreads/spinlock.h b/linuxthreads/spinlock.h
index 96010e4636..d1da3c1094 100644
--- a/linuxthreads/spinlock.h
+++ b/linuxthreads/spinlock.h
@@ -12,6 +12,25 @@
 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        */
 /* GNU Library General Public License for more details.                 */
 
+
+/* There are 2 compare and swap synchronization primitives with
+   different semantics:
+
+	1. compare_and_swap, which has acquire semantics (i.e. it
+	completes befor subsequent writes.)
+	2. compare_and_swap_with_release_semantics, which has release
+	semantics (it completes after previous writes.)
+
+   For those platforms on which they are the same. HAS_COMPARE_AND_SWAP
+   should be defined. For those platforms on which they are different, 
+   HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS has to be defined.  */
+
+#ifndef HAS_COMPARE_AND_SWAP
+#ifdef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
+#define HAS_COMPARE_AND_SWAP
+#endif
+#endif
+
 #if defined(TEST_FOR_COMPARE_AND_SWAP)
 
 extern int __pthread_has_cas;
@@ -29,6 +48,18 @@ static inline int compare_and_swap(long * ptr, long oldval, long newval,
 
 #elif defined(HAS_COMPARE_AND_SWAP)
 
+#ifdef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
+
+static inline int
+compare_and_swap_with_release_semantics (long * ptr, long oldval,
+					 long newval, int * spinlock)
+{
+  return __compare_and_swap_with_release_semantics (ptr, oldval,
+						    newval);
+}
+
+#endif
+
 static inline int compare_and_swap(long * ptr, long oldval, long newval,
                                    int * spinlock)
 {
@@ -48,6 +79,10 @@ static inline int compare_and_swap(long * ptr, long oldval, long newval,
 
 #endif
 
+#ifndef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
+#define compare_and_swap_with_release_semantics compare_and_swap
+#endif
+
 /* Internal locks */
 
 extern void internal_function __pthread_lock(struct _pthread_fastlock * lock,
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 29cb7c32bf..4d8d6543d9 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,8 @@
+2000-06-19  Ulrich Drepper  <drepper@redhat.com>
+
+	* locales/pt_BR: Correct day and month names.
+	Patch by Henrique M. Holschuh <hmh@rcm.org.br>.
+
 2000-06-13  Ulrich Drepper  <drepper@redhat.com>
 
 	* Makefile (ld-test-srcs): Add tests/test6.c.
diff --git a/localedata/locales/pt_BR b/localedata/locales/pt_BR
index ca0f8c80af..79470553cf 100644
--- a/localedata/locales/pt_BR
+++ b/localedata/locales/pt_BR
@@ -58,35 +58,35 @@ grouping                  0;0
 END LC_NUMERIC
 
 LC_TIME
-abday   "<d><o><m>";"<s><e><g>";/
-        "<t><e><r>";"<q><u><a>";/
-        "<q><u><i>";"<s><e><x>";/
-        "<s><a'><b>"
-day     "<d><o><m><i><n><g><o>";/
-        "<s><e><g><u><n><d><a>";/
-        "<t><e><r><c,><a>";/
-        "<q><u><a><r><t><a>";/
-        "<q><u><i><n><t><a>";/
-        "<s><e><x><t><a>";/
-        "<s><a'><b><a><d><o>"
-abmon   "<j><a><n>";"<f><e><v>";/
-        "<m><a><r>";"<a><b><r>";/
-        "<m><a><i>";"<j><u><n>";/
-        "<j><u><l>";"<a><g><o>";/
-        "<s><e><t>";"<o><u><t>";/
-        "<n><o><v>";"<d><e><z>"
-mon     "<j><a><n><e><i><r><o>";/
-        "<f><e><v><e><r><e><i><r><o>";/
-        "<m><a><r><c,><o>";/
-        "<a><b><r><i><l>";/
-        "<m><a><i><o>";/
-        "<j><u><n><h><o>";/
-        "<j><u><l><h><o>";/
-        "<a><g><o><s><t><o>";/
-        "<s><e><t><e><m><b><r><o>";/
-        "<o><u><t><u><b><r><o>";/
-        "<n><o><v><e><m><b><r><o>";/
-        "<d><e><z><e><m><b><r><o>"
+abday   "<D><o><m>";"<S><e><g>";/
+        "<T><e><r>";"<Q><u><a>";/
+        "<Q><u><i>";"<S><e><x>";/
+        "<S><a'><b>"
+day     "<D><o><m><i><n><g><o>";/
+        "<S><e><g><u><n><d><a>";/
+        "<T><e><r><c,><a>";/
+        "<Q><u><a><r><t><a>";/
+        "<Q><u><i><n><t><a>";/
+        "<S><e><x><t><a>";/
+        "<S><a'><b><a><d><o>"
+abmon   "<J><a><n>";"<F><e><v>";/
+        "<M><a><r>";"<A><b><r>";/
+        "<M><a><i>";"<J><u><n>";/
+        "<J><u><l>";"<A><g><o>";/
+        "<S><e><t>";"<O><u><t>";/
+        "<N><o><v>";"<D><e><z>"
+mon     "<J><a><n><e><i><r><o>";/
+        "<F><e><v><e><r><e><i><r><o>";/
+        "<M><a><r><c,><o>";/
+        "<A><b><r><i><l>";/
+        "<M><a><i><o>";/
+        "<J><u><n><h><o>";/
+        "<J><u><l><h><o>";/
+        "<A><g><o><s><t><o>";/
+        "<S><e><t><e><m><b><r><o>";/
+        "<O><u><t><u><b><r><o>";/
+        "<N><o><v><e><m><b><r><o>";/
+        "<D><e><z><e><m><b><r><o>"
 d_t_fmt "<%><a><SP><%><d><SP><%><b><SP><%><Y><SP><%><T><SP><%><Z>"
 d_fmt   "<%><d><-><%><m><-><%><Y>"
 t_fmt   "<%><T>"
diff --git a/malloc/memprof.c b/malloc/memusage.c
index 56d3ac556e..6296d99230 100644
--- a/malloc/memprof.c
+++ b/malloc/memusage.c
@@ -1,5 +1,5 @@
 /* Profile heap and stack memory usage of running program.
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -28,7 +28,7 @@
 #include <unistd.h>
 #include <sys/time.h>
 
-#include <memprof.h>
+#include <memusage.h>
 
 /* Pointer to the real functions.  These are determined used `dlsym'
    when really needed.  */
@@ -164,24 +164,24 @@ init (void)
 
 /* Find out whether this is the program we are supposed to profile.
    For this the name in the variable `__progname' must match the one
-   given in the environment variable MEMPROF_PROG_NAME.  If the variable
+   given in the environment variable MEMUSAGE_PROG_NAME.  If the variable
    is not present every program assumes it should be profiling.
 
    If this is the program open a file descriptor to the output file.
    We will write to it whenever the buffer overflows.  The name of the
-   output file is determined by the environment variable MEMPROF_OUTPUT.
+   output file is determined by the environment variable MEMUSAGE_OUTPUT.
 
-   If the environment variable MEMPROF_BUFFER_SIZE is set its numerical
+   If the environment variable MEMUSAGE_BUFFER_SIZE is set its numerical
    value determines the size of the internal buffer.  The number gives
    the number of elements in the buffer.  By setting the number to one
    one effectively selects unbuffered operation.
 
-   If MEMPROF_NO_TIMER is not present an alarm handler is installed
+   If MEMUSAGE_NO_TIMER is not present an alarm handler is installed
    which at the highest possible frequency records the stack pointer.  */
 static void
 me (void)
 {
-  const char *env = getenv ("MEMPROF_PROG_NAME");
+  const char *env = getenv ("MEMUSAGE_PROG_NAME");
   size_t prog_len = strlen (__progname);
   if (env != NULL)
     {
@@ -195,7 +195,7 @@ me (void)
   /* Only open the file if it's really us.  */
   if (!not_me && fd == -1)
     {
-      const char *outname = getenv ("MEMPROF_OUTPUT");
+      const char *outname = getenv ("MEMUSAGE_OUTPUT");
       if (outname != NULL)
 	{
 	  fd = creat (outname, 0666);
@@ -216,15 +216,15 @@ me (void)
 	      /* Determine the buffer size.  We use the default if the
 		 environment variable is not present.  */
 	      buffer_size = DEFAULT_BUFFER_SIZE;
-	      if (getenv ("MEMPROF_BUFFER_SIZE") != NULL)
+	      if (getenv ("MEMUSAGE_BUFFER_SIZE") != NULL)
 		{
-		  buffer_size = atoi (getenv ("MEMPROF_BUFFER_SIZE"));
+		  buffer_size = atoi (getenv ("MEMUSAGE_BUFFER_SIZE"));
 		  if (buffer_size == 0 || buffer_size > DEFAULT_BUFFER_SIZE)
 		    buffer_size = DEFAULT_BUFFER_SIZE;
 		}
 
 	      /* Possibly enable timer-based stack pointer retrieval.  */
-	      if (getenv ("MEMPROF_NO_TIMER") == NULL)
+	      if (getenv ("MEMUSAGE_NO_TIMER") == NULL)
 		{
 		  struct sigaction act;
 
diff --git a/malloc/memprof.sh b/malloc/memusage.sh
index 3113f591e6..744991ff02 100755
--- a/malloc/memprof.sh
+++ b/malloc/memusage.sh
@@ -1,5 +1,5 @@
 #! @BASH@
-# Copyright (C) 1999 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@gnu.org>, 1999.
 
@@ -18,24 +18,24 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-memprofso=@LIBDIR@/libmemprof.so
-memprofstat=@BINDIR@/memprofstat
+memusageso=@LIBDIR@/libmemusage.so
+memusagestat=@BINDIR@/memusagestat
 
 # Print usage message.
 do_usage() {
-  echo >&2 $"Try \`memprof --help' for more information."
+  echo >&2 $"Try \`memusage --help' for more information."
   exit 1
 }
 
 # Message for missing argument.
 do_missing_arg() {
-  echo >&2 $"memprof: option \`$1' requires an argument"
+  echo >&2 $"memusage: option \`$1' requires an argument"
   do_usage
 }
 
 # Print help message
 do_help() {
-  echo $"Usage: memprof [OPTION]... PROGRAM [PROGRAMOPTION]...
+  echo $"Usage: memusage [OPTION]... PROGRAM [PROGRAMOPTION]...
 Profile memory usage of PROGRAM.
 
    -n,--progname=NAME     Name of the program file to profile
@@ -64,8 +64,8 @@ Report bugs using the \`glibcbug' script to <bugs@gnu.org>."
 }
 
 do_version() {
-  echo 'memprof (GNU libc) @VERSION@'
-  echo $"Copyright (C) 1999 Free Software Foundation, Inc.
+  echo 'memusage (GNU libc) @VERSION@'
+  echo $"Copyright (C) 2000 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 Written by Ulrich Drepper."
@@ -82,7 +82,7 @@ while test $# -gt 0; do
     do_help
     ;;
   --us | --usa | --usag | --usage)
-    echo $"Syntax: memprof [--data=FILE] [--progname=NAME] [--png=FILE] [--unbuffered]
+    echo $"Syntax: memusage [--data=FILE] [--progname=NAME] [--png=FILE] [--unbuffered]
             [--buffer=SIZE] [--no-timer] [--time-based] [--total]
             [--title=STRING] [--x-size=SIZE] [--y-size=SIZE]
             PROGRAM [PROGRAMOPTION]..."
@@ -135,43 +135,43 @@ while test $# -gt 0; do
     notimer=yes
     ;;
   -t | --tim | --time | --time- | --time-b | --time-ba | --time-bas | --time-base | --time-based)
-    memprofstat_args="$memprofstat_args -t"
+    memusagestat_args="$memusagestat_args -t"
     ;;
   -T | --to | --tot | --tota | --total)
-    memprofstat_args="$memprofstat_args -T"
+    memusagestat_args="$memusagestat_args -T"
     ;;
   --tit | --titl | --title)
     if test $# -eq 1; then
       do_missing_arg $1
     fi
     shift
-    memprofstat_args="$memprofstat_args -s $1"
+    memusagestat_args="$memusagestat_args -s $1"
     ;;
   --tit=* | --titl=* | --title=*)
-    memprofstat_args="$memprofstat_args -s ${1##*=}"
+    memusagestat_args="$memusagestat_args -s ${1##*=}"
     ;;
   -x | --x | --x- | --x-s | --x-si | --x-siz | --x-size)
     if test $# -eq 1; then
       do_missing_arg $1
     fi
     shift
-    memprofstat_args="$memprofstat_args -x $1"
+    memusagestat_args="$memusagestat_args -x $1"
     ;;
   --x=* | --x-=* | --x-s=* | --x-si=* | --x-siz=* | --x-size=*)
-    memprofstat_args="$memprofstat_args -x ${1##*=}"
+    memusagestat_args="$memusagestat_args -x ${1##*=}"
     ;;
   -y | --y | --y- | --y-s | --y-si | --y-siz | --y-size)
     if test $# -eq 1; then
       do_missing_arg $1
     fi
     shift
-    memprofstat_args="$memprofstat_args -y $1"
+    memusagestat_args="$memusagestat_args -y $1"
     ;;
   --y=* | --y-=* | --y-s=* | --y-si=* | --y-siz=* | --y-size=*)
-    memprofstat_args="$memprofstat_args -y ${1##*=}"
+    memusagestat_args="$memusagestat_args -y ${1##*=}"
     ;;
   --p | --p=* | --t | --t=* | --ti | --ti=* | --u)
-    echo >&2 $"memprof: option \`${1##*=}' is ambiguous"
+    echo >&2 $"memusage: option \`${1##*=}' is ambiguous"
     do_usage
     ;;
   --)
@@ -180,7 +180,7 @@ while test $# -gt 0; do
     break
     ;;
   --*)
-    echo >&2 $"memprof: unrecognized option \`$1'"
+    echo >&2 $"memusage: unrecognized option \`$1'"
     do_usage
     ;;
   *)
@@ -198,35 +198,35 @@ if test $# -eq 0; then
 fi
 
 # This will be in the environment.
-add_env="LD_PRELOAD=$memprofso"
+add_env="LD_PRELOAD=$memusageso"
 
 # Generate data file name.
 datafile=
 if test -n "$data"; then
   datafile="$data"
 elif test -n "$png"; then
-  datafile=$(mktemp ${TMPDIR:-/tmp}/memprof.XXXXXX 2> /dev/null)
+  datafile=$(mktemp ${TMPDIR:-/tmp}/memusage.XXXXXX 2> /dev/null)
   if test $? -ne 0; then
     # Lame, but if there is no `mktemp' program the user cannot expect more.
     if test "$RANDOM" != "$RANDOM"; then
-      datafile=${TMPDIR:-/tmp}/memprof.$RANDOM
+      datafile=${TMPDIR:-/tmp}/memusage.$RANDOM
     else
-      datafile=${TMPDIR:-/tmp}/memprof.$$
+      datafile=${TMPDIR:-/tmp}/memusage.$$
     fi
   fi
 fi
 if test -n "$datafile"; then
-  add_env="$add_env MEMPROF_OUTPUT=$datafile"
+  add_env="$add_env MEMUSAGE_OUTPUT=$datafile"
 fi
 
 # Set buffer size.
 if test -n "$buffer"; then
-  add_env="$add_env MEMPROF_BUFFER_SIZE=$buffer"
+  add_env="$add_env MEMUSAGE_BUFFER_SIZE=$buffer"
 fi
 
 # Disable timers.
 if test -n "$notimer"; then
-  add_env="$add_env MEMPROF_NO_TIMER=yes"
+  add_env="$add_env MEMUSAGE_NO_TIMER=yes"
 fi
 
 # Execute the program itself.
@@ -241,7 +241,7 @@ if test -n "$png" -a -n "$datafile" -a -s "$datafile"; then
   *.png) ;;
   *) png="$png.png" ;;
   esac
-  $memprofstat $memprofstat_args "$datafile" "$png"
+  $memusagestat $memusagestat_args "$datafile" "$png"
 fi
 
 if test -z "$data" -a -n "$datafile"; then
diff --git a/malloc/memprofstat.c b/malloc/memusagestat.c
index 638b3beb73..1da0ff0ce9 100644
--- a/malloc/memprofstat.c
+++ b/malloc/memusagestat.c
@@ -1,5 +1,5 @@
 /* Generate graphic from memory profiling data.
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -191,7 +191,7 @@ main (int argc, char *argv[])
 
   if (maxsize_heap == 0 && maxsize_stack == 0)
     {
-      /* The program aborted before memprof was able to write the
+      /* The program aborted before memusage was able to write the
 	 information about the maximum heap and stack use.  Repair
 	 the file now.  */
       struct entry next;