about summary refs log tree commit diff
path: root/rt
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /rt
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'rt')
-rw-r--r--rt/Depend1
-rw-r--r--rt/Makefile10
-rw-r--r--rt/Versions2
-rw-r--r--rt/aio_cancel.c44
-rw-r--r--rt/aio_fsync.c51
-rw-r--r--rt/aio_misc.c29
-rw-r--r--rt/aio_notify.c24
-rw-r--r--rt/aio_read.c36
-rw-r--r--rt/aio_read64.c2
-rw-r--r--rt/aio_sigqueue.c36
-rw-r--r--rt/aio_suspend.c46
-rw-r--r--rt/aio_write.c36
-rw-r--r--rt/aio_write64.c2
-rw-r--r--rt/clock_getcpuclockid.c39
-rw-r--r--rt/clock_getres.c30
-rw-r--r--rt/clock_gettime.c31
-rw-r--r--rt/clock_nanosleep.c39
-rw-r--r--rt/clock_settime.c30
-rw-r--r--rt/get_clockfreq.c28
-rw-r--r--rt/lio_listio.c42
-rw-r--r--rt/lio_listio64.c2
-rw-r--r--rt/mq_close.c31
-rw-r--r--rt/mq_getattr.c30
-rw-r--r--rt/mq_notify.c31
-rw-r--r--rt/mq_open.c36
-rw-r--r--rt/mq_receive.c32
-rw-r--r--rt/mq_send.c31
-rw-r--r--rt/mq_setattr.c33
-rw-r--r--rt/mq_timedreceive.c34
-rw-r--r--rt/mq_timedsend.c33
-rw-r--r--rt/mq_unlink.c30
-rw-r--r--rt/mqueue.h9
-rw-r--r--rt/shm_open.c31
-rw-r--r--rt/shm_unlink.c31
-rw-r--r--rt/timer_create.c30
-rw-r--r--rt/timer_delete.c30
-rw-r--r--rt/timer_getoverr.c30
-rw-r--r--rt/timer_gettime.c30
-rw-r--r--rt/timer_settime.c31
-rw-r--r--rt/tst-aio.c2
-rw-r--r--rt/tst-aio10.c119
-rw-r--r--rt/tst-aio2.c25
-rw-r--r--rt/tst-aio3.c22
-rw-r--r--rt/tst-aio64.c2
-rw-r--r--rt/tst-aio8.c39
-rw-r--r--rt/tst-aio9.c124
-rw-r--r--rt/tst-clock2.c43
-rw-r--r--rt/tst-cpuclock1.c307
-rw-r--r--rt/tst-cpuclock2.c332
-rw-r--r--rt/tst-cputimer1.c68
-rw-r--r--rt/tst-cputimer2.c83
-rw-r--r--rt/tst-cputimer3.c130
-rw-r--r--rt/tst-timer.c33
53 files changed, 2411 insertions, 21 deletions
diff --git a/rt/Depend b/rt/Depend
index fe673ba5ec..8d2587bbc1 100644
--- a/rt/Depend
+++ b/rt/Depend
@@ -1 +1,2 @@
 linuxthreads
+nptl
diff --git a/rt/Makefile b/rt/Makefile
index 407cc99897..148ded996e 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1997-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1997-2004, 2006 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
@@ -43,9 +43,13 @@ librt-routines = $(aio-routines) \
 
 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-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \
+	 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-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)
diff --git a/rt/Versions b/rt/Versions
index a7d633d0ea..51bb033ec9 100644
--- a/rt/Versions
+++ b/rt/Versions
@@ -19,7 +19,7 @@ librt {
   }
   GLIBC_2.3.4 {
     # m*
-    mq_open; mq_close; mq_unlink; mq_getattr; mq_setattr; 
+    mq_open; mq_close; mq_unlink; mq_getattr; mq_setattr;
     mq_notify; mq_send; mq_receive; mq_timedsend; mq_timedreceive;
   }
 }
