summary refs log tree commit diff
path: root/linuxthreads
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-04-12 02:29:04 +0000
committerUlrich Drepper <drepper@redhat.com>2001-04-12 02:29:04 +0000
commit7d4c3e67b4375ff9b56cc82fbc60e89d342691bc (patch)
tree7abca8a364df4e68a2ccbc4002b2449f130ff76a /linuxthreads
parent43df859b957290a8fa1c1f55916aa560352099ee (diff)
downloadglibc-7d4c3e67b4375ff9b56cc82fbc60e89d342691bc.tar.gz
glibc-7d4c3e67b4375ff9b56cc82fbc60e89d342691bc.tar.xz
glibc-7d4c3e67b4375ff9b56cc82fbc60e89d342691bc.zip
Update.
2001-04-11  Ulrich Drepper  <drepper@redhat.com>

	* tst-cancel.c (main): Cleanup 4 is supposed to run.  Create
	temporary file in object directory.
	* Makefile: Don't allow inlining when compiling tst-cancel.c.
	Pass $(objpfx) to tst-cancel.
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/ChangeLog7
-rw-r--r--linuxthreads/Makefile3
-rw-r--r--linuxthreads/tst-cancel.c40
3 files changed, 46 insertions, 4 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index d21b6968c0..bc807ecc6a 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,10 @@
+2001-04-11  Ulrich Drepper  <drepper@redhat.com>
+
+	* tst-cancel.c (main): Cleanup 4 is supposed to run.  Create
+	temporary file in object directory.
+	* Makefile: Don't allow inlining when compiling tst-cancel.c.
+	Pass $(objpfx) to tst-cancel.
+
 2001-04-11  David S. Miller  <davem@redhat.com>
 
 	* sysdeps/sparc/sparc32/pt-machine.h (stack_pointer): Advance
diff --git a/linuxthreads/Makefile b/linuxthreads/Makefile
index b719ff8f21..42f06a6645 100644
--- a/linuxthreads/Makefile
+++ b/linuxthreads/Makefile
@@ -44,6 +44,9 @@ LDFLAGS-pthread.so = $(nodelete-$(have-z-nodelete)) \
 
 vpath %.c Examples
 
+tst-cancel-ARGS = "$(objpfx)"
+CFLAGS-tst-cancel.c = -fno-inline
+
 include ../Makeconfig
 
 ifeq ($(build-shared),yes)
diff --git a/linuxthreads/tst-cancel.c b/linuxthreads/tst-cancel.c
index f2f97d2dbf..84b8197e42 100644
--- a/linuxthreads/tst-cancel.c
+++ b/linuxthreads/tst-cancel.c
@@ -25,6 +25,15 @@ cleanup (void *arg)
 }
 
 
+volatile int cleanupokcnt;
+
+static void
+cleanupok (void *arg)
+{
+  ++cleanupokcnt;
+}
+
+
 static void *
 t1 (void *arg)
 {
@@ -54,25 +63,41 @@ t2 (void *arg)
 }
 
 
+static void
+innerok (int a)
+{
+  pthread_cleanup_push (cleanup, (void *) (long int) a);
+  if (a)
+    return;
+  pthread_cleanup_pop (0);
+}
+
+
 static void *
 t3 (void *arg)
 {
-  pthread_cleanup_push (cleanup, (void *) (long int) 4);
-  inner ((int) (long int) arg);
+  pthread_cleanup_push (cleanupok, (void *) (long int) 4);
+  innerok ((int) (long int) arg);
   pthread_exit (NULL);
   pthread_cleanup_pop (0);
 }
 
 
 int
-main (void)
+main (int argc, char *argv[])
 {
   pthread_t td;
   int err;
-  char tmp[] = "thtstXXXXXX";
+  char *tmp;
+  const char *path;
+  const char template[] = "thtstXXXXXX";
   struct stat64 st;
   int result = 0;
 
+  path = argc > 1 ? argv[1] : "";
+  tmp = (char *) alloca (strlen (path) + sizeof template);
+  strcpy (stpcpy (tmp, path), template);
+
   fd = mkstemp (tmp);
   if (fd == -1)
     {
@@ -140,6 +165,7 @@ main (void)
       char buf[512];
       puts ("some cleanup handlers ran:");
       fflush (stdout);
+      __lseek (fd, 0, SEEK_SET);
       while (1)
 	{
 	  ssize_t n = read (fd, buf, sizeof buf);
@@ -150,5 +176,11 @@ main (void)
       result = 1;
     }
 
+  if (cleanupokcnt != 1)
+    {
+      printf ("cleanupokcnt = %d\n", cleanupokcnt);
+      result = 1;
+    }
+
   return result;
 }