summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/bits/sigstack.h39
-rw-r--r--sysdeps/unix/sysv/linux/bits/sigstack.h39
-rw-r--r--sysdeps/unix/sysv/linux/tcgetattr.c22
-rw-r--r--sysdeps/unix/sysv/linux/tcsetattr.c8
4 files changed, 100 insertions, 8 deletions
diff --git a/sysdeps/generic/bits/sigstack.h b/sysdeps/generic/bits/sigstack.h
new file mode 100644
index 0000000000..3a58e8bb58
--- /dev/null
+++ b/sysdeps/generic/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 <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;
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 <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;
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 <string.h>
 #include <termios.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 
@@ -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 <errno.h>
+#include <string.h>
 #include <termios.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
@@ -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);
 }