diff options
| author | Ulrich Drepper <drepper@redhat.com> | 1996-12-10 03:08:06 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 1996-12-10 03:08:06 +0000 |
| commit | 8a4b65b46966f99180de59141cbfa14de2d80380 (patch) | |
| tree | f002e045ac3b4006cd7578b3e5fce2f0426e6dcd | |
| parent | f5c1ec414e169d34cb8b1698686845c9373b0469 (diff) | |
| download | glibc-8a4b65b46966f99180de59141cbfa14de2d80380.tar.xz glibc-8a4b65b46966f99180de59141cbfa14de2d80380.zip | |
update from main archive 961209cvs/libc-961210
Tue Dec 10 02:17:31 1996 Ulrich Drepper <drepper@cygnus.com>
* stdio-common/printf_fp.c (__guess_grouping): Fix of by one
error in computation of number of groups.
Patch sent by Harald Schreiber <Harald.Schreiber@post.rwth-aachen.de>.
Tue Dec 10 01:50:07 1996 Ulrich Drepper <drepper@cygnus.com>
* version.h: Set version to 1.99.
* Make-dist (routines): Add malloc and new-malloc.
* Makeconfig: Allow Makefiles to set $(CPPFLAGS-$(<F)) and
$(CPPFLAGS-$(@F)) to be added to CPPFLAGS.
Same for $(CFLAGS-$(@F)) and CFLAGS.
* gmon/sys/gmon_out.h: Add __BEGIN_DECLS/__END_DECLS. Unify
layout.
* io/sys/poll.h: Likewise.
* sysdeps/stub/sys/ipb_buf.h: Likewise.
* sysdeps/unix/sysv/linux/i386/sys/perm.h: Likewise.
* sysdeps/unix/sysv/linux/i386/sys/vm86.h: Likewise.
* sysdeps/unix/sysv/linux/sys/ipc_buf.h: Likewise.
* sysdeps/unix/sysv/linux/sys/kdaemon.h: Likewise.
* sysdeps/unix/sysv/linux/sys/klog.h: Likewise.
* sysdeps/unix/sysv/linux/sys/mman.h: Likewise.
* sysdeps/unix/sysv/linux/sys/module.h: Likewise.
* sysdeps/unix/sysv/linux/sys/mount.h: Likewise.
* sysdeps/unix/sysv/linux/sys/msq_buf.h: Likewise.
* sysdeps/unix/sysv/linux/sys/param.h: Likewise.
* sysdeps/unix/sysv/linux/sys/procfs.h: Likewise.
* sysdeps/unix/sysv/linux/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/sys/reboot.h: Likewise.
* sysdeps/unix/sysv/linux/sys/sem_buf.h: Likewise.
* sysdeps/unix/sysv/linux/sys/shm_buf.h: Likewise.
* sysdeps/unix/sysv/linux/sys/socketcall.h: Likewise.
* sysdeps/unix/sysv/linux/sys/swap.h: Likewise.
* sysdeps/unix/sysv/linux/sys/sysctl.h: Likewise.
* sysdeps/unix/sysv/linux/sys/sysinfo.h: Likewise.
* sysdeps/unix/sysv/linux/sys/sysmacros.h: Likewise.
* sysdeps/unix/sysv/linux/sys/timex.h: Likewise.
* sysvipc/sys/sem.h: Likewise.
* sysvipc/sys/shm.h: Likewise.
* new-malloc/Makefile: Set CPPFLAGS-malloc.o.
* new-malloc/malloc.c: Remove problem with 64 bits pointers.
Add statistics for threads.
* new-malloc/malloc.h: Likewise.
* new-malloc/thread-m.h: Likewise.
* time/strftime.c: Declare tzname if if HAVE_TZNAME is defined.
* time/strptime.c: Update copyright.
Mon Dec 9 14:51:10 1996 Ulrich Drepper <drepper@cygnus.com>
* Make-dist: Make sure both malloc directories get distributed.
Sun Dec 8 23:14:10 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* libio/iogets.c (_IO_gets): Fix early returns to not leave the
stream locked.
Sat Dec 7 22:08:09 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/sys/module.h: Enclose declarations in
__BEGIN_DECLS/__END_DECLS.
Sat Dec 7 14:23:12 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* login/utmp_file.c: Consistently set file_offset to the position
after the entry just read.
39 files changed, 888 insertions, 536 deletions
@@ -1,3 +1,76 @@ +Tue Dec 10 02:17:31 1996 Ulrich Drepper <drepper@cygnus.com> + + * stdio-common/printf_fp.c (__guess_grouping): Fix of by one + error in computation of number of groups. + Patch sent by Harald Schreiber <Harald.Schreiber@post.rwth-aachen.de>. + +Tue Dec 10 01:50:07 1996 Ulrich Drepper <drepper@cygnus.com> + + * version.h: Set version to 1.99. + + * Make-dist (routines): Add malloc and new-malloc. + + * Makeconfig: Allow Makefiles to set $(CPPFLAGS-$(<F)) and + $(CPPFLAGS-$(@F)) to be added to CPPFLAGS. + Same for $(CFLAGS-$(@F)) and CFLAGS. + + * gmon/sys/gmon_out.h: Add __BEGIN_DECLS/__END_DECLS. Unify + layout. + * io/sys/poll.h: Likewise. + * sysdeps/stub/sys/ipb_buf.h: Likewise. + * sysdeps/unix/sysv/linux/i386/sys/perm.h: Likewise. + * sysdeps/unix/sysv/linux/i386/sys/vm86.h: Likewise. + * sysdeps/unix/sysv/linux/sys/ipc_buf.h: Likewise. + * sysdeps/unix/sysv/linux/sys/kdaemon.h: Likewise. + * sysdeps/unix/sysv/linux/sys/klog.h: Likewise. + * sysdeps/unix/sysv/linux/sys/mman.h: Likewise. + * sysdeps/unix/sysv/linux/sys/module.h: Likewise. + * sysdeps/unix/sysv/linux/sys/mount.h: Likewise. + * sysdeps/unix/sysv/linux/sys/msq_buf.h: Likewise. + * sysdeps/unix/sysv/linux/sys/param.h: Likewise. + * sysdeps/unix/sysv/linux/sys/procfs.h: Likewise. + * sysdeps/unix/sysv/linux/sys/ptrace.h: Likewise. + * sysdeps/unix/sysv/linux/sys/reboot.h: Likewise. + * sysdeps/unix/sysv/linux/sys/sem_buf.h: Likewise. + * sysdeps/unix/sysv/linux/sys/shm_buf.h: Likewise. + * sysdeps/unix/sysv/linux/sys/socketcall.h: Likewise. + * sysdeps/unix/sysv/linux/sys/swap.h: Likewise. + * sysdeps/unix/sysv/linux/sys/sysctl.h: Likewise. + * sysdeps/unix/sysv/linux/sys/sysinfo.h: Likewise. + * sysdeps/unix/sysv/linux/sys/sysmacros.h: Likewise. + * sysdeps/unix/sysv/linux/sys/timex.h: Likewise. + * sysvipc/sys/sem.h: Likewise. + * sysvipc/sys/shm.h: Likewise. + + * new-malloc/Makefile: Set CPPFLAGS-malloc.o. + * new-malloc/malloc.c: Remove problem with 64 bits pointers. + Add statistics for threads. + * new-malloc/malloc.h: Likewise. + * new-malloc/thread-m.h: Likewise. + + * time/strftime.c: Declare tzname if if HAVE_TZNAME is defined. + + * time/strptime.c: Update copyright. + +Mon Dec 9 14:51:10 1996 Ulrich Drepper <drepper@cygnus.com> + + * Make-dist: Make sure both malloc directories get distributed. + +Sun Dec 8 23:14:10 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * libio/iogets.c (_IO_gets): Fix early returns to not leave the + stream locked. + +Sat Dec 7 22:08:09 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * sysdeps/unix/sysv/linux/sys/module.h: Enclose declarations in + __BEGIN_DECLS/__END_DECLS. + +Sat Dec 7 14:23:12 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * login/utmp_file.c: Consistently set file_offset to the position + after the entry just read. + Mon Dec 9 03:39:30 1996 Ulrich Drepper <drepper@cygnus.com> * config.make.in (defines): Add @USE_NEW_MALLOC@. @@ -47,6 +47,9 @@ subdirs := $(filter-out $(add-ons),$(subdirs)) # Make sure both stdio and libio get in, whichever is in use. subdirs += stdio libio +# The same must be true for the malloc directories. +subdirs += malloc new-malloc + sysdep-Subdir-files := $(wildcard $(addsuffix /Subdirs,$(sysdep_dirs))) ifdef sysdep-Subdir-files subdirs := $(sort $(subdirs) \ diff --git a/Makeconfig b/Makeconfig index 2a287a47a5..b61af28b0b 100644 --- a/Makeconfig +++ b/Makeconfig @@ -446,9 +446,10 @@ libio-include = -I$(..)libio # These are the variables that the implicit compilation rules use. CPPFLAGS = $(+includes) $(defines) -include $(..)libc-symbols.h \ - $(sysdep-CPPFLAGS) $(CPPFLAGS-$(suffix $@)) + $(sysdep-CPPFLAGS) $(CPPFLAGS-$(suffix $@)) $(CPPFLAGS-$(<F)) \ + $(CPPFLAGS-$(@F)) override CFLAGS = $(+cflags) $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) \ - $(CFLAGS-$(<F)) + $(CFLAGS-$(<F)) $(CFLAGS-$(@F)) # This is the macro that the implicit linking rules use. diff --git a/gmon/sys/gmon_out.h b/gmon/sys/gmon_out.h index c02362ba47..94e815d94b 100644 --- a/gmon/sys/gmon_out.h +++ b/gmon/sys/gmon_out.h @@ -25,12 +25,16 @@ a sequence of records. Each record starts with a one-byte tag identifying the type of records, followed by records specific data. */ -#ifndef _SYS_GMON_OUT_H_ -#define _SYS_GMON_OUT_H_ +#ifndef _SYS_GMON_OUT_H + +#define _SYS_GMON_OUT_H 1 +#include <features.h> #define GMON_MAGIC "gmon" /* magic cookie */ #define GMON_VERSION 1 /* version number */ +__BEGIN_DECLS + /* * Raw header as it appears on file (without padding). This header * always comes first in gmon.out and is then followed by a series @@ -62,4 +66,6 @@ struct gmon_cg_arc_record { int count; /* number of arc traversals */ }; -#endif /* !_SYS_GMON_OUT_H_ */ +__END_DECLS + +#endif /* _SYS_GMON_OUT_H */ diff --git a/io/sys/poll.h b/io/sys/poll.h index 09ee7f27de..f9880a140c 100644 --- a/io/sys/poll.h +++ b/io/sys/poll.h @@ -18,9 +18,11 @@ Boston, MA 02111-1307, USA. */ #ifndef _SYS_POLL_H -#define _SYS_POLL_H -#include <sys/cdefs.h> +#define _SYS_POLL_H 1 +#include <features.h> + +__BEGIN_DECLS /* Data structure describing a polling request. */ struct pollfd @@ -51,8 +53,6 @@ struct pollfd #define NPOLLFILE 30 -__BEGIN_DECLS - /* Poll the file descriptors described by the NFDS structures starting at FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for an event to occur; if TIMEOUT is -1, block until an event occurs. @@ -64,4 +64,4 @@ extern int poll __P ((struct pollfd *__fds, unsigned long int __nfds, __END_DECLS -#endif /* sys/poll.h */ +#endif /* _SYS_POLL_H */ diff --git a/libio/iogets.c b/libio/iogets.c index 716ecd1b18..b5611f29da 100644 --- a/libio/iogets.c +++ b/libio/iogets.c @@ -31,13 +31,17 @@ _IO_gets (buf) { _IO_size_t count; int ch; + char *retval; __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, _IO_stdin); _IO_flockfile (_IO_stdin); ch = _IO_getc_unlocked (_IO_stdin); if (ch == EOF) - return NULL; + { + retval = NULL; + goto unlock_return; + } if (ch == '\n') count = 0; else @@ -45,11 +49,16 @@ _IO_gets (buf) buf[0] = (char)ch; count = _IO_getline (_IO_stdin, buf + 1, INT_MAX, '\n', 0) + 1; if (_IO_stdin->_IO_file_flags & _IO_ERR_SEEN) - return NULL; + { + retval = NULL; + goto unlock_return; + } } - __libc_cleanup_region_end (1); buf[count] = 0; - return buf; + retval = buf; +unlock_return: + __libc_cleanup_region_end (1); + return retval; } weak_alias (_IO_gets, gets) diff --git a/login/utmp_file.c b/login/utmp_file.c index fff487a0a3..2bb6c926f9 100644 --- a/login/utmp_file.c +++ b/login/utmp_file.c @@ -134,7 +134,7 @@ getutent_r_file (struct utmp *buffer, struct utmp **result) nbytes = read (file_fd, &last_entry, sizeof (struct utmp)); flock (file_fd, LOCK_UN); - if (nbytes!= sizeof (struct utmp)) + if (nbytes != sizeof (struct utmp)) { file_offset = -1l; *result = NULL; @@ -174,6 +174,7 @@ getutline_r_file (const struct utmp *line, struct utmp *buffer, *result = NULL; return -1; } + file_offset += sizeof (struct utmp); /* Stop if we found a user or login entry. */ if ( @@ -184,8 +185,6 @@ getutline_r_file (const struct utmp *line, struct utmp *buffer, #endif !strncmp (line->ut_line, last_entry.ut_line, sizeof line->ut_line)) break; - - file_offset += sizeof (struct utmp); } memcpy (buffer, &last_entry, sizeof (struct utmp)); @@ -214,11 +213,10 @@ internal_getutid_r (const struct utmp *id, struct utmp *buffer) file_offset = -1l; return -1; } + file_offset += sizeof (struct utmp); if (id->ut_type == buffer->ut_type) break; - - file_offset += sizeof (struct utmp); } } else @@ -236,14 +234,14 @@ internal_getutid_r (const struct utmp *id, struct utmp *buffer) file_offset = -1l; return -1; } + file_offset += sizeof (struct utmp); + if (( buffer->ut_type == INIT_PROCESS || buffer->ut_type == LOGIN_PROCESS || buffer->ut_type == USER_PROCESS || buffer->ut_type == DEAD_PROCESS) && strncmp (buffer->ut_id, id->ut_id, sizeof id->ut_id) == 0) break; - - file_offset += sizeof (struct utmp); } } @@ -347,7 +345,10 @@ pututline_file (const struct utmp *data) pbuf = NULL; } else - pbuf = (struct utmp *) data; + { + file_offset += sizeof (struct utmp); + pbuf = (struct utmp *) data; + } /* And unlock the file. */ (void) flock (file_fd, LOCK_UN); diff --git a/malloc/Makefile b/malloc/Makefile index a6213949e1..63fe786168 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -37,4 +37,5 @@ routines = $(dist-routines) obstack include ../Rules +CPPFLAGS-malloc.o += -DMALLOC_DEBUG CFLAGS-obstack.c = -Wno-strict-prototypes diff --git a/malloc/malloc.c b/malloc/malloc.c index ed24d5d76d..22f2ee89ed 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -266,12 +266,6 @@ -/* Macros for handling mutexes and thread-specific data. This is - included first, because some thread-related header files (such as - pthread.h) should be included before any others. */ -#include "thread-m.h" - - /* Preliminaries */ #ifndef __STD_C @@ -300,6 +294,11 @@ #include <sys/types.h> #endif +/* Macros for handling mutexes and thread-specific data. This is + included early, because some thread-related header files (such as + pthread.h) should be included before any others. */ +#include "thread-m.h" + #ifdef __cplusplus extern "C" { #endif @@ -597,9 +596,13 @@ do { \ /* #define HAVE_USR_INCLUDE_MALLOC_H */ #if HAVE_USR_INCLUDE_MALLOC_H -#include "/usr/include/malloc.h" +# include "/usr/include/malloc.h" #else -#include "malloc.h" +# ifdef _LIBC +# include "malloc.h" +# else +# include "ptmalloc.h" +# endif #endif @@ -1106,6 +1109,10 @@ typedef struct malloc_chunk* mbinptr; typedef struct _arena { mbinptr av[2*NAV + 2]; struct _arena *next; + size_t size; +#if THREAD_STATS + long stat_lock_direct, stat_lock_loop, stat_lock_wait; +#endif mutex_t mutex; } arena; @@ -1116,8 +1123,10 @@ typedef struct _arena { multiple threads. */ typedef struct _heap_info { - arena *ar_ptr; - size_t size; + arena *ar_ptr; /* Arena for this heap. */ + struct _heap_info *prev; /* Previous heap. */ + size_t size; /* Current size in bytes. */ + size_t pad; /* Make sure the following data is properly aligned. */ } heap_info; @@ -1128,11 +1137,17 @@ typedef struct _heap_info { #if __STD_C static void chunk_free(arena *ar_ptr, mchunkptr p); static mchunkptr chunk_alloc(arena *ar_ptr, INTERNAL_SIZE_T size); -static int arena_trim(arena *ar_ptr, size_t pad); +static int main_trim(size_t pad); +#ifndef NO_THREADS |
