aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-05-17 10:09:50 +0000
committerUlrich Drepper <drepper@redhat.com>1999-05-17 10:09:50 +0000
commit431c33c0bc7cb43231da4364187e0161b0541071 (patch)
tree56976a8674f9ba49073bbfba93397e684180eb8c
parent15925412407840399fbc6ca2ab49ad92d3369896 (diff)
downloadglibc-431c33c0bc7cb43231da4364187e0161b0541071.tar
glibc-431c33c0bc7cb43231da4364187e0161b0541071.tar.gz
glibc-431c33c0bc7cb43231da4364187e0161b0541071.tar.bz2
glibc-431c33c0bc7cb43231da4364187e0161b0541071.zip
Update.
1999-05-16 Wolfram Gloger <wmglo@dent.med.uni-muenchen.de> * malloc/malloc.c: Cleanup to bring in line with released stand-alone version `ptmalloc'. Update some comments. (internal_function): Move fallback definition so that the source compiles outside of libc, and use it in more places. (malloc_atfork): Fix when malloc_check is in use. 1999-05-16 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * stdlib/tst-strtod.c: Fix typo. 1999-05-16 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * elf/dl-close.c (_dl_close): Add cast to avoid warning about const incorrectness.
-rw-r--r--ChangeLog17
-rw-r--r--linuxthreads/ChangeLog9
-rw-r--r--linuxthreads/manager.c12
-rw-r--r--malloc/malloc.c69
-rw-r--r--stdlib/tst-strtod.c4
5 files changed, 83 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 69f4b8b4ad..b4942af87c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+1999-05-16 Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>
+
+ * malloc/malloc.c: Cleanup to bring in line with released
+ stand-alone version `ptmalloc'. Update some comments.
+ (internal_function): Move fallback definition so that the source
+ compiles outside of libc, and use it in more places.
+ (malloc_atfork): Fix when malloc_check is in use.
+
+1999-05-16 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * stdlib/tst-strtod.c: Fix typo.
+
+1999-05-16 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * elf/dl-close.c (_dl_close): Add cast to avoid warning about
+ const incorrectness.
+
1999-05-16 Roland McGrath <roland@baalperazim.frob.com>
* sysdeps/generic/bits/termios.h (CRTSCTS): New macro.
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 9c45f6e746..9e30a35ee7 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,12 @@
+1999-05-16 Xavier Leroy <Xavier.Leroy@inria.fr>
+
+ * manager.c: If pthread_create() is given a NULL attribute
+ and the thread manager runs with a realtime policy, set the
+ scheduling policy of the newly created thread back to SCHED_OTHER.
+ * manager.c: If the PTHREAD_INHERIT_SCHED attribute is given,
+ initialize the schedpolicy field of new_thread->p_start_args
+ to that of the calling thread.
+
1999-04-29 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/sparc/sparc64/pt-machine.h (__compare_and_swap): cas
diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c
index 6bafc868c1..eee4b5c1e1 100644
--- a/linuxthreads/manager.c
+++ b/linuxthreads/manager.c
@@ -189,9 +189,19 @@ static int pthread_start_thread(void *arg)
sigprocmask(SIG_SETMASK, &self->p_start_args.mask, NULL);
/* Set the scheduling policy and priority for the new thread, if needed */
if (THREAD_GETMEM(self, p_start_args.schedpolicy) >= 0)
+ /* Explicit scheduling attributes were provided: apply them */
__sched_setscheduler(THREAD_GETMEM(self, p_pid),
THREAD_GETMEM(self, p_start_args.schedpolicy),
&self->p_start_args.schedparam);
+else if (__pthread_manager_thread.p_priority > 0)
+ /* Default scheduling required, but thread manager runs in realtime
+ scheduling: switch new thread to SCHED_OTHER policy */
+ {
+ struct sched_param default_params;
+ default_params.sched_priority = 0;
+ __sched_setscheduler(THREAD_GETMEM(self, p_pid),
+ SCHED_OTHER, &default_params);
+ }
/* Make gdb aware of new thread */
if (__pthread_threads_debug && __pthread_sig_debug > 0) {
request.req_thread = self;
@@ -347,7 +357,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
sizeof (struct sched_param));
break;
case PTHREAD_INHERIT_SCHED:
- /* schedpolicy doesn't need to be set, only get priority */
+ new_thread->p_start_args.schedpolicy = __sched_getscheduler(father_pid);
__sched_getparam(father_pid, &new_thread->p_start_args.schedparam);
break;
}
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 4bdc2585cb..43d89d43da 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -182,10 +182,11 @@
MALLOC_HOOKS (default: NOT defined)
Define to enable support run-time replacement of the allocation
functions through user-defined `hooks'.
- REALLOC_ZERO_BYTES_FREES (default: NOT defined)
+ REALLOC_ZERO_BYTES_FREES (default: defined)
Define this if you think that realloc(p, 0) should be equivalent
- to free(p). Otherwise, since malloc returns a unique pointer for
- malloc(0), so does realloc(p, 0).
+ to free(p). (The C standard requires this behaviour, therefore
+ it is the default.) Otherwise, since malloc returns a unique
+ pointer for malloc(0), so does realloc(p, 0).
HAVE_MEMCPY (default: defined)
Define if you are not otherwise using ANSI STD C, but still
have memcpy and memset in your C library and want to use them.
@@ -366,10 +367,10 @@ extern "C" {
#endif
/*
- REALLOC_ZERO_BYTES_FREES should be set if a call to
- realloc with zero bytes should be the same as a call to free.
- Some people think it should. Otherwise, since this malloc
- returns a unique pointer for malloc(0), so does realloc(p, 0).
+ REALLOC_ZERO_BYTES_FREES should be set if a call to realloc with
+ zero bytes should be the same as a call to free. The C standard
+ requires this. Otherwise, since this malloc returns a unique pointer
+ for malloc(0), so does realloc(p, 0).
*/
@@ -528,6 +529,9 @@ do { \
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
#define MAP_ANONYMOUS MAP_ANON
#endif
+#if !defined(MAP_FAILED)
+#define MAP_FAILED ((char*)-1)
+#endif
#ifndef MAP_NORESERVE
# ifdef MAP_AUTORESRV
@@ -818,6 +822,15 @@ do { \
computed. */
+
+/* On some platforms we can compile internal, not exported functions better.
+ Let the environment provide a macro and define it to be empty if it
+ is not available. */
+#ifndef internal_function
+# define internal_function
+#endif
+
+
/*
Special defines for the Linux/GNU C library.
@@ -1230,13 +1243,6 @@ static void free_atfork();
#endif
-/* On some platforms we can compile internal, not exported functions better.
- Let the environment provide a macro and define it to be empty if it
- is not available. */
-#ifndef internal_function
-# define internal_function
-#endif
-
/* sizes, alignments */
@@ -1613,7 +1619,7 @@ ptmalloc_init_all __MALLOC_P((void))
(void)mutex_init(&list_lock);
}
-#endif
+#endif /* !defined NO_THREADS */
/* Initialization routine. */
#if defined(_LIBC)
@@ -1852,10 +1858,12 @@ mmap_chunk(size) size_t size;
return p;
}
+static void
+internal_function
#if __STD_C
-static void munmap_chunk(mchunkptr p)
+munmap_chunk(mchunkptr p)
#else
-static void munmap_chunk(p) mchunkptr p;
+munmap_chunk(p) mchunkptr p;
#endif
{
INTERNAL_SIZE_T size = chunksize(p);
@@ -1877,10 +1885,12 @@ static void munmap_chunk(p) mchunkptr p;
#if HAVE_MREMAP
+static mchunkptr
+internal_function
#if __STD_C
-static mchunkptr mremap_chunk(mchunkptr p, size_t new_size)
+mremap_chunk(mchunkptr p, size_t new_size)
#else
-static mchunkptr mremap_chunk(p, new_size) mchunkptr p; size_t new_size;
+mremap_chunk(p, new_size) mchunkptr p; size_t new_size;
#endif
{
size_t page_mask = malloc_getpagesize - 1;
@@ -1899,7 +1909,7 @@ static mchunkptr mremap_chunk(p, new_size) mchunkptr p; size_t new_size;
cp = (char *)mremap((char *)p - offset, size + offset, new_size,
MREMAP_MAYMOVE);
- if (cp == (char *)-1) return 0;
+ if (cp == MAP_FAILED) return 0;
p = (mchunkptr)(cp + offset);
@@ -3034,7 +3044,7 @@ chunk_free(ar_ptr, p) arena *ar_ptr; mchunkptr p;
if(next->size < MINSIZE &&
(unsigned long)sz > trim_threshold &&
ar_ptr != &main_arena) { /* fencepost */
- heap_info* heap = heap_for_ptr(top(ar_ptr));
+ heap_info *heap = heap_for_ptr(top(ar_ptr));
if(top(ar_ptr) == chunk_at_offset(heap, sizeof(*heap)) &&
heap->prev == heap_for_ptr(p))
@@ -4212,6 +4222,7 @@ mALLOC_SET_STATe(msptr) Void_t* msptr;
into a user pointer with requested size sz. */
static Void_t*
+internal_function
#if __STD_C
chunk2mem_check(mchunkptr p, size_t sz)
#else
@@ -4293,6 +4304,7 @@ mem2chunk_check(mem) Void_t* mem;
necessary. */
static int
+internal_function
#if __STD_C
top_check(void)
#else
@@ -4525,11 +4537,18 @@ malloc_atfork(sz, caller) size_t sz; const Void_t *caller;
#endif
{
Void_t *vptr = NULL;
+ mchunkptr victim;
tsd_getspecific(arena_key, vptr);
if(!vptr) {
- mchunkptr victim = chunk_alloc(&main_arena, request2size(sz));
- return victim ? chunk2mem(victim) : 0;
+ if(save_malloc_hook != malloc_check) {
+ victim = chunk_alloc(&main_arena, request2size(sz));
+ return victim ? chunk2mem(victim) : 0;
+ } else {
+ if(top_check() < 0) return 0;
+ victim = chunk_alloc(&main_arena, request2size(sz+1));
+ return victim ? chunk2mem_check(victim, sz) : 0;
+ }
} else {
/* Suspend the thread until the `atfork' handlers have completed.
By that time, the hooks will have been reset as well, so that
@@ -4554,7 +4573,7 @@ free_atfork(mem, caller) Void_t* mem; const Void_t *caller;
if (mem == 0) /* free(0) has no effect */
return;
- p = mem2chunk(mem);
+ p = mem2chunk(mem); /* do not bother to replicate free_check here */
#if HAVE_MMAP
if (chunk_is_mmapped(p)) /* release mmapped memory. */
@@ -4573,7 +4592,7 @@ free_atfork(mem, caller) Void_t* mem; const Void_t *caller;
(void)mutex_unlock(&ar_ptr->mutex);
}
-#endif
+#endif /* !defined NO_THREADS */
#endif /* defined _LIBC || defined MALLOC_HOOKS */
diff --git a/stdlib/tst-strtod.c b/stdlib/tst-strtod.c
index b9158c11f9..4f0ea34367 100644
--- a/stdlib/tst-strtod.c
+++ b/stdlib/tst-strtod.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1997, 1998, 1999 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
@@ -88,7 +88,7 @@ main (int argc, char ** argv)
sprintf (buf, "%f", strtod ("-0.0", NULL));
if (strcmp (buf, "-0.000000") != 0)
{
- printf (" strtod (\"-0.0\', NULL) returns \"%s\"\n", buf);
+ printf (" strtod (\"-0.0\", NULL) returns \"%s\"\n", buf);
status = 1;
}