diff --git a/ap/libc/glibc/glibc-2.22/rt/Depend b/ap/libc/glibc/glibc-2.22/rt/Depend
new file mode 100644
index 0000000..6c1aa44
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/Depend
@@ -0,0 +1 @@
+nptl
diff --git a/ap/libc/glibc/glibc-2.22/rt/Makefile b/ap/libc/glibc/glibc-2.22/rt/Makefile
new file mode 100644
index 0000000..e62e059
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/Makefile
@@ -0,0 +1,77 @@
+# 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/>.
+
+#
+#	Sub-makefile for real-time portion of the library.
+#
+subdir	:= rt
+
+include ../Makeconfig
+
+headers	:= aio.h mqueue.h bits/mqueue.h bits/mqueue2.h
+
+aio-routines   := aio_cancel aio_error aio_fsync aio_misc aio_read	\
+		  aio_read64 aio_return aio_suspend aio_write		\
+		  aio_write64 lio_listio lio_listio64 aio_sigqueue	\
+		  aio_notify
+clock-routines := get_clockfreq clock_getcpuclockid			\
+		  clock_getres clock_gettime clock_settime		\
+		  clock_nanosleep
+timer-routines := timer_create timer_delete timer_getoverr		\
+		  timer_gettime timer_settime
+shm-routines   := shm_open shm_unlink
+mq-routines    := mq_open mq_close mq_unlink mq_getattr mq_setattr	\
+		  mq_notify mq_send mq_receive mq_timedsend		\
+		  mq_timedreceive
+
+routines = $(clock-routines)
+
+librt-routines = $(aio-routines) \
+		 $(timer-routines) \
+		 $(shm-routines) $(mq-routines) \
+		 clock-compat
+
+tests := tst-shm tst-clock tst-clock_nanosleep tst-timer tst-timer2 \
+	 tst-aio tst-aio64 tst-aio2 tst-aio3 tst-aio4 tst-aio5 tst-aio6 \
+	 tst-aio7 tst-aio8 tst-aio9 tst-aio10 \
+	 tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \
+	 tst-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \
+	 tst-timer3 tst-timer4 tst-timer5 \
+	 tst-cpuclock1 tst-cpuclock2 \
+	 tst-cputimer1 tst-cputimer2 tst-cputimer3 \
+	 tst-clock2
+
+extra-libs := librt
+extra-libs-others := $(extra-libs)
+
+include ../Rules
+
+CFLAGS-aio_suspend.c = -fexceptions
+CFLAGS-clock_nanosleep.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-librt-cancellation.c = -fasynchronous-unwind-tables
+
+LDFLAGS-rt.so = -Wl,--enable-new-dtags,-z,nodelete
+
+$(objpfx)librt.so: $(shared-thread-library)
+
+ifeq (yes,$(build-shared))
+$(addprefix $(objpfx),$(tests)): $(objpfx)librt.so $(shared-thread-library)
+else
+$(addprefix $(objpfx),$(tests)): $(objpfx)librt.a $(static-thread-library)
+endif
+
+tst-mqueue7-ARGS = -- $(host-test-program-cmd)
diff --git a/ap/libc/glibc/glibc-2.22/rt/Versions b/ap/libc/glibc/glibc-2.22/rt/Versions
new file mode 100644
index 0000000..91e3fd2
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/Versions
@@ -0,0 +1,40 @@
+libc {
+  GLIBC_2.17 {
+    # c*
+    clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
+    clock_nanosleep;
+  }
+  GLIBC_PRIVATE {
+    __clock_getres; __clock_gettime; __clock_settime; __clock_getcpuclockid;
+    __clock_nanosleep;
+  }
+}
+
+librt {
+  GLIBC_2.1 {
+    # AIO functions.
+    aio_cancel; aio_cancel64; aio_error; aio_error64; aio_fsync; aio_fsync64;
+    aio_init; aio_read; aio_read64; aio_return; aio_return64; aio_suspend;
+    aio_suspend64; aio_write; aio_write64; lio_listio; lio_listio64;
+  }
+  GLIBC_2.2 {
+    # These have moved to libc and are still here only for compatibility.
+    clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
+    clock_nanosleep;
+
+    # s*
+    shm_open; shm_unlink;
+
+    # t*
+    timer_create; timer_delete; timer_getoverrun; timer_gettime;
+    timer_settime;
+  }
+  GLIBC_2.3.4 {
+    # m*
+    mq_open; mq_close; mq_unlink; mq_getattr; mq_setattr;
+    mq_notify; mq_send; mq_receive; mq_timedsend; mq_timedreceive;
+  }
+  GLIBC_2.7 {
+   __mq_open_2;
+  }
+}
diff --git a/ap/libc/glibc/glibc-2.22/rt/aio.h b/ap/libc/glibc/glibc-2.22/rt/aio.h
new file mode 100644
index 0000000..5e343d0
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/aio.h
@@ -0,0 +1,246 @@
+/* Copyright (C) 1996-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/>.  */
+
+/*
+ * ISO/IEC 9945-1:1996 6.7: Asynchronous Input and Output
+ */
+
+#ifndef _AIO_H
+#define _AIO_H	1
+
+#include <features.h>
+#include <sys/types.h>
+#define __need_sigevent_t
+#include <bits/siginfo.h>
+#define __need_timespec
+#include <time.h>
+
+__BEGIN_DECLS
+
+/* Asynchronous I/O control block.  */
+struct aiocb
+{
+  int aio_fildes;		/* File desriptor.  */
+  int aio_lio_opcode;		/* Operation to be performed.  */
+  int aio_reqprio;		/* Request priority offset.  */
+  volatile void *aio_buf;	/* Location of buffer.  */
+  size_t aio_nbytes;		/* Length of transfer.  */
+  struct sigevent aio_sigevent;	/* Signal number and value.  */
+
+  /* Internal members.  */
+  struct aiocb *__next_prio;
+  int __abs_prio;
+  int __policy;
+  int __error_code;
+  __ssize_t __return_value;
+
+#ifndef __USE_FILE_OFFSET64
+  __off_t aio_offset;		/* File offset.  */
+  char __pad[sizeof (__off64_t) - sizeof (__off_t)];
+#else
+  __off64_t aio_offset;		/* File offset.  */
+#endif
+  char __glibc_reserved[32];
+};
+
+/* The same for the 64bit offsets.  Please note that the members aio_fildes
+   to __return_value have to be the same in aiocb and aiocb64.  */
+#ifdef __USE_LARGEFILE64
+struct aiocb64
+{
+  int aio_fildes;		/* File desriptor.  */
+  int aio_lio_opcode;		/* Operation to be performed.  */
+  int aio_reqprio;		/* Request priority offset.  */
+  volatile void *aio_buf;	/* Location of buffer.  */
+  size_t aio_nbytes;		/* Length of transfer.  */
+  struct sigevent aio_sigevent;	/* Signal number and value.  */
+
+  /* Internal members.  */
+  struct aiocb *__next_prio;
+  int __abs_prio;
+  int __policy;
+  int __error_code;
+  __ssize_t __return_value;
+
+  __off64_t aio_offset;		/* File offset.  */
+  char __glibc_reserved[32];
+};
+#endif
+
+
+#ifdef __USE_GNU
+/* To customize the implementation one can use the following struct.
+   This implementation follows the one in Irix.  */
+struct aioinit
+  {
+    int aio_threads;		/* Maximal number of threads.  */
+    int aio_num;		/* Number of expected simultanious requests. */
+    int aio_locks;		/* Not used.  */
+    int aio_usedba;		/* Not used.  */
+    int aio_debug;		/* Not used.  */
+    int aio_numusers;		/* Not used.  */
+    int aio_idle_time;		/* Number of seconds before idle thread
+				   terminates.  */
+    int aio_reserved;
+  };
+#endif
+
+
+/* Return values of cancelation function.  */
+enum
+{
+  AIO_CANCELED,
+#define AIO_CANCELED AIO_CANCELED
+  AIO_NOTCANCELED,
+#define AIO_NOTCANCELED AIO_NOTCANCELED
+  AIO_ALLDONE
+#define AIO_ALLDONE AIO_ALLDONE
+};
+
+
+/* Operation codes for `aio_lio_opcode'.  */
+enum
+{
+  LIO_READ,
+#define LIO_READ LIO_READ
+  LIO_WRITE,
+#define LIO_WRITE LIO_WRITE
+  LIO_NOP
+#define LIO_NOP LIO_NOP
+};
+
+
+/* Synchronization options for `lio_listio' function.  */
+enum
+{
+  LIO_WAIT,
+#define LIO_WAIT LIO_WAIT
+  LIO_NOWAIT
+#define LIO_NOWAIT LIO_NOWAIT
+};
+
+
+/* Allow user to specify optimization.  */
+#ifdef __USE_GNU
+extern void aio_init (const struct aioinit *__init) __THROW __nonnull ((1));
+#endif
+
+
+#ifndef __USE_FILE_OFFSET64
+/* Enqueue read request for given number of bytes and the given priority.  */
+extern int aio_read (struct aiocb *__aiocbp) __THROW __nonnull ((1));
+/* Enqueue write request for given number of bytes and the given priority.  */
+extern int aio_write (struct aiocb *__aiocbp) __THROW __nonnull ((1));
+
+/* Initiate list of I/O requests.  */
+extern int lio_listio (int __mode,
+		       struct aiocb *const __list[__restrict_arr],
+		       int __nent, struct sigevent *__restrict __sig)
+  __THROW __nonnull ((2));
+
+/* Retrieve error status associated with AIOCBP.  */
+extern int aio_error (const struct aiocb *__aiocbp) __THROW __nonnull ((1));
+/* Return status associated with AIOCBP.  */
+extern __ssize_t aio_return (struct aiocb *__aiocbp) __THROW __nonnull ((1));
+
+/* Try to cancel asynchronous I/O requests outstanding against file
+   descriptor FILDES.  */
+extern int aio_cancel (int __fildes, struct aiocb *__aiocbp) __THROW;
+
+/* Suspend calling thread until at least one of the asynchronous I/O
+   operations referenced by LIST has completed.
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
+extern int aio_suspend (const struct aiocb *const __list[], int __nent,
+			const struct timespec *__restrict __timeout)
+  __nonnull ((1));
+
+/* Force all operations associated with file desriptor described by
+   `aio_fildes' member of AIOCBP.  */
+extern int aio_fsync (int __operation, struct aiocb *__aiocbp)
+  __THROW __nonnull ((2));
+#else
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (aio_read, (struct aiocb *__aiocbp), aio_read64)
+  __nonnull ((1));
+extern int __REDIRECT_NTH (aio_write, (struct aiocb *__aiocbp), aio_write64)
+  __nonnull ((1));
+
+extern int __REDIRECT_NTH (lio_listio,
+			   (int __mode,
+			    struct aiocb *const __list[__restrict_arr],
+			    int __nent, struct sigevent *__restrict __sig),
+			   lio_listio64) __nonnull ((2));
+
+extern int __REDIRECT_NTH (aio_error, (const struct aiocb *__aiocbp),
+			   aio_error64) __nonnull ((1));
+extern __ssize_t __REDIRECT_NTH (aio_return, (struct aiocb *__aiocbp),
+				 aio_return64) __nonnull ((1));
+
+extern int __REDIRECT_NTH (aio_cancel,
+			   (int __fildes, struct aiocb *__aiocbp),
+			   aio_cancel64);
+
+extern int __REDIRECT_NTH (aio_suspend,
+			   (const struct aiocb *const __list[], int __nent,
+			    const struct timespec *__restrict __timeout),
+			   aio_suspend64) __nonnull ((1));
+
+extern int __REDIRECT_NTH (aio_fsync,
+			   (int __operation, struct aiocb *__aiocbp),
+			   aio_fsync64) __nonnull ((2));
+
+# else
+#  define aio_read aio_read64
+#  define aio_write aio_write64
+#  define lio_listio lio_listio64
+#  define aio_error aio_error64
+#  define aio_return aio_return64
+#  define aio_cancel aio_cancel64
+#  define aio_suspend aio_suspend64
+#  define aio_fsync aio_fsync64
+# endif
+#endif
+
+#ifdef __USE_LARGEFILE64
+extern int aio_read64 (struct aiocb64 *__aiocbp) __THROW __nonnull ((1));
+extern int aio_write64 (struct aiocb64 *__aiocbp) __THROW __nonnull ((1));
+
+extern int lio_listio64 (int __mode,
+			 struct aiocb64 *const __list[__restrict_arr],
+			 int __nent, struct sigevent *__restrict __sig)
+  __THROW __nonnull ((2));
+
+extern int aio_error64 (const struct aiocb64 *__aiocbp)
+  __THROW __nonnull ((1));
+extern __ssize_t aio_return64 (struct aiocb64 *__aiocbp)
+  __THROW __nonnull ((1));
+
+extern int aio_cancel64 (int __fildes, struct aiocb64 *__aiocbp) __THROW;
+
+extern int aio_suspend64 (const struct aiocb64 *const __list[], int __nent,
+			  const struct timespec *__restrict __timeout)
+  __THROW __nonnull ((1));
+
+extern int aio_fsync64 (int __operation, struct aiocb64 *__aiocbp)
+  __THROW __nonnull ((2));
+#endif
+
+__END_DECLS
+
+#endif /* aio.h */
diff --git a/ap/libc/glibc/glibc-2.22/rt/aio_cancel.c b/ap/libc/glibc/glibc-2.22/rt/aio_cancel.c
new file mode 100644
index 0000000..235f572
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/aio_cancel.c
@@ -0,0 +1,42 @@
+/* Cancel requests associated with given file descriptor.  Stub version.
+   Copyright (C) 2001-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/>.  */
+
+
+/* We use an UGLY hack to prevent gcc from finding us cheating.  The
+   implementation of aio_cancel and aio_cancel64 are identical and so
+   we want to avoid code duplication by using aliases.  But gcc sees
+   the different parameter lists and prints a warning.  We define here
+   a function so that aio_cancel64 has no prototype.  */
+#define aio_cancel64 XXX
+#include <aio.h>
+/* And undo the hack.  */
+#undef aio_cancel64
+
+#include <errno.h>
+
+int
+aio_cancel (int fildes, struct aiocb *aiocbp)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+weak_alias (aio_cancel, aio_cancel64)
+
+stub_warning (aio_cancel)
+stub_warning (aio_cancel64)
diff --git a/ap/libc/glibc/glibc-2.22/rt/aio_error.c b/ap/libc/glibc/glibc-2.22/rt/aio_error.c
new file mode 100644
index 0000000..c546cab
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/aio_error.c
@@ -0,0 +1,39 @@
+/* Return error status of asynchronous I/O request.
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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/>.  */
+
+
+/* We use an UGLY hack to prevent gcc from finding us cheating.  The
+   implementation of aio_error and aio_error64 are identical and so
+   we want to avoid code duplication by using aliases.  But gcc sees
+   the different parameter lists and prints a warning.  We define here
+   a function so that aio_error64 has no prototype.  */
+#define aio_error64 XXX
+#include <aio.h>
+/* And undo the hack.  */
+#undef aio_error64
+
+
+int
+aio_error (aiocbp)
+     const struct aiocb *aiocbp;
+{
+  return aiocbp->__error_code;
+}
+
+weak_alias (aio_error, aio_error64)
diff --git a/ap/libc/glibc/glibc-2.22/rt/aio_fsync.c b/ap/libc/glibc/glibc-2.22/rt/aio_fsync.c
new file mode 100644
index 0000000..6ad1e03
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/aio_fsync.c
@@ -0,0 +1,49 @@
+/* Synchronize I/O in given file descriptor.  Stub version.
+   Copyright (C) 2001-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/>.  */
+
+
+/* We use an UGLY hack to prevent gcc from finding us cheating.  The
+   implementation of aio_fsync and aio_fsync64 are identical and so
+   we want to avoid code duplication by using aliases.  But gcc sees
+   the different parameter lists and prints a warning.  We define here
+   a function so that aio_fsync64 has no prototype.  */
+#define aio_fsync64 XXX
+#include <aio.h>
+/* And undo the hack.  */
+#undef aio_fsync64
+
+#include <errno.h>
+#include <fcntl.h>
+
+int
+aio_fsync (int op, struct aiocb *aiocbp)
+{
+  if (op != O_SYNC && op != O_DSYNC)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+weak_alias (aio_fsync, aio_fsync64)
+
+stub_warning (aio_fsync)
+stub_warning (aio_fsync64)
diff --git a/ap/libc/glibc/glibc-2.22/rt/aio_misc.c b/ap/libc/glibc/glibc-2.22/rt/aio_misc.c
new file mode 100644
index 0000000..889a705
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/aio_misc.c
@@ -0,0 +1,28 @@
+/* Handle general operations.  Stub version.
+   Copyright (C) 2001-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 <aio.h>
+#include <aio_misc.h>
+
+/* This file is for internal code needed by the aio_* implementation.  */
+
+void
+__aio_init (const struct aioinit *init)
+{
+}
+weak_alias (__aio_init, aio_init)
diff --git a/ap/libc/glibc/glibc-2.22/rt/aio_notify.c b/ap/libc/glibc/glibc-2.22/rt/aio_notify.c
new file mode 100644
index 0000000..44e123a
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/aio_notify.c
@@ -0,0 +1,23 @@
+/* Notify initiator of AIO request.  Stub version.
+   Copyright (C) 2001-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 <aio.h>
+#include <aio_misc.h>
+
+/* This file contains only internal functions used by
+   the particular aio_* implementation code.  */
diff --git a/ap/libc/glibc/glibc-2.22/rt/aio_read.c b/ap/libc/glibc/glibc-2.22/rt/aio_read.c
new file mode 100644
index 0000000..e595073
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/aio_read.c
@@ -0,0 +1,34 @@
+/* Asynchronous read.  Stub version.
+   Copyright (C) 2001-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 <aio.h>
+#include <errno.h>
+
+#ifdef BE_AIO64
+#define aiocb		aiocb64
+#define aio_read	aio_read64
+#endif
+
+int
+aio_read (struct aiocb *aiocbp)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (aio_read)
diff --git a/ap/libc/glibc/glibc-2.22/rt/aio_read64.c b/ap/libc/glibc/glibc-2.22/rt/aio_read64.c
new file mode 100644
index 0000000..e9994ae
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/aio_read64.c
@@ -0,0 +1,2 @@
+#define BE_AIO64
+#include <aio_read.c>
diff --git a/ap/libc/glibc/glibc-2.22/rt/aio_return.c b/ap/libc/glibc/glibc-2.22/rt/aio_return.c
new file mode 100644
index 0000000..61fee9f
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/aio_return.c
@@ -0,0 +1,39 @@
+/* Return exit value of asynchronous I/O request.
+   Copyright (C) 1997-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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/>.  */
+
+
+/* We use an UGLY hack to prevent gcc from finding us cheating.  The
+   implementation of aio_return and aio_return64 are identical and so
+   we want to avoid code duplication by using aliases.  But gcc sees
+   the different parameter lists and prints a warning.  We define here
+   a function so that aio_return64 has no prototype.  */
+#define aio_return64 XXX
+#include <aio.h>
+/* And undo the hack.  */
+#undef aio_return64
+
+
+ssize_t
+aio_return (aiocbp)
+     struct aiocb *aiocbp;
+{
+  return aiocbp->__return_value;
+}
+
+weak_alias (aio_return, aio_return64)
diff --git a/ap/libc/glibc/glibc-2.22/rt/aio_sigqueue.c b/ap/libc/glibc/glibc-2.22/rt/aio_sigqueue.c
new file mode 100644
index 0000000..5481be0
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/aio_sigqueue.c
@@ -0,0 +1,34 @@
+/* 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 <aio.h>
+#include <errno.h>
+#include <signal.h>
+
+#include <aio_misc.h>
+
+int
+__aio_sigqueue (sig, val, caller_pid)
+     int sig;
+     const union sigval val;
+     pid_t caller_pid;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (__aio_sigqueue)
diff --git a/ap/libc/glibc/glibc-2.22/rt/aio_suspend.c b/ap/libc/glibc/glibc-2.22/rt/aio_suspend.c
new file mode 100644
index 0000000..0a1e33c
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/aio_suspend.c
@@ -0,0 +1,44 @@
+/* Suspend until termination of a requests.  Stub version.
+   Copyright (C) 2001-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/>.  */
+
+
+/* We use an UGLY hack to prevent gcc from finding us cheating.  The
+   implementations of aio_suspend and aio_suspend64 are identical and so
+   we want to avoid code duplication by using aliases.  But gcc sees
+   the different parameter lists and prints a warning.  We define here
+   a function so that aio_suspend64 has no prototype.  */
+#define aio_suspend64 XXX
+#include <aio.h>
+/* And undo the hack.  */
+#undef aio_suspend64
+
+#include <errno.h>
+#include <sys/time.h>
+
+
+int
+aio_suspend (const struct aiocb *const list[], int nent,
+	     const struct timespec *timeout)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (aio_suspend, aio_suspend64)
+
+stub_warning (aio_suspend)
+stub_warning (aio_suspend64)
diff --git a/ap/libc/glibc/glibc-2.22/rt/aio_write.c b/ap/libc/glibc/glibc-2.22/rt/aio_write.c
new file mode 100644
index 0000000..5909571
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/aio_write.c
@@ -0,0 +1,34 @@
+/* Asynchronous write.  Stub version.
+   Copyright (C) 2001-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 <aio.h>
+#include <errno.h>
+
+#ifdef BE_AIO64
+#define aiocb		aiocb64
+#define aio_write	aio_write64
+#endif
+
+int
+aio_write (struct aiocb *aiocbp)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (aio_write)
diff --git a/ap/libc/glibc/glibc-2.22/rt/aio_write64.c b/ap/libc/glibc/glibc-2.22/rt/aio_write64.c
new file mode 100644
index 0000000..88d5c00
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/aio_write64.c
@@ -0,0 +1,2 @@
+#define BE_AIO64
+#include <aio_write.c>
diff --git a/ap/libc/glibc/glibc-2.22/rt/bits/mqueue2.h b/ap/libc/glibc/glibc-2.22/rt/bits/mqueue2.h
new file mode 100644
index 0000000..cdb6149
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/bits/mqueue2.h
@@ -0,0 +1,57 @@
+/* Checking macros for mq functions.
+   Copyright (C) 2007-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/>.  */
+
+#ifndef	_FCNTL_H
+# error "Never include <bits/mqueue2.h> directly; use <mqueue.h> instead."
+#endif
+
+/* Check that calls to mq_open with O_CREAT set have an appropriate third and fourth
+   parameter.  */
+extern mqd_t mq_open (const char *__name, int __oflag, ...)
+     __THROW __nonnull ((1));
+extern mqd_t __mq_open_2 (const char *__name, int __oflag)
+     __THROW __nonnull ((1));
+extern mqd_t __REDIRECT_NTH (__mq_open_alias, (const char *__name,
+					       int __oflag, ...), mq_open)
+     __nonnull ((1));
+__errordecl (__mq_open_wrong_number_of_args,
+	     "mq_open can be called either with 2 or 4 arguments");
+__errordecl (__mq_open_missing_mode_and_attr,
+	     "mq_open with O_CREAT in second argument needs 4 arguments");
+
+__fortify_function mqd_t
+__NTH (mq_open (const char *__name, int __oflag, ...))
+{
+  if (__va_arg_pack_len () != 0 && __va_arg_pack_len () != 2)
+    __mq_open_wrong_number_of_args ();
+
+  if (__builtin_constant_p (__oflag))
+    {
+      if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () == 0)
+	{
+	  __mq_open_missing_mode_and_attr ();
+	  return __mq_open_2 (__name, __oflag);
+	}
+      return __mq_open_alias (__name, __oflag, __va_arg_pack ());
+    }
+
+  if (__va_arg_pack_len () == 0)
+    return __mq_open_2 (__name, __oflag);
+
+  return __mq_open_alias (__name, __oflag, __va_arg_pack ());
+}
diff --git a/ap/libc/glibc/glibc-2.22/rt/clock-compat.c b/ap/libc/glibc/glibc-2.22/rt/clock-compat.c
new file mode 100644
index 0000000..d0e7245
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/clock-compat.c
@@ -0,0 +1,65 @@
+/* ABI compatibility redirects for clock_* symbols in librt.
+   Copyright (C) 2012-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 <shlib-compat.h>
+
+/* The clock_* symbols were originally defined in librt and so
+   are part of its ABI.  As of 2.17, they have moved to libc.
+   So we supply definitions for librt that just redirect to
+   their libc counterparts.  */
+
+#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17)
+
+#include <time.h>
+
+#if HAVE_IFUNC
+# define COMPAT_REDIRECT(name, proto, arglist)				      \
+  __typeof (name) *name##_ifunc (void) asm (#name);			      \
+  __typeof (name) *name##_ifunc (void)					      \
+  {									      \
+    return &__##name;							      \
+  }									      \
+  asm (".type " #name ", %gnu_indirect_function");
+#else
+# define COMPAT_REDIRECT(name, proto, arglist)				      \
+  int									      \
+  name proto								      \
+  {									      \
+    return __##name arglist;						      \
+  }
+#endif
+
+COMPAT_REDIRECT (clock_getres,
+                 (clockid_t clock_id, struct timespec *res),
+                 (clock_id, res))
+COMPAT_REDIRECT (clock_gettime,
+                 (clockid_t clock_id, struct timespec *tp),
+                 (clock_id, tp))
+COMPAT_REDIRECT (clock_settime,
+                 (clockid_t clock_id, const struct timespec *tp),
+                 (clock_id, tp))
+COMPAT_REDIRECT (clock_getcpuclockid,
+                 (pid_t pid, clockid_t *clock_id),
+                 (pid, clock_id))
+COMPAT_REDIRECT (clock_nanosleep,
+                 (clockid_t clock_id, int flags,
+                  const struct timespec *req,
+                  struct timespec *rem),
+                 (clock_id, flags, req, rem))
+
+#endif
diff --git a/ap/libc/glibc/glibc-2.22/rt/clock_getcpuclockid.c b/ap/libc/glibc/glibc-2.22/rt/clock_getcpuclockid.c
new file mode 100644
index 0000000..e9d86b5
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/clock_getcpuclockid.c
@@ -0,0 +1,40 @@
+/* Get a clockid_t for the process CPU clock of a given process.  Generic.
+   Copyright (C) 2000-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 <time.h>
+#include <unistd.h>
+
+int
+__clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
+{
+  /* We don't allow any process ID but our own.  */
+  if (pid != 0 && pid != getpid ())
+    return EPERM;
+
+#ifdef CLOCK_PROCESS_CPUTIME_ID
+  /* Store the number.  */
+  *clock_id = CLOCK_PROCESS_CPUTIME_ID;
+
+  return 0;
+#else
+  /* We don't have a timer for that.  */
+  return ENOENT;
+#endif
+}
+weak_alias (__clock_getcpuclockid, clock_getcpuclockid)
diff --git a/ap/libc/glibc/glibc-2.22/rt/clock_getres.c b/ap/libc/glibc/glibc-2.22/rt/clock_getres.c
new file mode 100644
index 0000000..c758093
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/clock_getres.c
@@ -0,0 +1,30 @@
+/* Get the resolution of a clock.  Stub version.
+   Copyright (C) 1999-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 <time.h>
+
+/* Get resolution of clock.  */
+int
+__clock_getres (clockid_t clock_id, struct timespec *res)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__clock_getres, clock_getres)
+stub_warning (clock_getres)
diff --git a/ap/libc/glibc/glibc-2.22/rt/clock_gettime.c b/ap/libc/glibc/glibc-2.22/rt/clock_gettime.c
new file mode 100644
index 0000000..2197e79
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/clock_gettime.c
@@ -0,0 +1,31 @@
+/* Get the current value of a clock.  Stub version.
+   Copyright (C) 1999-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 <time.h>
+
+/* Get current value of CLOCK and store it in TP.  */
+int
+__clock_gettime (clockid_t clock_id, struct timespec *tp)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__clock_gettime, clock_gettime)
+libc_hidden_def (__clock_gettime)
+stub_warning (clock_gettime)
diff --git a/ap/libc/glibc/glibc-2.22/rt/clock_nanosleep.c b/ap/libc/glibc/glibc-2.22/rt/clock_nanosleep.c
new file mode 100644
index 0000000..1262dc8
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/clock_nanosleep.c
@@ -0,0 +1,37 @@
+/* High-resolution sleep with the specified clock.  Stub version.
+   Copyright (C) 2000-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 <time.h>
+
+int
+__clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
+		   struct timespec *rem)
+{
+  if (__builtin_expect (req->tv_nsec, 0) < 0
+      || __builtin_expect (req->tv_nsec, 0) >= 1000000000)
+    return EINVAL;
+
+  if (flags != TIMER_ABSTIME && flags != 0)
+    return EINVAL;
+
+  /* Not implemented.  */
+  return ENOSYS;
+}
+weak_alias (__clock_nanosleep, clock_nanosleep)
+stub_warning (clock_nanosleep)
diff --git a/ap/libc/glibc/glibc-2.22/rt/clock_settime.c b/ap/libc/glibc/glibc-2.22/rt/clock_settime.c
new file mode 100644
index 0000000..0864266
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/clock_settime.c
@@ -0,0 +1,30 @@
+/* Set a clock to a given value.  Stub version.
+   Copyright (C) 1999-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 <time.h>
+
+/* Set CLOCK to value TP.  */
+int
+__clock_settime (clockid_t clock_id, const struct timespec *tp)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__clock_settime, clock_settime)
+stub_warning (clock_settime)
diff --git a/ap/libc/glibc/glibc-2.22/rt/get_clockfreq.c b/ap/libc/glibc/glibc-2.22/rt/get_clockfreq.c
new file mode 100644
index 0000000..92c2d24
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/get_clockfreq.c
@@ -0,0 +1,27 @@
+/* Get frequency of the system processor.
+   Copyright (C) 2000-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 <libc-internal.h>
+
+hp_timing_t
+__get_clockfreq (void)
+{
+  /* There is no generic way to find this out since we have in general
+     no counter register either.  */
+  return 0;
+}
diff --git a/ap/libc/glibc/glibc-2.22/rt/lio_listio.c b/ap/libc/glibc/glibc-2.22/rt/lio_listio.c
new file mode 100644
index 0000000..226844d
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/lio_listio.c
@@ -0,0 +1,40 @@
+/* Enqueue a list of read or write requests.  Stub version.
+   Copyright (C) 2001-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 <aio.h>
+#include <errno.h>
+
+#ifdef BE_AIO64
+#define lio_listio	lio_listio64
+#define aiocb		aiocb64
+#define aio_read	aio_read64
+#define aio_write	aio_write64
+#define aio_suspend	aio_suspend64
+#endif
+
+
+int
+lio_listio (int mode,
+	    struct aiocb *const list[], int nent,
+	    struct sigevent *sig)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (lio_listio)
diff --git a/ap/libc/glibc/glibc-2.22/rt/lio_listio64.c b/ap/libc/glibc/glibc-2.22/rt/lio_listio64.c
new file mode 100644
index 0000000..35a571c
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/lio_listio64.c
@@ -0,0 +1,2 @@
+#define BE_AIO64
+#include <lio_listio.c>
diff --git a/ap/libc/glibc/glibc-2.22/rt/mq_close.c b/ap/libc/glibc/glibc-2.22/rt/mq_close.c
new file mode 100644
index 0000000..0d9ffff
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/mq_close.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2004-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 <mqueue.h>
+
+/* Removes the association between message queue descriptor MQDES and its
+   message queue.  */
+int
+mq_close (mqd_t mqdes)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (mq_close)
diff --git a/ap/libc/glibc/glibc-2.22/rt/mq_getattr.c b/ap/libc/glibc/glibc-2.22/rt/mq_getattr.c
new file mode 100644
index 0000000..b0c5e21
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/mq_getattr.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2004-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 <mqueue.h>
+
+/* Query status and attributes of message queue MQDES.  */
+int
+mq_getattr (mqd_t mqdes, struct mq_attr *mqstat)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (mq_getattr)
diff --git a/ap/libc/glibc/glibc-2.22/rt/mq_notify.c b/ap/libc/glibc/glibc-2.22/rt/mq_notify.c
new file mode 100644
index 0000000..410b5ff
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/mq_notify.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2004-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 <mqueue.h>
+
+/* Register notification upon message arrival to an empty message queue
+   MQDES.  */
+int
+mq_notify (mqd_t mqdes, const struct sigevent *notification)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (mq_notify)
diff --git a/ap/libc/glibc/glibc-2.22/rt/mq_open.c b/ap/libc/glibc/glibc-2.22/rt/mq_open.c
new file mode 100644
index 0000000..f895612
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/mq_open.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2004-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 <mqueue.h>
+#include <stdio.h>
+
+/* Establish connection between a process and a message queue NAME and
+   return message queue descriptor or (mqd_t) -1 on error.  OFLAG determines
+   the type of access used.  If O_CREAT is on OFLAG, the third argument is
+   taken as a `mode_t', the mode of the created message queue, and the fourth
+   argument is taken as `struct mq_attr *', pointer to message queue
+   attributes.  If the fourth argument is NULL, default attributes are
+   used.  */
+mqd_t
+__mq_open (const char *name, int oflag, ...)
+{
+  __set_errno (ENOSYS);
+  return (mqd_t) -1;
+}
+strong_alias (__mq_open, mq_open);
+stub_warning (mq_open)
+
+mqd_t
+__mq_open_2 (const char *name, int oflag)
+{
+  if (oflag & O_CREAT)
+    __fortify_fail ("invalid mq_open call: O_CREAT without mode and attr");
+
+  return __mq_open (name, oflag);
+}
+stub_warning (__mq_open_2)
diff --git a/ap/libc/glibc/glibc-2.22/rt/mq_receive.c b/ap/libc/glibc/glibc-2.22/rt/mq_receive.c
new file mode 100644
index 0000000..5542bb9
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/mq_receive.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2004-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 <mqueue.h>
+
+/* Receive the oldest from highest priority messages in message queue
+   MQDES.  */
+ssize_t
+mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len,
+	    unsigned int *msg_prio)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (mq_receive)
diff --git a/ap/libc/glibc/glibc-2.22/rt/mq_send.c b/ap/libc/glibc/glibc-2.22/rt/mq_send.c
new file mode 100644
index 0000000..28294f7
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/mq_send.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2004-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 <mqueue.h>
+
+/* Add message pointed by MSG_PTR to message queue MQDES.  */
+int
+mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
+	 unsigned int msg_prio)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (mq_send)
diff --git a/ap/libc/glibc/glibc-2.22/rt/mq_setattr.c b/ap/libc/glibc/glibc-2.22/rt/mq_setattr.c
new file mode 100644
index 0000000..1fba9b2
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/mq_setattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2004-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 <mqueue.h>
+
+/* Set attributes associated with message queue MQDES and if OMQSTAT is
+   not NULL also query its old attributes.  */
+int
+mq_setattr (mqd_t mqdes, const struct mq_attr *__restrict mqstat,
+	    struct mq_attr *__restrict omqstat)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+hidden_def (mq_setattr)
+stub_warning (mq_setattr)
diff --git a/ap/libc/glibc/glibc-2.22/rt/mq_timedreceive.c b/ap/libc/glibc/glibc-2.22/rt/mq_timedreceive.c
new file mode 100644
index 0000000..c476c68
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/mq_timedreceive.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2004-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 <mqueue.h>
+
+/* Receive the oldest from highest priority messages in message queue
+   MQDES, stop waiting if ABS_TIMEOUT expires.  */
+ssize_t
+__mq_timedreceive (mqd_t mqdes, char *__restrict msg_ptr, size_t msg_len,
+		 unsigned int *__restrict msg_prio,
+		 const struct timespec *__restrict abs_timeout)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+hidden_def (__mq_timedreceive)
+weak_alias (__mq_timedreceive, mq_timedreceive)
+hidden_weak (mq_timedreceive)
+stub_warning (mq_timedreceive)
diff --git a/ap/libc/glibc/glibc-2.22/rt/mq_timedsend.c b/ap/libc/glibc/glibc-2.22/rt/mq_timedsend.c
new file mode 100644
index 0000000..30caaf1
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/mq_timedsend.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2004-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 <mqueue.h>
+
+/* Add message pointed by MSG_PTR to message queue MQDES, stop blocking
+   on full message queue if ABS_TIMEOUT expires.  */
+int
+__mq_timedsend (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
+	      unsigned int msg_prio, const struct timespec *abs_timeout)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+hidden_def (__mq_timedsend)
+weak_alias (__mq_timedsend, mq_timedsend)
+hidden_weak (mq_timedsend)
+stub_warning (mq_timedsend)
diff --git a/ap/libc/glibc/glibc-2.22/rt/mq_unlink.c b/ap/libc/glibc/glibc-2.22/rt/mq_unlink.c
new file mode 100644
index 0000000..f31daff
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/mq_unlink.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2004-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 <mqueue.h>
+
+/* Remove message queue named NAME.  */
+int
+mq_unlink (const char *name)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (mq_unlink)
diff --git a/ap/libc/glibc/glibc-2.22/rt/mqueue.h b/ap/libc/glibc/glibc-2.22/rt/mqueue.h
new file mode 100644
index 0000000..9767447
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/mqueue.h
@@ -0,0 +1,100 @@
+/* Copyright (C) 2004-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/>.  */
+
+#ifndef _MQUEUE_H
+#define _MQUEUE_H	1
+
+#include <features.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#define __need_sigevent_t
+#include <bits/siginfo.h>
+#define __need_timespec
+#include <time.h>
+/* Get the definition of mqd_t and struct mq_attr.  */
+#include <bits/mqueue.h>
+
+__BEGIN_DECLS
+
+/* Establish connection between a process and a message queue NAME and
+   return message queue descriptor or (mqd_t) -1 on error.  OFLAG determines
+   the type of access used.  If O_CREAT is on OFLAG, the third argument is
+   taken as a `mode_t', the mode of the created message queue, and the fourth
+   argument is taken as `struct mq_attr *', pointer to message queue
+   attributes.  If the fourth argument is NULL, default attributes are
+   used.  */
+extern mqd_t mq_open (const char *__name, int __oflag, ...)
+  __THROW __nonnull ((1));
+
+/* Removes the association between message queue descriptor MQDES and its
+   message queue.  */
+extern int mq_close (mqd_t __mqdes) __THROW;
+
+/* Query status and attributes of message queue MQDES.  */
+extern int mq_getattr (mqd_t __mqdes, struct mq_attr *__mqstat)
+  __THROW __nonnull ((2));
+
+/* Set attributes associated with message queue MQDES and if OMQSTAT is
+   not NULL also query its old attributes.  */
+extern int mq_setattr (mqd_t __mqdes,
+		       const struct mq_attr *__restrict __mqstat,
+		       struct mq_attr *__restrict __omqstat)
+  __THROW __nonnull ((2));
+
+/* Remove message queue named NAME.  */
+extern int mq_unlink (const char *__name) __THROW __nonnull ((1));
+
+/* Register notification issued upon message arrival to an empty
+   message queue MQDES.  */
+extern int mq_notify (mqd_t __mqdes, const struct sigevent *__notification)
+     __THROW;
+
+/* Receive the oldest from highest priority messages in message queue
+   MQDES.  */
+extern ssize_t mq_receive (mqd_t __mqdes, char *__msg_ptr, size_t __msg_len,
+			   unsigned int *__msg_prio) __nonnull ((2));
+
+/* Add message pointed by MSG_PTR to message queue MQDES.  */
+extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len,
+		    unsigned int __msg_prio) __nonnull ((2));
+
+#ifdef __USE_XOPEN2K
+/* Receive the oldest from highest priority messages in message queue
+   MQDES, stop waiting if ABS_TIMEOUT expires.  */
+extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr,
+				size_t __msg_len,
+				unsigned int *__restrict __msg_prio,
+				const struct timespec *__restrict __abs_timeout)
+  __nonnull ((2, 5));
+
+/* Add message pointed by MSG_PTR to message queue MQDES, stop blocking
+   on full message queue if ABS_TIMEOUT expires.  */
+extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr,
+			 size_t __msg_len, unsigned int __msg_prio,
+			 const struct timespec *__abs_timeout)
+  __nonnull ((2, 5));
+#endif
+
+/* Define some inlines helping to catch common problems.  */
+#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
+    && defined __va_arg_pack_len
+# include <bits/mqueue2.h>
+#endif
+
+__END_DECLS
+
+#endif /* mqueue.h */
diff --git a/ap/libc/glibc/glibc-2.22/rt/shm_open.c b/ap/libc/glibc/glibc-2.22/rt/shm_open.c
new file mode 100644
index 0000000..4a9a3fe
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/shm_open.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2000-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 <sys/mman.h>
+
+/* Open shared memory object.  */
+int
+shm_open (const char *name, int oflag, mode_t mode)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (shm_open)
diff --git a/ap/libc/glibc/glibc-2.22/rt/shm_unlink.c b/ap/libc/glibc/glibc-2.22/rt/shm_unlink.c
new file mode 100644
index 0000000..41610f8
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/shm_unlink.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2000-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 <sys/mman.h>
+
+/* Remove shared memory object.  */
+int
+shm_unlink (const char *name)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (shm_unlink)
diff --git a/ap/libc/glibc/glibc-2.22/rt/timer_create.c b/ap/libc/glibc/glibc-2.22/rt/timer_create.c
new file mode 100644
index 0000000..f841eec
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/timer_create.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1999-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 <time.h>
+
+/* Create new per-process timer using CLOCK.  */
+int
+timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (timer_create)
diff --git a/ap/libc/glibc/glibc-2.22/rt/timer_delete.c b/ap/libc/glibc/glibc-2.22/rt/timer_delete.c
new file mode 100644
index 0000000..fdfffc1
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/timer_delete.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1999-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 <time.h>
+
+/* Delete timer TIMERID.  */
+int
+timer_delete (timer_t timerid)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (timer_delete)
diff --git a/ap/libc/glibc/glibc-2.22/rt/timer_getoverr.c b/ap/libc/glibc/glibc-2.22/rt/timer_getoverr.c
new file mode 100644
index 0000000..f805ee4
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/timer_getoverr.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1999-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 <time.h>
+
+/* Get expiration overrun for timer TIMERID.  */
+int
+timer_getoverrun (timer_t timerid)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (timer_getoverrun)
diff --git a/ap/libc/glibc/glibc-2.22/rt/timer_gettime.c b/ap/libc/glibc/glibc-2.22/rt/timer_gettime.c
new file mode 100644
index 0000000..00ed51e
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/timer_gettime.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1999-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 <time.h>
+
+/* Get current value of timer TIMERID and store it in VLAUE.  */
+int
+timer_gettime (timer_t timerid, struct itimerspec *value)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (timer_gettime)
diff --git a/ap/libc/glibc/glibc-2.22/rt/timer_settime.c b/ap/libc/glibc/glibc-2.22/rt/timer_settime.c
new file mode 100644
index 0000000..9c20fc1
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/timer_settime.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1999-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 <time.h>
+
+/* Set timer TIMERID to VALUE, returning old value in OVLAUE.  */
+int
+timer_settime (timer_t timerid, int flags, const struct itimerspec *value,
+	       struct itimerspec *ovalue)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (timer_settime)
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-aio.c b/ap/libc/glibc/glibc-2.22/rt/tst-aio.c
new file mode 100644
index 0000000..783907e
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-aio.c
@@ -0,0 +1,289 @@
+/* Tests for AIO in librt.
+   Copyright (C) 1998-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+   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 <aio.h>
+#include <errno.h>
+#include <error.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+
+/* Prototype for our test function.  */
+extern void do_prepare (int argc, char *argv[]);
+extern int do_test (int argc, char *argv[]);
+
+/* We have a preparation function.  */
+#define PREPARE do_prepare
+
+/* We might need a bit longer timeout.  */
+#define TIMEOUT 20 /* sec */
+
+/* This defines the `main' function and some more.  */
+#include <test-skeleton.c>
+
+
+/* These are for the temporary file we generate.  */
+char *name;
+int fd;
+
+void
+do_prepare (int argc, char *argv[])
+{
+  size_t name_len;
+
+  name_len = strlen (test_dir);
+  name = malloc (name_len + sizeof ("/aioXXXXXX"));
+  mempcpy (mempcpy (name, test_dir, name_len),
+	   "/aioXXXXXX", sizeof ("/aioXXXXXX"));
+  add_temp_file (name);
+
+  /* Open our test file.   */
+  fd = mkstemp (name);
+  if (fd == -1)
+    error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
+}
+
+
+static int
+test_file (const void *buf, size_t size, int fd, const char *msg)
+{
+  struct stat st;
+  char tmp[size];
+
+  errno = 0;
+  if (fstat (fd, &st) < 0)
+    {
+      error (0, errno, "%s: failed stat", msg);
+      return 1;
+    }
+
+  if (st.st_size != (off_t) size)
+    {
+      error (0, errno, "%s: wrong size: %lu, should be %lu",
+	     msg, (unsigned long int) st.st_size, (unsigned long int) size);
+      return 1;
+    }
+
+  if (pread (fd, tmp, size, 0) != (ssize_t) size)
+    {
+      error (0, errno, "%s: failed pread", msg);
+      return 1;
+    }
+
+  if (memcmp (buf, tmp, size) != 0)
+    {
+      error (0, errno, "%s: failed comparison", msg);
+      return 1;
+    }
+
+  printf ("%s test ok\n", msg);
+
+  return 0;
+}
+
+
+static int
+do_wait (struct aiocb **cbp, size_t nent, int allowed_err)
+{
+  int go_on;
+  size_t cnt;
+  int result = 0;
+
+  do
+    {
+      aio_suspend ((const struct aiocb *const *) cbp, nent, NULL);
+      go_on = 0;
+      for (cnt = 0; cnt < nent; ++cnt)
+	if (cbp[cnt] != NULL)
+	  {
+	    if (aio_error (cbp[cnt]) == EINPROGRESS)
+	      go_on = 1;
+	    else
+	      {
+		if (aio_return (cbp[cnt]) == -1
+		    && (allowed_err == 0
+			|| aio_error (cbp[cnt]) != allowed_err))
+		  {
+		    error (0, aio_error (cbp[cnt]), "Operation failed\n");
+		    result = 1;
+		  }
+		cbp[cnt] = NULL;
+	      }
+	  }
+    }
+  while (go_on);
+
+  return result;
+}
+
+
+int
+do_test (int argc, char *argv[])
+{
+  struct aiocb cbs[10];
+  struct aiocb cbs_fsync;
+  struct aiocb *cbp[10];
+  struct aiocb *cbp_fsync[1];
+  char buf[1000];
+  size_t cnt;
+  int result = 0;
+
+  /* Preparation.  */
+  for (cnt = 0; cnt < 10; ++cnt)
+    {
+      cbs[cnt].aio_fildes = fd;
+      cbs[cnt].aio_reqprio = 0;
+      cbs[cnt].aio_buf = memset (&buf[cnt * 100], '0' + cnt, 100);
+      cbs[cnt].aio_nbytes = 100;
+      cbs[cnt].aio_offset = cnt * 100;
+      cbs[cnt].aio_sigevent.sigev_notify = SIGEV_NONE;
+
+      cbp[cnt] = &cbs[cnt];
+    }
+
+  /* First a simple test.  */
+  for (cnt = 10; cnt > 0; )
+    if (aio_write (cbp[--cnt]) < 0 && errno == ENOSYS)
+      {
+	error (0, 0, "no aio support in this configuration");
+	return 0;
+      }
+  /* Wait 'til the results are there.  */
+  result |= do_wait (cbp, 10, 0);
+  /* Test this.  */
+  result |= test_file (buf, sizeof (buf), fd, "aio_write");
+
+  /* Read now as we've written it.  */
+  memset (buf, '\0', sizeof (buf));
+  /* Issue the commands.  */
+  for (cnt = 10; cnt > 0; )
+    {
+      --cnt;
+      cbp[cnt] = &cbs[cnt];
+      aio_read (cbp[cnt]);
+    }
+  /* Wait 'til the results are there.  */
+  result |= do_wait (cbp, 10, 0);
+  /* Test this.  */
+  for (cnt = 0; cnt < 1000; ++cnt)
+    if (buf[cnt] != '0' + (cnt / 100))
+      {
+	result = 1;
+	error (0, 0, "comparison failed for aio_read test");
+	break;
+      }
+
+  if (cnt == 1000)
+    puts ("aio_read test ok");
+
+  /* Remove the test file contents.  */
+  if (ftruncate (fd, 0) < 0)
+    {
+      error (0, errno, "ftruncate failed\n");
+      result = 1;
+    }
+
+  /* Test lio_listio.  */
+  for (cnt = 0; cnt < 10; ++cnt)
+    {
+      cbs[cnt].aio_lio_opcode = LIO_WRITE;
+      cbp[cnt] = &cbs[cnt];
+    }
+  /* Issue the command.  */
+  lio_listio (LIO_WAIT, cbp, 10, NULL);
+  /* ...and immediately test it since we started it in wait mode.  */
+  result |= test_file (buf, sizeof (buf), fd, "lio_listio (write)");
+
+  /* Test aio_fsync.  */
+  cbs_fsync.aio_fildes = fd;
+  cbs_fsync.aio_sigevent.sigev_notify = SIGEV_NONE;
+  cbp_fsync[0] = &cbs_fsync;
+
+  /* Remove the test file contents first.  */
+  if (ftruncate (fd, 0) < 0)
+    {
+      error (0, errno, "ftruncate failed\n");
+      result = 1;
+    }
+
+  /* Write again.  */
+  for (cnt = 10; cnt > 0; )
+    aio_write (cbp[--cnt]);
+
+  if (aio_fsync (O_SYNC, &cbs_fsync) < 0)
+    {
+      error (0, errno, "aio_fsync failed\n");
+      result = 1;
+    }
+  result |= do_wait (cbp_fsync, 1, 0);
+
+  /* ...and test since all data should be on disk now.  */
+  result |= test_file (buf, sizeof (buf), fd, "aio_fsync (aio_write)");
+
+  /* Test aio_cancel.  */
+  /* Remove the test file contents first.  */
+  if (ftruncate (fd, 0) < 0)
+    {
+      error (0, errno, "ftruncate failed\n");
+      result = 1;
+    }
+
+  /* Write again.  */
+  for (cnt = 10; cnt > 0; )
+    aio_write (cbp[--cnt]);
+
+  /* Cancel all requests.  */
+  if (aio_cancel (fd, NULL) == -1)
+    printf ("aio_cancel (fd, NULL) cannot cancel anything\n");
+
+  result |= do_wait (cbp, 10, ECANCELED);
+
+  /* Another test for aio_cancel.  */
+  /* Remove the test file contents first.  */
+  if (ftruncate (fd, 0) < 0)
+    {
+      error (0, errno, "ftruncate failed\n");
+      result = 1;
+    }
+
+  /* Write again.  */
+  for (cnt = 10; cnt > 0; )
+    {
+      --cnt;
+      cbp[cnt] = &cbs[cnt];
+      aio_write (cbp[cnt]);
+    }
+  puts ("finished3");
+
+  /* Cancel all requests.  */
+  for (cnt = 10; cnt > 0; )
+    if (aio_cancel (fd, cbp[--cnt]) == -1)
+      /* This is not an error.  The request can simply be finished.  */
+      printf ("aio_cancel (fd, cbp[%Zd]) cannot be canceled\n", cnt);
+  puts ("finished2");
+
+  result |= do_wait (cbp, 10, ECANCELED);
+
+  puts ("finished");
+
+  return result;
+}
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-aio10.c b/ap/libc/glibc/glibc-2.22/rt/tst-aio10.c
new file mode 100644
index 0000000..6e8f7b7
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-aio10.c
@@ -0,0 +1,119 @@
+#include <aio.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <unistd.h>
+
+static pthread_barrier_t b;
+static pthread_t main_thread;
+static int flag;
+
+
+static void *
+tf (void *arg)
+{
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: barrier_wait failed");
+      exit (1);
+    }
+
+  /* There is unfortunately no other way to try to make sure the other
+     thread reached the aio_suspend call.  This test could fail on
+     highly loaded machines.  */
+  sleep (2);
+
+  pthread_kill (main_thread, SIGUSR1);
+
+  while (1)
+    sleep (1000);
+
+  return NULL;
+}
+
+
+static void
+sh (int sig)
+{
+  flag = 1;
+}
+
+
+static int
+do_test (void)
+{
+  main_thread = pthread_self ();
+
+  struct sigaction sa;
+
+  sa.sa_handler = sh;
+  sa.sa_flags = 0;
+  sigemptyset (&sa.sa_mask);
+
+  if (sigaction (SIGUSR1, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init");
+      return 1;
+    }
+
+  int fds[2];
+  if (pipe (fds) != 0)
+    {
+      puts ("pipe failed");
+      return 1;
+    }
+
+  char buf[42];
+  struct aiocb req;
+  req.aio_fildes = fds[0];
+  req.aio_lio_opcode = LIO_READ;
+  req.aio_reqprio = 0;
+  req.aio_offset = 0;
+  req.aio_buf = buf;
+  req.aio_nbytes = sizeof (buf);
+  req.aio_sigevent.sigev_notify = SIGEV_NONE;
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("parent: barrier_wait failed");
+      exit (1);
+    }
+
+  struct aiocb *list[1];
+  list[0] = &req;
+
+  e = lio_listio (LIO_WAIT, list, 1, NULL);
+  if (e != -1)
+    {
+      puts ("lio_listio succeeded");
+      return 1;
+    }
+  if (errno != EINTR)
+    {
+      printf ("lio_listio did not return EINTR: %d (%d = %m)\n", e, errno);
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 5
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-aio2.c b/ap/libc/glibc/glibc-2.22/rt/tst-aio2.c
new file mode 100644
index 0000000..4b1de0a
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-aio2.c
@@ -0,0 +1,106 @@
+/* Test for notification mechanism in lio_listio.
+   Copyright (C) 2000-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
+
+   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 <aio.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
+
+
+static pthread_barrier_t b;
+
+
+static void
+thrfct (sigval_t arg)
+{
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("thread: barrier_wait failed");
+      exit (1);
+    }
+}
+
+
+static int
+do_test (int argc, char *argv[])
+{
+  char name[] = "/tmp/aio2.XXXXXX";
+  int fd;
+  struct aiocb *arr[1];
+  struct aiocb cb;
+  static const char buf[] = "Hello World\n";
+
+  fd = mkstemp (name);
+  if (fd == -1)
+    {
+      printf ("cannot open temp name: %m\n");
+      return 1;
+    }
+
+  unlink (name);
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  arr[0] = &cb;
+
+  cb.aio_fildes = fd;
+  cb.aio_lio_opcode = LIO_WRITE;
+  cb.aio_reqprio = 0;
+  cb.aio_buf = (void *) buf;
+  cb.aio_nbytes = sizeof (buf) - 1;
+  cb.aio_offset = 0;
+  cb.aio_sigevent.sigev_notify = SIGEV_THREAD;
+  cb.aio_sigevent.sigev_notify_function = thrfct;
+  cb.aio_sigevent.sigev_notify_attributes = NULL;
+  cb.aio_sigevent.sigev_value.sival_ptr = NULL;
+
+  if (lio_listio (LIO_WAIT, arr, 1, NULL) < 0)
+    {
+      if (errno == ENOSYS)
+	{
+	  puts ("no aio support in this configuration");
+	  return 0;
+	}
+      printf ("lio_listio failed: %m\n");
+      return 1;
+    }
+
+  puts ("lio_listio returned");
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("barrier_wait failed");
+      return 1;
+    }
+
+  puts ("all OK");
+
+  return 0;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-aio3.c b/ap/libc/glibc/glibc-2.22/rt/tst-aio3.c
new file mode 100644
index 0000000..545b591
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-aio3.c
@@ -0,0 +1,108 @@
+/* Test for notification mechanism in lio_listio.
+   Copyright (C) 2000-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 <aio.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
+
+static pthread_barrier_t b;
+
+
+static void
+thrfct (sigval_t arg)
+{
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: barrier_wait failed");
+      exit (1);
+    }
+}
+
+
+static int
+do_test (int argc, char *argv[])
+{
+  char name[] = "/tmp/aio3.XXXXXX";
+  int fd;
+  struct aiocb *arr[1];
+  struct aiocb cb;
+  static const char buf[] = "Hello World\n";
+
+  fd = mkstemp (name);
+  if (fd == -1)
+    {
+      printf ("cannot open temp name: %m\n");
+      return 1;
+    }
+
+  unlink (name);
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  arr[0] = &cb;
+
+  cb.aio_fildes = fd;
+  cb.aio_lio_opcode = LIO_WRITE;
+  cb.aio_reqprio = 0;
+  cb.aio_buf = (void *) buf;
+  cb.aio_nbytes = sizeof (buf) - 1;
+  cb.aio_offset = 0;
+  cb.aio_sigevent.sigev_notify = SIGEV_THREAD;
+  cb.aio_sigevent.sigev_notify_function = thrfct;
+  cb.aio_sigevent.sigev_notify_attributes = NULL;
+  cb.aio_sigevent.sigev_value.sival_ptr = NULL;
+
+  if (lio_listio (LIO_NOWAIT, arr, 1, NULL) < 0)
+    {
+      if (errno == ENOSYS)
+	{
+	  puts ("no aio support in this configuration");
+	  return 0;
+	}
+      printf ("lio_listio failed: %m\n");
+      return 1;
+    }
+
+  if (aio_suspend ((const struct aiocb *const *) arr, 1, NULL) < 0)
+    {
+      printf ("aio_suspend failed: %m\n");
+      return 1;
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("parent: barrier_wait failed");
+      return 1;
+    }
+
+  puts ("all OK");
+
+  return 0;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-aio4.c b/ap/libc/glibc/glibc-2.22/rt/tst-aio4.c
new file mode 100644
index 0000000..d385a1e
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-aio4.c
@@ -0,0 +1,159 @@
+/* Test for completion signal handling.
+   Copyright (C) 2000-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 <aio.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+
+/* We might need a bit longer timeout.  */
+#define TIMEOUT 10 /* sec */
+
+int my_signo;
+
+volatile sig_atomic_t flag;
+
+
+static void
+sighandler (const int signo)
+{
+  flag = signo;
+}
+
+static int
+wait_flag (void)
+{
+  while (flag == 0)
+    {
+      puts ("Sleeping...");
+      sleep (1);
+    }
+
+  if (flag != my_signo)
+    {
+      printf ("signal handler received wrong signal, flag is %d\n", flag);
+      return 1;
+    }
+
+  return 0;
+}
+
+#ifndef SIGRTMIN
+# define SIGRTMIN -1
+# define SIGRTMAX -1
+#endif
+
+static int
+do_test (int argc, char *argv[])
+{
+  char name[] = "/tmp/aio4.XXXXXX";
+  int fd;
+  struct aiocb *arr[1];
+  struct aiocb cb;
+  static const char buf[] = "Hello World\n";
+  struct aioinit init = {10, 20, 0};
+  struct sigaction sa;
+  struct sigevent ev;
+
+  if (SIGRTMIN == -1)
+  {
+      printf ("RT signals not supported.\n");
+      return 0;
+  }
+
+  /* Select a signal from the middle of the available choices... */
+  my_signo = (SIGRTMAX + SIGRTMIN) / 2;
+
+  fd = mkstemp (name);
+  if (fd == -1)
+    {
+      printf ("cannot open temp name: %m\n");
+      return 1;
+    }
+
+  unlink (name);
+
+  /* Test also aio_init.  */
+  aio_init (&init);
+
+  arr[0] = &cb;
+
+  cb.aio_fildes = fd;
+  cb.aio_lio_opcode = LIO_WRITE;
+  cb.aio_reqprio = 0;
+  cb.aio_buf = (void *) buf;
+  cb.aio_nbytes = sizeof (buf) - 1;
+  cb.aio_offset = 0;
+  cb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
+  cb.aio_sigevent.sigev_notify_function = NULL;
+  cb.aio_sigevent.sigev_notify_attributes = NULL;
+  cb.aio_sigevent.sigev_signo = my_signo;
+  cb.aio_sigevent.sigev_value.sival_ptr = NULL;
+
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_notify_function = NULL;
+  ev.sigev_notify_attributes = NULL;
+  ev.sigev_signo = my_signo;
+
+  sa.sa_handler = sighandler;
+  sigemptyset (&sa.sa_mask);
+  sa.sa_flags = SA_RESTART;
+
+  if (sigaction (my_signo, &sa, NULL) < 0)
+    {
+      printf ("sigaction failed: %m\n");
+      return 1;
+    }
+
+  flag = 0;
+  /* First use aio_write.  */
+  if (aio_write (arr[0]) < 0)
+    {
+      if (errno == ENOSYS)
+	{
+	  puts ("no aio support in this configuration");
+	  return 0;
+	}
+      printf ("aio_write failed: %m\n");
+      return 1;
+    }
+
+  if (wait_flag ())
+    return 1;
+
+  puts ("aio_write OK");
+
+  flag = 0;
+  /* Again with lio_listio.  */
+  if (lio_listio (LIO_NOWAIT, arr, 1, &ev) < 0)
+    {
+      printf ("lio_listio failed: %m\n");
+      return 1;
+    }
+
+  if (wait_flag ())
+    return 1;
+
+  puts ("all OK");
+
+  return 0;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-aio5.c b/ap/libc/glibc/glibc-2.22/rt/tst-aio5.c
new file mode 100644
index 0000000..2499c77
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-aio5.c
@@ -0,0 +1,129 @@
+/* Test for completion thread handling.
+   Copyright (C) 2000-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 <aio.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+
+/* We might need a bit longer timeout.  */
+#define TIMEOUT 10 /* sec */
+
+#define MY_SIVAL 27
+
+volatile sig_atomic_t flag;
+
+
+static void
+callback (sigval_t s)
+{
+  flag = s.sival_int;
+}
+
+static int
+wait_flag (void)
+{
+  while (flag == 0)
+    {
+      puts ("Sleeping...");
+      sleep (1);
+    }
+
+  if (flag != MY_SIVAL)
+    {
+      printf ("signal handler received wrong signal, flag is %d\n", flag);
+      return 1;
+    }
+
+  return 0;
+}
+
+
+static int
+do_test (int argc, char *argv[])
+{
+  char name[] = "/tmp/aio5.XXXXXX";
+  int fd;
+  struct aiocb *arr[1];
+  struct aiocb cb;
+  static const char buf[] = "Hello World\n";
+  struct sigevent ev;
+
+  fd = mkstemp (name);
+  if (fd == -1)
+    {
+      printf ("cannot open temp name: %m\n");
+      return 1;
+    }
+
+  unlink (name);
+
+  arr[0] = &cb;
+
+  cb.aio_fildes = fd;
+  cb.aio_lio_opcode = LIO_WRITE;
+  cb.aio_reqprio = 0;
+  cb.aio_buf = (void *) buf;
+  cb.aio_nbytes = sizeof (buf) - 1;
+  cb.aio_offset = 0;
+  cb.aio_sigevent.sigev_notify = SIGEV_THREAD;
+  cb.aio_sigevent.sigev_notify_function = callback;
+  cb.aio_sigevent.sigev_notify_attributes = NULL;
+  cb.aio_sigevent.sigev_value.sival_int = MY_SIVAL;
+
+  ev.sigev_notify = SIGEV_THREAD;
+  ev.sigev_notify_function = callback;
+  ev.sigev_notify_attributes = NULL;
+  ev.sigev_value.sival_int = MY_SIVAL;
+
+  /* First use aio_write.  */
+  if (aio_write (arr[0]) < 0)
+    {
+      if (errno == ENOSYS)
+	{
+	  puts ("no aio support in this configuration");
+	  return 0;
+	}
+      printf ("aio_write failed: %m\n");
+      return 1;
+    }
+
+  if (wait_flag ())
+    return 1;
+
+  puts ("aio_write OK");
+
+  flag = 0;
+  /* Again with lio_listio.  */
+  if (lio_listio (LIO_NOWAIT, arr, 1, &ev) < 0)
+    {
+      printf ("lio_listio failed: %m\n");
+      return 1;
+    }
+
+  if (wait_flag ())
+    return 1;
+
+  puts ("all OK");
+
+  return 0;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-aio6.c b/ap/libc/glibc/glibc-2.22/rt/tst-aio6.c
new file mode 100644
index 0000000..5ffe130
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-aio6.c
@@ -0,0 +1,101 @@
+/* Test for timeout handling.
+   Copyright (C) 2000-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 <aio.h>
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+
+/* We expect to wait for 3 seconds so we have to increase the timeout.  */
+#define TIMEOUT 10 /* sec */
+
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  struct aiocb *arr[1];
+  struct aiocb cb;
+  char buf[100];
+  struct timeval before;
+  struct timeval after;
+  struct timespec timeout;
+  int fd[2];
+  int result = 0;
+
+  if (pipe (fd) != 0)
+    {
+      printf ("cannot create pipe: %m\n");
+      return 1;
+    }
+
+  arr[0] = &cb;
+
+  cb.aio_fildes = fd[0];
+  cb.aio_lio_opcode = LIO_WRITE;
+  cb.aio_reqprio = 0;
+  cb.aio_buf = (void *) buf;
+  cb.aio_nbytes = sizeof (buf) - 1;
+  cb.aio_offset = 0;
+  cb.aio_sigevent.sigev_notify = SIGEV_NONE;
+
+  /* Try to read from stdin where nothing will be available.  */
+  if (aio_read (arr[0]) < 0)
+    {
+      if (errno == ENOSYS)
+	{
+	  puts ("no aio support in this configuration");
+	  return 0;
+	}
+      printf ("aio_read failed: %m\n");
+      return 1;
+    }
+
+  /* Get the current time.  */
+  gettimeofday (&before, NULL);
+
+  /* Wait for input which is unsuccessful and therefore the function will
+     time out.  */
+  timeout.tv_sec = 3;
+  timeout.tv_nsec = 0;
+  if (aio_suspend ((const struct aiocb *const*) arr, 1, &timeout) != -1)
+    {
+      puts ("aio_suspend() didn't return -1");
+      result = 1;
+    }
+  else if (errno != EAGAIN)
+    {
+      puts ("error not set to EAGAIN");
+      result = 1;
+    }
+  else
+    {
+      gettimeofday (&after, NULL);
+      if (after.tv_sec < before.tv_sec + 1)
+	{
+	  puts ("timeout came too early");
+	  result = 1;
+	}
+    }
+
+  return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-aio64.c b/ap/libc/glibc/glibc-2.22/rt/tst-aio64.c
new file mode 100644
index 0000000..3a9ae79
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-aio64.c
@@ -0,0 +1,290 @@
+/* Tests for 64bit AIO in librt.
+   Copyright (C) 1998-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+   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/>.  */
+
+#define _LARGEFILE_SOURCE 1
+#include <aio.h>
+#include <errno.h>
+#include <error.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+
+/* Prototype for our test function.  */
+extern void do_prepare (int argc, char *argv[]);
+extern int do_test (int argc, char *argv[]);
+
+/* We have a preparation function.  */
+#define PREPARE do_prepare
+
+/* We might need a bit longer timeout.  */
+#define TIMEOUT 20 /* sec */
+
+/* This defines the `main' function and some more.  */
+#include <test-skeleton.c>
+
+
+/* These are for the temporary file we generate.  */
+char *name;
+int fd;
+
+void
+do_prepare (int argc, char *argv[])
+{
+  size_t name_len;
+
+  name_len = strlen (test_dir);
+  name = malloc (name_len + sizeof ("/aioXXXXXX"));
+  mempcpy (mempcpy (name, test_dir, name_len),
+	   "/aioXXXXXX", sizeof ("/aioXXXXXX"));
+  add_temp_file (name);
+
+  /* Open our test file.   */
+  fd = mkstemp (name);
+  if (fd == -1)
+    error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
+}
+
+
+static int
+test_file (const void *buf, size_t size, int fd, const char *msg)
+{
+  struct stat st;
+  char tmp[size];
+
+  errno = 0;
+  if (fstat (fd, &st) < 0)
+    {
+      error (0, errno, "%s: failed stat", msg);
+      return 1;
+    }
+
+  if (st.st_size != (off_t) size)
+    {
+      error (0, errno, "%s: wrong size: %lu, should be %lu",
+	     msg, (unsigned long int) st.st_size, (unsigned long int) size);
+      return 1;
+    }
+
+  if (pread (fd, tmp, size, 0) != (ssize_t) size)
+    {
+      error (0, errno, "%s: failed pread", msg);
+      return 1;
+    }
+
+  if (memcmp (buf, tmp, size) != 0)
+    {
+      error (0, errno, "%s: failed comparison", msg);
+      return 1;
+    }
+
+  printf ("%s test ok\n", msg);
+
+  return 0;
+}
+
+
+static int
+do_wait (struct aiocb64 **cbp, size_t nent, int allowed_err)
+{
+  int go_on;
+  size_t cnt;
+  int result = 0;
+
+  do
+    {
+      aio_suspend64 ((const struct aiocb64 *const *) cbp, nent, NULL);
+      go_on = 0;
+      for (cnt = 0; cnt < nent; ++cnt)
+	if (cbp[cnt] != NULL)
+	  {
+	    if (aio_error64 (cbp[cnt]) == EINPROGRESS)
+	      go_on = 1;
+	    else
+	      {
+		if (aio_return64 (cbp[cnt]) == -1
+		    && (allowed_err == 0
+			|| aio_error64 (cbp[cnt]) != allowed_err))
+		  {
+		    error (0, aio_error64 (cbp[cnt]), "Operation failed\n");
+		    result = 1;
+		  }
+		cbp[cnt] = NULL;
+	      }
+	  }
+    }
+  while (go_on);
+
+  return result;
+}
+
+
+int
+do_test (int argc, char *argv[])
+{
+  struct aiocb64 cbs[10];
+  struct aiocb64 cbs_fsync;
+  struct aiocb64 *cbp[10];
+  struct aiocb64 *cbp_fsync[1];
+  char buf[1000];
+  size_t cnt;
+  int result = 0;
+
+  /* Preparation.  */
+  for (cnt = 0; cnt < 10; ++cnt)
+    {
+      cbs[cnt].aio_fildes = fd;
+      cbs[cnt].aio_reqprio = 0;
+      cbs[cnt].aio_buf = memset (&buf[cnt * 100], '0' + cnt, 100);
+      cbs[cnt].aio_nbytes = 100;
+      cbs[cnt].aio_offset = cnt * 100;
+      cbs[cnt].aio_sigevent.sigev_notify = SIGEV_NONE;
+
+      cbp[cnt] = &cbs[cnt];
+    }
+
+  /* First a simple test.  */
+  for (cnt = 10; cnt > 0; )
+    if (aio_write64 (cbp[--cnt]) < 0 && errno == ENOSYS)
+      {
+	error (0, 0, "no aio support in this configuration");
+	return 0;
+      }
+  /* Wait 'til the results are there.  */
+  result |= do_wait (cbp, 10, 0);
+  /* Test this.  */
+  result |= test_file (buf, sizeof (buf), fd, "aio_write");
+
+  /* Read now as we've written it.  */
+  memset (buf, '\0', sizeof (buf));
+  /* Issue the commands.  */
+  for (cnt = 10; cnt > 0; )
+    {
+      --cnt;
+      cbp[cnt] = &cbs[cnt];
+      aio_read64 (cbp[cnt]);
+    }
+  /* Wait 'til the results are there.  */
+  result |= do_wait (cbp, 10, 0);
+  /* Test this.  */
+  for (cnt = 0; cnt < 1000; ++cnt)
+    if (buf[cnt] != '0' + (cnt / 100))
+      {
+	result = 1;
+	error (0, 0, "comparison failed for aio_read test");
+	break;
+      }
+
+  if (cnt == 1000)
+    puts ("aio_read test ok");
+
+  /* Remove the test file contents.  */
+  if (ftruncate64 (fd, 0) < 0)
+    {
+      error (0, errno, "ftruncate failed\n");
+      result = 1;
+    }
+
+  /* Test lio_listio.  */
+  for (cnt = 0; cnt < 10; ++cnt)
+    {
+      cbs[cnt].aio_lio_opcode = LIO_WRITE;
+      cbp[cnt] = &cbs[cnt];
+    }
+  /* Issue the command.  */
+  lio_listio64 (LIO_WAIT, cbp, 10, NULL);
+  /* ...and immediately test it since we started it in wait mode.  */
+  result |= test_file (buf, sizeof (buf), fd, "lio_listio (write)");
+
+  /* Test aio_fsync.  */
+  cbs_fsync.aio_fildes = fd;
+  cbs_fsync.aio_sigevent.sigev_notify = SIGEV_NONE;
+  cbp_fsync[0] = &cbs_fsync;
+
+  /* Remove the test file contents first.  */
+  if (ftruncate64 (fd, 0) < 0)
+    {
+      error (0, errno, "ftruncate failed\n");
+      result = 1;
+    }
+
+  /* Write again.  */
+  for (cnt = 10; cnt > 0; )
+    aio_write64 (cbp[--cnt]);
+
+  if (aio_fsync64 (O_SYNC, &cbs_fsync) < 0)
+    {
+      error (0, errno, "aio_fsync failed\n");
+      result = 1;
+    }
+  result |= do_wait (cbp_fsync, 1, 0);
+
+  /* ...and test since all data should be on disk now.  */
+  result |= test_file (buf, sizeof (buf), fd, "aio_fsync (aio_write)");
+
+  /* Test aio_cancel.  */
+  /* Remove the test file contents first.  */
+  if (ftruncate64 (fd, 0) < 0)
+    {
+      error (0, errno, "ftruncate failed\n");
+      result = 1;
+    }
+
+  /* Write again.  */
+  for (cnt = 10; cnt > 0; )
+    aio_write64 (cbp[--cnt]);
+
+  /* Cancel all requests.  */
+  if (aio_cancel64 (fd, NULL) == -1)
+    printf ("aio_cancel64 (fd, NULL) cannot cancel anything\n");
+
+  result |= do_wait (cbp, 10, ECANCELED);
+
+  /* Another test for aio_cancel.  */
+  /* Remove the test file contents first.  */
+  if (ftruncate64 (fd, 0) < 0)
+    {
+      error (0, errno, "ftruncate failed\n");
+      result = 1;
+    }
+
+  /* Write again.  */
+  for (cnt = 10; cnt > 0; )
+    {
+      --cnt;
+      cbp[cnt] = &cbs[cnt];
+      aio_write64 (cbp[cnt]);
+    }
+  puts ("finished3");
+
+  /* Cancel all requests.  */
+  for (cnt = 10; cnt > 0; )
+    if (aio_cancel64 (fd, cbp[--cnt]) == -1)
+      /* This is not an error.  The request can simply be finished.  */
+      printf ("aio_cancel64 (fd, cbp[%Zd]) cannot be canceled\n", cnt);
+  puts ("finished2");
+
+  result |= do_wait (cbp, 10, ECANCELED);
+
+  puts ("finished");
+
+  return result;
+}
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-aio7.c b/ap/libc/glibc/glibc-2.22/rt/tst-aio7.c
new file mode 100644
index 0000000..30a3768
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-aio7.c
@@ -0,0 +1,177 @@
+/* Test for AIO POSIX compliance.
+   Copyright (C) 2001-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 <aio.h>
+#include <error.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+/* We might wait for 3 seconds, so increase timeout to 10 seconds.  */
+#define TIMEOUT 10
+
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+  int piped[2];
+
+  /* Make a pipe that we will never write to, so we can block reading it.  */
+  if (pipe (piped) < 0)
+    {
+      perror ("pipe");
+      return 1;
+    }
+
+  /* Test for aio_cancel() detecting invalid file descriptor.  */
+  {
+    struct aiocb cb;
+    int fd = -1;
+
+    cb.aio_fildes = fd;
+    cb.aio_offset = 0;
+    cb.aio_buf = NULL;
+    cb.aio_nbytes = 0;
+    cb.aio_reqprio = 0;
+    cb.aio_sigevent.sigev_notify = SIGEV_NONE;
+
+    errno = 0;
+
+    /* Case one: invalid fds that match.  */
+    if (aio_cancel (fd, &cb) != -1 || errno != EBADF)
+      {
+	if (errno == ENOSYS)
+	  {
+	    puts ("no aio support in this configuration");
+	    return 0;
+	  }
+
+	puts ("aio_cancel( -1, {-1..} ) did not return -1 or errno != EBADF");
+	++result;
+      }
+
+    cb.aio_fildes = -2;
+    errno = 0;
+
+    /* Case two: invalid fds that do not match; just print warning.  */
+    if (aio_cancel (fd, &cb) != -1 || errno != EBADF)
+      puts ("aio_cancel( -1, {-2..} ) did not return -1 or errno != EBADF");
+  }
+
+  /* Test for aio_fsync() detecting bad fd.  */
+  {
+    struct aiocb cb;
+    int fd = -1;
+
+    cb.aio_fildes = fd;
+    cb.aio_offset = 0;
+    cb.aio_buf = NULL;
+    cb.aio_nbytes = 0;
+    cb.aio_reqprio = 0;
+    cb.aio_sigevent.sigev_notify = SIGEV_NONE;
+
+    errno = 0;
+
+    /* Case one: invalid fd.  */
+    if (aio_fsync (O_SYNC, &cb) != -1 || errno != EBADF)
+      {
+	puts ("aio_fsync( op, {-1..} ) did not return -1 or errno != EBADF");
+	++result;
+      }
+  }
+
+  /* Test for aio_suspend() suspending even if completed elements in list.  */
+  {
+#define BYTES 8
+    const int ELEMS = 2;
+    int i, r, fd;
+    static char buff[BYTES];
+    char name[] = "/tmp/aio7.XXXXXX";
+    struct timespec timeout;
+    static struct aiocb cb0, cb1;
+    struct aiocb *list[ELEMS];
+
+    fd = mkstemp (name);
+    if (fd < 0)
+      error (1, errno, "creating temp file");
+
+    if (unlink (name))
+      error (1, errno, "unlinking temp file");
+
+    if (write (fd, "01234567", BYTES) != BYTES)
+      error (1, errno, "writing to temp file");
+
+    cb0.aio_fildes = fd;
+    cb0.aio_offset = 0;
+    cb0.aio_buf = buff;
+    cb0.aio_nbytes = BYTES;
+    cb0.aio_reqprio = 0;
+    cb0.aio_sigevent.sigev_notify = SIGEV_NONE;
+
+    r = aio_read (&cb0);
+    if (r != 0)
+      error (1, errno, "reading from file");
+
+    while (aio_error (&(cb0)) == EINPROGRESS)
+      usleep (10);
+
+    for (i = 0; i < BYTES; i++)
+      printf ("%c ", buff[i]);
+    printf ("\n");
+
+    /* At this point, the first read is completed, so start another one on
+       the read half of a pipe on which nothing will be written.  */
+    cb1.aio_fildes = piped[0];
+    cb1.aio_offset = 0;
+    cb1.aio_buf = buff;
+    cb1.aio_nbytes = BYTES;
+    cb1.aio_reqprio = 0;
+    cb1.aio_sigevent.sigev_notify = SIGEV_NONE;
+
+    r = aio_read (&cb1);
+    if (r != 0)
+      error (1, errno, "reading from file");
+
+    /* Now call aio_suspend() with the two reads.  It should return
+     * immediately according to the POSIX spec.
+     */
+    list[0] = &cb0;
+    list[1] = &cb1;
+    timeout.tv_sec = 3;
+    timeout.tv_nsec = 0;
+    r = aio_suspend ((const struct aiocb * const *) list, ELEMS, &timeout);
+
+    if (r == -1 && errno == EAGAIN)
+      {
+	puts ("aio_suspend([done,blocked],2,3) suspended thread");
+	++result;
+      }
+
+    /* Note that CB1 is still pending, and so cannot be an auto variable.
+       Thus we also test that exiting with an outstanding request works.  */
+  }
+
+  return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-aio8.c b/ap/libc/glibc/glibc-2.22/rt/tst-aio8.c
new file mode 100644
index 0000000..b03639d
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-aio8.c
@@ -0,0 +1,39 @@
+#include <aio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+static int
+do_test (void)
+{
+  int fd = open ("/dev/full", O_RDWR);
+  if (fd == -1)
+    {
+      puts ("could not open /dev/full");
+      return 0;
+    }
+
+  struct aiocb req;
+  req.aio_fildes = fd;
+  req.aio_lio_opcode = LIO_WRITE;
+  req.aio_reqprio = 0;
+  req.aio_buf = (void *) "hello";
+  req.aio_nbytes = 5;
+  req.aio_offset = 0;
+  req.aio_sigevent.sigev_notify = SIGEV_NONE;
+
+  struct aiocb *list[1];
+  list[0] = &req;
+
+  int r = lio_listio (LIO_WAIT, list, 1, NULL);
+  int e = errno;
+
+  printf ("r = %d, e = %d (%s)\n", r, e, strerror (e));
+
+  return r != -1 || e != EIO;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-aio9.c b/ap/libc/glibc/glibc-2.22/rt/tst-aio9.c
new file mode 100644
index 0000000..eab4f68
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-aio9.c
@@ -0,0 +1,124 @@
+#include <aio.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <unistd.h>
+
+static pthread_barrier_t b;
+static pthread_t main_thread;
+static int flag;
+
+
+static void *
+tf (void *arg)
+{
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: barrier_wait failed");
+      exit (1);
+    }
+
+  /* There is unfortunately no other way to try to make sure the other
+     thread reached the aio_suspend call.  This test could fail on
+     highly loaded machines.  */
+  sleep (2);
+
+  pthread_kill (main_thread, SIGUSR1);
+
+  while (1)
+    sleep (1000);
+
+  return NULL;
+}
+
+
+static void
+sh (int sig)
+{
+  flag = 1;
+}
+
+
+static int
+do_test (void)
+{
+  main_thread = pthread_self ();
+
+  struct sigaction sa;
+
+  sa.sa_handler = sh;
+  sa.sa_flags = 0;
+  sigemptyset (&sa.sa_mask);
+
+  if (sigaction (SIGUSR1, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init");
+      return 1;
+    }
+
+  int fds[2];
+  if (pipe (fds) != 0)
+    {
+      puts ("pipe failed");
+      return 1;
+    }
+
+  char buf[42];
+  struct aiocb req;
+  req.aio_fildes = fds[0];
+  req.aio_reqprio = 0;
+  req.aio_offset = 0;
+  req.aio_buf = buf;
+  req.aio_nbytes = sizeof (buf);
+  req.aio_sigevent.sigev_notify = SIGEV_NONE;
+
+  if (aio_read (&req) != 0)
+    {
+      puts ("aio_read failed");
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("parent: barrier_wait failed");
+      exit (1);
+    }
+
+  const struct aiocb *list[1];
+  list[0] = &req;
+
+  e = aio_suspend (list, 1, NULL);
+  if (e != -1)
+    {
+      puts ("aio_suspend succeeded");
+      return 1;
+    }
+  if (errno != EINTR)
+    {
+      puts ("aio_suspend did not return EINTR");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#define TIMEOUT 5
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-clock.c b/ap/libc/glibc/glibc-2.22/rt/tst-clock.c
new file mode 100644
index 0000000..4ca6681
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-clock.c
@@ -0,0 +1,124 @@
+/* Test program for POSIX clock_* functions.
+   Copyright (C) 2000-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
+
+   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 <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <stdint.h>
+
+
+/* We want to see output immediately.  */
+#define STDOUT_UNBUFFERED
+
+/* We expect to run at least 10 seconds.  */
+#define TIMEOUT 15
+
+static int
+clock_test (clockid_t cl)
+{
+  struct timespec old_ts;
+  struct timespec ts;
+  struct timespec waitit;
+  int result = 0;
+  int i;
+
+  memset (&ts, '\0', sizeof ts);
+
+  waitit.tv_sec = 0;
+  waitit.tv_nsec = 500000000;
+
+  /* Get and print resolution of the clock.  */
+  if (clock_getres (cl, &ts) == 0)
+    {
+      if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000)
+	{
+	  printf ("clock %d: nanosecond value of resolution wrong\n", cl);
+	  result = 1;
+	}
+      else
+	printf ("clock %d: resolution = %jd.%09jd secs\n",
+		cl, (intmax_t) ts.tv_sec, (intmax_t) ts.tv_nsec);
+    }
+  else
+    {
+      printf ("clock %d: cannot get resolution\n", cl);
+      result = 1;
+    }
+
+  memset (&ts, '\0', sizeof ts);
+  memset (&old_ts, '\0', sizeof old_ts);
+
+  /* Next get the current time value a few times.  */
+  for (i = 0; i < 10; ++i)
+    {
+      if (clock_gettime (cl, &ts) == 0)
+	{
+	  if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000)
+	    {
+	      printf ("clock %d: nanosecond value of time wrong (try %d)\n",
+		      cl, i);
+	      result = 1;
+	    }
+	  else
+	    {
+	      printf ("clock %d: time = %jd.%09jd secs\n",
+		      cl, (intmax_t) ts.tv_sec, (intmax_t) ts.tv_nsec);
+
+	      if (memcmp (&ts, &old_ts, sizeof ts) == 0)
+		{
+		  printf ("clock %d: time hasn't changed (try %d)\n", cl, i);
+		  result = 1;
+
+		  old_ts = ts;
+		}
+	    }
+	}
+      else
+	{
+	  printf ("clock %d: cannot get time (try %d)\n", cl, i);
+	  result = 1;
+	}
+
+      /* Wait a bit before the next iteration.  */
+      nanosleep (&waitit, NULL);
+    }
+
+  return result;
+}
+
+static int
+do_test (void)
+{
+  clockid_t cl;
+  int result;
+
+  result = clock_test (CLOCK_REALTIME);
+
+  if (clock_getcpuclockid (0, &cl) == 0)
+    /* XXX It's not yet a bug when this fails.  */
+    clock_test (cl);
+  else
+	  printf("CPU clock unavailble, skipping test\n");
+
+  return result;
+}
+#define TEST_FUNCTION do_test ()
+
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-clock2.c b/ap/libc/glibc/glibc-2.22/rt/tst-clock2.c
new file mode 100644
index 0000000..4c8fb9f
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-clock2.c
@@ -0,0 +1,43 @@
+/* Test setting the monotonic clock.  */
+
+#include <time.h>
+#include <unistd.h>
+
+#if defined CLOCK_MONOTONIC && defined _POSIX_MONOTONIC_CLOCK
+
+# include <errno.h>
+# include <stdio.h>
+
+static int
+do_test (void)
+{
+  if (sysconf (_SC_MONOTONIC_CLOCK) <= 0)
+    return 0;
+
+  struct timespec ts;
+  if (clock_gettime (CLOCK_MONOTONIC, &ts) != 0)
+    {
+      puts ("clock_gettime(CLOCK_MONOTONIC) failed");
+      return 1;
+    }
+
+  /* Setting the monotonic clock must fail.  */
+  if (clock_settime (CLOCK_MONOTONIC, &ts) != -1)
+    {
+      puts ("clock_settime(CLOCK_MONOTONIC) did not fail");
+      return 1;
+    }
+  if (errno != EINVAL)
+    {
+      printf ("clock_settime(CLOCK_MONOTONIC) set errno to %d, expected %d\n",
+	      errno, EINVAL);
+      return 1;
+    }
+  return 0;
+}
+# define TEST_FUNCTION do_test ()
+
+#else
+# define TEST_FUNCTION	0
+#endif
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-clock_nanosleep.c b/ap/libc/glibc/glibc-2.22/rt/tst-clock_nanosleep.c
new file mode 100644
index 0000000..8eea9d1
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-clock_nanosleep.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2003-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 <stdio.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <time.h>
+
+
+/* Test that clock_nanosleep() does sleep.  */
+static int
+do_test (void)
+{
+  /* Current time.  */
+  struct timeval tv1;
+  (void) gettimeofday (&tv1, NULL);
+
+  struct timespec ts;
+  ts.tv_sec = 1;
+  ts.tv_nsec = 0;
+  TEMP_FAILURE_RETRY (clock_nanosleep (CLOCK_REALTIME, 0, &ts, &ts));
+
+  /* At least one second must have passed.  */
+  struct timeval tv2;
+  (void) gettimeofday (&tv2, NULL);
+
+  tv2.tv_sec -= tv1.tv_sec;
+  tv2.tv_usec -= tv1.tv_usec;
+  if (tv2.tv_usec < 0)
+    --tv2.tv_sec;
+
+  if (tv2.tv_sec < 1)
+    {
+      puts ("clock_nanosleep didn't sleep long enough");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-cpuclock1.c b/ap/libc/glibc/glibc-2.22/rt/tst-cpuclock1.c
new file mode 100644
index 0000000..f1c72d6
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-cpuclock1.c
@@ -0,0 +1,321 @@
+/* Test program for process CPU clocks.
+   Copyright (C) 2004-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 <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdint.h>
+#include <sys/wait.h>
+
+/* This function is intended to rack up both user and system time.  */
+static void
+chew_cpu (void)
+{
+  while (1)
+    {
+      static volatile char buf[4096];
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xaa;
+      int nullfd = open ("/dev/null", O_WRONLY);
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xbb;
+      write (nullfd, (char *) buf, sizeof buf);
+      close (nullfd);
+      if (getppid () == 1)
+	_exit (2);
+    }
+}
+
+static int
+do_test (void)
+{
+  int result = 0;
+  clockid_t cl;
+  int e;
+  pid_t dead_child, child;
+
+  /* Fork a child and let it die, to give us a PID known not be valid
+     (assuming PIDs don't wrap around during the test).  */
+  {
+    dead_child = fork ();
+    if (dead_child == 0)
+      _exit (0);
+    if (dead_child < 0)
+      {
+	perror ("fork");
+	return 1;
+      }
+    int x;
+    if (wait (&x) != dead_child)
+      {
+	perror ("wait");
+	return 2;
+      }
+  }
+
+  /* POSIX says we should get ESRCH for this.  */
+  e = clock_getcpuclockid (dead_child, &cl);
+  if (e != ENOSYS && e != ESRCH && e != EPERM)
+    {
+      printf ("clock_getcpuclockid on dead PID %d => %s\n",
+	      dead_child, strerror (e));
+      result = 1;
+    }
+
+  /* Now give us a live child eating up CPU time.  */
+  child = fork ();
+  if (child == 0)
+    {
+      chew_cpu ();
+      _exit (1);
+    }
+  if (child < 0)
+    {
+      perror ("fork");
+      return 1;
+    }
+
+  e = clock_getcpuclockid (child, &cl);
+  if (e == EPERM)
+    {
+      puts ("clock_getcpuclockid does not support other processes");
+      goto done;
+    }
+  if (e != 0)
+    {
+      printf ("clock_getcpuclockid on live PID %d => %s\n",
+	      child, strerror (e));
+      result = 1;
+      goto done;
+    }
+
+  const clockid_t child_clock = cl;
+  struct timespec res;
+  if (clock_getres (child_clock, &res) < 0)
+    {
+      printf ("clock_getres on live PID %d clock %lx => %s\n",
+	      child, (unsigned long int) child_clock, strerror (errno));
+      result = 1;
+      goto done;
+    }
+  printf ("live PID %d clock %lx resolution %ju.%.9ju\n",
+	  child, (unsigned long int) child_clock,
+	  (uintmax_t) res.tv_sec, (uintmax_t) res.tv_nsec);
+
+  struct timespec before, after;
+  if (clock_gettime (child_clock, &before) < 0)
+    {
+      printf ("clock_gettime on live PID %d clock %lx => %s\n",
+	      child, (unsigned long int) child_clock, strerror (errno));
+      result = 1;
+      goto done;
+    }
+  /* Should be close to 0.0.  */
+  printf ("live PID %d before sleep => %ju.%.9ju\n",
+	  child, (uintmax_t) before.tv_sec, (uintmax_t) before.tv_nsec);
+
+  struct timespec sleeptime = { .tv_nsec = 500000000 };
+  if (nanosleep (&sleeptime, NULL) != 0)
+    {
+      perror ("nanosleep");
+      result = 1;
+      goto done;
+    }
+
+  if (clock_gettime (child_clock, &after) < 0)
+    {
+      printf ("clock_gettime on live PID %d clock %lx => %s\n",
+	      child, (unsigned long int) child_clock, strerror (errno));
+      result = 1;
+      goto done;
+    }
+  /* Should be close to 0.5.  */
+  printf ("live PID %d after sleep => %ju.%.9ju\n",
+	  child, (uintmax_t) after.tv_sec, (uintmax_t) after.tv_nsec);
+
+  struct timespec diff = { .tv_sec = after.tv_sec - before.tv_sec,
+			   .tv_nsec = after.tv_nsec - before.tv_nsec };
+  if (diff.tv_nsec < 0)
+    {
+      --diff.tv_sec;
+      diff.tv_nsec += 1000000000;
+    }
+  if (diff.tv_sec != 0
+      || diff.tv_nsec > 600000000
+      || diff.tv_nsec < 100000000)
+    {
+      printf ("before - after %ju.%.9ju outside reasonable range\n",
+	      (uintmax_t) diff.tv_sec, (uintmax_t) diff.tv_nsec);
+      result = 1;
+    }
+
+  sleeptime.tv_nsec = 100000000;
+  e = clock_nanosleep (child_clock, 0, &sleeptime, NULL);
+  if (e == EINVAL || e == ENOTSUP || e == ENOSYS)
+    {
+      printf ("clock_nanosleep not supported for other process clock: %s\n",
+	      strerror (e));
+    }
+  else if (e != 0)
+    {
+      printf ("clock_nanosleep on other process clock: %s\n", strerror (e));
+      result = 1;
+    }
+  else
+    {
+      struct timespec afterns;
+      if (clock_gettime (child_clock, &afterns) < 0)
+	{
+	  printf ("clock_gettime on live PID %d clock %lx => %s\n",
+		  child, (unsigned long int) child_clock, strerror (errno));
+	  result = 1;
+	}
+      else
+	{
+	  struct timespec d = { .tv_sec = afterns.tv_sec - after.tv_sec,
+				.tv_nsec = afterns.tv_nsec - after.tv_nsec };
+	  if (d.tv_nsec < 0)
+	    {
+	      --d.tv_sec;
+	      d.tv_nsec += 1000000000;
+	    }
+	  if (d.tv_sec > 0
+	      || d.tv_nsec < sleeptime.tv_nsec
+	      || d.tv_nsec > sleeptime.tv_nsec * 2)
+	    {
+	      printf ("nanosleep time %ju.%.9ju outside reasonable range\n",
+		      (uintmax_t) d.tv_sec, (uintmax_t) d.tv_nsec);
+	      result = 1;
+	    }
+	}
+    }
+
+  if (kill (child, SIGKILL) != 0)
+    {
+      perror ("kill");
+      result = 2;
+      goto done;
+    }
+
+  /* Wait long enough to let the child finish dying.  */
+
+  sleeptime.tv_nsec = 200000000;
+  if (nanosleep (&sleeptime, NULL) != 0)
+    {
+      perror ("nanosleep");
+      result = 1;
+      goto done;
+    }
+
+  struct timespec dead;
+  if (clock_gettime (child_clock, &dead) < 0)
+    {
+      printf ("clock_gettime on dead PID %d clock %lx => %s\n",
+	      child, (unsigned long int) child_clock, strerror (errno));
+      result = 1;
+      goto done;
+    }
+  /* Should be close to 0.6.  */
+  printf ("dead PID %d => %ju.%.9ju\n",
+	  child, (uintmax_t) dead.tv_sec, (uintmax_t) dead.tv_nsec);
+
+  diff.tv_sec = dead.tv_sec - after.tv_sec;
+  diff.tv_nsec = dead.tv_nsec - after.tv_nsec;
+  if (diff.tv_nsec < 0)
+    {
+      --diff.tv_sec;
+      diff.tv_nsec += 1000000000;
+    }
+  if (diff.tv_sec != 0 || diff.tv_nsec > 200000000)
+    {
+      printf ("dead - after %ju.%.9ju outside reasonable range\n",
+	      (uintmax_t) diff.tv_sec, (uintmax_t) diff.tv_nsec);
+      result = 1;
+    }
+
+  /* Now reap the child and verify that its clock is no longer valid.  */
+  {
+    int x;
+    if (waitpid (child, &x, 0) != child)
+      {
+	perror ("waitpid");
+	result = 1;
+      }
+  }
+
+  if (clock_gettime (child_clock, &dead) == 0)
+    {
+      printf ("clock_gettime on reaped PID %d clock %lx => %ju%.9ju\n",
+	      child, (unsigned long int) child_clock,
+	      (uintmax_t) dead.tv_sec, (uintmax_t) dead.tv_nsec);
+      result = 1;
+    }
+  else
+    {
+      if (errno != EINVAL)
+	result = 1;
+      printf ("clock_gettime on reaped PID %d clock %lx => %s\n",
+	      child, (unsigned long int) child_clock, strerror (errno));
+    }
+
+  if (clock_getres (child_clock, &dead) == 0)
+    {
+      printf ("clock_getres on reaped PID %d clock %lx => %ju%.9ju\n",
+	      child, (unsigned long int) child_clock,
+	      (uintmax_t) dead.tv_sec, (uintmax_t) dead.tv_nsec);
+      result = 1;
+    }
+  else
+    {
+      if (errno != EINVAL)
+	result = 1;
+      printf ("clock_getres on reaped PID %d clock %lx => %s\n",
+	      child, (unsigned long int) child_clock, strerror (errno));
+    }
+
+  return result;
+
+ done:
+  {
+    if (kill (child, SIGKILL) != 0 && errno != ESRCH)
+      {
+	perror ("kill");
+	return 2;
+      }
+    int x;
+    if (waitpid (child, &x, 0) != child && errno != ECHILD)
+      {
+	perror ("waitpid");
+	return 2;
+      }
+  }
+
+  return result;
+}
+
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-cpuclock2.c b/ap/libc/glibc/glibc-2.22/rt/tst-cpuclock2.c
new file mode 100644
index 0000000..fb07655
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-cpuclock2.c
@@ -0,0 +1,337 @@
+/* Test program for process and thread CPU clocks.
+   Copyright (C) 2005-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 <unistd.h>
+#include <stdint.h>
+
+#if (_POSIX_THREADS - 0) <= 0
+
+# define TEST_FUNCTION 0
+
+#else
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <pthread.h>
+
+static pthread_barrier_t barrier;
+
+/* This function is intended to rack up both user and system time.  */
+static void *
+chew_cpu (void *arg)
+{
+  pthread_barrier_wait (&barrier);
+
+  while (1)
+    {
+      static volatile char buf[4096];
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xaa;
+      int nullfd = open ("/dev/null", O_WRONLY);
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xbb;
+      write (nullfd, (char *) buf, sizeof buf);
+      close (nullfd);
+    }
+
+  return NULL;
+}
+
+static unsigned long long int
+tsdiff (const struct timespec *before, const struct timespec *after)
+{
+  struct timespec diff = { .tv_sec = after->tv_sec - before->tv_sec,
+			   .tv_nsec = after->tv_nsec - before->tv_nsec };
+  while (diff.tv_nsec < 0)
+    {
+      --diff.tv_sec;
+      diff.tv_nsec += 1000000000;
+    }
+  return diff.tv_sec * 1000000000ULL + diff.tv_nsec;
+}
+
+static unsigned long long int
+test_nanosleep (clockid_t clock, const char *which,
+		const struct timespec *before, int *bad)
+{
+  const struct timespec sleeptime = { .tv_nsec = 100000000 };
+  int e = clock_nanosleep (clock, 0, &sleeptime, NULL);
+  if (e == EINVAL || e == ENOTSUP || e == ENOSYS)
+    {
+      printf ("clock_nanosleep not supported for %s CPU clock: %s\n",
+	      which, strerror (e));
+      return 0;
+    }
+  if (e != 0)
+    {
+      printf ("clock_nanosleep on %s CPU clock: %s\n", which, strerror (e));
+      *bad = 1;
+      return 0;
+    }
+
+  struct timespec after;
+  if (clock_gettime (clock, &after) < 0)
+    {
+      printf ("clock_gettime on %s CPU clock %lx => %s\n",
+	      which, (unsigned long int) clock, strerror (errno));
+      *bad = 1;
+      return 0;
+    }
+
+  unsigned long long int diff = tsdiff (before, &after);
+  if (diff < sleeptime.tv_nsec || diff > sleeptime.tv_nsec * 2)
+    {
+      printf ("clock_nanosleep on %s slept %llu (outside reasonable range)\n",
+	      which, diff);
+      *bad = 1;
+      return diff;
+    }
+
+  struct timespec sleeptimeabs = sleeptime;
+  sleeptimeabs.tv_sec += after.tv_sec;
+  sleeptimeabs.tv_nsec += after.tv_nsec;
+  while (sleeptimeabs.tv_nsec >= 1000000000)
+    {
+      ++sleeptimeabs.tv_sec;
+      sleeptimeabs.tv_nsec -= 1000000000;
+    }
+  e = clock_nanosleep (clock, TIMER_ABSTIME, &sleeptimeabs, NULL);
+  if (e != 0)
+    {
+      printf ("absolute clock_nanosleep on %s CPU clock: %s\n",
+	      which, strerror (e));
+      *bad = 1;
+      return diff;
+    }
+
+  struct timespec afterabs;
+  if (clock_gettime (clock, &afterabs) < 0)
+    {
+      printf ("clock_gettime on %s CPU clock %lx => %s\n",
+	      which, (unsigned long int) clock, strerror (errno));
+      *bad = 1;
+      return diff;
+    }
+
+  unsigned long long int sleepdiff = tsdiff (&sleeptimeabs, &afterabs);
+  if (sleepdiff > sleeptime.tv_nsec)
+    {
+      printf ("\
+absolute clock_nanosleep on %s %llu past target (outside reasonable range)\n",
+	      which, sleepdiff);
+      *bad = 1;
+    }
+
+  unsigned long long int diffabs = tsdiff (&after, &afterabs);
+  if (diffabs < sleeptime.tv_nsec || diffabs > sleeptime.tv_nsec * 2)
+    {
+      printf ("\
+absolute clock_nanosleep on %s slept %llu (outside reasonable range)\n",
+	      which, diffabs);
+      *bad = 1;
+    }
+
+  return diff + diffabs;
+}
+
+
+
+static int
+do_test (void)
+{
+  int result = 0;
+  clockid_t process_clock, th_clock, my_thread_clock;
+  int e;
+  pthread_t th;
+
+  e = clock_getcpuclockid (0, &process_clock);
+  if (e != 0)
+    {
+      printf ("clock_getcpuclockid on self => %s\n", strerror (e));
+      return 1;
+    }
+
+  e = pthread_getcpuclockid (pthread_self (), &my_thread_clock);
+  if (e != 0)
+    {
+      printf ("pthread_getcpuclockid on self => %s\n", strerror (e));
+      return 1;
+    }
+
+  /* This is a kludge.  This test fails if the semantics of thread and
+     process clocks are wrong.  The old code using hp-timing without kernel
+     support has bogus semantics if there are context switches.  We don't
+     fail to report failure when the proper functionality is not available
+     in the kernel.  It so happens that Linux kernels without correct CPU
+     clock support also lack CPU timer support, so we use use that to guess
+     that we are using the bogus code and not test it.  */
+  timer_t t;
+  if (timer_create (my_thread_clock, NULL, &t) != 0)
+    {
+      printf ("timer_create: %m\n");
+      puts ("No support for CPU clocks with good semantics, skipping test");
+      return 0;
+    }
+  timer_delete (t);
+
+
+  pthread_barrier_init (&barrier, NULL, 2);
+
+  e = pthread_create (&th, NULL, chew_cpu, NULL);
+  if (e != 0)
+    {
+      printf ("pthread_create: %s\n", strerror (e));
+      return 1;
+    }
+
+  e = pthread_getcpuclockid (th, &th_clock);
+  if (e == ENOENT || e == ENOSYS || e == ENOTSUP)
+    {
+      puts ("pthread_getcpuclockid does not support other threads");
+      return 1;
+    }
+
+  pthread_barrier_wait (&barrier);
+
+  struct timespec res;
+  if (clock_getres (th_clock, &res) < 0)
+    {
+      printf ("clock_getres on live thread clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      result = 1;
+      return 1;
+    }
+  printf ("live thread clock %lx resolution %ju.%.9ju\n",
+	  (unsigned long int) th_clock,
+	  (uintmax_t) res.tv_sec, (uintmax_t) res.tv_nsec);
+
+  struct timespec process_before, process_after;
+  if (clock_gettime (process_clock, &process_before) < 0)
+    {
+      printf ("clock_gettime on process clock %lx => %s\n",
+	      (unsigned long int) process_clock, strerror (errno));
+      return 1;
+    }
+
+  struct timespec before, after;
+  if (clock_gettime (th_clock, &before) < 0)
+    {
+      printf ("clock_gettime on live thread clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      return 1;
+    }
+  printf ("live thread before sleep => %ju.%.9ju\n",
+	  (uintmax_t) before.tv_sec, (uintmax_t) before.tv_nsec);
+
+  struct timespec me_before, me_after;
+  if (clock_gettime (my_thread_clock, &me_before) < 0)
+    {
+      printf ("clock_gettime on self thread clock %lx => %s\n",
+	      (unsigned long int) my_thread_clock, strerror (errno));
+      return 1;
+    }
+  printf ("self thread before sleep => %ju.%.9ju\n",
+	  (uintmax_t) me_before.tv_sec, (uintmax_t) me_before.tv_nsec);
+
+  struct timespec sleeptime = { .tv_nsec = 500000000 };
+  if (nanosleep (&sleeptime, NULL) != 0)
+    {
+      perror ("nanosleep");
+      return 1;
+    }
+
+  if (clock_gettime (th_clock, &after) < 0)
+    {
+      printf ("clock_gettime on live thread clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      return 1;
+    }
+  printf ("live thread after sleep => %ju.%.9ju\n",
+	  (uintmax_t) after.tv_sec, (uintmax_t) after.tv_nsec);
+
+  if (clock_gettime (process_clock, &process_after) < 0)
+    {
+      printf ("clock_gettime on process clock %lx => %s\n",
+	      (unsigned long int) process_clock, strerror (errno));
+      return 1;
+    }
+
+  if (clock_gettime (my_thread_clock, &me_after) < 0)
+    {
+      printf ("clock_gettime on self thread clock %lx => %s\n",
+	      (unsigned long int) my_thread_clock, strerror (errno));
+      return 1;
+    }
+  printf ("self thread after sleep => %ju.%.9ju\n",
+	  (uintmax_t) me_after.tv_sec, (uintmax_t) me_after.tv_nsec);
+
+  unsigned long long int th_diff = tsdiff (&before, &after);
+  unsigned long long int pdiff = tsdiff (&process_before, &process_after);
+  unsigned long long int my_diff = tsdiff (&me_before, &me_after);
+
+  if (th_diff < 100000000 || th_diff > 600000000)
+    {
+      printf ("live thread before - after %llu outside reasonable range\n",
+	      th_diff);
+      result = 1;
+    }
+
+  if (my_diff > 100000000)
+    {
+      printf ("self thread before - after %llu outside reasonable range\n",
+	      my_diff);
+      result = 1;
+    }
+
+  if (pdiff < th_diff)
+    {
+      printf ("process before - after %llu outside reasonable range (%llu)\n",
+	      pdiff, th_diff);
+      result = 1;
+    }
+
+  process_after.tv_nsec += test_nanosleep (th_clock, "live thread",
+					   &after, &result);
+  process_after.tv_nsec += test_nanosleep (process_clock, "process",
+					   &process_after, &result);
+  test_nanosleep (CLOCK_PROCESS_CPUTIME_ID,
+		  "PROCESS_CPUTIME_ID", &process_after, &result);
+
+  pthread_cancel (th);
+
+  e = clock_nanosleep (CLOCK_THREAD_CPUTIME_ID, 0, &sleeptime, NULL);
+  if (e != EINVAL)
+    {
+      printf ("clock_nanosleep CLOCK_THREAD_CPUTIME_ID: %s\n",
+	      strerror (e));
+      result = 1;
+    }
+
+  return result;
+}
+# define TIMEOUT 8
+# define TEST_FUNCTION do_test ()
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-cputimer1.c b/ap/libc/glibc/glibc-2.22/rt/tst-cputimer1.c
new file mode 100644
index 0000000..8f5dd76
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-cputimer1.c
@@ -0,0 +1,68 @@
+/* Tests for POSIX timer implementation using process CPU clock.  */
+
+#include <unistd.h>
+
+#if _POSIX_THREADS && defined _POSIX_CPUTIME
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <time.h>
+#include <pthread.h>
+
+#define TEST_CLOCK CLOCK_PROCESS_CPUTIME_ID
+#define TEST_CLOCK_MISSING(clock) \
+  (setup_test () ? "process CPU clock timer support" : NULL)
+
+/* This function is intended to rack up both user and system time.  */
+static void *
+chew_cpu (void *arg)
+{
+  while (1)
+    {
+      static volatile char buf[4096];
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xaa;
+      int nullfd = open ("/dev/null", O_WRONLY);
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xbb;
+      write (nullfd, (char *) buf, sizeof buf);
+      close (nullfd);
+    }
+
+  return NULL;
+}
+
+static int
+setup_test (void)
+{
+  /* Test timers on our own process CPU clock by having a worker thread
+     eating CPU.  First make sure we can make such timers at all.  */
+
+  timer_t t;
+  if (timer_create (TEST_CLOCK, NULL, &t) != 0)
+    {
+      printf ("timer_create: %m\n");
+      return 1;
+    }
+  timer_delete (t);
+
+  pthread_t th;
+  int e = pthread_create (&th, NULL, chew_cpu, NULL);
+  if (e != 0)
+    {
+      printf ("pthread_create: %s\n", strerror (e));
+      exit (1);
+    }
+
+  return 0;
+}
+
+#else
+# define TEST_CLOCK_MISSING(clock) "process clocks"
+#endif
+
+#include "tst-timer4.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-cputimer2.c b/ap/libc/glibc/glibc-2.22/rt/tst-cputimer2.c
new file mode 100644
index 0000000..397d799
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-cputimer2.c
@@ -0,0 +1,83 @@
+/* Tests for POSIX timer implementation using thread CPU clock.  */
+
+#include <unistd.h>
+
+#if _POSIX_THREADS && defined _POSIX_CPUTIME
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <time.h>
+#include <pthread.h>
+
+static clockid_t worker_thread_clock;
+
+#define TEST_CLOCK worker_thread_clock
+#define TEST_CLOCK_MISSING(clock) \
+  (setup_test () ? "thread CPU clock timer support" : NULL)
+
+/* This function is intended to rack up both user and system time.  */
+static void *
+chew_cpu (void *arg)
+{
+  while (1)
+    {
+      static volatile char buf[4096];
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xaa;
+      int nullfd = open ("/dev/null", O_WRONLY);
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xbb;
+      write (nullfd, (char *) buf, sizeof buf);
+      close (nullfd);
+    }
+
+  return NULL;
+}
+
+static int
+setup_test (void)
+{
+  /* Test timers on a thread CPU clock by having a worker thread eating
+     CPU.  First make sure we can make such timers at all.  */
+
+  pthread_t th;
+  int e = pthread_create (&th, NULL, chew_cpu, NULL);
+  if (e != 0)
+    {
+      printf ("pthread_create: %s\n", strerror (e));
+      exit (1);
+    }
+
+  e = pthread_getcpuclockid (th, &worker_thread_clock);
+  if (e == EPERM || e == ENOENT || e == ENOTSUP)
+    {
+      puts ("pthread_getcpuclockid does not support other threads");
+      return 1;
+    }
+  if (e != 0)
+    {
+      printf ("pthread_getcpuclockid: %s\n", strerror (e));
+      exit (1);
+    }
+
+  timer_t t;
+  if (timer_create (TEST_CLOCK, NULL, &t) != 0)
+    {
+      printf ("timer_create: %m\n");
+      return 1;
+    }
+  timer_delete (t);
+
+  return 0;
+}
+
+#else
+# define TEST_CLOCK_MISSING(clock) "process clocks"
+#endif
+
+#include "tst-timer4.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-cputimer3.c b/ap/libc/glibc/glibc-2.22/rt/tst-cputimer3.c
new file mode 100644
index 0000000..056766a
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-cputimer3.c
@@ -0,0 +1,130 @@
+/* Tests for POSIX timer implementation using another process's CPU clock.  */
+
+#include <unistd.h>
+
+#if _POSIX_THREADS && defined _POSIX_CPUTIME
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <time.h>
+#include <signal.h>
+#include <sys/wait.h>
+
+static clockid_t child_clock;
+
+#define TEST_CLOCK child_clock
+#define TEST_CLOCK_MISSING(clock) \
+  (setup_test () ? "other-process CPU clock timer support" : NULL)
+
+/* This function is intended to rack up both user and system time.  */
+static void
+chew_cpu (void)
+{
+  while (1)
+    {
+      static volatile char buf[4096];
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xaa;
+      int nullfd = open ("/dev/null", O_WRONLY);
+      for (int i = 0; i < 100; ++i)
+	for (size_t j = 0; j < sizeof buf; ++j)
+	  buf[j] = 0xbb;
+      write (nullfd, (char *) buf, sizeof buf);
+      close (nullfd);
+      if (getppid () == 1)
+	_exit (2);
+    }
+}
+
+static pid_t child;
+static void
+cleanup_child (void)
+{
+  if (child <= 0)
+    return;
+  if (kill (child, SIGKILL) < 0 && errno != ESRCH)
+    printf ("cannot kill child %d: %m\n", child);
+  else
+    {
+      int status;
+      errno = 0;
+      if (waitpid (child, &status, 0) != child)
+	printf ("waitpid %d: %m\n", child);
+    }
+}
+#define CLEANUP_HANDLER cleanup_child ()
+
+static int
+setup_test (void)
+{
+  /* Test timers on a process CPU clock by having a child process eating
+     CPU.  First make sure we can make such timers at all.  */
+
+  int pipefd[2];
+  if (pipe (pipefd) < 0)
+    {
+      printf ("pipe: %m\n");
+      exit (1);
+    }
+
+  child = fork ();
+
+  if (child == 0)
+    {
+      char c;
+      close (pipefd[1]);
+      if (read (pipefd[0], &c, 1) == 1)
+	chew_cpu ();
+      _exit (1);
+    }
+
+  if (child < 0)
+    {
+      printf ("fork: %m\n");
+      exit (1);
+    }
+
+  atexit (&cleanup_child);
+
+  close (pipefd[0]);
+
+  int e = clock_getcpuclockid (child, &child_clock);
+  if (e == EPERM)
+    {
+      puts ("clock_getcpuclockid does not support other processes");
+      return 1;
+    }
+  if (e != 0)
+    {
+      printf ("clock_getcpuclockid: %s\n", strerror (e));
+      exit (1);
+    }
+
+  timer_t t;
+  if (timer_create (TEST_CLOCK, NULL, &t) != 0)
+    {
+      printf ("timer_create: %m\n");
+      return 1;
+    }
+  timer_delete (t);
+
+  /* Get the child started chewing.  */
+  if (write (pipefd[1], "x", 1) != 1)
+    {
+      printf ("write to pipe: %m\n");
+      return 1;
+    }
+  close (pipefd[1]);
+
+  return 0;
+}
+
+#else
+# define TEST_CLOCK_MISSING(clock) "process clocks"
+#endif
+
+#include "tst-timer4.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-mqueue.h b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue.h
new file mode 100644
index 0000000..4ff7f85
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue.h
@@ -0,0 +1,83 @@
+/* Common code for message queue passing tests.
+   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <mqueue.h>
+#include <search.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+static int temp_mq_fd;
+
+/* Add temporary files in list.  */
+static void
+__attribute__ ((unused))
+add_temp_mq (const char *name)
+{
+  struct iovec iov[2];
+  iov[0].iov_base = (char *) name;
+  iov[0].iov_len = strlen (name);
+  iov[1].iov_base = (char *) "\n";
+  iov[1].iov_len = 1;
+  if (writev (temp_mq_fd, iov, 2) != iov[0].iov_len + 1)
+    printf ("Could not record temp mq filename %s\n", name);
+}
+
+/* Delete all temporary message queues.  */
+static void
+do_cleanup (void)
+{
+  if (lseek (temp_mq_fd, 0, SEEK_SET) != 0)
+    return;
+
+  FILE *f = fdopen (temp_mq_fd, "r");
+  if (f == NULL)
+    return;
+
+  char *line = NULL;
+  size_t n = 0;
+  ssize_t rets;
+  while ((rets = getline (&line, &n, f)) > 0)
+    {
+      if (line[rets - 1] != '\n')
+        continue;
+
+      line[rets - 1] = '\0';
+      mq_unlink (line);
+    }
+  fclose (f);
+}
+
+static void
+do_prepare (void)
+{
+  char name [] = "/tmp/tst-mqueueN.XXXXXX";
+  temp_mq_fd = mkstemp (name);
+  if (temp_mq_fd == -1)
+    {
+      printf ("Could not create temporary file %s: %m\n", name);
+      exit (1);
+    }
+  unlink (name);
+}
+
+#define PREPARE(argc, argv) do_prepare ()
+#define CLEANUP_HANDLER	do_cleanup ()
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-mqueue1.c b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue1.c
new file mode 100644
index 0000000..a7270c9
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue1.c
@@ -0,0 +1,418 @@
+/* Test message queue passing.
+   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <fcntl.h>
+#include <mqueue.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+#include <stdint.h>
+#include "tst-mqueue.h"
+
+static int
+intcmp (const void *a, const void *b)
+{
+  if (*(unsigned char *)a < *(unsigned char *)b)
+    return 1;
+  if (*(unsigned char *)a > *(unsigned char *)b)
+    return -1;
+  return 0;
+}
+
+static int
+check_attrs (struct mq_attr *attr, int nonblock, long cnt)
+{
+  int result = 0;
+
+  if (attr->mq_maxmsg != 10 || attr->mq_msgsize != 1)
+    {
+      printf ("attributes don't match those passed to mq_open\n"
+	      "mq_maxmsg %jd, mq_msgsize %jd\n",
+	      (intmax_t) attr->mq_maxmsg, (intmax_t) attr->mq_msgsize);
+      result = 1;
+    }
+
+  if ((attr->mq_flags & O_NONBLOCK) != nonblock)
+    {
+      printf ("mq_flags %jx != %x\n",
+	      (intmax_t) (attr->mq_flags & O_NONBLOCK), nonblock);
+      result = 1;
+    }
+
+  if (attr->mq_curmsgs != cnt)
+    {
+      printf ("mq_curmsgs %jd != %ld\n", (intmax_t) attr->mq_curmsgs, cnt);
+      result = 1;
+    }
+
+  return result;
+}
+
+static int
+do_one_test (mqd_t q, const char *name, int nonblock)
+{
+  int result = 0;
+
+  unsigned char v []
+    = { 0x32, 0x62, 0x22, 0x31, 0x11, 0x73, 0x61, 0x21, 0x72, 0x71, 0x81 };
+
+  struct mq_attr attr;
+  memset (&attr, 0xaa, sizeof (attr));
+  if (mq_getattr (q, &attr) != 0)
+    {
+      printf ("mq_getattr failed: %m\n");
+      result = 1;
+    }
+  else
+    result |= check_attrs (&attr, nonblock, 0);
+
+  if (mq_receive (q, (char *) &v[0], 1, NULL) != -1)
+    {
+      puts ("mq_receive on O_WRONLY mqd_t unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_receive on O_WRONLY mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  struct timespec ts;
+  if (clock_gettime (CLOCK_REALTIME, &ts) == 0)
+    --ts.tv_sec;
+  else
+    {
+      ts.tv_sec = time (NULL) - 1;
+      ts.tv_nsec = 0;
+    }
+
+  int ret;
+  for (int i = 0; i < 10; ++i)
+    {
+      if (i & 1)
+	ret = mq_send (q, (char *) &v[i], 1, v[i] >> 4);
+      else
+	ret = mq_timedsend (q, (char *) &v[i], 1, v[i] >> 4, &ts);
+
+      if (ret)
+	{
+	  printf ("mq_%ssend failed: %m\n", (i & 1) ? "" : "timed");
+	  result = 1;
+	}
+    }
+
+  ret = mq_timedsend (q, (char *) &v[10], 1, 8, &ts);
+  if (ret != -1)
+    {
+      puts ("mq_timedsend on full queue did not fail");
+      result = 1;
+    }
+  else if (errno != (nonblock ? EAGAIN : ETIMEDOUT))
+    {
+      printf ("mq_timedsend on full queue did not fail with %s: %m\n",
+	      nonblock ? "EAGAIN" : "ETIMEDOUT");
+      result = 1;
+    }
+
+  if (nonblock)
+    {
+      ret = mq_send (q, (char *) &v[10], 1, 8);
+      if (ret != -1)
+	{
+	  puts ("mq_send on full non-blocking queue did not fail");
+	  result = 1;
+	}
+      else if (errno != EAGAIN)
+	{
+	  printf ("mq_send on full non-blocking queue did not fail"
+		  "with EAGAIN: %m\n");
+	  result = 1;
+	}
+    }
+
+  memset (&attr, 0xaa, sizeof (attr));
+  if (mq_getattr (q, &attr) != 0)
+    {
+      printf ("mq_getattr failed: %m\n");
+      result = 1;
+    }
+  else
+    result |= check_attrs (&attr, nonblock, 10);
+
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      printf ("fork failed: %m\n");
+      result = 1;
+    }
+  else if (pid == 0)
+    {
+      result = 0;
+
+      if (mq_close (q) != 0)
+	{
+	  printf ("mq_close in child failed: %m\n");
+	  result = 1;
+	}
+
+      q = mq_open (name, O_RDONLY | nonblock);
+      if (q == (mqd_t) -1)
+        {
+	  printf ("mq_open in child failed: %m\n");
+	  exit (1);
+        }
+
+      memset (&attr, 0xaa, sizeof (attr));
+      if (mq_getattr (q, &attr) != 0)
+	{
+	  printf ("mq_getattr failed: %m\n");
+	  result = 1;
+	}
+      else
+	result |= check_attrs (&attr, nonblock, 10);
+
+      unsigned char vr[11] = { };
+      unsigned int prio;
+      ssize_t rets;
+
+      if (mq_send (q, (char *) &v[0], 1, 1) != -1)
+	{
+	  puts ("mq_send on O_RDONLY mqd_t unexpectedly succeeded");
+	  result = 1;
+	}
+      else if (errno != EBADF)
+	{
+	  printf ("mq_send on O_WRONLY mqd_t did not fail with EBADF: %m\n");
+	  result = 1;
+	}
+
+      for (int i = 0; i < 10; ++i)
+	{
+	  if (i & 1)
+	    rets = mq_receive (q, (char *) &vr[i], 1, &prio);
+	  else
+	    rets = mq_timedreceive (q, (char *) &vr[i], 1, &prio, &ts);
+
+	  if (rets != 1)
+	    {
+	      if (rets == -1)
+		printf ("mq_%sreceive failed: %m\n", (i & 1) ? "" : "timed");
+	      else
+		printf ("mq_%sreceive returned %zd != 1\n",
+			(i & 1) ? "" : "timed", rets);
+	      result = 1;
+	    }
+	  else if (prio != (unsigned int) vr[i] >> 4)
+	    {
+	      printf ("unexpected priority %x for value %02x\n", prio,
+		      vr[i]);
+	      result = 1;
+	    }
+	}
+
+      qsort (v, 10, 1, intcmp);
+      if (memcmp (v, vr, 10) != 0)
+	{
+	  puts ("messages not received in expected order");
+	  result = 1;
+	}
+
+      rets = mq_timedreceive (q, (char *) &vr[10], 1, &prio, &ts);
+      if (rets != -1)
+	{
+	  puts ("mq_timedreceive on empty queue did not fail");
+	  result = 1;
+	}
+      else if (errno != (nonblock ? EAGAIN : ETIMEDOUT))
+	{
+	  printf ("mq_timedreceive on empty queue did not fail with %s: %m\n",
+		  nonblock ? "EAGAIN" : "ETIMEDOUT");
+	  result = 1;
+	}
+
+      if (nonblock)
+	{
+	  ret = mq_receive (q, (char *) &vr[10], 1, &prio);
+	  if (ret != -1)
+	    {
+	      puts ("mq_receive on empty non-blocking queue did not fail");
+	      result = 1;
+	    }
+	  else if (errno != EAGAIN)
+	    {
+	      printf ("mq_receive on empty non-blocking queue did not fail"
+		      "with EAGAIN: %m\n");
+	      result = 1;
+	    }
+	}
+
+      memset (&attr, 0xaa, sizeof (attr));
+      if (mq_getattr (q, &attr) != 0)
+	{
+	  printf ("mq_getattr failed: %m\n");
+	  result = 1;
+	}
+      else
+	result |= check_attrs (&attr, nonblock, 0);
+
+      if (mq_close (q) != 0)
+	{
+	  printf ("mq_close in child failed: %m\n");
+	  result = 1;
+	}
+
+      exit (result);
+    }
+
+  int status;
+  if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid)
+    {
+      printf ("waitpid failed: %m\n");
+      kill (pid, SIGKILL);
+      result = 1;
+    }
+  else if (!WIFEXITED (status) || WEXITSTATUS (status))
+    {
+      printf ("child failed: %d\n", status);
+      result = 1;
+    }
+
+  memset (&attr, 0xaa, sizeof (attr));
+  if (mq_getattr (q, &attr) != 0)
+    {
+      printf ("mq_getattr failed: %m\n");
+      result = 1;
+    }
+  else
+    result |= check_attrs (&attr, nonblock, 0);
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+
+  char name[sizeof "/tst-mqueue1-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue1-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 10, .mq_msgsize = 1 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_WRONLY, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return result;
+    }
+  else
+    add_temp_mq (name);
+
+  result |= do_one_test (q, name, 0);
+
+  mqd_t q2 = mq_open (name, O_WRONLY | O_NONBLOCK);
+  if (q2 == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      q2 = q;
+      result = 1;
+    }
+  else
+    {
+      if (mq_close (q) != 0)
+	{
+	  printf ("mq_close in parent failed: %m\n");
+	  result = 1;
+	}
+
+      q = q2;
+      result |= do_one_test (q, name, O_NONBLOCK);
+
+      if (mq_getattr (q, &attr) != 0)
+	{
+	  printf ("mq_getattr failed: %m\n");
+	  result = 1;
+	}
+      else
+	{
+	  attr.mq_flags ^= O_NONBLOCK;
+
+	  struct mq_attr attr2;
+	  memset (&attr2, 0x55, sizeof (attr2));
+	  if (mq_setattr (q, &attr, &attr2) != 0)
+	    {
+	      printf ("mq_setattr failed: %m\n");
+	      result = 1;
+	    }
+	  else if (attr.mq_flags != (attr2.mq_flags ^ O_NONBLOCK)
+		   || attr.mq_maxmsg != attr2.mq_maxmsg
+		   || attr.mq_msgsize != attr2.mq_msgsize
+		   || attr.mq_curmsgs != 0
+		   || attr2.mq_curmsgs != 0)
+	    {
+	      puts ("mq_setattr returned unexpected values in *omqstat");
+	      result = 1;
+	    }
+	  else
+	    {
+	      result |= do_one_test (q, name, 0);
+
+	      if (mq_setattr (q, &attr2, NULL) != 0)
+		{
+		  printf ("mq_setattr failed: %m\n");
+		  result = 1;
+		}
+	      else
+		result |= do_one_test (q, name, O_NONBLOCK);
+	    }
+	}
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close in parent failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q) != -1)
+    {
+      puts ("second mq_close did not fail");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("second mq_close did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-mqueue2.c b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue2.c
new file mode 100644
index 0000000..78ec4c8
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue2.c
@@ -0,0 +1,476 @@
+/* Test message queue passing.
+   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <fcntl.h>
+#include <mqueue.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+#include "tst-mqueue.h"
+
+static void
+alrm_handler (int sig)
+{
+}
+
+#define TIMEOUT 10
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+
+  char name[sizeof "/tst-mqueue2-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue2-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 2, .mq_msgsize = 2 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return result;
+    }
+  else
+    add_temp_mq (name);
+
+  mqd_t q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+  if (q2 != (mqd_t) -1)
+    {
+      puts ("mq_open with O_EXCL unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EEXIST)
+    {
+      printf ("mq_open did not fail with EEXIST: %m\n");
+      result = 1;
+    }
+
+  char name2[sizeof "/tst-mqueue2-2-" + sizeof (pid_t) * 3];
+  snprintf (name2, sizeof (name2), "/tst-mqueue2-2-%u", getpid ());
+
+  attr.mq_maxmsg = -2;
+  q2 = mq_open (name2, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+  if (q2 != (mqd_t) -1)
+    {
+      puts ("mq_open with invalid mq_maxmsg unexpectedly succeeded");
+      add_temp_mq (name2);
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("mq_open with invalid mq_maxmsg did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  attr.mq_maxmsg = 2;
+  attr.mq_msgsize = -56;
+  q2 = mq_open (name2, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+  if (q2 != (mqd_t) -1)
+    {
+      puts ("mq_open with invalid mq_msgsize unexpectedly succeeded");
+      add_temp_mq (name2);
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("mq_open with invalid mq_msgsize did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  char buf[3];
+  struct timespec ts;
+  if (clock_gettime (CLOCK_REALTIME, &ts) == 0)
+    ts.tv_sec += 10;
+  else
+    {
+      ts.tv_sec = time (NULL) + 10;
+      ts.tv_nsec = 0;
+    }
+
+  if (mq_timedreceive (q, buf, 1, NULL, &ts) == 0)
+    {
+      puts ("mq_timedreceive with too small msg_len did not fail");
+      result = 1;
+    }
+  else if (errno != EMSGSIZE)
+    {
+      printf ("mq_timedreceive with too small msg_len did not fail with "
+	      "EMSGSIZE: %m\n");
+      result = 1;
+    }
+
+  ts.tv_nsec = -1;
+  if (mq_timedreceive (q, buf, 2, NULL, &ts) == 0)
+    {
+      puts ("mq_timedreceive with negative tv_nsec did not fail");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("mq_timedreceive with negative tv_nsec did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  ts.tv_nsec = 1000000000;
+  if (mq_timedreceive (q, buf, 2, NULL, &ts) == 0)
+    {
+      puts ("mq_timedreceive with tv_nsec >= 1000000000 did not fail");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("mq_timedreceive with tv_nsec >= 1000000000 did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  struct sigaction sa = { .sa_handler = alrm_handler, .sa_flags = 0 };
+  sigemptyset (&sa.sa_mask);
+  sigaction (SIGALRM, &sa, NULL);
+
+  struct itimerval it = { .it_value = { .tv_sec = 1 } };
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  if (mq_receive (q, buf, 2, NULL) == 0)
+    {
+      puts ("mq_receive on empty queue did not block");
+      result = 1;
+    }
+  else if (errno != EINTR)
+    {
+      printf ("mq_receive on empty queue did not fail with EINTR: %m\n");
+      result = 1;
+    }
+
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  ts.tv_nsec = 0;
+  if (mq_timedreceive (q, buf, 2, NULL, &ts) == 0)
+    {
+      puts ("mq_timedreceive on empty queue did not block");
+      result = 1;
+    }
+  else if (errno != EINTR)
+    {
+      printf ("mq_timedreceive on empty queue did not fail with EINTR: %m\n");
+      result = 1;
+    }
+
+  buf[0] = '6';
+  buf[1] = '7';
+  if (mq_send (q, buf, 2, 3) != 0
+      || (buf[0] = '8', mq_send (q, buf, 1, 4) != 0))
+    {
+      printf ("mq_send failed: %m\n");
+      result = 1;
+    }
+
+  memset (buf, ' ', sizeof (buf));
+
+  unsigned int prio;
+  ssize_t rets = mq_receive (q, buf, 3, &prio);
+  if (rets != 1)
+    {
+      if (rets == -1)
+	printf ("mq_receive failed: %m\n");
+      else
+	printf ("mq_receive returned %zd != 1\n", rets);
+      result = 1;
+    }
+  else if (prio != 4 || memcmp (buf, "8  ", 3) != 0)
+    {
+      printf ("mq_receive prio %u (4) buf \"%c%c%c\" (\"8  \")\n",
+	      prio, buf[0], buf[1], buf[2]);
+      result = 1;
+    }
+
+  rets = mq_receive (q, buf, 2, NULL);
+  if (rets != 2)
+    {
+      if (rets == -1)
+	printf ("mq_receive failed: %m\n");
+      else
+	printf ("mq_receive returned %zd != 2\n", rets);
+      result = 1;
+    }
+  else if (memcmp (buf, "67 ", 3) != 0)
+    {
+      printf ("mq_receive buf \"%c%c%c\" != \"67 \"\n",
+	      buf[0], buf[1], buf[2]);
+      result = 1;
+    }
+
+  buf[0] = '2';
+  buf[1] = '1';
+  if (clock_gettime (CLOCK_REALTIME, &ts) != 0)
+    ts.tv_sec = time (NULL);
+  ts.tv_nsec = -1000000001;
+  if ((mq_timedsend (q, buf, 2, 5, &ts) != 0
+       && (errno != EINVAL || mq_send (q, buf, 2, 5) != 0))
+      || (buf[0] = '3', ts.tv_nsec = -ts.tv_nsec,
+	  (mq_timedsend (q, buf, 1, 4, &ts) != 0
+	   && (errno != EINVAL || mq_send (q, buf, 1, 4) != 0))))
+    {
+      printf ("mq_timedsend failed: %m\n");
+      result = 1;
+    }
+
+  buf[0] = '-';
+  ts.tv_nsec = 1000000001;
+  if (mq_timedsend (q, buf, 1, 6, &ts) == 0)
+    {
+      puts ("mq_timedsend with tv_nsec >= 1000000000 did not fail");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("mq_timedsend with tv_nsec >= 1000000000 did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  ts.tv_nsec = -2;
+  if (mq_timedsend (q, buf, 1, 6, &ts) == 0)
+    {
+      puts ("mq_timedsend with negative tv_nsec did not fail");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("mq_timedsend with megatove tv_nsec did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  if (mq_send (q, buf, 2, 8) == 0)
+    {
+      puts ("mq_send on full queue did not block");
+      result = 1;
+    }
+  else if (errno != EINTR)
+    {
+      printf ("mq_send on full queue did not fail with EINTR: %m\n");
+      result = 1;
+    }
+
+  setitimer (ITIMER_REAL, &it, NULL);
+
+  ts.tv_sec += 10;
+  ts.tv_nsec = 0;
+  if (mq_timedsend (q, buf, 2, 7, &ts) == 0)
+    {
+      puts ("mq_timedsend on full queue did not block");
+      result = 1;
+    }
+  else if (errno != EINTR)
+    {
+      printf ("mq_timedsend on full queue did not fail with EINTR: %m\n");
+      result = 1;
+    }
+
+  memset (buf, ' ', sizeof (buf));
+
+  if (clock_gettime (CLOCK_REALTIME, &ts) != 0)
+    ts.tv_sec = time (NULL);
+  ts.tv_nsec = -1000000001;
+  rets = mq_timedreceive (q, buf, 2, &prio, &ts);
+  if (rets == -1 && errno == EINVAL)
+    rets = mq_receive (q, buf, 2, &prio);
+  if (rets != 2)
+    {
+      if (rets == -1)
+	printf ("mq_timedreceive failed: %m\n");
+      else
+	printf ("mq_timedreceive returned %zd != 2\n", rets);
+      result = 1;
+    }
+  else if (prio != 5 || memcmp (buf, "21 ", 3) != 0)
+    {
+      printf ("mq_timedreceive prio %u (5) buf \"%c%c%c\" (\"21 \")\n",
+	      prio, buf[0], buf[1], buf[2]);
+      result = 1;
+    }
+
+  if (mq_receive (q, buf, 1, NULL) == 0)
+    {
+      puts ("mq_receive with too small msg_len did not fail");
+      result = 1;
+    }
+  else if (errno != EMSGSIZE)
+    {
+      printf ("mq_receive with too small msg_len did not fail with "
+	      "EMSGSIZE: %m\n");
+      result = 1;
+    }
+
+  ts.tv_nsec = -ts.tv_nsec;
+  rets = mq_timedreceive (q, buf, 2, NULL, &ts);
+  if (rets == -1 && errno == EINVAL)
+    rets = mq_receive (q, buf, 2, NULL);
+  if (rets != 1)
+    {
+      if (rets == -1)
+	printf ("mq_timedreceive failed: %m\n");
+      else
+	printf ("mq_timedreceive returned %zd != 1\n", rets);
+      result = 1;
+    }
+  else if (memcmp (buf, "31 ", 3) != 0)
+    {
+      printf ("mq_timedreceive buf \"%c%c%c\" != \"31 \"\n",
+	      buf[0], buf[1], buf[2]);
+      result = 1;
+    }
+
+  if (mq_send (q, "", 0, 2) != 0)
+    {
+      printf ("mq_send with msg_len 0 failed: %m\n");
+      result = 1;
+    }
+
+  rets = mq_receive (q, buf, 2, &prio);
+  if (rets)
+    {
+      if (rets == -1)
+	printf ("mq_receive failed: %m\n");
+      else
+	printf ("mq_receive returned %zd != 0\n", rets);
+      result = 1;
+    }
+
+  long mq_prio_max = sysconf (_SC_MQ_PRIO_MAX);
+  if (mq_prio_max > 0 && (unsigned int) mq_prio_max == mq_prio_max)
+    {
+      if (mq_send (q, buf, 1, mq_prio_max) == 0)
+	{
+	  puts ("mq_send with MQ_PRIO_MAX priority unpexpectedly succeeded");
+	  result = 1;
+	}
+      else if (errno != EINVAL)
+	{
+	  printf ("mq_send with MQ_PRIO_MAX priority did not fail with "
+		  "EINVAL: %m\n");
+	  result = 1;
+	}
+
+      if (mq_send (q, buf, 1, mq_prio_max - 1) != 0)
+	{
+	  printf ("mq_send with MQ_PRIO_MAX-1 priority failed: %m\n");
+	  result = 1;
+	}
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed: %m\n");
+      result = 1;
+    }
+
+  q2 = mq_open (name, O_RDWR);
+  if (q2 != (mqd_t) -1)
+    {
+      printf ("mq_open of unlinked %s without O_CREAT unexpectedly"
+	      "succeeded\n", name);
+      result = 1;
+    }
+  else if (errno != ENOENT)
+    {
+      printf ("mq_open of unlinked %s without O_CREAT did not fail with "
+	      "ENOENT: %m\n", name);
+      result = 1;
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close in parent failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_receive (q, buf, 2, NULL) == 0)
+    {
+      puts ("mq_receive on invalid mqd_t did not fail");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_receive on invalid mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  if (mq_send (q, buf, 1, 2) == 0)
+    {
+      puts ("mq_send on invalid mqd_t did not fail");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_send on invalid mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  if (mq_getattr (q, &attr) == 0)
+    {
+      puts ("mq_getattr on invalid mqd_t did not fail");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_getattr on invalid mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  memset (&attr, 0, sizeof (attr));
+  if (mq_setattr (q, &attr, NULL) == 0)
+    {
+      puts ("mq_setattr on invalid mqd_t did not fail");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_setattr on invalid mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  if (mq_unlink ("/tst-mqueue2-which-should-never-exist") != -1)
+    {
+      puts ("mq_unlink of non-existant message queue unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != ENOENT)
+    {
+      printf ("mq_unlink of non-existant message queue did not fail with "
+	      "ENOENT: %m\n");
+      result = 1;
+    }
+  return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-mqueue3.c b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue3.c
new file mode 100644
index 0000000..ef20632
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue3.c
@@ -0,0 +1,243 @@
+/* Test SIGEV_THREAD handling for POSIX message queues.
+   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   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 <mqueue.h>
+#include <signal.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#if _POSIX_THREADS
+# include <pthread.h>
+
+static pid_t pid;
+static mqd_t m;
+static const char message[] = "hello";
+
+# define MAXMSG 10
+# define MSGSIZE 10
+# define UNIQUE 42
+
+
+static void
+fct (union sigval s)
+{
+  /* Put the mq in non-blocking mode.  */
+  struct mq_attr attr;
+  if (mq_getattr (m, &attr) != 0)
+    {
+      printf ("%s: mq_getattr failed: %m\n", __FUNCTION__);
+      exit (1);
+    }
+  attr.mq_flags |= O_NONBLOCK;
+  if (mq_setattr (m, &attr, NULL) != 0)
+    {
+      printf ("%s: mq_setattr failed: %m\n", __FUNCTION__);
+      exit (1);
+    }
+
+  /* Check the values.  */
+  if (attr.mq_maxmsg != MAXMSG)
+    {
+      printf ("%s: mq_maxmsg wrong: is %jd, expecte %d\n",
+	      __FUNCTION__, (intmax_t) attr.mq_maxmsg, MAXMSG);
+      exit (1);
+    }
+  if (attr.mq_msgsize != MAXMSG)
+    {
+      printf ("%s: mq_msgsize wrong: is %jd, expecte %d\n",
+	      __FUNCTION__, (intmax_t) attr.mq_msgsize, MSGSIZE);
+      exit (1);
+    }
+
+  /* Read the message.  */
+  char buf[attr.mq_msgsize];
+  ssize_t n = TEMP_FAILURE_RETRY (mq_receive (m, buf, attr.mq_msgsize, NULL));
+  if (n != sizeof (message))
+    {
+      printf ("%s: length of message wrong: is %zd, expected %zu\n",
+	      __FUNCTION__, n, sizeof (message));
+      exit (1);
+    }
+  if (memcmp (buf, message, sizeof (message)) != 0)
+    {
+      printf ("%s: message wrong: is \"%s\", expected \"%s\"\n",
+	      __FUNCTION__, buf, message);
+      exit (1);
+    }
+
+  exit (UNIQUE);
+}
+
+
+int
+do_test (void)
+{
+  char tmpfname[] = "/tmp/tst-mqueue3-barrier.XXXXXX";
+  int fd = mkstemp (tmpfname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      return 1;
+    }
+
+  /* Make sure it is always removed.  */
+  unlink (tmpfname);
+
+  /* Create one page of data.  */
+  size_t ps = sysconf (_SC_PAGESIZE);
+  char data[ps];
+  memset (data, '\0', ps);
+
+  /* Write the data to the file.  */
+  if (write (fd, data, ps) != (ssize_t) ps)
+    {
+      puts ("short write");
+      return 1;
+    }
+
+  void *mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    {
+      printf ("mmap failed: %m\n");
+      return 1;
+    }
+
+  pthread_barrier_t *b;
+  b = (pthread_barrier_t *) (((uintptr_t) mem + __alignof (pthread_barrier_t))
+                             & ~(__alignof (pthread_barrier_t) - 1));
+
+  pthread_barrierattr_t a;
+  if (pthread_barrierattr_init (&a) != 0)
+    {
+      puts ("barrierattr_init failed");
+      return 1;
+    }
+
+  if (pthread_barrierattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("barrierattr_setpshared failed, could not test");
+      return 0;
+    }
+
+  if (pthread_barrier_init (b, &a, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_barrierattr_destroy (&a) != 0)
+    {
+      puts ("barrierattr_destroy failed");
+      return 1;
+    }
+
+  /* Name for the message queue.  */
+  char mqname[sizeof ("/tst-mqueue3-") + 3 * sizeof (pid_t)];
+  snprintf (mqname, sizeof (mqname) - 1, "/tst-mqueue3-%ld",
+	    (long int) getpid ());
+
+  /* Create the message queue.  */
+  struct mq_attr attr = { .mq_maxmsg = MAXMSG, .mq_msgsize = MSGSIZE };
+  m = mq_open (mqname, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+  if (m == -1)
+    {
+      if (errno == ENOSYS)
+	{
+	  puts ("not implemented");
+	  return 0;
+	}
+
+      puts ("mq_open failed");
+      return 1;
+    }
+
+  /* Unlink the message queue right away.  */
+  if (mq_unlink (mqname) != 0)
+    {
+      puts ("mq_unlink failed");
+      return 1;
+    }
+
+  pid = fork ();
+  if (pid == -1)
+    {
+      puts ("fork failed");
+      return 1;
+    }
+  if (pid == 0)
+    {
+      /* Request notification via thread.  */
+      struct sigevent ev;
+      ev.sigev_notify = SIGEV_THREAD;
+      ev.sigev_notify_function = fct;
+      ev.sigev_value.sival_ptr = NULL;
+      ev.sigev_notify_attributes = NULL;
+
+      /* Tell the kernel.  */
+      if (mq_notify (m,&ev) != 0)
+	{
+	  puts ("mq_notify failed");
+	  exit (1);
+	}
+
+      /* Tell the parent we are ready.  */
+      (void) pthread_barrier_wait (b);
+
+      /* Make sure the process goes away eventually.  */
+      alarm (10);
+
+      /* Do nothing forever.  */
+      while (1)
+	pause ();
+    }
+
+  /* Wait for the child process to register to notification method.  */
+  (void) pthread_barrier_wait (b);
+
+  /* Send the message.  */
+  if (mq_send (m, message, sizeof (message), 1) != 0)
+    {
+      kill (pid, SIGKILL);
+      puts ("mq_send failed");
+      return 1;
+    }
+
+  int r;
+  if (TEMP_FAILURE_RETRY (waitpid (pid, &r, 0)) != pid)
+    {
+      kill (pid, SIGKILL);
+      puts ("waitpid failed");
+      return 1;
+    }
+
+  return WIFEXITED (r) && WEXITSTATUS (r) == UNIQUE ? 0 : 1;
+}
+# define TEST_FUNCTION do_test ()
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-mqueue4.c b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue4.c
new file mode 100644
index 0000000..294b85f
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue4.c
@@ -0,0 +1,289 @@
+/* Test message queue passing.
+   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <fcntl.h>
+#include <mqueue.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+#include "tst-mqueue.h"
+
+#define TIMEOUT 4
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+
+  char name[sizeof "/tst-mqueue4-" + sizeof (pid_t) * 3 + NAME_MAX];
+  char *p;
+  p = name + snprintf (name, sizeof (name), "/tst-mqueue4-%u", getpid ());
+  struct mq_attr attr = { .mq_maxmsg = 2, .mq_msgsize = 2 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return result;
+    }
+  else
+    add_temp_mq (name);
+
+  *p = '.';
+  memset (p + 1, 'x', NAME_MAX + 1 - (p - name));
+  name[NAME_MAX + 1] = '\0';
+
+  mqd_t q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+  if (q2 == (mqd_t) -1)
+    {
+      printf ("mq_open with NAME_MAX long name compoment failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q2) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  name[NAME_MAX + 1] = 'x';
+  name[NAME_MAX + 2] = '\0';
+  q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+  if (q2 != (mqd_t) -1)
+    {
+      puts ("mq_open with too long name component unexpectedly succeeded");
+      mq_unlink (name);
+      mq_close (q2);
+      result = 1;
+    }
+  else if (errno != ENAMETOOLONG)
+    {
+      printf ("mq_open with too long name component did not fail with "
+	      "ENAMETOOLONG: %m\n");
+      result = 1;
+    }
+
+  if (mq_unlink (name) == 0)
+    {
+      puts ("mq_unlink with too long name component unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != ENAMETOOLONG)
+    {
+      printf ("mq_unlink with too long name component did not fail with "
+	      "ENAMETOOLONG: %m\n");
+      result = 1;
+    }
+
+  *p = '\0';
+  attr.mq_maxmsg = 1;
+  attr.mq_msgsize = 3;
+  q2 = mq_open (name, O_CREAT | O_RDWR, 0600, &attr);
+  if (q2 == (mqd_t) -1)
+    {
+      printf ("mq_open without O_EXCL failed with %m\n");
+      result = 1;
+    }
+
+  char buf[3];
+  strcpy (buf, "jk");
+  if (mq_send (q, buf, 2, 4) != 0)
+    {
+      printf ("mq_send failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_send (q, buf + 1, 1, 5) != 0)
+    {
+      printf ("mq_send failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_getattr (q2, &attr) != 0)
+    {
+      printf ("mq_getattr failed: %m\n");
+      result = 1;
+    }
+
+  if ((attr.mq_flags & O_NONBLOCK)
+      || attr.mq_maxmsg != 2
+      || attr.mq_msgsize != 2
+      || attr.mq_curmsgs != 2)
+    {
+      printf ("mq_getattr returned unexpected { .mq_flags = %jd,\n"
+	      ".mq_maxmsg = %jd, .mq_msgsize = %jd, .mq_curmsgs = %jd }\n",
+	      (intmax_t) attr.mq_flags, (intmax_t) attr.mq_maxmsg,
+	      (intmax_t) attr.mq_msgsize, (intmax_t) attr.mq_curmsgs);
+      result = 1;
+    }
+
+  struct timespec ts;
+  if (clock_gettime (CLOCK_REALTIME, &ts) == 0)
+    ++ts.tv_sec;
+  else
+    {
+      ts.tv_sec = time (NULL) + 1;
+      ts.tv_nsec = 0;
+    }
+
+  if (mq_timedsend (q2, buf, 1, 1, &ts) == 0)
+    {
+      puts ("mq_timedsend unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != ETIMEDOUT)
+    {
+      printf ("mq_timedsend did not fail with ETIMEDOUT: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q2) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  q2 = mq_open (name, O_RDONLY, 0600);
+  if (q2 == (mqd_t) -1)
+    {
+      printf ("mq_open without O_CREAT failed with %m\n");
+      result = 1;
+    }
+
+  mqd_t q3 = mq_open (name, O_RDONLY, 0600);
+  if (q3 == (mqd_t) -1)
+    {
+      printf ("mq_open without O_CREAT failed with %m\n");
+      result = 1;
+    }
+
+  memset (buf, ' ', sizeof (buf));
+
+  unsigned int prio;
+  ssize_t rets = mq_receive (q2, buf, 2, &prio);
+  if (rets != 1)
+    {
+      if (rets == -1)
+	printf ("mq_receive failed with: %m\n");
+      else
+	printf ("mq_receive returned %zd != 1\n", rets);
+      result = 1;
+    }
+  else if (prio != 5 || memcmp (buf, "k  ", 3) != 0)
+    {
+      printf ("mq_receive returned prio %u (2) buf \"%c%c%c\" (\"k  \")\n",
+	      prio, buf[0], buf[1], buf[2]);
+      result = 1;
+    }
+
+  if (mq_getattr (q3, &attr) != 0)
+    {
+      printf ("mq_getattr failed: %m\n");
+      result = 1;
+    }
+
+  if ((attr.mq_flags & O_NONBLOCK)
+      || attr.mq_maxmsg != 2
+      || attr.mq_msgsize != 2
+      || attr.mq_curmsgs != 1)
+    {
+      printf ("mq_getattr returned unexpected { .mq_flags = %jd,\n"
+	      ".mq_maxmsg = %jd, .mq_msgsize = %jd, .mq_curmsgs = %jd }\n",
+	      (intmax_t) attr.mq_flags, (intmax_t) attr.mq_maxmsg,
+	      (intmax_t) attr.mq_msgsize, (intmax_t) attr.mq_curmsgs);
+      result = 1;
+    }
+
+  rets = mq_receive (q3, buf, 2, NULL);
+  if (rets != 2)
+    {
+      if (rets == -1)
+	printf ("mq_receive failed with: %m\n");
+      else
+	printf ("mq_receive returned %zd != 2\n", rets);
+      result = 1;
+    }
+  else if (memcmp (buf, "jk ", 3) != 0)
+    {
+      printf ("mq_receive returned buf \"%c%c%c\" != \"jk \"\n",
+	      buf[0], buf[1], buf[2]);
+      result = 1;
+    }
+
+  if (clock_gettime (CLOCK_REALTIME, &ts) == 0)
+    ++ts.tv_sec;
+  else
+    {
+      ts.tv_sec = time (NULL) + 1;
+      ts.tv_nsec = 0;
+    }
+
+  if (mq_timedreceive (q2, buf, 2, NULL, &ts) != -1)
+    {
+      puts ("mq_timedreceive on empty queue unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != ETIMEDOUT)
+    {
+      printf ("mq_timedreceive on empty queue did not fail with "
+	      "ETIMEDOUT: %m\n");
+      result = 1;
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q2) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q3) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-mqueue5.c b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue5.c
new file mode 100644
index 0000000..6000f72
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue5.c
@@ -0,0 +1,1013 @@
+/* Test mq_notify.
+   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <fcntl.h>
+#include <mqueue.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+#include "tst-mqueue.h"
+
+#define TIMEOUT 3
+
+#if _POSIX_THREADS && defined SIGRTMIN && defined SA_SIGINFO
+# include <pthread.h>
+
+volatile int rtmin_cnt;
+volatile pid_t rtmin_pid;
+volatile uid_t rtmin_uid;
+volatile int rtmin_code;
+volatile union sigval rtmin_sigval;
+
+static void
+rtmin_handler (int sig, siginfo_t *info, void *ctx)
+{
+  if (sig != SIGRTMIN)
+    abort ();
+  ++rtmin_cnt;
+  rtmin_pid = info->si_pid;
+  rtmin_uid = info->si_uid;
+  rtmin_code = info->si_code;
+  rtmin_sigval = info->si_value;
+}
+
+#define mqsend(q) (mqsend) (q, __LINE__)
+static int
+(mqsend) (mqd_t q, int line)
+{
+  char c;
+  if (mq_send (q, &c, 1, 1) != 0)
+    {
+      printf ("mq_send on line %d failed with: %m\n", line);
+      return 1;
+    }
+  return 0;
+}
+
+#define mqrecv(q) (mqrecv) (q, __LINE__)
+static int
+(mqrecv) (mqd_t q, int line)
+{
+  char c;
+  ssize_t rets = TEMP_FAILURE_RETRY (mq_receive (q, &c, 1, NULL));
+  if (rets != 1)
+    {
+      if (rets == -1)
+	printf ("mq_receive on line %d failed with: %m\n", line);
+      else
+	printf ("mq_receive on line %d returned %zd != 1\n",
+		line, rets);
+      return 1;
+    }
+  return 0;
+}
+
+struct thr_data
+{
+  const char *name;
+  pthread_barrier_t *b3;
+  mqd_t q;
+};
+
+static void *
+thr (void *arg)
+{
+  pthread_barrier_t *b3 = ((struct thr_data *)arg)->b3;
+  mqd_t q = ((struct thr_data *)arg)->q;
+  const char *name = ((struct thr_data *)arg)->name;
+  int result = 0;
+
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been sent.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  if (rtmin_cnt != 2)
+    {
+      puts ("SIGRTMIN signal in child did not arrive");
+      result = 1;
+    }
+  else if (rtmin_pid != getppid ()
+	   || rtmin_uid != getuid ()
+	   || rtmin_code != SI_MESGQ
+	   || rtmin_sigval.sival_int != 0xdeadbeef)
+    {
+      printf ("unexpected siginfo_t fields: pid %u (%u), uid %u (%u), code %d (%d), si_int %d (%d)\n",
+	      rtmin_pid, getppid (), rtmin_uid, getuid (),
+	      rtmin_code, SI_MESGQ, rtmin_sigval.sival_int, 0xdeadbeef);
+      result = 1;
+    }
+
+  struct sigevent ev;
+  memset (&ev, 0x82, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("mq_notify in thread (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("mq_notify in thread (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child calls mq_notify (q, { SIGEV_SIGNAL }).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("second mq_notify in thread (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should not trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been received.  */
+  /* Child calls mq_notify (q, { SIGEV_SIGNAL }).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  mqd_t q4 = mq_open (name, O_RDONLY);
+  if (q4 == (mqd_t) -1)
+    {
+      printf ("mq_open in thread failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q4, NULL) != 0)
+    {
+      printf ("mq_notify in thread (q4, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q4) != 0)
+    {
+      printf ("mq_close in thread failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should not trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been received.  */
+  /* Child calls mq_notify (q, { SIGEV_SIGNAL }).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  mqd_t q5 = mq_open (name, O_WRONLY);
+  if (q5 == (mqd_t) -1)
+    {
+      printf ("mq_open O_WRONLY in thread failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q5, NULL) != 0)
+    {
+      printf ("mq_notify in thread (q5, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q5) != 0)
+    {
+      printf ("mq_close in thread failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should not trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been received.  */
+
+  return (void *) (long) result;
+}
+
+static void
+do_child (const char *name, pthread_barrier_t *b2, pthread_barrier_t *b3,
+	  mqd_t q)
+{
+  int result = 0;
+
+  struct sigevent ev;
+  memset (&ev, 0x55, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_ptr = &ev;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("first mq_notify in child (q, { SIGEV_SIGNAL }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("first mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent calls mqsend (q), which makes notification available.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  rtmin_cnt = 0;
+
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("second mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (rtmin_cnt != 0)
+    {
+      puts ("SIGRTMIN signal in child caught too early");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent unsuccessfully attempts to mq_notify.  */
+  /* Parent calls mqsend (q), which makes notification available
+     and triggers a signal in the child.  */
+  /* Parent successfully calls mq_notify SIGEV_SIGNAL.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  if (rtmin_cnt != 1)
+    {
+      puts ("SIGRTMIN signal in child did not arrive");
+      result = 1;
+    }
+  else if (rtmin_pid != getppid ()
+	   || rtmin_uid != getuid ()
+	   || rtmin_code != SI_MESGQ
+	   || rtmin_sigval.sival_ptr != &ev)
+    {
+      printf ("unexpected siginfo_t fields: pid %u (%u), uid %u (%u), code %d (%d), si_ptr %p (%p)\n",
+	      rtmin_pid, getppid (), rtmin_uid, getuid (),
+	      rtmin_code, SI_MESGQ, rtmin_sigval.sival_ptr, &ev);
+      result = 1;
+    }
+
+  result |= mqsend (q);
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent verifies caught SIGRTMIN.  */
+
+  mqd_t q2 = mq_open (name, O_RDWR);
+  if (q2 == (mqd_t) -1)
+    {
+      printf ("mq_open in child failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent mq_open's another mqd_t for the same queue (q3).  */
+
+  memset (&ev, 0x11, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_ptr = &ev;
+  if (mq_notify (q2, &ev) != 0)
+    {
+      printf ("mq_notify in child (q2, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent unsuccessfully attempts to mq_notify { SIGEV_NONE } on q.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  if (mq_close (q2) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent successfully calls mq_notify { SIGEV_NONE } on q3.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  memset (&ev, 0xbb, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_ptr = &b2;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("third mq_notify in child (q, { SIGEV_SIGNAL }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("third mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent calls mq_close on q3, which makes the queue available again for
+     notification.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  memset (&ev, 0x13, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("mq_notify in child (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("mq_notify in child (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  struct thr_data thr_data = { .name = name, .b3 = b3, .q = q };
+  pthread_t th;
+  int ret = pthread_create (&th, NULL, thr, &thr_data);
+  if (ret)
+    {
+      errno = ret;
+      printf ("pthread_created failed with: %m\n");
+      result = 1;
+    }
+
+  /* Wait till thr calls mq_receive on the empty queue q and blocks on it.  */
+  sleep (1);
+
+  memset (&ev, 0x5f, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_int = 0xdeadbeef;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("fourth mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Parent calls mqsend (q), which should wake up mqrecv (q)
+     in the thread but no notification should be sent.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  if (rtmin_cnt != 1)
+    {
+      puts ("SIGRTMIN signal caught while thr was blocked on mq_receive");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread verifies SIGRTMIN has been received.  */
+  /* Thread calls mq_notify (q, { SIGEV_NONE }) to verify notification is now
+     available for registration.  */
+  /* Thread calls mq_notify (q, NULL).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  memset (&ev, 0x6a, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_ptr = do_child;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("fifth mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread calls mq_notify (q, NULL), which should unregister the above
+     notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should not trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  if (rtmin_cnt != 2)
+    {
+      puts ("SIGRTMIN signal caught while notification has been disabled");
+      result = 1;
+    }
+
+  memset (&ev, 0x7b, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_ptr = thr;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("sixth mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread opens a new O_RDONLY mqd_t (q4).  */
+  /* Thread calls mq_notify (q4, NULL), which should unregister the above
+     notification.  */
+  /* Thread calls mq_close (q4).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should not trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  if (rtmin_cnt != 2)
+    {
+      puts ("SIGRTMIN signal caught while notification has been disabled");
+      result = 1;
+    }
+
+  memset (&ev, 0xe1, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_int = 127;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("seventh mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread opens a new O_WRONLY mqd_t (q5).  */
+  /* Thread calls mq_notify (q5, NULL), which should unregister the above
+     notification.  */
+  /* Thread calls mq_close (q5).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Parent calls mqsend (q), which should not trigger notification.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  if (rtmin_cnt != 2)
+    {
+      puts ("SIGRTMIN signal caught while notification has been disabled");
+      result = 1;
+    }
+
+ void *thr_ret;
+  ret = pthread_join (th, &thr_ret);
+  if (ret)
+    {
+      errno = ret;
+      printf ("pthread_join failed: %m\n");
+      result = 1;
+    }
+  else if (thr_ret)
+    result = 1;
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  exit (result);
+}
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+
+  char tmpfname[] = "/tmp/tst-mqueue5-barrier.XXXXXX";
+  int fd = mkstemp (tmpfname);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      return 1;
+    }
+
+  /* Make sure it is always removed.  */
+  unlink (tmpfname);
+
+  /* Create one page of data.  */
+  size_t ps = sysconf (_SC_PAGESIZE);
+  char data[ps];
+  memset (data, '\0', ps);
+
+  /* Write the data to the file.  */
+  if (write (fd, data, ps) != (ssize_t) ps)
+    {
+      puts ("short write");
+      return 1;
+    }
+
+  void *mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    {
+      printf ("mmap failed: %m\n");
+      return 1;
+    }
+
+  pthread_barrier_t *b2;
+  b2 = (pthread_barrier_t *) (((uintptr_t) mem + __alignof (pthread_barrier_t))
+			      & ~(__alignof (pthread_barrier_t) - 1));
+
+  pthread_barrier_t *b3;
+  b3 = b2 + 1;
+
+  pthread_barrierattr_t a;
+  if (pthread_barrierattr_init (&a) != 0)
+    {
+      puts ("barrierattr_init failed");
+      return 1;
+    }
+
+  if (pthread_barrierattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0)
+    {
+      puts ("barrierattr_setpshared failed, could not test");
+      return 0;
+    }
+
+  if (pthread_barrier_init (b2, &a, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_barrier_init (b3, &a, 3) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (pthread_barrierattr_destroy (&a) != 0)
+    {
+      puts ("barrierattr_destroy failed");
+      return 1;
+    }
+
+  char name[sizeof "/tst-mqueue5-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue5-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = 1 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return result;
+    }
+  else
+    add_temp_mq (name);
+
+  struct sigevent ev;
+  memset (&ev, 0xaa, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("second mq_notify (q, { SIGEV_NONE }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("second mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  result |= mqsend (q);
+
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("third mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  result |= mqrecv (q);
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("mq_notify (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      /* Implementation-defined behaviour, so don't fail,
+	 just inform.  */
+      printf ("second mq_notify (q, NULL) failed with: %m\n");
+    }
+
+  struct sigaction sa = { .sa_sigaction = rtmin_handler,
+			  .sa_flags = SA_SIGINFO };
+  sigemptyset (&sa.sa_mask);
+  sigaction (SIGRTMIN, &sa, NULL);
+
+  memset (&ev, 0x55, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_int = 26;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  ev.sigev_value.sival_ptr = &ev;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("second mq_notify (q, { SIGEV_SIGNAL }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("second mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (rtmin_cnt != 0)
+    {
+      puts ("SIGRTMIN signal caught too early");
+      result = 1;
+    }
+
+  result |= mqsend (q);
+
+  if (rtmin_cnt != 1)
+    {
+      puts ("SIGRTMIN signal did not arrive");
+      result = 1;
+    }
+  else if (rtmin_pid != getpid ()
+	   || rtmin_uid != getuid ()
+	   || rtmin_code != SI_MESGQ
+	   || rtmin_sigval.sival_int != 26)
+    {
+      printf ("unexpected siginfo_t fields: pid %u (%u), uid %u (%u), code %d (%d), si_int %d (26)\n",
+	      rtmin_pid, getpid (), rtmin_uid, getuid (),
+	      rtmin_code, SI_MESGQ, rtmin_sigval.sival_int);
+      result = 1;
+    }
+
+  ev.sigev_value.sival_int = 75;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("third mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  result |= mqrecv (q);
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("mq_notify (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  memset (&ev, 0x33, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("fourth mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  pid_t pid = fork ();
+  if (pid == -1)
+    {
+      printf ("fork () failed: %m\n");
+      mq_unlink (name);
+      return 1;
+    }
+
+  if (pid == 0)
+    do_child (name, b2, b3, q);
+
+  /* Child unsuccessfully attempts to mq_notify.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  result |= mqsend (q);
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child successfully calls mq_notify SIGEV_SIGNAL now.  */
+
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b2);
+
+  memset (&ev, 0xbb, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_int = 15;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("fourth mq_notify (q, { SIGEV_SIGNAL }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("fourth mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  result |= mqsend (q);
+
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("fifth mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (rtmin_cnt != 1)
+    {
+      puts ("SIGRTMIN signal caught too early");
+      result = 1;
+    }
+
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child verifies caught SIGRTMIN signal.  */
+  /* Child calls mq_send (q) which triggers SIGRTMIN signal here.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child mq_open's another mqd_t for the same queue (q2).  */
+
+  if (rtmin_cnt != 2)
+    {
+      puts ("SIGRTMIN signal did not arrive");
+      result = 1;
+    }
+  else if (rtmin_pid != pid
+	   || rtmin_uid != getuid ()
+	   || rtmin_code != SI_MESGQ
+	   || rtmin_sigval.sival_int != 15)
+    {
+      printf ("unexpected siginfo_t fields: pid %u (%u), uid %u (%u), code %d (%d), si_int %d (15)\n",
+	      rtmin_pid, pid, rtmin_uid, getuid (),
+	      rtmin_code, SI_MESGQ, rtmin_sigval.sival_int);
+      result = 1;
+    }
+
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child successfully calls mq_notify { SIGEV_SIGNAL } on q2.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  memset (&ev, 0xbb, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("fifth mq_notify (q, { SIGEV_NONE }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("fifth mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child calls mq_close on q2, which makes the queue available again for
+     notification.  */
+
+  mqd_t q3 = mq_open (name, O_RDWR);
+  if (q3 == (mqd_t) -1)
+    {
+      printf ("mq_open q3 in parent failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  memset (&ev, 0x12, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q3, &ev) != 0)
+    {
+      printf ("mq_notify (q3, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child unsuccessfully attempts to mq_notify { SIGEV_SIGNAL } on q.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  if (mq_close (q3) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child successfully calls mq_notify { SIGEV_NONE } on q.  */
+  /* Child successfully calls mq_notify NULL on q.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  /* Child creates new thread.  */
+  /* Thread blocks on mqrecv (q).  */
+  /* Child sleeps for 1sec so that thread has time to reach that point.  */
+  /* Child successfully calls mq_notify { SIGEV_SIGNAL } on q.  */
+
+  (void) pthread_barrier_wait (b2);
+
+  result |= mqsend (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been sent.  */
+
+  (void) pthread_barrier_wait (b3);
+
+  result |= mqsend (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread verifies SIGRTMIN has been caught.  */
+  /* Thread calls mq_notify (q, { SIGEV_NONE }) to verify notification is now
+     available for registration.  */
+  /* Thread calls mq_notify (q, NULL).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child calls mq_notify (q, { SIGEV_SIGNAL }).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread calls mq_notify (q, NULL). */
+
+  (void) pthread_barrier_wait (b3);
+
+  result |= mqsend (q);
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been sent.  */
+  /* Child calls mq_notify (q, { SIGEV_SIGNAL }).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread opens a new O_RDONLY mqd_t (q4).  */
+  /* Thread calls mq_notify (q4, NULL). */
+  /* Thread calls mq_close (q4).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  result |= mqsend (q);
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been sent.  */
+  /* Child calls mq_notify (q, { SIGEV_SIGNAL }).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Thread opens a new O_WRONLY mqd_t (q5).  */
+  /* Thread calls mq_notify (q5, NULL). */
+  /* Thread calls mq_close (q5).  */
+
+  (void) pthread_barrier_wait (b3);
+
+  result |= mqsend (q);
+  result |= mqrecv (q);
+
+  (void) pthread_barrier_wait (b3);
+
+  /* Child verifies SIGRTMIN has not been sent.  */
+
+  int status;
+  if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid)
+    {
+      puts ("waitpid failed");
+      kill (pid, SIGKILL);
+      result = 1;
+    }
+  else if (!WIFEXITED (status) || WEXITSTATUS (status))
+    {
+      printf ("child failed with status %d\n", status);
+      result = 1;
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, NULL) == 0)
+    {
+      puts ("mq_notify on closed mqd_t unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_notify on closed mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  memset (&ev, 0x55, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("mq_notify on closed mqd_t unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_notify on closed mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  return result;
+}
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-mqueue6.c b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue6.c
new file mode 100644
index 0000000..6cd1ff5
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue6.c
@@ -0,0 +1,304 @@
+/* Test mq_notify.
+   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <fcntl.h>
+#include <mqueue.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+#include "tst-mqueue.h"
+
+#if _POSIX_THREADS
+# include <pthread.h>
+
+# define mqsend(q) (mqsend) (q, __LINE__)
+static int
+(mqsend) (mqd_t q, int line)
+{
+  char c;
+  if (mq_send (q, &c, 1, 1) != 0)
+    {
+      printf ("mq_send on line %d failed with: %m\n", line);
+      return 1;
+    }
+  return 0;
+}
+
+# define mqrecv(q) (mqrecv) (q, __LINE__)
+static int
+(mqrecv) (mqd_t q, int line)
+{
+  char c;
+  ssize_t rets = TEMP_FAILURE_RETRY (mq_receive (q, &c, 1, NULL));
+  if (rets != 1)
+    {
+      if (rets == -1)
+	printf ("mq_receive on line %d failed with: %m\n", line);
+      else
+	printf ("mq_receive on line %d returned %zd != 1\n",
+		line, rets);
+      return 1;
+    }
+  return 0;
+}
+
+volatile int fct_cnt, fct_err;
+size_t fct_guardsize;
+
+static void
+fct (union sigval s)
+{
+  mqd_t q = *(mqd_t *) s.sival_ptr;
+
+  pthread_attr_t nattr;
+  int ret = pthread_getattr_np (pthread_self (), &nattr);
+  if (ret)
+    {
+      errno = ret;
+      printf ("pthread_getattr_np failed: %m\n");
+      fct_err = 1;
+    }
+  else
+    {
+      ret = pthread_attr_getguardsize (&nattr, &fct_guardsize);
+      if (ret)
+	{
+	  errno = ret;
+	  printf ("pthread_attr_getguardsize failed: %m\n");
+	  fct_err = 1;
+	}
+      if (pthread_attr_destroy (&nattr) != 0)
+	{
+	  puts ("pthread_attr_destroy failed");
+	  fct_err = 1;
+	}
+    }
+
+  ++fct_cnt;
+  fct_err |= mqsend (q);
+}
+
+# define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+
+  char name[sizeof "/tst-mqueue6-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue6-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = 1 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return result;
+    }
+  else
+    add_temp_mq (name);
+
+  pthread_attr_t nattr;
+  if (pthread_attr_init (&nattr)
+      || pthread_attr_setguardsize (&nattr, 0))
+    {
+      puts ("pthread_attr_t setup failed");
+      result = 1;
+    }
+
+  fct_guardsize = 1;
+
+  struct sigevent ev;
+  memset (&ev, 0xaa, sizeof (ev));
+  ev.sigev_notify = SIGEV_THREAD;
+  ev.sigev_notify_function = fct;
+  ev.sigev_notify_attributes = &nattr;
+  ev.sigev_value.sival_ptr = &q;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("mq_notify (q, { SIGEV_THREAD }) failed with: %m\n");
+      result = 1;
+    }
+
+  size_t ps = sysconf (_SC_PAGESIZE);
+  if (pthread_attr_setguardsize (&nattr, 32 * ps))
+    {
+      puts ("pthread_attr_t setup failed");
+      result = 1;
+    }
+
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("second mq_notify (q, { SIGEV_NONE }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("second mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (fct_cnt != 0)
+    {
+      printf ("fct called too early (%d on %d)\n", fct_cnt, __LINE__);
+      result = 1;
+    }
+
+  result |= mqsend (q);
+
+  result |= mqrecv (q);
+  result |= mqrecv (q);
+
+  if (fct_cnt != 1)
+    {
+      printf ("fct not called (%d on %d)\n", fct_cnt, __LINE__);
+      result = 1;
+    }
+  else if (fct_guardsize != 0)
+    {
+      printf ("fct_guardsize %zd != 0\n", fct_guardsize);
+      result = 1;
+    }
+
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("third mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("mq_notify (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  memset (&ev, 0x11, sizeof (ev));
+  ev.sigev_notify = SIGEV_THREAD;
+  ev.sigev_notify_function = fct;
+  ev.sigev_notify_attributes = &nattr;
+  ev.sigev_value.sival_ptr = &q;
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("mq_notify (q, { SIGEV_THREAD }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (pthread_attr_setguardsize (&nattr, 0))
+    {
+      puts ("pthread_attr_t setup failed");
+      result = 1;
+    }
+
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("second mq_notify (q, { SIGEV_NONE }) unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBUSY)
+    {
+      printf ("second mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (fct_cnt != 1)
+    {
+      printf ("fct called too early (%d on %d)\n", fct_cnt, __LINE__);
+      result = 1;
+    }
+
+  result |= mqsend (q);
+
+  result |= mqrecv (q);
+  result |= mqrecv (q);
+
+  if (fct_cnt != 2)
+    {
+      printf ("fct not called (%d on %d)\n", fct_cnt, __LINE__);
+      result = 1;
+    }
+  else if (fct_guardsize != 32 * ps)
+    {
+      printf ("fct_guardsize %zd != %zd\n", fct_guardsize, 32 * ps);
+      result = 1;
+    }
+
+  if (mq_notify (q, &ev) != 0)
+    {
+      printf ("third mq_notify (q, { SIGEV_NONE }) failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_notify (q, NULL) != 0)
+    {
+      printf ("mq_notify (q, NULL) failed with: %m\n");
+      result = 1;
+    }
+
+  if (pthread_attr_destroy (&nattr) != 0)
+    {
+      puts ("pthread_attr_destroy failed");
+      result = 1;
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  memset (&ev, 0x55, sizeof (ev));
+  ev.sigev_notify = SIGEV_THREAD;
+  ev.sigev_notify_function = fct;
+  ev.sigev_notify_attributes = NULL;
+  ev.sigev_value.sival_int = 0;
+  if (mq_notify (q, &ev) == 0)
+    {
+      puts ("mq_notify on closed mqd_t unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_notify on closed mqd_t did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  if (fct_err)
+    result = 1;
+  return result;
+}
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-mqueue7.c b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue7.c
new file mode 100644
index 0000000..efea390
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue7.c
@@ -0,0 +1,108 @@
+/* Test all open message queues descriptors are closed during exec*.
+   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <fcntl.h>
+#include <mqueue.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+
+#define OPT_AFTEREXEC 20000
+
+static mqd_t after_exec = (mqd_t) -1;
+
+#define CMDLINE_OPTIONS \
+  { "after-exec", required_argument, NULL, OPT_AFTEREXEC },
+
+#define CMDLINE_PROCESS \
+  case OPT_AFTEREXEC:					\
+    after_exec = (mqd_t) strtoul (optarg, NULL, 0);	\
+    break;
+
+static int
+do_after_exec (void)
+{
+  int result = 0;
+
+  struct mq_attr attr;
+  if (mq_getattr (after_exec, &attr) == 0)
+    {
+      puts ("mq_getattr after exec unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EBADF)
+    {
+      printf ("mq_getattr after exec did not fail with EBADF: %m\n");
+      result = 1;
+    }
+
+  return result;
+}
+
+static int
+do_test (int argc, char **argv)
+{
+  if (after_exec != (mqd_t) -1)
+    return do_after_exec ();
+
+  char name[sizeof "/tst-mqueue7-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue7-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 10, .mq_msgsize = 1 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_WRONLY, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return 0;
+    }
+  else if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed with: %m\n");
+      return 1;
+    }
+
+  if (mq_getattr (q, &attr) != 0)
+    {
+      printf ("mq_getattr failed: %m\n");
+      return 1;
+    }
+
+  char after_exec_arg[sizeof "--after-exec=0x" + sizeof (long) * 3];
+  snprintf (after_exec_arg, sizeof (after_exec_arg),
+	    "--after-exec=0x%lx", (long) q);
+
+  const char *newargv[argc + 2];
+  for (int i = 1; i < argc; ++i)
+    newargv[i - 1] = argv[i];
+  newargv[argc - 1] = "--direct";
+  newargv[argc] = after_exec_arg;
+  newargv[argc + 1] = NULL;
+
+  /* Verify that exec* has the effect of mq_close (q).  */
+  execv (newargv[0], (char * const *) newargv);
+  printf ("execv failed: %m\n");
+  return 1;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-mqueue8.c b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue8.c
new file mode 100644
index 0000000..61bfad0
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue8.c
@@ -0,0 +1,265 @@
+/* Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <mqueue.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#if _POSIX_THREADS
+# include <pthread.h>
+
+static pthread_barrier_t b;
+
+/* Cleanup handling test.  */
+static int cl_called;
+
+static void
+cl (void *arg)
+{
+  ++cl_called;
+}
+
+#define TF_MQ_RECEIVE		0L
+#define TF_MQ_TIMEDRECEIVE	1L
+#define TF_MQ_SEND		2L
+#define TF_MQ_TIMEDSEND		3L
+
+static const char *names[]
+  = { "mq_receive", "mq_timedreceive", "mq_send", "mq_timedsend" };
+
+static mqd_t q;
+static struct timespec never;
+
+static void *
+tf (void *arg)
+{
+  int r = pthread_barrier_wait (&b);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("tf: barrier_wait failed");
+      exit (1);
+    }
+
+  pthread_cleanup_push (cl, NULL);
+
+  char c = ' ';
+
+  switch ((long) arg)
+    {
+    case TF_MQ_SEND:
+      TEMP_FAILURE_RETRY (mq_send (q, &c, 1, 1));
+      break;
+    case TF_MQ_TIMEDSEND:
+      TEMP_FAILURE_RETRY (mq_timedsend (q, &c, 1, 1, &never));
+      break;
+    case TF_MQ_RECEIVE:
+      TEMP_FAILURE_RETRY (mq_receive (q, &c, 1, NULL));
+      break;
+    case TF_MQ_TIMEDRECEIVE:
+      TEMP_FAILURE_RETRY (mq_timedreceive (q, &c, 1, NULL, &never));
+      break;
+    }
+
+  pthread_cleanup_pop (0);
+
+  printf ("tf: %s returned\n", names[(long) arg]);
+
+  exit (1);
+}
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  char name[sizeof "/tst-mqueue8-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue8-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = 1 };
+  q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return 0;
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed with: %m\n");
+      return 1;
+    }
+
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
+  if (clock_gettime (CLOCK_REALTIME, &never) == 0)
+    never.tv_sec += 100;
+  else
+    {
+      never.tv_sec = time (NULL) + 100;
+      never.tv_nsec = 0;
+    }
+
+  int result = 0;
+  for (long l = TF_MQ_RECEIVE; l <= TF_MQ_TIMEDSEND; ++l)
+    {
+      cl_called = 0;
+
+      pthread_t th;
+      if (pthread_create (&th, NULL, tf, (void *) l) != 0)
+	{
+	  printf ("1st %s create failed\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      int r = pthread_barrier_wait (&b);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("barrier_wait failed");
+	  result = 1;
+	  continue;
+	}
+
+      struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 };
+      while (nanosleep (&ts, &ts) != 0)
+	continue;
+
+      printf ("going to cancel %s in-time\n", names[l]);
+      if (pthread_cancel (th) != 0)
+	{
+	  printf ("1st cancel of %s failed\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      void *status;
+      if (pthread_join (th, &status) != 0)
+	{
+	  printf ("1st join of %s failed\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+      if (status != PTHREAD_CANCELED)
+	{
+	  printf ("1st %s thread not canceled\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      if (cl_called == 0)
+	{
+	  printf ("%s cleanup handler not called\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+      if (cl_called > 1)
+	{
+	  printf ("%s cleanup handler called more than once\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      printf ("in-time %s cancellation succeeded\n", names[l]);
+
+      cl_called = 0;
+
+      if (pthread_create (&th, NULL, tf, (void *) l) != 0)
+	{
+	  printf ("2nd %s create failed\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      printf ("going to cancel %s early\n", names[l]);
+      if (pthread_cancel (th) != 0)
+	{
+	  printf ("2nd cancel of %s failed\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      r = pthread_barrier_wait (&b);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  puts ("barrier_wait failed");
+	  result = 1;
+	  continue;
+	}
+
+      if (pthread_join (th, &status) != 0)
+	{
+	  printf ("2nd join of %s failed\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+      if (status != PTHREAD_CANCELED)
+	{
+	  printf ("2nd %s thread not canceled\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      if (cl_called == 0)
+	{
+	  printf ("%s cleanup handler not called\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+      if (cl_called > 1)
+	{
+	  printf ("%s cleanup handler called more than once\n", names[l]);
+	  result = 1;
+	  continue;
+	}
+
+      printf ("early %s cancellation succeeded\n", names[l]);
+
+      if (l == TF_MQ_TIMEDRECEIVE)
+	{
+	  /* mq_receive and mq_timedreceive are tested on empty mq.
+	     For mq_send and mq_timedsend we need to make it full.
+	     If this fails, there is no point in doing further testing.  */
+	  char c = ' ';
+	  if (mq_send (q, &c, 1, 1) != 0)
+	    {
+	      printf ("mq_send failed: %m\n");
+	      result = 1;
+	      break;
+	    }
+	}
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close failed: %m\n");
+      result = 1;
+    }
+
+  return result;
+}
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-mqueue9.c b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue9.c
new file mode 100644
index 0000000..b5a5b3f
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-mqueue9.c
@@ -0,0 +1,91 @@
+/* Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+   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 <mqueue.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "tst-mqueue.h"
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  if (geteuid () != 0)
+    {
+      puts ("this test requires root");
+      return 0;
+    }
+
+  char name[sizeof "/tst-mqueue9-" + sizeof (pid_t) * 3];
+  snprintf (name, sizeof (name), "/tst-mqueue9-%u", getpid ());
+
+  struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = 1 };
+  mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+
+  if (q == (mqd_t) -1)
+    {
+      printf ("mq_open failed with: %m\n");
+      return 0;
+    }
+  else
+    add_temp_mq (name);
+
+  if (seteuid (1) != 0)
+    {
+      printf ("failed to seteuid (1): %m\n");
+      mq_unlink (name);
+      return 0;
+    }
+
+  int result = 0;
+  if (mq_unlink (name) == 0)
+    {
+      puts ("mq_unlink unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EACCES)
+    {
+      printf ("mq_unlink did not fail with EACCES: %m\n");
+      result = 1;;
+    }
+
+  if (seteuid (0) != 0)
+    {
+      printf ("failed to seteuid (0): %m\n");
+      result = 1;
+    }
+
+  if (mq_unlink (name) != 0)
+    {
+      printf ("mq_unlink failed with: %m\n");
+      result = 1;
+    }
+
+  if (mq_close (q) != 0)
+    {
+      printf ("mq_close failed with: %m\n");
+      result = 1;
+    }
+
+  return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-shm.c b/ap/libc/glibc/glibc-2.22/rt/tst-shm.c
new file mode 100644
index 0000000..afa3b18
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-shm.c
@@ -0,0 +1,207 @@
+/* Test program for POSIX shm_* functions.
+   Copyright (C) 2000-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
+
+   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 <error.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+
+/* We want to see output immediately.  */
+#define STDOUT_UNBUFFERED
+
+static void
+worker (int write_now)
+{
+  struct timespec ts;
+  struct stat64 st;
+  int i;
+  int fd = shm_open ("/glibc-shm-test", O_RDWR, 0600);
+
+  if (fd == -1)
+    error (EXIT_FAILURE, 0, "failed to open shared memory object: shm_open");
+
+  char *mem;
+
+  if (fd == -1)
+    exit (fd);
+
+  if (fstat64 (fd, &st) == -1)
+    error (EXIT_FAILURE, 0, "stat failed");
+  if (st.st_size != 4000)
+    error (EXIT_FAILURE, 0, "size incorrect");
+
+  mem = mmap (NULL, 4000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  if (mem == MAP_FAILED)
+    error (EXIT_FAILURE, 0, "mmap failed");
+
+  ts.tv_sec = 0;
+  ts.tv_nsec = 500000000;
+
+  if (write_now)
+    for (i = 0; i <= 4; ++i)
+      mem[i] = i;
+  else
+    /* Wait until the first bytes of the memory region are 0, 1, 2, 3, 4.  */
+    while (1)
+      {
+	for (i = 0; i <= 4; ++i)
+	  if (mem[i] != i)
+	    break;
+
+	if (i > 4)
+	  /* OK, that's done.  */
+	  break;
+
+	nanosleep (&ts, NULL);
+      }
+
+  if (!write_now)
+    for (i = 0; i <= 4; ++i)
+      mem[i] = 4 + i;
+  else
+    /* Wait until the first bytes of the memory region are 4, 5, 6, 7, 8.  */
+    while (1)
+      {
+	for (i = 0; i <= 4; ++i)
+	  if (mem[i] != 4 + i)
+	    break;
+
+	if (i > 4)
+	  /* OK, that's done.  */
+	  break;
+
+	nanosleep (&ts, NULL);
+      }
+
+  if (munmap (mem, 4000) == -1)
+    error (EXIT_FAILURE, errno, "munmap");
+
+  close (fd);
+
+  exit (0);
+}
+
+
+static int
+do_test (void)
+{
+  int fd;
+  pid_t pid1;
+  pid_t pid2;
+  int status1;
+  int status2;
+  struct stat64 st;
+
+  fd = shm_open ("/../escaped", O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600);
+  if (fd != -1)
+    {
+      perror ("read file outside of SHMDIR directory");
+      return 1;
+    }
+
+
+  /* Create the shared memory object.  */
+  fd = shm_open ("/glibc-shm-test", O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600);
+  if (fd == -1)
+    {
+      /* If shm_open is unimplemented we skip the test.  */
+      if (errno == ENOSYS)
+        {
+	  perror ("shm_open unimplemented.  Test skipped.");
+          return 0;
+        }
+      else
+        error (EXIT_FAILURE, 0, "failed to create shared memory object: shm_open");
+    }
+
+  /* Size the object.  We make it 4000 bytes long.  */
+  if (ftruncate (fd, 4000) == -1)
+    {
+      /* This failed.  Must be a bug in the implementation of the
+         shared memory itself.  */
+      perror ("failed to size of shared memory object: ftruncate");
+      close (fd);
+      shm_unlink ("/glibc-shm-test");
+      return 0;
+    }
+
+  if (fstat64 (fd, &st) == -1)
+    {
+      shm_unlink ("/glibc-shm-test");
+      error (EXIT_FAILURE, 0, "initial stat failed");
+    }
+  if (st.st_size != 4000)
+    {
+      shm_unlink ("/glibc-shm-test");
+      error (EXIT_FAILURE, 0, "initial size not correct");
+    }
+
+  /* Spawn to processes which will do the work.  */
+  pid1 = fork ();
+  if (pid1 == 0)
+    worker (0);
+  else if (pid1 == -1)
+    {
+      /* Couldn't create a second process.  */
+      perror ("fork");
+      close (fd);
+      shm_unlink ("/glibc-shm-test");
+      return 0;
+    }
+
+  pid2 = fork ();
+  if (pid2 == 0)
+    worker (1);
+  else if (pid2 == -1)
+    {
+      /* Couldn't create a second process.  */
+      int ignore;
+      perror ("fork");
+      kill (pid1, SIGTERM);
+      waitpid (pid1, &ignore, 0);
+      close (fd);
+      shm_unlink ("/glibc-shm-test");
+      return 0;
+    }
+
+  /* Wait until the two processes are finished.  */
+  waitpid (pid1, &status1, 0);
+  waitpid (pid2, &status2, 0);
+
+  /* Now we can unlink the shared object.  */
+  shm_unlink ("/glibc-shm-test");
+
+  return (!WIFEXITED (status1) || WEXITSTATUS (status1) != 0
+	  || !WIFEXITED (status2) || WEXITSTATUS (status2) != 0);
+}
+#define TEST_FUNCTION do_test ()
+
+#define CLEANUP_HANDLER shm_unlink ("/glibc-shm-test");
+
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-timer.c b/ap/libc/glibc/glibc-2.22/rt/tst-timer.c
new file mode 100644
index 0000000..363f4e1
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-timer.c
@@ -0,0 +1,35 @@
+/* Tests for POSIX timer implementation.  Dummy version.
+   Copyright (C) 2000-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 <unistd.h>
+
+/* This file is only used if there is no other implementation and it should
+   means that there is no implementation of POSIX timers.  */
+static int
+do_test (void)
+{
+#ifdef _POSIX_TIMERS
+  /* There should be a test.  */
+  return 1;
+#else
+  return 0;
+#endif
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-timer2.c b/ap/libc/glibc/glibc-2.22/rt/tst-timer2.c
new file mode 100644
index 0000000..b2ce987
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-timer2.c
@@ -0,0 +1,64 @@
+/* Test for crashing bugs when trying to create too many timers.  */
+
+#include <stdio.h>
+#include <time.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+
+#if _POSIX_THREADS
+# include <pthread.h>
+
+void
+thread (union sigval arg)
+{
+  puts ("Timeout");
+}
+
+int
+do_test (void)
+{
+  int i, res;
+  timer_t timerId;
+  struct itimerspec itval;
+  struct sigevent sigev;
+
+  itval.it_interval.tv_sec = 2;
+  itval.it_interval.tv_nsec = 0;
+  itval.it_value.tv_sec = 2;
+  itval.it_value.tv_nsec = 0;
+
+  sigev.sigev_notify = SIGEV_THREAD;
+  sigev.sigev_notify_function = thread;
+  sigev.sigev_notify_attributes = NULL;
+  sigev.sigev_value.sival_ptr = (void *) &timerId;
+
+  for (i = 0; i < 100; i++)
+    {
+      printf ("cnt = %d\n", i);
+
+      if (timer_create (CLOCK_REALTIME, &sigev, &timerId) < 0)
+	{
+	  perror ("timer_create");
+	  continue;
+	}
+
+      res = timer_settime (timerId, 0, &itval, NULL);
+      if (res < 0)
+	perror ("timer_settime");
+
+      res = timer_delete (timerId);
+      if (res < 0)
+	perror ("timer_delete");
+    }
+
+  return 0;
+}
+
+# define TEST_FUNCTION do_test ()
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-timer3.c b/ap/libc/glibc/glibc-2.22/rt/tst-timer3.c
new file mode 100644
index 0000000..8113f66
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-timer3.c
@@ -0,0 +1,86 @@
+/* Test for bogus per-thread deletion of timers.  */
+
+#include <stdio.h>
+#include <error.h>
+#include <time.h>
+#include <signal.h>
+#include <stdint.h>
+#include <string.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+#if _POSIX_THREADS
+# include <pthread.h>
+
+
+/* Creating timers in another thread should work too.  */
+static void *
+do_timer_create (void *arg)
+{
+  struct sigevent *const sigev = arg;
+  timer_t *const timerId = sigev->sigev_value.sival_ptr;
+  if (timer_create (CLOCK_REALTIME, sigev, timerId) < 0)
+    {
+      printf ("timer_create: %m\n");
+      return NULL;
+    }
+  return timerId;
+}
+
+
+static int
+do_test (void)
+{
+  int i, res;
+  timer_t timerId;
+  struct itimerspec itval;
+  struct sigevent sigev;
+
+  itval.it_interval.tv_sec = 2;
+  itval.it_interval.tv_nsec = 0;
+  itval.it_value.tv_sec = 2;
+  itval.it_value.tv_nsec = 0;
+
+  sigev.sigev_notify = SIGEV_SIGNAL;
+  sigev.sigev_signo = SIGALRM;
+  sigev.sigev_value.sival_ptr = (void *) &timerId;
+
+  for (i = 0; i < 100; i++)
+    {
+      printf ("cnt = %d\n", i);
+
+      pthread_t thr;
+      res = pthread_create (&thr, NULL, &do_timer_create, &sigev);
+      if (res)
+	{
+	  printf ("pthread_create: %s\n", strerror (res));
+	  continue;
+	}
+      void *val;
+      res = pthread_join (thr, &val);
+      if (res)
+	{
+	  printf ("pthread_join: %s\n", strerror (res));
+	  continue;
+	}
+      if (val == NULL)
+	continue;
+
+      res = timer_settime (timerId, 0, &itval, NULL);
+      if (res < 0)
+	printf ("timer_settime: %m\n");
+
+      res = timer_delete (timerId);
+      if (res < 0)
+	printf ("timer_delete: %m\n");
+    }
+
+  return 0;
+}
+
+# define TEST_FUNCTION do_test ()
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-timer4.c b/ap/libc/glibc/glibc-2.22/rt/tst-timer4.c
new file mode 100644
index 0000000..f694e30
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-timer4.c
@@ -0,0 +1,653 @@
+/* Tests for POSIX timer implementation.
+   Copyright (C) 2004-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2004
+
+   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; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <stdint.h>
+#if _POSIX_THREADS && defined SA_SIGINFO
+# include <pthread.h>
+
+# ifndef TEST_CLOCK
+#  define TEST_CLOCK		CLOCK_REALTIME
+# endif
+
+pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+timer_t timer_none, timer_sig1, timer_sig2, timer_thr1, timer_thr2;
+
+int thr1_cnt, thr1_err;
+union sigval thr1_sigval;
+struct timespec thr1_ts;
+
+static void
+thr1 (union sigval sigval)
+{
+  pthread_mutex_lock (&lock);
+  thr1_err = clock_gettime (TEST_CLOCK, &thr1_ts);
+  if (thr1_cnt >= 5)
+    {
+      struct itimerspec it = { };
+      thr1_err |= timer_settime (timer_thr1, 0, &it, NULL);
+    }
+  thr1_sigval = sigval;
+  ++thr1_cnt;
+  pthread_cond_signal (&cond);
+  pthread_mutex_unlock (&lock);
+}
+
+int thr2_cnt, thr2_err;
+union sigval thr2_sigval;
+size_t thr2_guardsize;
+struct timespec thr2_ts;
+
+static void
+thr2 (union sigval sigval)
+{
+  pthread_attr_t nattr;
+  int err = 0;
+  size_t guardsize = -1;
+  int ret = pthread_getattr_np (pthread_self (), &nattr);
+  if (ret)
+    {
+      errno = ret;
+      printf ("*** pthread_getattr_np failed: %m\n");
+      err = 1;
+    }
+  else
+    {
+      ret = pthread_attr_getguardsize (&nattr, &guardsize);
+      if (ret)
+        {
+          errno = ret;
+          printf ("*** pthread_attr_getguardsize failed: %m\n");
+          err = 1;
+        }
+      if (pthread_attr_destroy (&nattr) != 0)
+        {
+          puts ("*** pthread_attr_destroy failed");
+          err = 1;
+        }
+    }
+  pthread_mutex_lock (&lock);
+  thr2_err = clock_gettime (TEST_CLOCK, &thr2_ts) | err;
+  if (thr2_cnt >= 5)
+    {
+      struct itimerspec it = { };
+      thr2_err |= timer_settime (timer_thr2, 0, &it, NULL);
+    }
+  thr2_sigval = sigval;
+  ++thr2_cnt;
+  thr2_guardsize = guardsize;
+  pthread_cond_signal (&cond);
+  pthread_mutex_unlock (&lock);
+}
+
+volatile int sig1_cnt, sig1_err;
+volatile union sigval sig1_sigval;
+struct timespec sig1_ts;
+
+static void
+sig1_handler (int sig, siginfo_t *info, void *ctx)
+{
+  int err = 0;
+  if (sig != SIGRTMIN) err |= 1 << 0;
+  if (info->si_signo != SIGRTMIN) err |= 1 << 1;
+  if (info->si_code != SI_TIMER) err |= 1 << 2;
+  if (clock_gettime (TEST_CLOCK, &sig1_ts) != 0)
+    err |= 1 << 3;
+  if (sig1_cnt >= 5)
+    {
+      struct itimerspec it = { };
+      if (timer_settime (timer_sig1, 0, &it, NULL))
+	err |= 1 << 4;
+    }
+  sig1_err |= err;
+  sig1_sigval = info->si_value;
+  ++sig1_cnt;
+}
+
+volatile int sig2_cnt, sig2_err;
+volatile union sigval sig2_sigval;
+struct timespec sig2_ts;
+
+static void
+sig2_handler (int sig, siginfo_t *info, void *ctx)
+{
+  int err = 0;
+  if (sig != SIGRTMIN + 1) err |= 1 << 0;
+  if (info->si_signo != SIGRTMIN + 1) err |= 1 << 1;
+  if (info->si_code != SI_TIMER) err |= 1 << 2;
+  if (clock_gettime (TEST_CLOCK, &sig2_ts) != 0)
+    err |= 1 << 3;
+  if (sig2_cnt >= 5)
+    {
+      struct itimerspec it = { };
+      if (timer_settime (timer_sig2, 0, &it, NULL))
+	err |= 1 << 4;
+    }
+  sig2_err |= err;
+  sig2_sigval = info->si_value;
+  ++sig2_cnt;
+}
+
+/* Check if end is later or equal to start + nsec.  */
+static int
+check_ts (const char *name, const struct timespec *start,
+	  const struct timespec *end, long msec)
+{
+  struct timespec ts = *start;
+
+  ts.tv_sec += msec / 1000000;
+  ts.tv_nsec += (msec % 1000000) * 1000;
+  if (ts.tv_nsec >= 1000000000)
+    {
+      ++ts.tv_sec;
+      ts.tv_nsec -= 1000000000;
+    }
+  if (end->tv_sec < ts.tv_sec
+      || (end->tv_sec == ts.tv_sec && end->tv_nsec < ts.tv_nsec))
+    {
+      printf ("\
+*** timer %s invoked too soon: %ld.%09jd instead of expected %ld.%09jd\n",
+	      name, (long) end->tv_sec, (intmax_t) end->tv_nsec,
+	      (long) ts.tv_sec, (intmax_t) ts.tv_nsec);
+      return 1;
+    }
+  else
+    return 0;
+}
+
+#define TIMEOUT 15
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  int result = 0;
+
+#ifdef TEST_CLOCK_MISSING
+  const char *missing = TEST_CLOCK_MISSING (TEST_CLOCK);
+  if (missing != NULL)
+    {
+      printf ("%s missing, skipping test\n", missing);
+      return 0;
+    }
+#endif
+
+  struct timespec ts;
+  if (clock_gettime (TEST_CLOCK, &ts) != 0)
+    {
+      printf ("*** clock_gettime failed: %m\n");
+      result = 1;
+    }
+  else
+    printf ("clock_gettime returned timespec = { %ld, %jd }\n",
+	    (long) ts.tv_sec, (intmax_t) ts.tv_nsec);
+
+  if (clock_getres (TEST_CLOCK, &ts) != 0)
+    {
+      printf ("*** clock_getres failed: %m\n");
+      result = 1;
+    }
+  else
+    printf ("clock_getres returned timespec = { %ld, %jd }\n",
+	    (long) ts.tv_sec, (intmax_t) ts.tv_nsec);
+
+  struct sigevent ev;
+  memset (&ev, 0x11, sizeof (ev));
+  ev.sigev_notify = SIGEV_NONE;
+  if (timer_create (TEST_CLOCK, &ev, &timer_none) != 0)
+    {
+      printf ("*** timer_create for timer_none failed: %m\n");
+      return 1;
+    }
+
+  struct sigaction sa = { .sa_sigaction = sig1_handler,
+			  .sa_flags = SA_SIGINFO };
+  sigemptyset (&sa.sa_mask);
+  sigaction (SIGRTMIN, &sa, NULL);
+  sa.sa_sigaction = sig2_handler;
+  sigaction (SIGRTMIN + 1, &sa, NULL);
+
+  memset (&ev, 0x22, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN;
+  ev.sigev_value.sival_ptr = &ev;
+  if (timer_create (TEST_CLOCK, &ev, &timer_sig1) != 0)
+    {
+      printf ("*** timer_create for timer_sig1 failed: %m\n");
+      return 1;
+    }
+
+  memset (&ev, 0x33, sizeof (ev));
+  ev.sigev_notify = SIGEV_SIGNAL;
+  ev.sigev_signo = SIGRTMIN + 1;
+  ev.sigev_value.sival_int = 163;
+  if (timer_create (TEST_CLOCK, &ev, &timer_sig2) != 0)
+    {
+      printf ("*** timer_create for timer_sig2 failed: %m\n");
+      return 1;
+    }
+
+  memset (&ev, 0x44, sizeof (ev));
+  ev.sigev_notify = SIGEV_THREAD;
+  ev.sigev_notify_function = thr1;
+  ev.sigev_notify_attributes = NULL;
+  ev.sigev_value.sival_ptr = &ev;
+  if (timer_create (TEST_CLOCK, &ev, &timer_thr1) != 0)
+    {
+      printf ("*** timer_create for timer_thr1 failed: %m\n");
+      return 1;
+    }
+
+  pthread_attr_t nattr;
+  if (pthread_attr_init (&nattr)
+      || pthread_attr_setguardsize (&nattr, 0))
+    {
+      puts ("*** pthread_attr_t setup failed");
+      result = 1;
+    }
+
+  memset (&ev, 0x55, sizeof (ev));
+  ev.sigev_notify = SIGEV_THREAD;
+  ev.sigev_notify_function = thr2;
+  ev.sigev_notify_attributes = &nattr;
+  ev.sigev_value.sival_int = 111;
+  if (timer_create (TEST_CLOCK, &ev, &timer_thr2) != 0)
+    {
+      printf ("*** timer_create for timer_thr2 failed: %m\n");
+      return 1;
+    }
+
+  int ret = timer_getoverrun (timer_thr1);
+  if (ret != 0)
+    {
+      if (ret == -1)
+	printf ("*** timer_getoverrun failed: %m\n");
+      else
+	printf ("*** timer_getoverrun returned %d != 0\n", ret);
+      result = 1;
+    }
+
+  struct itimerspec it;
+  it.it_value.tv_sec = 0;
+  it.it_value.tv_nsec = -26;
+  it.it_interval.tv_sec = 0;
+  it.it_interval.tv_nsec = 0;
+  if (timer_settime (timer_sig1, 0, &it, NULL) == 0)
+    {
+      puts ("*** timer_settime with negative tv_nsec unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("*** timer_settime with negative tv_nsec did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 100000;
+  it.it_interval.tv_nsec = 1000000000;
+  if (timer_settime (timer_sig2, 0, &it, NULL) == 0)
+    {
+      puts ("\
+*** timer_settime with tv_nsec 1000000000 unexpectedly succeeded");
+      result = 1;
+    }
+  else if (errno != EINVAL)
+    {
+      printf ("*** timer_settime with tv_nsec 1000000000 did not fail with "
+	      "EINVAL: %m\n");
+      result = 1;
+    }
+
+#if 0
+  it.it_value.tv_nsec = 0;
+  it.it_interval.tv_nsec = -26;
+  if (timer_settime (timer_thr1, 0, &it, NULL) != 0)
+    {
+      printf ("\
+!!! timer_settime with it_value 0 it_interval invalid failed: %m\n");
+      /* FIXME: is this mandated by POSIX?
+      result = 1; */
+    }
+
+  it.it_interval.tv_nsec = 3000000000;
+  if (timer_settime (timer_thr2, 0, &it, NULL) != 0)
+    {
+      printf ("\
+!!! timer_settime with it_value 0 it_interval invalid failed: %m\n");
+      /* FIXME: is this mandated by POSIX?
+      result = 1; */
+    }
+#endif
+
+  struct timespec startts;
+  if (clock_gettime (TEST_CLOCK, &startts) != 0)
+    {
+      printf ("*** clock_gettime failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 100000000;
+  it.it_interval.tv_nsec = 0;
+  if (timer_settime (timer_none, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_none failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 200000000;
+  if (timer_settime (timer_thr1, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_thr1 failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 300000000;
+  if (timer_settime (timer_thr2, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_thr2 failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 400000000;
+  if (timer_settime (timer_sig1, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_sig1 failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 500000000;
+  if (TEMP_FAILURE_RETRY (timer_settime (timer_sig2, 0, &it, NULL)) != 0)
+    {
+      printf ("*** timer_settime timer_sig2 failed: %m\n");
+      result = 1;
+    }
+
+  pthread_mutex_lock (&lock);
+  while (thr1_cnt == 0 || thr2_cnt == 0)
+    pthread_cond_wait (&cond, &lock);
+  pthread_mutex_unlock (&lock);
+
+  while (sig1_cnt == 0 || sig2_cnt == 0)
+    {
+      ts.tv_sec = 0;
+      ts.tv_nsec = 100000000;
+      nanosleep (&ts, NULL);
+    }
+
+  pthread_mutex_lock (&lock);
+
+  if (thr1_cnt != 1)
+    {
+      printf ("*** thr1 not called exactly once, but %d times\n", thr1_cnt);
+      result = 1;
+    }
+  else if (thr1_err)
+    {
+      puts ("*** an error occurred in thr1");
+      result = 1;
+    }
+  else if (thr1_sigval.sival_ptr != &ev)
+    {
+      printf ("*** thr1_sigval.sival_ptr %p != %p\n",
+	      thr1_sigval.sival_ptr, &ev);
+      result = 1;
+    }
+  else if (check_ts ("thr1", &startts, &thr1_ts, 200000))
+    result = 1;
+
+  if (thr2_cnt != 1)
+    {
+      printf ("*** thr2 not called exactly once, but %d times\n", thr2_cnt);
+      result = 1;
+    }
+  else if (thr2_err)
+    {
+      puts ("*** an error occurred in thr2");
+      result = 1;
+    }
+  else if (thr2_sigval.sival_int != 111)
+    {
+      printf ("*** thr2_sigval.sival_ptr %d != 111\n", thr2_sigval.sival_int);
+      result = 1;
+    }
+  else if (check_ts ("thr2", &startts, &thr2_ts, 300000))
+    result = 1;
+  else if (thr2_guardsize != 0)
+    {
+      printf ("*** thr2 guardsize %zd != 0\n", thr2_guardsize);
+      result = 1;
+    }
+
+  pthread_mutex_unlock (&lock);
+
+  if (sig1_cnt != 1)
+    {
+      printf ("*** sig1 not called exactly once, but %d times\n", sig1_cnt);
+      result = 1;
+    }
+  else if (sig1_err)
+    {
+      printf ("*** errors occurred in sig1 handler %x\n", sig1_err);
+      result = 1;
+    }
+  else if (sig1_sigval.sival_ptr != &ev)
+    {
+      printf ("*** sig1_sigval.sival_ptr %p != %p\n",
+	      sig1_sigval.sival_ptr, &ev);
+      result = 1;
+    }
+  else if (check_ts ("sig1", &startts, &sig1_ts, 400000))
+    result = 1;
+
+  if (sig2_cnt != 1)
+    {
+      printf ("*** sig2 not called exactly once, but %d times\n", sig2_cnt);
+      result = 1;
+    }
+  else if (sig2_err)
+    {
+      printf ("*** errors occurred in sig2 handler %x\n", sig2_err);
+      result = 1;
+    }
+  else if (sig2_sigval.sival_int != 163)
+    {
+      printf ("*** sig2_sigval.sival_ptr %d != 163\n", sig2_sigval.sival_int);
+      result = 1;
+    }
+  else if (check_ts ("sig2", &startts, &sig2_ts, 500000))
+    result = 1;
+
+  if (timer_gettime (timer_none, &it) != 0)
+    {
+      printf ("*** timer_gettime timer_none failed: %m\n");
+      result = 1;
+    }
+  else if (it.it_value.tv_sec || it.it_value.tv_nsec
+	   || it.it_interval.tv_sec || it.it_interval.tv_nsec)
+    {
+      printf ("\
+*** timer_gettime timer_none returned { %ld.%09jd, %ld.%09jd }\n",
+	      (long) it.it_value.tv_sec, (intmax_t) it.it_value.tv_nsec,
+	      (long) it.it_interval.tv_sec, (intmax_t) it.it_interval.tv_nsec);
+      result = 1;
+    }
+
+  if (clock_gettime (TEST_CLOCK, &startts) != 0)
+    {
+      printf ("*** clock_gettime failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_sec = 1;
+  it.it_value.tv_nsec = 0;
+  it.it_interval.tv_sec = 0;
+  it.it_interval.tv_nsec = 100000000;
+  if (timer_settime (timer_none, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_none failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 100000000;
+  it.it_interval.tv_nsec = 200000000;
+  if (timer_settime (timer_thr1, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_thr1 failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 200000000;
+  it.it_interval.tv_nsec = 300000000;
+  if (timer_settime (timer_thr2, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_thr2 failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 300000000;
+  it.it_interval.tv_nsec = 400000000;
+  if (timer_settime (timer_sig1, 0, &it, NULL) != 0)
+    {
+      printf ("*** timer_settime timer_sig1 failed: %m\n");
+      result = 1;
+    }
+
+  it.it_value.tv_nsec = 400000000;
+  it.it_interval.tv_nsec = 500000000;
+  if (TEMP_FAILURE_RETRY (timer_settime (timer_sig2, 0, &it, NULL)) != 0)
+    {
+      printf ("*** timer_settime timer_sig2 failed: %m\n");
+      result = 1;
+    }
+
+  pthread_mutex_lock (&lock);
+  while (thr1_cnt < 6 || thr2_cnt < 6)
+    pthread_cond_wait (&cond, &lock);
+  pthread_mutex_unlock (&lock);
+
+  while (sig1_cnt < 6 || sig2_cnt < 6)
+    {
+      ts.tv_sec = 0;
+      ts.tv_nsec = 100000000;
+      nanosleep (&ts, NULL);
+    }
+
+  pthread_mutex_lock (&lock);
+
+  if (thr1_err)
+    {
+      puts ("*** an error occurred in thr1");
+      result = 1;
+    }
+  else if (check_ts ("thr1", &startts, &thr1_ts, 1100000 + 4 * 200000))
+    result = 1;
+
+  if (thr2_err)
+    {
+      puts ("*** an error occurred in thr2");
+      result = 1;
+    }
+  else if (check_ts ("thr2", &startts, &thr2_ts, 1200000 + 4 * 300000))
+    result = 1;
+  else if (thr2_guardsize != 0)
+    {
+      printf ("*** thr2 guardsize %zd != 0\n", thr2_guardsize);
+      result = 1;
+    }
+
+  pthread_mutex_unlock (&lock);
+
+  if (sig1_err)
+    {
+      printf ("*** errors occurred in sig1 handler %x\n", sig1_err);
+      result = 1;
+    }
+  else if (check_ts ("sig1", &startts, &sig1_ts, 1300000 + 4 * 400000))
+    result = 1;
+
+  if (sig2_err)
+    {
+      printf ("*** errors occurred in sig2 handler %x\n", sig2_err);
+      result = 1;
+    }
+  else if (check_ts ("sig2", &startts, &sig2_ts, 1400000 + 4 * 500000))
+    result = 1;
+
+  if (timer_gettime (timer_none, &it) != 0)
+    {
+      printf ("*** timer_gettime timer_none failed: %m\n");
+      result = 1;
+    }
+  else if (it.it_interval.tv_sec || it.it_interval.tv_nsec != 100000000)
+    {
+      printf ("\
+!!! second timer_gettime timer_none returned it_interval %ld.%09jd\n",
+	      (long) it.it_interval.tv_sec, (intmax_t) it.it_interval.tv_nsec);
+      /* FIXME: For now disabled.
+      result = 1; */
+    }
+
+  if (timer_delete (timer_none) != 0)
+    {
+      printf ("*** timer_delete for timer_none failed: %m\n");
+      result = 1;
+    }
+
+  if (timer_delete (timer_sig1) != 0)
+    {
+      printf ("*** timer_delete for timer_sig1 failed: %m\n");
+      result = 1;
+    }
+
+  if (timer_delete (timer_sig2) != 0)
+    {
+      printf ("*** timer_delete for timer_sig2 failed: %m\n");
+      result = 1;
+    }
+
+  if (timer_delete (timer_thr1) != 0)
+    {
+      printf ("*** timer_delete for timer_thr1 failed: %m\n");
+      result = 1;
+    }
+
+  if (timer_delete (timer_thr2) != 0)
+    {
+      printf ("*** timer_delete for timer_thr2 failed: %m\n");
+      result = 1;
+    }
+  return result;
+}
+
+#elif defined TEST_CLOCK_MISSING
+/* This just ensures that any functions called in TEST_CLOCK_MISSING
+   are not diagnosed as unused.  */
+# define TEST_FUNCTION (TEST_CLOCK_MISSING (TEST_CLOCK), 0)
+#else
+# define TEST_FUNCTION 0
+#endif
+
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.22/rt/tst-timer5.c b/ap/libc/glibc/glibc-2.22/rt/tst-timer5.c
new file mode 100644
index 0000000..6466c8e
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/rt/tst-timer5.c
@@ -0,0 +1,38 @@
+/* Timer test using the monotonic clock.  */
+
+#include <time.h>
+#include <unistd.h>
+
+#if defined CLOCK_MONOTONIC && defined _POSIX_MONOTONIC_CLOCK
+
+# define TEST_CLOCK	CLOCK_MONOTONIC
+# define TEST_CLOCK_MISSING(clock) \
+  (setup_test () ? "CLOCK_MONOTONIC" : NULL)
+
+# include <stdio.h>
+
+static int
+setup_test (void)
+{
+  if (sysconf (_SC_MONOTONIC_CLOCK) <= 0)
+    return 1;
+
+  /* The user-level timers implementation doesn't support CLOCK_MONOTONIC,
+     even though sysconf claims it will.  */
+  timer_t t;
+  if (timer_create (TEST_CLOCK, NULL, &t) != 0)
+    {
+      printf ("timer_create: %m\n");
+      return 1;
+    }
+  timer_delete (t);
+
+  return 0;
+}
+
+# include "tst-timer4.c"
+
+#else
+# define TEST_FUNCTION	0
+# include "../test-skeleton.c"
+#endif