diff --git a/rt/aio_cancel.c b/rt/aio_cancel.c
new file mode 100644
index 0000000000..c24a2f7529
--- /dev/null
+++ b/rt/aio_cancel.c
@@ -0,0 +1,44 @@
+/* Cancel requests associated with given file descriptor.  Stub version.
+   Copyright (C) 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+
+/* 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)
+#include <stub-tag.h>
diff --git a/rt/aio_fsync.c b/rt/aio_fsync.c
new file mode 100644
index 0000000000..bc23d75f69
--- /dev/null
+++ b/rt/aio_fsync.c
@@ -0,0 +1,51 @@
+/* Synchronize I/O in given file descriptor.  Stub version.
+   Copyright (C) 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+
+/* 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)
+#include <stub-tag.h>
diff --git a/rt/aio_misc.c b/rt/aio_misc.c
new file mode 100644
index 0000000000..c29b8d0eae
--- /dev/null
+++ b/rt/aio_misc.c
@@ -0,0 +1,29 @@
+/* Handle general operations.  Stub version.
+   Copyright (C) 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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/rt/aio_notify.c b/rt/aio_notify.c
new file mode 100644
index 0000000000..2c79ee6c2f
--- /dev/null
+++ b/rt/aio_notify.c
@@ -0,0 +1,24 @@
+/* Notify initiator of AIO request.  Stub version.
+   Copyright (C) 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <aio.h>
+#include <aio_misc.h>
+
+/* This file contains only internal functions used by
+   the particular aio_* implementation code.  */
diff --git a/rt/aio_read.c b/rt/aio_read.c
new file mode 100644
index 0000000000..db1d19f3d7
--- /dev/null
+++ b/rt/aio_read.c
@@ -0,0 +1,36 @@
+/* Asynchronous read.  Stub version.
+   Copyright (C) 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/aio_read64.c b/rt/aio_read64.c
new file mode 100644
index 0000000000..e9994aefcb
--- /dev/null
+++ b/rt/aio_read64.c
@@ -0,0 +1,2 @@
+#define BE_AIO64
+#include <aio_read.c>
diff --git a/rt/aio_sigqueue.c b/rt/aio_sigqueue.c
new file mode 100644
index 0000000000..0e3ba1f90b
--- /dev/null
+++ b/rt/aio_sigqueue.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1997, 1999, 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/aio_suspend.c b/rt/aio_suspend.c
new file mode 100644
index 0000000000..0530f0019c
--- /dev/null
+++ b/rt/aio_suspend.c
@@ -0,0 +1,46 @@
+/* Suspend until termination of a requests.  Stub version.
+   Copyright (C) 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+
+/* 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)
+#include <stub-tag.h>
diff --git a/rt/aio_write.c b/rt/aio_write.c
new file mode 100644
index 0000000000..bc62fcb469
--- /dev/null
+++ b/rt/aio_write.c
@@ -0,0 +1,36 @@
+/* Asynchronous write.  Stub version.
+   Copyright (C) 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/aio_write64.c b/rt/aio_write64.c
new file mode 100644
index 0000000000..88d5c001ce
--- /dev/null
+++ b/rt/aio_write64.c
@@ -0,0 +1,2 @@
+#define BE_AIO64
+#include <aio_write.c>
diff --git a/rt/clock_getcpuclockid.c b/rt/clock_getcpuclockid.c
new file mode 100644
index 0000000000..39c7e55f66
--- /dev/null
+++ b/rt/clock_getcpuclockid.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 2000, 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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
+}
diff --git a/rt/clock_getres.c b/rt/clock_getres.c
new file mode 100644
index 0000000000..f5978da380
--- /dev/null
+++ b/rt/clock_getres.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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;
+}
+stub_warning (clock_getres)
+#include <stub-tag.h>
diff --git a/rt/clock_gettime.c b/rt/clock_gettime.c
new file mode 100644
index 0000000000..ff306120ba
--- /dev/null
+++ b/rt/clock_gettime.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1999, 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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;
+}
+librt_hidden_def (clock_gettime)
+stub_warning (clock_gettime)
+#include <stub-tag.h>
diff --git a/rt/clock_nanosleep.c b/rt/clock_nanosleep.c
new file mode 100644
index 0000000000..cff1c2570a
--- /dev/null
+++ b/rt/clock_nanosleep.c
@@ -0,0 +1,39 @@
+/* High-resolution sleep with the specified clock.  Stub version.
+   Copyright (C) 2000 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/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;
+}
+stub_warning (clock_nanosleep)
+#include <stub-tag.h>
diff --git a/rt/clock_settime.c b/rt/clock_settime.c
new file mode 100644
index 0000000000..9d6a92e058
--- /dev/null
+++ b/rt/clock_settime.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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;
+}
+stub_warning (clock_settime)
+#include <stub-tag.h>
diff --git a/rt/get_clockfreq.c b/rt/get_clockfreq.c
new file mode 100644
index 0000000000..14375ec186
--- /dev/null
+++ b/rt/get_clockfreq.c
@@ -0,0 +1,28 @@
+/* Get frequency of the system processor.
+   Copyright (C) 2000, 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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/rt/lio_listio.c b/rt/lio_listio.c
new file mode 100644
index 0000000000..d535594492
--- /dev/null
+++ b/rt/lio_listio.c
@@ -0,0 +1,42 @@
+/* Enqueue a list of read or write requests.  Stub version.
+   Copyright (C) 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/lio_listio64.c b/rt/lio_listio64.c
new file mode 100644
index 0000000000..35a571c685
--- /dev/null
+++ b/rt/lio_listio64.c
@@ -0,0 +1,2 @@
+#define BE_AIO64
+#include <lio_listio.c>
diff --git a/rt/mq_close.c b/rt/mq_close.c
new file mode 100644
index 0000000000..8237a6438e
--- /dev/null
+++ b/rt/mq_close.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/mq_getattr.c b/rt/mq_getattr.c
new file mode 100644
index 0000000000..2d24b85d47
--- /dev/null
+++ b/rt/mq_getattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/mq_notify.c b/rt/mq_notify.c
new file mode 100644
index 0000000000..29de75a471
--- /dev/null
+++ b/rt/mq_notify.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/mq_open.c b/rt/mq_open.c
new file mode 100644
index 0000000000..dea5741d5a
--- /dev/null
+++ b/rt/mq_open.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <mqueue.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;
+}
+stub_warning (mq_open)
+#include <stub-tag.h>
diff --git a/rt/mq_receive.c b/rt/mq_receive.c
new file mode 100644
index 0000000000..527fd75963
--- /dev/null
+++ b/rt/mq_receive.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/mq_send.c b/rt/mq_send.c
new file mode 100644
index 0000000000..8b7cd87f7f
--- /dev/null
+++ b/rt/mq_send.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/mq_setattr.c b/rt/mq_setattr.c
new file mode 100644
index 0000000000..57ee0759ab
--- /dev/null
+++ b/rt/mq_setattr.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/mq_timedreceive.c b/rt/mq_timedreceive.c
new file mode 100644
index 0000000000..e4723f812a
--- /dev/null
+++ b/rt/mq_timedreceive.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+stub_warning (mq_timedreceive)
+#include <stub-tag.h>
diff --git a/rt/mq_timedsend.c b/rt/mq_timedsend.c
new file mode 100644
index 0000000000..5ccfe23b0a
--- /dev/null
+++ b/rt/mq_timedsend.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+stub_warning (mq_timedsend)
+#include <stub-tag.h>
diff --git a/rt/mq_unlink.c b/rt/mq_unlink.c
new file mode 100644
index 0000000000..e947b84f3b
--- /dev/null
+++ b/rt/mq_unlink.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/mqueue.h b/rt/mqueue.h
index 42313b192b..1ccad5bbad 100644
--- a/rt/mqueue.h
+++ b/rt/mqueue.h
@@ -1,6 +1,5 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005 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
@@ -57,8 +56,8 @@ extern int mq_setattr (mqd_t __mqdes,
 /* Remove message queue named NAME.  */
 extern int mq_unlink (const char *__name) __THROW;
 
