[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit

Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/libc/glibc/glibc-2.22/termios/Makefile b/ap/libc/glibc/glibc-2.22/termios/Makefile
new file mode 100644
index 0000000..fea9f1d
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/Makefile
@@ -0,0 +1,33 @@
+# Copyright (C) 1991-2015 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 Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 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
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+#
+#	Makefile for the terminal I/O functions.
+#
+subdir	:= termios
+
+include ../Makeconfig
+
+headers	:= termios.h bits/termios.h sys/ttydefaults.h sys/termios.h \
+	   sys/ttychars.h
+
+routines	:= speed cfsetspeed tcsetattr tcgetattr tcgetpgrp tcsetpgrp \
+		   tcdrain tcflow tcflush tcsendbrk cfmakeraw tcgetsid
+
+include ../Rules
+
+CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables
diff --git a/ap/libc/glibc/glibc-2.22/termios/Versions b/ap/libc/glibc/glibc-2.22/termios/Versions
new file mode 100644
index 0000000..711ed03
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/Versions
@@ -0,0 +1,14 @@
+libc {
+  GLIBC_2.0 {
+    # c*
+    cfgetispeed; cfgetospeed; cfmakeraw; cfsetispeed; cfsetospeed; cfsetspeed;
+
+    # t*
+    tcdrain; tcflow; tcflush; tcgetattr; tcgetpgrp; tcsendbreak; tcsetattr;
+    tcsetpgrp;
+  }
+  GLIBC_2.1 {
+    # t*
+    tcgetsid;
+  }
+}
diff --git a/ap/libc/glibc/glibc-2.22/termios/cfmakeraw.c b/ap/libc/glibc/glibc-2.22/termios/cfmakeraw.c
new file mode 100644
index 0000000..035a6d6
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/cfmakeraw.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1992-2015 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <termios.h>
+
+/* Set *T to indicate raw mode.  */
+void
+cfmakeraw (t)
+     struct termios *t;
+{
+  t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+  t->c_oflag &= ~OPOST;
+  t->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+  t->c_cflag &= ~(CSIZE|PARENB);
+  t->c_cflag |= CS8;
+  t->c_cc[VMIN] = 1;		/* read returns when one char is available.  */
+  t->c_cc[VTIME] = 0;
+}
diff --git a/ap/libc/glibc/glibc-2.22/termios/cfsetspeed.c b/ap/libc/glibc/glibc-2.22/termios/cfsetspeed.c
new file mode 100644
index 0000000..4fe8ed6
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/cfsetspeed.c
@@ -0,0 +1,161 @@
+/* Copyright (C) 1992-2015 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <termios.h>
+#include <errno.h>
+#include <stddef.h>
+
+struct speed_struct
+{
+  speed_t value;
+  speed_t internal;
+};
+
+static const struct speed_struct speeds[] =
+  {
+#ifdef B0
+    { 0, B0 },
+#endif
+#ifdef B50
+    { 50, B50 },
+#endif
+#ifdef B75
+    { 75, B75 },
+#endif
+#ifdef B110
+    { 110, B110 },
+#endif
+#ifdef B134
+    { 134, B134 },
+#endif
+#ifdef B150
+    { 150, B150 },
+#endif
+#ifdef B200
+    { 200, B200 },
+#endif
+#ifdef B300
+    { 300, B300 },
+#endif
+#ifdef B600
+    { 600, B600 },
+#endif
+#ifdef B1200
+    { 1200, B1200 },
+#endif
+#ifdef B1200
+    { 1200, B1200 },
+#endif
+#ifdef B1800
+    { 1800, B1800 },
+#endif
+#ifdef B2400
+    { 2400, B2400 },
+#endif
+#ifdef B4800
+    { 4800, B4800 },
+#endif
+#ifdef B9600
+    { 9600, B9600 },
+#endif
+#ifdef B19200
+    { 19200, B19200 },
+#endif
+#ifdef B38400
+    { 38400, B38400 },
+#endif
+#ifdef B57600
+    { 57600, B57600 },
+#endif
+#ifdef B76800
+    { 76800, B76800 },
+#endif
+#ifdef B115200
+    { 115200, B115200 },
+#endif
+#ifdef B153600
+    { 153600, B153600 },
+#endif
+#ifdef B230400
+    { 230400, B230400 },
+#endif
+#ifdef B307200
+    { 307200, B307200 },
+#endif
+#ifdef B460800
+    { 460800, B460800 },
+#endif
+#ifdef B500000
+    { 500000, B500000 },
+#endif
+#ifdef B576000
+    { 576000, B576000 },
+#endif
+#ifdef B921600
+    { 921600, B921600 },
+#endif
+#ifdef B1000000
+    { 1000000, B1000000 },
+#endif
+#ifdef B1152000
+    { 1152000, B1152000 },
+#endif
+#ifdef B1500000
+    { 1500000, B1500000 },
+#endif
+#ifdef B2000000
+    { 2000000, B2000000 },
+#endif
+#ifdef B2500000
+    { 2500000, B2500000 },
+#endif
+#ifdef B3000000
+    { 3000000, B3000000 },
+#endif
+#ifdef B3500000
+    { 3500000, B3500000 },
+#endif
+#ifdef B4000000
+    { 4000000, B4000000 },
+#endif
+  };
+
+
+/* Set both the input and output baud rates stored in *TERMIOS_P to SPEED.  */
+int
+cfsetspeed (struct termios *termios_p, speed_t speed)
+{
+  size_t cnt;
+
+  for (cnt = 0; cnt < sizeof (speeds) / sizeof (speeds[0]); ++cnt)
+    if (speed == speeds[cnt].internal)
+      {
+	cfsetispeed (termios_p, speed);
+	cfsetospeed (termios_p, speed);
+	return 0;
+      }
+    else if (speed == speeds[cnt].value)
+      {
+	cfsetispeed (termios_p, speeds[cnt].internal);
+	cfsetospeed (termios_p, speeds[cnt].internal);
+	return 0;
+      }
+
+  __set_errno (EINVAL);
+
+  return -1;
+}
diff --git a/ap/libc/glibc/glibc-2.22/termios/speed.c b/ap/libc/glibc/glibc-2.22/termios/speed.c
new file mode 100644
index 0000000..a6380a9
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/speed.c
@@ -0,0 +1,71 @@
+/* `struct termios' speed frobnication functions.  4.4 BSD/generic GNU version.
+   Copyright (C) 1991-2015 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stddef.h>
+#include <errno.h>
+#include <termios.h>
+
+/* Return the output baud rate stored in *TERMIOS_P.  */
+speed_t
+cfgetospeed (termios_p)
+     const struct termios *termios_p;
+{
+  return termios_p->__ospeed;
+}
+
+/* Return the input baud rate stored in *TERMIOS_P.  */
+speed_t
+cfgetispeed (termios_p)
+     const struct termios *termios_p;
+{
+  return termios_p->__ispeed;
+}
+
+/* Set the output baud rate stored in *TERMIOS_P to SPEED.  */
+int
+cfsetospeed (termios_p, speed)
+     struct termios *termios_p;
+     speed_t speed;
+{
+  if (termios_p == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  termios_p->__ospeed = speed;
+  return 0;
+}
+libc_hidden_def (cfsetospeed)
+
+/* Set the input baud rate stored in *TERMIOS_P to SPEED.  */
+int
+cfsetispeed (termios_p, speed)
+     struct termios *termios_p;
+     speed_t speed;
+{
+  if (termios_p == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  termios_p->__ispeed = speed;
+  return 0;
+}
+libc_hidden_def (cfsetispeed)
diff --git a/ap/libc/glibc/glibc-2.22/termios/sys/termios.h b/ap/libc/glibc/glibc-2.22/termios/sys/termios.h
new file mode 100644
index 0000000..3e18805
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/sys/termios.h
@@ -0,0 +1,4 @@
+#ifndef _SYS_TERMIOS_H
+#define _SYS_TERMIOS_H
+#include <termios.h>
+#endif
diff --git a/ap/libc/glibc/glibc-2.22/termios/sys/ttychars.h b/ap/libc/glibc/glibc-2.22/termios/sys/ttychars.h
new file mode 100644
index 0000000..7043f60
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/sys/ttychars.h
@@ -0,0 +1,61 @@
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ttychars.h	8.2 (Berkeley) 1/4/94
+ */
+
+/*
+ * 4.3 COMPATIBILITY FILE
+ *
+ * User visible structures and constants related to terminal handling.
+ */
+#ifndef _SYS_TTYCHARS_H
+#define	_SYS_TTYCHARS_H 1
+
+struct ttychars {
+	char	tc_erase;	/* erase last character */
+	char	tc_kill;	/* erase entire line */
+	char	tc_intrc;	/* interrupt */
+	char	tc_quitc;	/* quit */
+	char	tc_startc;	/* start output */
+	char	tc_stopc;	/* stop output */
+	char	tc_eofc;	/* end-of-file */
+	char	tc_brkc;	/* input delimiter (like nl) */
+	char	tc_suspc;	/* stop process signal */
+	char	tc_dsuspc;	/* delayed stop process signal */
+	char	tc_rprntc;	/* reprint line */
+	char	tc_flushc;	/* flush output (toggles) */
+	char	tc_werasc;	/* word erase */
+	char	tc_lnextc;	/* literal next character */
+};
+
+#ifdef __USE_OLD_TTY
+#include <sys/ttydefaults.h>	/* to pick up character defaults */
+#endif
+
+#endif /* sys/ttychars.h */
diff --git a/ap/libc/glibc/glibc-2.22/termios/tcdrain.c b/ap/libc/glibc/glibc-2.22/termios/tcdrain.c
new file mode 100644
index 0000000..dc0be55
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/tcdrain.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991-2015 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <termios.h>
+
+/* Wait for pending output to be written on FD.  */
+int
+__libc_tcdrain (int fd)
+{
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__libc_tcdrain, tcdrain)
+
+
+stub_warning (tcdrain)
diff --git a/ap/libc/glibc/glibc-2.22/termios/tcflow.c b/ap/libc/glibc/glibc-2.22/termios/tcflow.c
new file mode 100644
index 0000000..a86fe8b
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/tcflow.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 1991-2015 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <termios.h>
+
+/* Suspend or restart transmission on FD.  */
+int
+tcflow (fd, action)
+     int fd;
+     int action;
+{
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+
+  switch (action)
+    {
+    case TCOOFF:
+    case TCOON:
+    case TCIOFF:
+    case TCION:
+      break;
+
+    default:
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+
+stub_warning (tcflow)
diff --git a/ap/libc/glibc/glibc-2.22/termios/tcflush.c b/ap/libc/glibc/glibc-2.22/termios/tcflush.c
new file mode 100644
index 0000000..db3c945
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/tcflush.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1991-2015 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <termios.h>
+
+/* Flush pending data on FD.  */
+int
+tcflush (fd, queue_selector)
+     int fd;
+     int queue_selector;
+{
+  switch (queue_selector)
+    {
+    case TCIFLUSH:
+    case TCOFLUSH:
+    case TCIOFLUSH:
+      break;
+
+    default:
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+
+stub_warning(tcflush);
diff --git a/ap/libc/glibc/glibc-2.22/termios/tcgetattr.c b/ap/libc/glibc/glibc-2.22/termios/tcgetattr.c
new file mode 100644
index 0000000..badbb59
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/tcgetattr.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1991-2015 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <termios.h>
+
+/* Put the state of FD into *TERMIOS_P.  */
+int
+__tcgetattr (fd, termios_p)
+     int fd;
+     struct termios *termios_p;
+{
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+  if (termios_p == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (tcgetattr)
+
+weak_alias (__tcgetattr, tcgetattr)
diff --git a/ap/libc/glibc/glibc-2.22/termios/tcgetpgrp.c b/ap/libc/glibc/glibc-2.22/termios/tcgetpgrp.c
new file mode 100644
index 0000000..b1a0547
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/tcgetpgrp.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991-2015 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Return the foreground process group ID of FD.  */
+pid_t
+tcgetpgrp (fd)
+     int fd;
+{
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return (pid_t) -1;
+    }
+
+  __set_errno (ENOSYS);
+  return (pid_t) -1;
+}
+libc_hidden_def (tcgetpgrp)
+stub_warning (tcgetpgrp)
diff --git a/ap/libc/glibc/glibc-2.22/termios/tcgetsid.c b/ap/libc/glibc/glibc-2.22/termios/tcgetsid.c
new file mode 100644
index 0000000..fcf4d7f
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/tcgetsid.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 1997-2015 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+/* Return the session ID of FD.  */
+pid_t
+tcgetsid (fd)
+     int fd;
+{
+  pid_t pgrp;
+  pid_t sid;
+#ifdef TIOCGSID
+  static int tiocgsid_does_not_work;
+
+  if (! tiocgsid_does_not_work)
+    {
+      int serrno = errno;
+      int sid;
+
+      if (__ioctl (fd, TIOCGSID, &sid) < 0)
+	{
+	  if (errno == EINVAL)
+	    {
+	      tiocgsid_does_not_work = 1;
+	      __set_errno (serrno);
+	    }
+	  else
+	    return (pid_t) -1;
+	}
+      else
+	return (pid_t) sid;
+    }
+#endif
+
+  pgrp = tcgetpgrp (fd);
+  if (pgrp == -1)
+    return (pid_t) -1;
+
+  sid = getsid (pgrp);
+  if (sid == -1 && errno == ESRCH)
+    __set_errno (ENOTTY);
+
+  return sid;
+}
diff --git a/ap/libc/glibc/glibc-2.22/termios/tcsendbrk.c b/ap/libc/glibc/glibc-2.22/termios/tcsendbrk.c
new file mode 100644
index 0000000..abd4d11
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/tcsendbrk.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1991-2015 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <termios.h>
+
+/* Send zero bits on FD.  */
+int
+tcsendbreak (fd, duration)
+     int fd;
+     int duration;
+{
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+
+stub_warning (tcsendbreak)
diff --git a/ap/libc/glibc/glibc-2.22/termios/tcsetattr.c b/ap/libc/glibc/glibc-2.22/termios/tcsetattr.c
new file mode 100644
index 0000000..3079337
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/tcsetattr.c
@@ -0,0 +1,106 @@
+/* Copyright (C) 1991-2015 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <termios.h>
+
+static int bad_speed (speed_t speed);
+
+/* Set the state of FD to *TERMIOS_P.  */
+int
+tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
+{
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+  if (termios_p == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+  switch (optional_actions)
+    {
+    case TCSANOW:
+    case TCSADRAIN:
+    case TCSAFLUSH:
+      break;
+    default:
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  if (bad_speed(termios_p->__ospeed) ||
+      bad_speed(termios_p->__ispeed == 0 ?
+		termios_p->__ospeed : termios_p->__ispeed))
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+libc_hidden_def (tcsetattr)
+
+/* Strychnine checking.  */
+static int
+bad_speed (speed_t speed)
+{
+  switch (speed)
+    {
+    case B0:
+    case B50:
+    case B75:
+    case B110:
+    case B134:
+    case B150:
+    case B200:
+    case B300:
+    case B600:
+    case B1200:
+    case B1800:
+    case B2400:
+    case B4800:
+    case B9600:
+    case B19200:
+    case B38400:
+    case B57600:
+    case B115200:
+    case B230400:
+    case B460800:
+    case B500000:
+    case B576000:
+    case B921600:
+    case B1000000:
+    case B1152000:
+    case B1500000:
+    case B2000000:
+    case B2500000:
+    case B3000000:
+    case B3500000:
+    case B4000000:
+      return 0;
+    default:
+      return 1;
+    }
+}
+
+
+stub_warning (tcsetattr)
diff --git a/ap/libc/glibc/glibc-2.22/termios/tcsetpgrp.c b/ap/libc/glibc/glibc-2.22/termios/tcsetpgrp.c
new file mode 100644
index 0000000..e6205c5
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/tcsetpgrp.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991-2015 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Set the foreground process group ID of FD set PGRP_ID.  */
+int
+tcsetpgrp (fd, pgrp_id)
+     int fd;
+     pid_t pgrp_id;
+{
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+
+stub_warning (tcsetpgrp)
diff --git a/ap/libc/glibc/glibc-2.22/termios/termios.h b/ap/libc/glibc/glibc-2.22/termios/termios.h
new file mode 100644
index 0000000..fb227e3
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/termios/termios.h
@@ -0,0 +1,109 @@
+/* Copyright (C) 1991-2015 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/*
+ *	POSIX Standard: 7.1-2 General Terminal Interface	<termios.h>
+ */
+
+#ifndef	_TERMIOS_H
+#define	_TERMIOS_H	1
+
+#include <features.h>
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
+/* We need `pid_t'.  */
+# include <bits/types.h>
+# ifndef __pid_t_defined
+typedef __pid_t pid_t;
+#  define __pid_t_defined
+# endif
+#endif
+
+__BEGIN_DECLS
+
+/* Get the system-dependent definitions of `struct termios', `tcflag_t',
+   `cc_t', `speed_t', and all the macros specifying the flag bits.  */
+#include <bits/termios.h>
+
+#ifdef __USE_MISC
+/* Compare a character C to a value VAL from the `c_cc' array in a
+   `struct termios'.  If VAL is _POSIX_VDISABLE, no character can match it.  */
+# define CCEQ(val, c)	((c) == (val) && (val) != _POSIX_VDISABLE)
+#endif
+
+/* Return the output baud rate stored in *TERMIOS_P.  */
+extern speed_t cfgetospeed (const struct termios *__termios_p) __THROW;
+
+/* Return the input baud rate stored in *TERMIOS_P.  */
+extern speed_t cfgetispeed (const struct termios *__termios_p) __THROW;
+
+/* Set the output baud rate stored in *TERMIOS_P to SPEED.  */
+extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW;
+
+/* Set the input baud rate stored in *TERMIOS_P to SPEED.  */
+extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW;
+
+#ifdef	__USE_MISC
+/* Set both the input and output baud rates in *TERMIOS_OP to SPEED.  */
+extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW;
+#endif
+
+
+/* Put the state of FD into *TERMIOS_P.  */
+extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW;
+
+/* Set the state of FD to *TERMIOS_P.
+   Values for OPTIONAL_ACTIONS (TCSA*) are in <bits/termios.h>.  */
+extern int tcsetattr (int __fd, int __optional_actions,
+		      const struct termios *__termios_p) __THROW;
+
+
+#ifdef	__USE_MISC
+/* Set *TERMIOS_P to indicate raw mode.  */
+extern void cfmakeraw (struct termios *__termios_p) __THROW;
+#endif
+
+/* Send zero bits on FD.  */
+extern int tcsendbreak (int __fd, int __duration) __THROW;
+
+/* Wait for pending output to be written on FD.
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
+extern int tcdrain (int __fd);
+
+/* Flush pending data on FD.
+   Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>.  */
+extern int tcflush (int __fd, int __queue_selector) __THROW;
+
+/* Suspend or restart transmission on FD.
+   Values for ACTION (TC[IO]{OFF,ON}) are in <bits/termios.h>.  */
+extern int tcflow (int __fd, int __action) __THROW;
+
+
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
+/* Get process group ID for session leader for controlling terminal FD.  */
+extern __pid_t tcgetsid (int __fd) __THROW;
+#endif
+
+
+#ifdef __USE_MISC
+# include <sys/ttydefaults.h>
+#endif
+
+__END_DECLS
+
+#endif /* termios.h  */