+1998-05-04 12:40 Ulrich Drepper <drepper@cygnus.com>
+
+ * malloc/malloc.c (ptmalloc_init_all): New function. Similar to
+ ptmalloc_unlock_all, but re-initializes the mutexes instead.
+ (ptmalloc_init): Use new function in thread_at_fork call.
+ (thread_atfork_static): Likewise.
+ Suggested by Wolfram Gloger and Xavier Leroy.
+
1998-05-04 Ulrich Drepper <drepper@cygnus.com>
* signal/signal.h: Move definitions of struct sigstack and
include $(patsubst %,$(..)extra-lib.mk,$(extra-libs))
endif
\f
++depfiles := $(sources:.c=.d) \
+ $(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
+ $(addsuffix .d,$(tests) $(test-srcs) $(tests-static))
ifeq ($(build-programs),yes)
-+depfiles := $(strip $(sources:.c=.d) \
- $(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
- $(addsuffix .d,$(others) $(tests) $(test-srcs)))
-else
-+depfiles := $(strip $(sources:.c=.d) \
- $(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
- $(addsuffix .d,$(tests) $(test-srcs)))
++depfiles += $(addsuffix .d,$(others))
endif
+depfiles := $(addprefix $(objpfx),\
$(filter-out $(addsuffix .d,$(omit-deps)),\
--- /dev/null
+/* sigstack, sigaltstack definitions.
+ Copyright (C) 1998 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 it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SIGNAL_H
+# error "Never include this file directly. Use <signal.h> instead"
+#endif
+
+
+/* Structure describing a signal stack (obsolete). */
+struct sigstack
+ {
+ __ptr_t ss_sp; /* Signal stack pointer. */
+ int ss_onstack; /* Nonzero if executing on this stack. */
+ };
+
+
+/* Alternate, preferred interface. */
+typedef struct sigaltstack
+ {
+ __ptr_t ss_sp;
+ size_t ss_size;
+ int ss_flags;
+ } stack_t;
is specified (i.e., this is no dynamically linked binary. */
if (main_map->l_ld == NULL)
_exit (1);
- if (!has_interp)
- _exit (2);
/* We allow here some platform specific code. */
#ifdef DISTINGUISH_LIB_VERSIONS
DISTINGUISH_LIB_VERSIONS;
#endif
- _exit (0);
+ _exit (has_interp ? 0 : 2);
}
if (! paths_initialized)
if (_dl_rtld_map.l_next)
_dl_rtld_map.l_next->l_prev = _dl_rtld_map.l_prev;
- if (_dl_rtld_map.l_opencount)
+ if (_dl_rtld_map.l_opencount > 1)
{
/* Some DT_NEEDED entry referred to the interpreter object itself, so
put it back in the list of visible objects. We insert it into the
/* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>
and Doug Lea <dl@cs.oswego.edu>, 1996.
(void)mutex_unlock(&list_lock);
}
+static void
+ptmalloc_init_all __MALLOC_P((void))
+{
+ arena *ar_ptr;
+
+#if defined _LIBC || defined MALLOC_HOOKS
+ tsd_setspecific(arena_key, save_arena);
+ __malloc_hook = save_malloc_hook;
+ __free_hook = save_free_hook;
+#endif
+ for(ar_ptr = &main_arena;;) {
+ (void)mutex_init(&ar_ptr->mutex);
+ ar_ptr = ar_ptr->next;
+ if(ar_ptr == &main_arena) break;
+ }
+ (void)mutex_init(&list_lock);
+}
+
/* Initialization routine. */
#if defined(_LIBC)
#if 0
mutex_init(&list_lock);
tsd_key_create(&arena_key, NULL);
tsd_setspecific(arena_key, (Void_t *)&main_arena);
- thread_atfork(ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_unlock_all);
+ thread_atfork(ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_init_all);
#endif
#if defined _LIBC || defined MALLOC_HOOKS
if((s = getenv("MALLOC_TRIM_THRESHOLD_")))
/* There are platforms (e.g. Hurd) with a link-time hook mechanism. */
#ifdef thread_atfork_static
thread_atfork_static(ptmalloc_lock_all, ptmalloc_unlock_all, \
- ptmalloc_unlock_all)
+ ptmalloc_init_all)
#endif
#if defined _LIBC || defined MALLOC_HOOKS
of the @code{struct termios} structure. This member is an array; each
element specifies the character for a particular role. Each element has
a symbolic constant that stands for the index of that element---for
-example, @code{INTR} is the index of the element that specifies the INTR
-character, so storing @code{'='} in @code{@var{termios}.c_cc[INTR]}
+example, @code{VINTR} is the index of the element that specifies the INTR
+character, so storing @code{'='} in @code{@var{termios}.c_cc[VINTR]}
specifies @samp{=} as the INTR character.
@vindex _POSIX_VDISABLE
subdir := signal
headers := signal.h sys/signal.h bits/signum.h bits/sigcontext.h \
- bits/sigaction.h bits/sigset.h bits/siginfo.h
+ bits/sigaction.h bits/sigset.h bits/siginfo.h bits/sigstack.h
routines := signal raise killpg \
sigaction sigprocmask kill \
calls be restarted after signal SIG. */
extern int siginterrupt __P ((int __sig, int __interrupt));
-
-/* Structure describing a signal stack. */
-struct sigstack
- {
- __ptr_t ss_sp; /* Signal stack pointer. */
- int ss_onstack; /* Nonzero if executing on this stack. */
- };
+# include <bits/sigstack.h>
/* Run signals handlers on the stack specified by SS (if not NULL).
- If OSS is not NULL, it is filled in with the old signal stack status. */
+ If OSS is not NULL, it is filled in with the old signal stack status.
+ This interface is obsolete and on many platform not implemented. */
extern int sigstack __P ((__const struct sigstack *__ss,
struct sigstack *__oss));
-/* Alternate interface. */
-typedef struct sigaltstack
- {
- __ptr_t ss_sp;
- int ss_flags;
- size_t ss_size;
- } stack_t;
-
+/* Alternate signal handler stack interface.
+ This interface should always be preferred over `sigstack'. */
extern int sigaltstack __P ((__const struct sigaltstack *__ss,
struct sigaltstack *__oss));
--- /dev/null
+/* sigstack, sigaltstack definitions.
+ Copyright (C) 1998 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 it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SIGNAL_H
+# error "Never include this file directly. Use <signal.h> instead"
+#endif
+
+
+/* Structure describing a signal stack (obsolete). */
+struct sigstack
+ {
+ __ptr_t ss_sp; /* Signal stack pointer. */
+ int ss_onstack; /* Nonzero if executing on this stack. */
+ };
+
+
+/* Alternate, preferred interface. */
+typedef struct sigaltstack
+ {
+ __ptr_t ss_sp;
+ size_t ss_size;
+ int ss_flags;
+ } stack_t;
--- /dev/null
+/* sigstack, sigaltstack definitions.
+ Copyright (C) 1998 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 it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SIGNAL_H
+# error "Never include this file directly. Use <signal.h> instead"
+#endif
+
+
+/* Structure describing a signal stack (obsolete). */
+struct sigstack
+ {
+ __ptr_t ss_sp; /* Signal stack pointer. */
+ int ss_onstack; /* Nonzero if executing on this stack. */
+ };
+
+
+/* Alternate, preferred interface. */
+typedef struct sigaltstack
+ {
+ __ptr_t ss_sp;
+ int ss_flags;
+ size_t ss_size;
+ } stack_t;
-/* Copyright (C) 1992, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995, 1997, 1998 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
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include <string.h>
#include <termios.h>
+#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
{
struct __kernel_termios k_termios;
int retval;
- size_t cnt;
retval = __ioctl (fd, TCGETS, &k_termios);
#ifdef _HAVE_C_OSPEED
termios_p->c_ospeed = k_termios.c_ospeed;
#endif
- for (cnt = 0; cnt < __KERNEL_NCCS; ++cnt)
- termios_p->c_cc[cnt] = k_termios.c_cc[cnt];
+ if (sizeof (cc_t) == 1 || _POSIX_VDISABLE == 0
+ || (unsigned char) _POSIX_VDISABLE == (unsigned char) -1)
+ memset (__mempcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
+ __KERNEL_NCCS * sizeof (cc_t)),
+ _POSIX_VDISABLE, (NCCS - __KERNEL_NCCS) * sizeof (cc_t));
+ else
+ {
+ size_t cnt;
+
+ memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
+ __KERNEL_NCCS * sizeof (cc_t));
+
+ for (cnt = __KERNEL_NCCS; cnt < NCCS; ++cnt)
+ termios_p->c_cc[cnt] = _POSIX_VDISABLE;
+ }
return retval;
}
-/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1996, 1997, 1998 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
Boston, MA 02111-1307, USA. */
#include <errno.h>
+#include <string.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/types.h>
{
struct __kernel_termios k_termios;
unsigned long int cmd;
- size_t cnt;
switch (optional_actions)
{
#ifdef _HAVE_C_OSPEED
k_termios.c_ospeed = termios_p->c_ospeed;
#endif
- for (cnt = 0; cnt < __KERNEL_NCCS; ++cnt)
- k_termios.c_cc[cnt] = termios_p->c_cc[cnt];
+ memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
+ __KERNEL_NCCS * sizeof (cc_t));
return __ioctl (fd, cmd, &k_termios);
}