about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-12-18 00:53:21 +0000
committerUlrich Drepper <drepper@redhat.com>2002-12-18 00:53:21 +0000
commitf077a4a9f027b938bd091583e3ec34725cba428c (patch)
tree6052d47da431d7cd5e745dab1a908a5f54ffbfc7 /nptl
parenta7d5c29129aab547faff1fd2cfe0d9095ec4689b (diff)
downloadglibc-f077a4a9f027b938bd091583e3ec34725cba428c.tar.gz
glibc-f077a4a9f027b938bd091583e3ec34725cba428c.tar.xz
glibc-f077a4a9f027b938bd091583e3ec34725cba428c.zip
Update.
2002-12-17  Jakub Jelinek  <jakub@redhat.com>

	* malloc/thread-m.h (mutex_init, mutex_lock, mutex_trylock,
	mutex_unlock): If not building NPTL, use __libc_maybe_call2 if
	available, otherwise __libc_maybe_call.
	* sysdeps/unix/sysv/linux/x86_64/recv.c: Add support for
	cancellation handling.
	* sysdeps/unix/sysv/linux/x86_64/send.c: Likewise.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog14
-rw-r--r--nptl/Makefile14
-rw-r--r--nptl/tst-cancel-wrappers.sh94
-rw-r--r--nptl/tst-cancel6.c79
-rw-r--r--nptl/tst-locale1.c6
5 files changed, 206 insertions, 1 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 0b7bbd4c57..ea32d2aabb 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,5 +1,19 @@
 2002-12-17  Jakub Jelinek  <jakub@redhat.com>
 
+	* Makefile (libpthread-shared-only-routines): Add pt-allocrtsig.
+	(tests): Depend on $(objpfx)tst-cancel-wrappers.out.
+	($(objpfx)tst-cancel-wrappers.out): New rule.
+	* tst-cancel-wrappers.sh: New test.
+	* tst-locale1.c: Include signal.h.
+	(uselocale): Test static linking of __libc_current_sigrt*.
+
+2002-12-17  Ulrich Drepper  <drepper@redhat.com>
+
+	* Makefile (tests): Add tst-cancel6.
+	* tst-cancel6.c: New file
+
+2002-12-17  Jakub Jelinek  <jakub@redhat.com>
+
 	* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (SINGLE_THREAD_P):
 	Define meaningfully for assembler as well.
 	* pthreadP.h (struct pthread_functions): Remove
diff --git a/nptl/Makefile b/nptl/Makefile
index 88f038deff..6b09f08f6a 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -107,6 +107,8 @@ libpthread-routines = init events \
 		      herrno res pt-allocrtsig \
 		      pthread_kill_other_threads
 
+libpthread-shared-only-routines = pt-allocrtsig
+
 libpthread-nonshared = pthread_atfork
 
 
@@ -126,6 +128,7 @@ tests = tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \
 	tst-fork1 tst-fork2 tst-fork3 \
 	tst-atfork1 \
 	tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel4 tst-cancel5 \
+	tst-cancel6 \
 	tst-cleanup1 \
 	tst-flock1 tst-flock2 \
 	tst-signal1 tst-signal2 tst-signal3 \
@@ -241,3 +244,14 @@ $(objpfx)crti.o: $(objpfx)crti.S $(objpfx)defs.h
 
 generated += crti.S defs.h pt-initfini.s
 endif