-/* Register notification upon message arrival to an empty message queue
-   MQDES.  */
+/* Register notification issued upon message arrival to an empty
+   message queue MQDES.  */
 extern int mq_notify (mqd_t __mqdes, const struct sigevent *__notification)
      __THROW;
 
@@ -86,6 +85,6 @@ extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr,
 			 const struct timespec *__abs_timeout);
 #endif
 
-__END_DECLS                                                      
+__END_DECLS
 
 #endif /* mqueue.h */
diff --git a/rt/shm_open.c b/rt/shm_open.c
new file mode 100644
index 0000000000..6a53903a75
--- /dev/null
+++ b/rt/shm_open.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2000 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+
+#include <stub-tag.h>
diff --git a/rt/shm_unlink.c b/rt/shm_unlink.c
new file mode 100644
index 0000000000..28478b895b
--- /dev/null
+++ b/rt/shm_unlink.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2000 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+
+#include <stub-tag.h>
diff --git a/rt/timer_create.c b/rt/timer_create.c
new file mode 100644
index 0000000000..0e3a6b0acc
--- /dev/null
+++ b/rt/timer_create.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/timer_delete.c b/rt/timer_delete.c
new file mode 100644
index 0000000000..4be55aa322
--- /dev/null
+++ b/rt/timer_delete.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <time.h>
+
+/* Delete timer TIMERID.  */
+int
+timer_delete (timer_t timerid)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (timer_delete)
+#include <stub-tag.h>
diff --git a/rt/timer_getoverr.c b/rt/timer_getoverr.c
new file mode 100644
index 0000000000..6ca7ff8e9e
--- /dev/null
+++ b/rt/timer_getoverr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/timer_gettime.c b/rt/timer_gettime.c
new file mode 100644
index 0000000000..728028ed3e
--- /dev/null
+++ b/rt/timer_gettime.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/timer_settime.c b/rt/timer_settime.c
new file mode 100644
index 0000000000..f494a0edd1
--- /dev/null
+++ b/rt/timer_settime.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1999 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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)
+#include <stub-tag.h>
diff --git a/rt/tst-aio.c b/rt/tst-aio.c
index 24efad3e23..ba50bdb082 100644
--- a/rt/tst-aio.c
+++ b/rt/tst-aio.c
@@ -48,7 +48,7 @@ int fd;
 void
 do_prepare (int argc, char *argv[])
 {
-  char name_len;
+  size_t name_len;
 
   name_len = strlen (test_dir);
   name = malloc (name_len + sizeof ("/aioXXXXXX"));
diff --git a/rt/tst-aio10.c b/rt/tst-aio10.c
new file mode 100644
index 0000000000..6e8f7b78c0
--- /dev/null
+++ b/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/rt/tst-aio2.c b/rt/tst-aio2.c
index 1ff92ce93b..79076396a4 100644
--- a/rt/tst-aio2.c
+++ b/rt/tst-aio2.c
@@ -1,5 +1,5 @@
 /* Test for notification mechanism in lio_listio.
-   Copyright (C) 2000,02 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
 
@@ -25,13 +25,19 @@
 #include <unistd.h>
 #include <errno.h>
 
-int flag;
+
+static pthread_barrier_t b;
 
 
 static void
 thrfct (sigval_t arg)
 {
-  flag = 1;
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("thread: barrier_wait failed");
+      exit (1);
+    }
 }
 
 
@@ -53,6 +59,12 @@ do_test (int argc, char *argv[])
 
   unlink (name);
 
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
   arr[0] = &cb;
 
   cb.aio_fildes = fd;
@@ -77,9 +89,12 @@ do_test (int argc, char *argv[])
       return 1;
     }
 
-  if (flag != 0)
+  puts ("lio_listio returned");
+
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
     {
-      puts ("thread created, should not have happened");
+      puts ("barrier_wait failed");
       return 1;
     }
 
diff --git a/rt/tst-aio3.c b/rt/tst-aio3.c
index 0c0ced4501..95da4c1325 100644
--- a/rt/tst-aio3.c
+++ b/rt/tst-aio3.c
@@ -1,5 +1,5 @@
 /* Test for notification mechanism in lio_listio.
-   Copyright (C) 2000,02 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002, 2006 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
@@ -24,13 +24,18 @@
 #include <unistd.h>
 #include <errno.h>
 
-int flag;
+static pthread_barrier_t b;
 
 
 static void
 thrfct (sigval_t arg)
 {
-  flag = 1;
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      puts ("child: barrier_wait failed");
+      exit (1);
+    }
 }
 
 
@@ -52,6 +57,12 @@ do_test (int argc, char *argv[])
 
   unlink (name);
 
+  if (pthread_barrier_init (&b, NULL, 2) != 0)
+    {
+      puts ("barrier_init failed");
+      return 1;
+    }
+
   arr[0] = &cb;
 
   cb.aio_fildes = fd;
@@ -82,9 +93,10 @@ do_test (int argc, char *argv[])
       return 1;
     }
 
-  if (flag != 0)
+  int e = pthread_barrier_wait (&b);
+  if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
     {
-      puts ("thread created, should not have happened");
+      puts ("parent: barrier_wait failed");
       return 1;
     }
 
diff --git a/rt/tst-aio64.c b/rt/tst-aio64.c
index 93e8cb2136..b6d964fd57 100644
--- a/rt/tst-aio64.c
+++ b/rt/tst-aio64.c
@@ -49,7 +49,7 @@ int fd;
 void
 do_prepare (int argc, char *argv[])
 {
-  char name_len;
+  size_t name_len;
 
   name_len = strlen (test_dir);
   name = malloc (name_len + sizeof ("/aioXXXXXX"));
diff --git a/rt/tst-aio8.c b/rt/tst-aio8.c
new file mode 100644
index 0000000000..b03639dabd
--- /dev/null
+++ b/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/rt/tst-aio9.c b/rt/tst-aio9.c
new file mode 100644
index 0000000000..eab4f6859a
--- /dev/null
+++ b/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/rt/tst-clock2.c b/rt/tst-clock2.c
new file mode 100644
index 0000000000..4c8fb9f247
--- /dev/null
+++ b/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/rt/tst-cpuclock1.c b/rt/tst-cpuclock1.c
new file mode 100644
index 0000000000..024df63141
--- /dev/null
+++ b/rt/tst-cpuclock1.c
@@ -0,0 +1,307 @@
+/* Test program for process CPU clocks.
+   Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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 <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 %lu.%.9lu\n",
+	  child, (unsigned long int) child_clock, res.tv_sec, 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;
+    }
+  printf ("live PID %d before sleep => %lu.%.9lu\n",
+	  child, before.tv_sec, before.tv_nsec);
+
+  struct timespec sleeptime = { .tv_nsec = 500000000 };
+  nanosleep (&sleeptime, NULL);
+
+  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;
+    }
+  printf ("live PID %d after sleep => %lu.%.9lu\n",
+	  child, after.tv_sec, 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 %lu.%.9lu outside reasonable range\n",
+	      diff.tv_sec, 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 %lu.%.9lu outside reasonable range\n",
+		      d.tv_sec, 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;
+  nanosleep (&sleeptime, NULL);
+
+  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;
+    }
+  printf ("dead PID %d => %lu.%.9lu\n",
+	  child, dead.tv_sec, 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 %lu.%.9lu outside reasonable range\n",
+	      diff.tv_sec, 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 => %lu%.9lu\n",
+	      child, (unsigned long int) child_clock,
+	      dead.tv_sec, 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 => %lu%.9lu\n",
+	      child, (unsigned long int) child_clock,
+	      dead.tv_sec, 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/rt/tst-cpuclock2.c b/rt/tst-cpuclock2.c
new file mode 100644
index 0000000000..d1621f3d01
--- /dev/null
+++ b/rt/tst-cpuclock2.c
@@ -0,0 +1,332 @@
+/* Test program for process and thread CPU clocks.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <unistd.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 thread clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      result = 1;
+      return 1;
+    }
+  printf ("live thread clock %lx resolution %lu.%.9lu\n",
+	  (unsigned long int) th_clock, res.tv_sec, 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) th_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 => %lu.%.9lu\n",
+	  before.tv_sec, before.tv_nsec);
+
+  struct timespec me_before, me_after;
+  if (clock_gettime (my_thread_clock, &me_before) < 0)
+    {
+      printf ("clock_gettime on live thread clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      return 1;
+    }
+  printf ("self thread before sleep => %lu.%.9lu\n",
+	  me_before.tv_sec, me_before.tv_nsec);
+
+  struct timespec sleeptime = { .tv_nsec = 500000000 };
+  nanosleep (&sleeptime, NULL);
+
+  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 => %lu.%.9lu\n",
+	  after.tv_sec, after.tv_nsec);
+
+  if (clock_gettime (process_clock, &process_after) < 0)
+    {
+      printf ("clock_gettime on process clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      return 1;
+    }
+
+  if (clock_gettime (my_thread_clock, &me_after) < 0)
+    {
+      printf ("clock_gettime on live thread clock %lx => %s\n",
+	      (unsigned long int) th_clock, strerror (errno));
+      return 1;
+    }
+  printf ("self thread after sleep => %lu.%.9lu\n",
+	  me_after.tv_sec, 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 ("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, "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/rt/tst-cputimer1.c b/rt/tst-cputimer1.c
new file mode 100644
index 0000000000..8f5dd76cf2
--- /dev/null
+++ b/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/rt/tst-cputimer2.c b/rt/tst-cputimer2.c
new file mode 100644
index 0000000000..397d7998c0
--- /dev/null
+++ b/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/rt/tst-cputimer3.c b/rt/tst-cputimer3.c
new file mode 100644
index 0000000000..056766a377
--- /dev/null
+++ b/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/rt/tst-timer.c b/rt/tst-timer.c
new file mode 100644
index 0000000000..d9b69a2467
--- /dev/null
+++ b/rt/tst-timer.c
@@ -0,0 +1,33 @@
+/* Tests for POSIX timer implementation.  Dummy version.
+   Copyright (C) 2000 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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.  */
+int
+main (void)
+{
+#ifdef _POSIX_TIMERS
+  /* There should be a test.  */
+  return 1;
+#else
+  return 0;
+#endif
+}