From eb4063467c4ef625c1687b4c158bacf475821363 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 4 May 1998 13:19:20 +0000 Subject: Update. 1998-05-04 12:40 Ulrich Drepper * 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. --- sysdeps/unix/sysv/linux/bits/sigstack.h | 39 +++++++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/tcgetattr.c | 22 +++++++++++++++---- sysdeps/unix/sysv/linux/tcsetattr.c | 8 +++---- 3 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/bits/sigstack.h (limited to 'sysdeps/unix/sysv') diff --git a/sysdeps/unix/sysv/linux/bits/sigstack.h b/sysdeps/unix/sysv/linux/bits/sigstack.h new file mode 100644 index 0000000000..a86473839c --- /dev/null +++ b/sysdeps/unix/sysv/linux/bits/sigstack.h @@ -0,0 +1,39 @@ +/* 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 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; diff --git a/sysdeps/unix/sysv/linux/tcgetattr.c b/sysdeps/unix/sysv/linux/tcgetattr.c index 7866183abe..cbb372f317 100644 --- a/sysdeps/unix/sysv/linux/tcgetattr.c +++ b/sysdeps/unix/sysv/linux/tcgetattr.c @@ -1,4 +1,4 @@ -/* 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 @@ -16,7 +16,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include +#include #include #include @@ -33,7 +35,6 @@ __tcgetattr (fd, termios_p) { struct __kernel_termios k_termios; int retval; - size_t cnt; retval = __ioctl (fd, TCGETS, &k_termios); @@ -48,8 +49,21 @@ __tcgetattr (fd, termios_p) #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; } diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c index 0b9fee2165..dee491564f 100644 --- a/sysdeps/unix/sysv/linux/tcsetattr.c +++ b/sysdeps/unix/sysv/linux/tcsetattr.c @@ -1,4 +1,4 @@ -/* 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 @@ -17,6 +17,7 @@ Boston, MA 02111-1307, USA. */ #include +#include #include #include #include @@ -36,7 +37,6 @@ tcsetattr (fd, optional_actions, termios_p) { struct __kernel_termios k_termios; unsigned long int cmd; - size_t cnt; switch (optional_actions) { @@ -65,8 +65,8 @@ tcsetattr (fd, optional_actions, termios_p) #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); } -- cgit v1.2.3