about summary refs log tree commit diff
path: root/nptl/tst-cancel4.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-01-20 07:08:05 +0000
committerUlrich Drepper <drepper@redhat.com>2006-01-20 07:08:05 +0000
commit7c65e9001b93d5d20046bc4d50fd10fff5f4adc2 (patch)
tree38f65e2a20910e6d074fbcec137eb66853e70eaa /nptl/tst-cancel4.c
parent93c04024a6b900b69bbe9a70de06ac23b8273787 (diff)
downloadglibc-7c65e9001b93d5d20046bc4d50fd10fff5f4adc2.tar.gz
glibc-7c65e9001b93d5d20046bc4d50fd10fff5f4adc2.tar.xz
glibc-7c65e9001b93d5d20046bc4d50fd10fff5f4adc2.zip
* include/fcntl.h: Declare __have_atfcts.
	* sysdeps/unix/sysv/linux/faccessat.c: Use syscall if available.
	* sysdeps/unix/sysv/linux/fchmodat.c: Likewise.
	* sysdeps/unix/sysv/linux/fchownat.c: Likewise.
	* sysdeps/unix/sysv/linux/futimesat.c: Likewise.
	* sysdeps/unix/sysv/linux/linkat.c: Likewise.
	* sysdeps/unix/sysv/linux/mkdirat.c: Likewise.
	* sysdeps/unix/sysv/linux/openat.c: Likewise.
	* sysdeps/unix/sysv/linux/readlinkat.c: Likewise.
	* sysdeps/unix/sysv/linux/renameat.c: Likewise.
	* sysdeps/unix/sysv/linux/symlinkat.c: Likewise.
	* sysdeps/unix/sysv/linux/unlinkat.c: Likewise.
	* sysdeps/unix/sysv/linux/xmknodat.c: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c: Likewise.
	* sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_PSELECT,
	__ASSUME_PPOLL, and __ASSUME_ATFCTS if possible.

	* io/ppoll.c: New file.
	* io/Makefile (routines): Add ppoll.
	(CFLAGS-ppoll.c): Define.
	* io/Versions: Export ppoll for GLIBC_2.4.
	* io/sys/poll.h: Declare ppoll.
	* sysdeps/unix/sysv/linux/ppoll.c: New file.

	* misc/pselect.c: Make it possible to include this file to define
	the generic code as a static function.
	* sysdeps/unix/sysv/linux/pselect.c: New file.
Diffstat (limited to 'nptl/tst-cancel4.c')
-rw-r--r--nptl/tst-cancel4.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c
index cb7619688e..73cfa44614 100644
--- a/nptl/tst-cancel4.c
+++ b/nptl/tst-cancel4.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -524,6 +524,53 @@ tf_poll (void *arg)
 
 
 static void *
+tf_ppoll (void *arg)
+{
+  int fd;
+  int r;
+
+  if (arg == NULL)
+    fd = fds[0];
+  else
+    {
+      char fname[] = "/tmp/tst-cancel4-fd-XXXXXX";
+      tempfd = fd = mkstemp (fname);
+      if (fd == -1)
+	printf ("%s: mkstemp failed\n", __FUNCTION__);
+      unlink (fname);
+
+      r = pthread_barrier_wait (&b2);
+      if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+	{
+	  printf ("%s: barrier_wait failed\n", __FUNCTION__);
+	  exit (1);
+	}
+    }
+
+  r = pthread_barrier_wait (&b2);
+  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+    {
+      printf ("%s: barrier_wait failed\n", __FUNCTION__);
+      exit (1);
+    }
+
+  struct pollfd rfs[1] = { [0] = { .fd = fd, .events = POLLIN } };
+
+  int s;
+  pthread_cleanup_push (cl, NULL);
+
+  s = ppoll (rfs, 1, NULL, NULL);
+
+  pthread_cleanup_pop (0);
+
+  printf ("%s: ppoll returns with %d (%s)\n", __FUNCTION__, s,
+	  strerror (errno));
+
+  exit (1);
+}
+
+
+static void *
 tf_wait (void *arg)
 {
   pid_t pid = fork ();
@@ -2006,6 +2053,7 @@ static struct
   ADD_TEST (select, 2, 0),
   ADD_TEST (pselect, 2, 0),
   ADD_TEST (poll, 2, 0),
+  ADD_TEST (ppoll, 2, 0),
   ADD_TEST (write, 2, 0),
   ADD_TEST (writev, 2, 0),
   ADD_TEST (sleep, 2, 0),