+
+ifeq (no,$(cross-compiling))
+ifeq (yes,$(build-shared))
+tests: $(objpfx)tst-cancel-wrappers.out
+$(objpfx)tst-cancel-wrappers.out: tst-cancel-wrappers.sh
+	$(SHELL) $< $(common-objpfx)libc_pic.a \
+		    $(common-objpfx)libc.a \
+		    $(objpfx)libpthread_pic.a \
+		    $(objpfx)libpthread.a > $@
+endif
+endif
diff --git a/nptl/tst-cancel-wrappers.sh b/nptl/tst-cancel-wrappers.sh
new file mode 100644
index 0000000000..39ded2e743
--- /dev/null
+++ b/nptl/tst-cancel-wrappers.sh
@@ -0,0 +1,94 @@
+#! /bin/sh
+# Test whether all cancellable functions are cancellable.
+# Copyright (C) 2002 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+# Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
+
+# 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.
+
+while [ $# -gt 0 ]; do
+  ( nm -P $1; echo 'end[end]:' ) | awk ' BEGIN {
+C["accept"]=1
+C["close"]=1
+C["connect"]=1
+C["creat"]=1
+C["fcntl"]=1
+C["fsync"]=1
+C["llseek"]=1
+C["lseek"]=1
+C["msgrcv"]=1
+C["msgsnd"]=1
+C["msync"]=1
+C["nanosleep"]=1
+C["open"]=1
+C["open64"]=1
+C["pause"]=1
+C["poll"]=1
+C["pread"]=1
+C["pread64"]=1
+C["pselect"]=1
+C["pwrite"]=1
+C["pwrite64"]=1
+C["read"]=1
+C["readv"]=1
+C["recv"]=1
+C["recvfrom"]=1
+C["recvmsg"]=1
+C["select"]=1
+C["send"]=1
+C["sendmsg"]=1
+C["sendto"]=1
+C["sigpause"]=1
+C["sigsuspend"]=1
+C["sigwait"]=1
+C["sigwaitinfo"]=1
+C["system"]=1
+C["tcdrain"]=1
+C["wait"]=1
+C["waitid"]=1
+C["waitpid"]=1
+C["write"]=1
+C["writev"]=1
+C["__xpg_sigpause"]=1
+}
+/:$/ {
+  if (seen)
+    {
+      if (!seen_enable || !seen_disable)
+	{
+	  printf "in '$1'(%s) %s'\''s cancellation missing\n", object, seen
+	  ret = 1
+	}
+    }
+  seen=""
+  seen_enable=""
+  seen_disable=""
+  object=gensub(/^.*\[(.*)\]:$/,"\\1","",$0)
+  next
+}
+{
+  if (C[$1] && $2 ~ /^[TW]$/)
+    seen=$1
+  else if ($1 ~ /^__(libc|pthread)_enable_asynccancel$/ && $2 == "U")
+    seen_enable=1
+  else if ($1 ~ /^__(libc|pthread)_disable_asynccancel$/ && $2 == "U")
+    seen_disable=1
+}
+END {
+  exit ret
+}' || exit
+  shift
+done
diff --git a/nptl/tst-cancel6.c b/nptl/tst-cancel6.c
new file mode 100644
index 0000000000..94de85830b
--- /dev/null
+++ b/nptl/tst-cancel6.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   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 <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static void *
+tf (void *arg)
+{
+  char buf[100];
+  fgets (buf, sizeof (buf), arg);
+  /* This call should never return.  */
+  return NULL;
+}
+
+
+static int
+do_test (void)
+{
+  int fd[2];
+  if (pipe (fd) != 0)
+    {
+      puts ("pipe failed");
+      return 1;
+    }
+
+  FILE *fp = fdopen (fd[0], "r");
+  if (fp == NULL)
+    {
+      puts ("fdopen failed");
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, fp) != 0)
+    {
+      puts ("pthread_create failed");
+      return 1;
+    }
+
+  sleep (1);
+
+  if (pthread_cancel (th) != 0)
+    {
+      puts ("pthread_cancel failed");
+      return 1;
+    }
+
+  void *r;
+  if (pthread_join (th, &r) != 0)
+    {
+      puts ("pthread_join failed");
+      return 1;
+    }
+
+  return r != PTHREAD_CANCELED;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/nptl/tst-locale1.c b/nptl/tst-locale1.c
index 3c88e729ba..08b43704e5 100644
--- a/nptl/tst-locale1.c
+++ b/nptl/tst-locale1.c
@@ -4,10 +4,14 @@
 #include "../locale/tst-C-locale.c"
 
 #include <pthread.h>
+#include <signal.h>
 
 /* This is never called, just here to get pthreads linked in.  */
-void
+int
 useless (void)
 {
   pthread_create (0, 0, 0, 0);
+  /* This is to check __libc_current_sigrt* can be used in statically
+     linked apps.  */
+  return SIGRTMIN;
 }