about summary refs log tree commit diff
path: root/rt/tst-clock2.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-08-03 08:17:20 +0000
committerUlrich Drepper <drepper@redhat.com>2006-08-03 08:17:20 +0000
commitf1762c0c4b3ba91073f82da02a16d8ee29ed7444 (patch)
treedd3ed0e40f1cb6a2560dfba1fd300cfe98be28ba /rt/tst-clock2.c
parent6eab4ee54b5ae38e6243a7bb419061d8d0fa216e (diff)
downloadglibc-f1762c0c4b3ba91073f82da02a16d8ee29ed7444.tar.gz
glibc-f1762c0c4b3ba91073f82da02a16d8ee29ed7444.tar.xz
glibc-f1762c0c4b3ba91073f82da02a16d8ee29ed7444.zip
[BZ #2978]
2006-08-03  Ulrich Drepper  <drepper@redhat.com>
	* rt/Makefile (tests): Add tst-clock2.
	* rt/tst-clock2.c: New file.

	[BZ #2978]
	* resolv/gai_notify.c (__gai_notify_only): Copy memory for thread
	function and its parameters and pass it to new thread.
	(__gai_notify): Add support for alternative waiting for completion.
	* resolv/gai_suspend.c (gai_suspend): Add support for alternative
	waiting for completion.
	* resolv/getaddrinfo_a.c: Likewise.
	* resolv/gai_misc.h (struct waitlist): Don't add cond if alternative
	waiting for completion is used.
	* resolv/gai_misc.c: Allow overwriting code to start helper thread.
	* resolv/gai_cancel.c: Include <gai_misc.h> not "gai_misc.h".
	* resolv/gai_error.c: Likewise.
	* resolv/gai_sigqueue.c: Likewise.

	* hurd/getdport.c (__detdport): Don't return EBADF; instead set
	errno to EBADF and return MACH_PORT_NULL.
	* posix/Makefile (CFLAGS-waitid.c): Add -fasynchronous-unwind-tables.
Diffstat (limited to 'rt/tst-clock2.c')
-rw-r--r--rt/tst-clock2.c43
1 files changed, 43 insertions, 0 deletions
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"