summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-02-26 01:06:05 +0000
committerUlrich Drepper <drepper@redhat.com>1997-02-26 01:06:05 +0000
commit4f72518358f9c217d00b8655cae01ad6bf77d9fa (patch)
tree2a3120a10d54d481695c794f68fe7f1f92573048
parent655fe3107058017a6d4e618be03b91b119457354 (diff)
update from main archive 970226
-rw-r--r--ChangeLog51
-rw-r--r--glibcbug.in2
-rw-r--r--inet/Makefile2
-rw-r--r--locale/C-time.c3
-rw-r--r--malloc/malloc.c162
-rw-r--r--malloc/malloc.h7
-rw-r--r--math/math.h11
-rw-r--r--misc/error.c13
-rw-r--r--stdio-common/vfprintf.c8
-rw-r--r--sysdeps/generic/netinet/in.h5
-rw-r--r--sysdeps/libm-i387/e_acoshf.S4
-rw-r--r--sysdeps/libm-ieee754/s_cbrtl.c2
-rw-r--r--sysdeps/unix/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/Makefile2
15 files changed, 255 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index d4ac15862e..ec039720b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,54 @@
+1997-02-25 15:11 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/libm-i387/e_acoshf.S (__ieee754_acoshf): Test correct
+ word on stack for overflow.
+
+1997-02-24 23:05 Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>
+
+ * malloc/malloc.c (malloc_get_state): New function.
+ Saves global malloc state to an opaque data structure which
+ is dynamically allocated in the heap.
+ * malloc/malloc.c (malloc_set_state): New function.
+ Restore previously obtained state.
+ * malloc/malloc.h: Add declaration of malloc_get_state()
+ and malloc_set_state().
+
+1997-02-24 23:29 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/libm-ieee754/s_cbrtl.c: Shift B1_EXP value to right
+ position.
+
+1997-02-24 17:38 Ulrich Drepper <drepper@cygnus.com>
+
+ * misc/error.c: Make error and error_at_line weak aliases of
+ __error and __error_at_line respectively.
+ Suggested by David Mosberger-Tang <davidm@AZStarNet.COM>.
+
+1997-02-22 12:25 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * locale/C-time.c (_nl_C_LC_TIME): Add missing entry for
+ time-era-num-entries.
+
+1997-02-24 15:20 Jonathan T. Agnew <jtagnew@amherst.edu>
+
+ * glibcbug.in: Don't mention destination on MAIL_AGENT command line
+ to avoid duplicate mail.
+
+1997-02-23 02:32 Ulrich Drepper <drepper@cygnus.com>
+
+ * stdio-common/vfprintf.c (printf_unknown): Correct printing of
+ numeric values.
+
+1997-02-22 03:02 Ulrich Drepper <drepper@cygnus.com>
+
+ * math/math.h: Prevent definition of struct exception when using
+ C++.
+
+1997-02-22 01:46 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/unix/syscalls.list: Dup takes only one argument.
+ Reported by Greg McGary.
+
1997-02-20 17:51 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/generic/netinet/in.h: Protect contents using
diff --git a/glibcbug.in b/glibcbug.in
index 28087892a5..0d46b325ab 100644
--- a/glibcbug.in
+++ b/glibcbug.in
@@ -232,7 +232,7 @@ sed -e "
/^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
" $TEMP > $TEMP.x
-if $MAIL_AGENT $BUGGLIBC < $TEMP.x; then
+if $MAIL_AGENT < $TEMP.x; then
echo "$COMMAND: problem report sent"
xs=0; exit
else
diff --git a/inet/Makefile b/inet/Makefile
index 74a6741b79..e965390a63 100644
--- a/inet/Makefile
+++ b/inet/Makefile
@@ -23,7 +23,7 @@ subdir := inet
headers := netinet/ether.h netinet/in.h netinet/if_ether.h \
netinet/tcp.h netinet/ip.h $(wildcard arpa/*.h protocols/*.h) \
- aliases.h net/ethernet.h
+ aliases.h
distribute := netgroup.h
diff --git a/locale/C-time.c b/locale/C-time.c
index a71ea93517..1078580f20 100644
--- a/locale/C-time.c
+++ b/locale/C-time.c
@@ -26,7 +26,7 @@ const struct locale_data _nl_C_LC_TIME =
{
_nl_C_name,
NULL, 0, /* no file mapped */
- 53,
+ 54,
{
{ string: "Sun" },
{ string: "Mon" },
@@ -79,6 +79,7 @@ const struct locale_data _nl_C_LC_TIME =
{ string: "" },
{ string: "" },
{ word: 0 },
+ { word: 0 },
{ string: "" },
{ string: "" },
}
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 0380527f64..6b4fc72b20 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -19,7 +19,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* V2.6.4-pt2 Sat Dec 14 1996
+/* V2.6.4-pt3 Thu Feb 20 1997
This work is mainly derived from malloc-2.6.4 by Doug Lea
<dl@cs.oswego.edu>, which is available from:
@@ -874,6 +874,8 @@ extern Void_t* sbrk();
#define mALLOC_STATs __malloc_stats
#define mALLOC_USABLE_SIZe __malloc_usable_size
#define mALLOC_TRIm __malloc_trim
+#define mALLOC_GET_STATe __malloc_get_state
+#define mALLOC_SET_STATe __malloc_set_state
#else
@@ -889,6 +891,8 @@ extern Void_t* sbrk();
#define mALLOC_STATs malloc_stats
#define mALLOC_USABLE_SIZe malloc_usable_size
#define mALLOC_TRIm malloc_trim
+#define mALLOC_GET_STATe malloc_get_state
+#define mALLOC_SET_STATe malloc_set_state
#endif
@@ -912,7 +916,11 @@ size_t mALLOC_USABLE_SIZe(Void_t*);
void mALLOC_STATs(void);
int mALLOPt(int, int);
struct mallinfo mALLINFo(void);
-#else
+Void_t* mALLOC_GET_STATe(void);
+int mALLOC_SET_STATe(Void_t*);
+
+#else /* !__STD_C */
+
#ifndef _LIBC
void ptmalloc_init();
#endif
@@ -929,7 +937,10 @@ size_t mALLOC_USABLE_SIZe();
void mALLOC_STATs();
int mALLOPt();
struct mallinfo mALLINFo();
-#endif
+Void_t* mALLOC_GET_STATe();
+int mALLOC_SET_STATe();
+
+#endif /* __STD_C */
#ifdef __cplusplus
@@ -3775,6 +3786,144 @@ int mALLOPt(param_number, value) int param_number; int value;
+/* Get/set state: malloc_get_state() records the current state of all
+ malloc variables (_except_ for the actual heap contents and `hook'
+ function pointers) in a system dependent, opaque data structure.
+ This data structure is dynamically allocated and can be free()d
+ after use. malloc_set_state() restores the state of all malloc
+ variables to the previously obtained state. This is especially
+ useful when using this malloc as part of a shared library, and when
+ the heap contents are saved/restored via some other method. The
+ primary example for this is GNU Emacs with its `dumping' procedure.
+ `Hook' function pointers are never saved or restored by these
+ functions. */
+
+#define MALLOC_STATE_MAGIC 0x444c4541l
+#define MALLOC_STATE_VERSION (0*0x100l + 0l) /* major*0x100 + minor */
+
+struct malloc_state {
+ long magic;
+ long version;
+ mbinptr av[NAV * 2 + 2];
+ char* sbrk_base;
+ int sbrked_mem_bytes;
+ unsigned long trim_threshold;
+ unsigned long top_pad;
+ unsigned int n_mmaps_max;
+ unsigned long mmap_threshold;
+ int check_action;
+ unsigned long max_sbrked_mem;
+ unsigned long max_total_mem;
+ unsigned int n_mmaps;
+ unsigned int max_n_mmaps;
+ unsigned long mmapped_mem;
+ unsigned long max_mmapped_mem;
+};
+
+Void_t*
+mALLOC_GET_STATe()
+{
+ mchunkptr victim;
+ struct malloc_state* ms;
+ int i;
+ mbinptr b;
+
+ ptmalloc_init();
+ (void)mutex_lock(&main_arena.mutex);
+ victim = chunk_alloc(&main_arena, request2size(sizeof(*ms)));
+ if(!victim) {
+ (void)mutex_unlock(&main_arena.mutex);
+ return 0;
+ }
+ ms = (struct malloc_state*)chunk2mem(victim);
+ ms->magic = MALLOC_STATE_MAGIC;
+ ms->version = MALLOC_STATE_VERSION;
+ ms->av[0] = main_arena.av[0];
+ ms->av[1] = main_arena.av[1];
+ for(i=0; i<NAV; i++) {
+ b = bin_at(&main_arena, i);
+ if(first(b) == b)
+ ms->av[2*i+2] = ms->av[2*i+3] = 0; /* empty bin (or initial top) */
+ else {
+ ms->av[2*i+2] = first(b);
+ ms->av[2*i+3] = last(b);
+ }
+ }
+ ms->sbrk_base = sbrk_base;
+ ms->sbrked_mem_bytes = sbrked_mem;
+ ms->trim_threshold = trim_threshold;
+ ms->top_pad = top_pad;
+ ms->n_mmaps_max = n_mmaps_max;
+ ms->mmap_threshold = mmap_threshold;
+ ms->check_action = check_action;
+ ms->max_sbrked_mem = max_sbrked_mem;
+#ifdef NO_THREADS
+ ms->max_total_mem = max_total_mem;
+#else
+ ms->max_total_mem = 0;
+#endif
+ ms->n_mmaps = n_mmaps;
+ ms->max_n_mmaps = max_n_mmaps;
+ ms->mmapped_mem = mmapped_mem;
+ ms->max_mmapped_mem = max_mmapped_mem;
+ (void)mutex_unlock(&main_arena.mutex);
+ return (Void_t*)ms;
+}
+
+int
+#if __STD_C
+mALLOC_SET_STATe(Void_t* msptr)
+#else
+mALLOC_SET_STATe(msptr) Void_t* msptr;
+#endif
+{
+ struct malloc_state* ms = (struct malloc_state*)msptr;
+ int i;
+ mbinptr b;
+
+ ptmalloc_init();
+ if(ms->magic != MALLOC_STATE_MAGIC) return -1;
+ /* Must fail if the major version is too high. */
+ if((ms->version & ~0xffl) > (MALLOC_STATE_VERSION & ~0xffl)) return -2;
+ (void)mutex_lock(&main_arena.mutex);
+ main_arena.av[0] = ms->av[0];
+ main_arena.av[1] = ms->av[1];
+ for(i=0; i<NAV; i++) {
+ b = bin_at(&main_arena, i);
+ if(ms->av[2*i+2] == 0)
+ first(b) = last(b) = b;
+ else {
+ first(b) = ms->av[2*i+2];
+ last(b) = ms->av[2*i+3];
+ if(i > 0) {
+ /* Make sure the links to the `av'-bins in the heap are correct. */
+ first(b)->bk = b;
+ last(b)->fd = b;
+ }
+ }
+ }
+ sbrk_base = ms->sbrk_base;
+ sbrked_mem = ms->sbrked_mem_bytes;
+ trim_threshold = ms->trim_threshold;
+ top_pad = ms->top_pad;
+ n_mmaps_max = ms->n_mmaps_max;
+ mmap_threshold = ms->mmap_threshold;
+ check_action = ms->check_action;
+ max_sbrked_mem = ms->max_sbrked_mem;
+#ifdef NO_THREADS
+ max_total_mem = ms->max_total_mem;
+#endif
+ n_mmaps = ms->n_mmaps;
+ max_n_mmaps = ms->max_n_mmaps;
+ mmapped_mem = ms->mmapped_mem;
+ max_mmapped_mem = ms->max_mmapped_mem;
+ /* add version-dependent code here */
+ (void)mutex_unlock(&main_arena.mutex);
+ return 0;
+}
+
+
+
#if defined(_LIBC) || defined(MALLOC_HOOKS)
/* A simple, standard set of debugging hooks. Overhead is `only' one
@@ -4048,12 +4197,19 @@ weak_alias (__libc_mallopt, __mallopt) weak_alias (__libc_mallopt, mallopt)
weak_alias (__malloc_stats, malloc_stats)
weak_alias (__malloc_usable_size, malloc_usable_size)
weak_alias (__malloc_trim, malloc_trim)
+weak_alias (__malloc_get_state, malloc_get_state)
+weak_alias (__malloc_set_state, malloc_set_state)
#endif
/*
History:
+ V2.6.4-pt3 Thu Feb 20 1997 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de)
+ * Added malloc_get/set_state() (mainly for use in GNU emacs),
+ using interface from Marcus Daniels
+ * All parameters are now adjustable via environment variables
+
V2.6.4-pt2 Sat Dec 14 1996 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de)
* Added debugging hooks
* Fixed possible deadlock in realloc() when out of memory
diff --git a/malloc/malloc.h b/malloc/malloc.h
index b27d06252c..53b9d1b206 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -171,6 +171,13 @@ extern size_t malloc_usable_size __MALLOC_P ((__malloc_ptr_t __ptr));
/* Prints brief summary statistics on stderr. */
extern void malloc_stats __MALLOC_P ((void));
+/* Record the state of all malloc variables in an opaque data structure. */
+extern __malloc_ptr_t malloc_get_state __MALLOC_P ((void));
+
+/* Restore the state of all malloc variables from data obtained with
+ malloc_get_state(). */
+extern int malloc_set_state __MALLOC_P ((__malloc_ptr_t __ptr));
+
#if defined(__GLIBC__) || defined(MALLOC_HOOKS)
/* Hooks for debugging versions. */
diff --git a/math/math.h b/math/math.h
index b713163f76..eb8a4f202d 100644
--- a/math/math.h
+++ b/math/math.h
@@ -1,5 +1,5 @@
/* Declarations for math functions.
- Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 93, 95, 96, 97 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
@@ -99,9 +99,12 @@ extern _LIB_VERSION_TYPE _LIB_VERSION;
#endif
-#ifdef __USE_SVID
+#if defined __USE_SVID && !defined __cplusplus
/* In SVID error handling, `matherr' is called with this description
- of the exceptional condition. */
+ of the exceptional condition.
+
+ We have a problem when using C++ since `exception' is reserved in
+ C++. */
struct exception
{
int type;
@@ -128,7 +131,7 @@ extern int matherr __P ((struct exception *));
#define HUGE FLT_MAX
#include <float.h> /* Defines FLT_MAX. */
-#endif
+#endif /* SVID && !C++ */
#ifdef __USE_BSD
diff --git a/misc/error.c b/misc/error.c
index 2a7df0210d..f49e4a7983 100644
--- a/misc/error.c
+++ b/misc/error.c
@@ -71,6 +71,11 @@ unsigned int error_message_count;
#define program_name program_invocation_name
#include <errno.h>
+/* In GNU libc we want do not want to use the common name `error' directly.
+ Instead make it a weak alias. */
+#define error __error
+#define error_at_line __error_at_line
+
#else
/* The calling program should define program_name and set it to the
@@ -230,3 +235,11 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
if (status)
exit (status);
}
+
+#ifdef _LIBC
+/* Make the weak alias. */
+#undef error
+#undef error_at_line
+weak_alias (__error, error)
+weak_alias (__error_at_line, error_at_line)
+#endif
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index eda0d7bd8e..4bd564fdc0 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1405,16 +1405,16 @@ printf_unknown (FILE *s, const struct printf_info *info,
if (info->width != 0)
{
w = _itoa_word (info->width, workend + 1, 10, 0);
- while (++w <= workend)
- outchar (*w);
+ while (w <= workend)
+ outchar (*w++);
}
if (info->prec != -1)
{
outchar ('.');
w = _itoa_word (info->prec, workend + 1, 10, 0);
- while (++w <= workend)
- outchar (*w);
+ while (w <= workend)
+ outchar (*w++);
}
if (info->spec != '\0')
diff --git a/sysdeps/generic/netinet/in.h b/sysdeps/generic/netinet/in.h
index bc8af8809e..ad77c8be7d 100644
--- a/sysdeps/generic/netinet/in.h
+++ b/sysdeps/generic/netinet/in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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 modify
@@ -23,6 +23,7 @@
#include <sys/socket.h>
+__BEGIN_DECLS
/* Standard well-defined IP protocols. */
enum
@@ -207,4 +208,6 @@ extern unsigned short int htons __P ((unsigned short int));
#define htons(x) (x)
#endif
+__END_DECLS
+
#endif /* netinet/in.h */
diff --git a/sysdeps/libm-i387/e_acoshf.S b/sysdeps/libm-i387/e_acoshf.S
index a4f50ba7ac..8aa78957e2 100644
--- a/sysdeps/libm-i387/e_acoshf.S
+++ b/sysdeps/libm-i387/e_acoshf.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of arcsinh.
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -42,7 +42,7 @@ limit: .double 0.29
.text
ENTRY(__ieee754_acoshf)
- movl 8(%esp), %ecx
+ movl 4(%esp), %ecx
cmpl $0x3f800000, %ecx
jl 5f // < 1 => invalid
fldln2 // log(2)
diff --git a/sysdeps/libm-ieee754/s_cbrtl.c b/sysdeps/libm-ieee754/s_cbrtl.c
index 9f45faa00c..21e7727728 100644
--- a/sysdeps/libm-ieee754/s_cbrtl.c
+++ b/sysdeps/libm-ieee754/s_cbrtl.c
@@ -90,7 +90,7 @@ G = 3.57142857142857150787e-01L; /* 5/14 */
{
u_int64_t xxl = ((u_int64_t) se) << 32 | x0;
xxl /= 3;
- xxl += B1_EXP << 16 | B1_MANT;
+ xxl += ((u_int64_t) B1_EXP) << 32 | B1_MANT;
SET_LDOUBLE_MSW(t,xxl&0xffffffffu);
xxl >>= 32;
SET_LDOUBLE_EXP(t,xxl);
diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
index fba1245730..9a2325c35c 100644
--- a/sysdeps/unix/syscalls.list
+++ b/sysdeps/unix/syscalls.list
@@ -7,7 +7,7 @@ chmod - chmod 2 __chmod chmod
chown - chown 3 __chown chown
chroot - chroot 1 chroot
close - close 1 __libc_close __close close
-dup - dup 2 __dup dup
+dup - dup 1 __dup dup
dup2 - dup2 2 __dup2 dup2
fchdir - fchdir 1 fchdir
fcntl - fcntl 3 __libc_fcntl __fcntl fcntl
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
index 0c5903dc89..9c41e50b4c 100644
--- a/sysdeps/unix/sysv/linux/Dist
+++ b/sysdeps/unix/sysv/linux/Dist
@@ -5,6 +5,7 @@ llseek.c
siglist.h
sysctl.c
termio.h
+net/ethernet.h
net/if.h
net/if_arp.h
net/if_ppp.h
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index a72fef2346..7a722c7d16 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -35,7 +35,7 @@ endif
ifeq ($(subdir),socket)
sysdep_headers += sys/socketcall.h net/if.h net/if_ppp.h net/ppp-comp.h \
- net/ppp_defs.h net/if_arp.h net/route.h
+ net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h
sysdep_routines += cmsg_nxthdr
endif