* [PATCH] Kill tst-cancel-wrappers exceptions, replace with LIBC_CANCEL_HANDLED macro.
@ 2003-01-06 14:42 Jakub Jelinek
2003-01-07 0:13 ` Ulrich Drepper
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2003-01-06 14:42 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: Glibc hackers
Hi!
On Alpha, tst-cancel-wrappers.out had failure because creat.o* did not seem to
have cancellation enable/disable calls.
Instead of adding more and more exceptions (especially when some would need
to be platform dependent), I've added LIBC_CANCEL_HANDLED() macro, which
when added to a .c file (ideally with a comment describing how cancellation
is handled instead) causes tst-cancel-wrappers to shut up for that
particular file. Shouldn't make any difference on the generated code.
2003-01-06 Jakub Jelinek <jakub@redhat.com>
* sysdeps/generic/sysdep-cancel.h (LIBC_CANCEL_HANDLED): Define.
* sysdeps/generic/creat.c: Include sysdep-cancel.h.
(LIBC_CANCEL_HANDLED): Add.
linuxthreads/
* internals.h (LIBC_CANCEL_HANDLED): Define.
* sysdeps/unix/sysv/linux/sigwait.c (LIBC_CANCEL_HANDLED): Add.
* signals.c (LIBC_CANCEL_HANDLED): Add.
* pt-system.c (LIBC_CANCEL_HANDLED): Add.
* tst-cancel-wrappers.sh: Remove all exceptions.
nptl/
* pthreadP.h (LIBC_CANCEL_HANDLED): Define.
* pt-system.c (LIBC_CANCEL_HANDLED): Add.
* tst-cancel-wrappers.sh: Remove all exceptions.
--- libc/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c.jj 2003-01-05 23:19:26.000000000 +0100
+++ libc/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c 2003-01-06 15:57:21.000000000 +0100
@@ -83,3 +83,6 @@ __sigwait (set, sig)
libc_hidden_def (__sigwait)
weak_alias (__sigwait, sigwait)
strong_alias (__sigwait, __libc_sigwait)
+
+/* Cancellation is handled in __pthread_sigwait. */
+LIBC_CANCEL_HANDLED ();
--- libc/linuxthreads/internals.h.jj 2003-01-05 21:11:04.000000000 +0100
+++ libc/linuxthreads/internals.h 2003-01-06 15:55:11.000000000 +0100
@@ -475,14 +475,21 @@ extern pid_t __pthread_fork (struct fork
__libc_enable_asynccancel ()
# define LIBC_CANCEL_RESET(oldtype) \
__libc_disable_asynccancel (oldtype)
+# define LIBC_CANCEL_HANDLED() \
+ __asm (".globl " __SYMBOL_PREFIX "__libc_enable_asynccancel"); \
+ __asm (".globl " __SYMBOL_PREFIX "__libc_disable_asynccancel")
#elif defined NOT_IN_libc && defined IS_IN_libpthread
# define LIBC_CANCEL_ASYNC() \
__pthread_enable_asynccancel ()
# define LIBC_CANCEL_RESET(oldtype) \
__pthread_disable_asynccancel (oldtype)
+# define LIBC_CANCEL_HANDLED() \
+ __asm (".globl " __SYMBOL_PREFIX "__pthread_enable_asynccancel"); \
+ __asm (".globl " __SYMBOL_PREFIX "__pthread_disable_asynccancel")
#else
# define LIBC_CANCEL_ASYNC() 0 /* Just a dummy value. */
# define LIBC_CANCEL_RESET(val) ((void)(val)) /* Nothing, but evaluate it. */
+# define LIBC_CANCEL_HANDLED() /* Nothing. */
#endif
/* Data type shared with libc. The libc uses it to pass on calls to
--- libc/linuxthreads/signals.c.jj 2003-01-03 14:06:37.000000000 +0100
+++ libc/linuxthreads/signals.c 2003-01-06 15:54:46.000000000 +0100
@@ -195,3 +195,6 @@ int __pthread_raise (int sig)
#ifdef SHARED
strong_alias (__pthread_raise, raise)
#endif
+
+/* This files handles cancellation internally. */
+LIBC_CANCEL_HANDLED ();
--- libc/linuxthreads/pt-system.c.jj 2002-12-28 13:00:45.000000000 +0100
+++ libc/linuxthreads/pt-system.c 2003-01-06 15:58:22.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
@@ -27,3 +27,6 @@ system (const char *line)
{
return __libc_system (line);
}
+
+/* __libc_system in libc.so handles cancellation. */
+LIBC_CANCEL_HANDLED ();
--- libc/linuxthreads/tst-cancel-wrappers.sh.jj 2003-01-03 14:06:37.000000000 +0100
+++ libc/linuxthreads/tst-cancel-wrappers.sh 2003-01-06 15:58:56.000000000 +0100
@@ -67,13 +67,7 @@ C["__xpg_sigpause"]=1
/:$/ {
if (seen)
{
- # signals.c and sigwait.c in linuxthreads do the cancellation checks
- # not using *_{enable,disable}_asynccancel.
- # Similarly pt-system.o* is allowed to call __libc_system directly.
- if ((!seen_enable || !seen_disable) \
- && !(object ~ /^signals.o/) \
- && !(object ~ /^sigwait.o/) \
- && !(object ~ /^pt-system.o/))
+ if (!seen_enable || !seen_disable)
{
printf "in '$1'(%s) %s'\''s cancellation missing\n", object, seen
ret = 1
--- libc/sysdeps/generic/sysdep-cancel.h.jj 2002-12-17 19:04:23.000000000 +0100
+++ libc/sysdeps/generic/sysdep-cancel.h 2003-01-06 15:50:20.000000000 +0100
@@ -4,3 +4,4 @@
#define SINGLE_THREAD_P (1)
#define LIBC_CANCEL_ASYNC() 0 /* Just a dummy value. */
#define LIBC_CANCEL_RESET(val) ((void)(val)) /* Nothing, but evaluate it. */
+#define LIBC_CANCEL_HANDLED() /* Nothing. */
--- libc/sysdeps/generic/creat.c.jj 2002-12-17 19:04:23.000000000 +0100
+++ libc/sysdeps/generic/creat.c 2003-01-06 16:02:21.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1997, 2003 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
@@ -18,6 +18,7 @@
#include <fcntl.h>
#include <sys/types.h>
+#include <sysdep-cancel.h>
#undef creat
@@ -30,3 +31,6 @@ __libc_creat (file, mode)
return __open (file, O_WRONLY|O_CREAT|O_TRUNC, mode);
}
weak_alias (__libc_creat, creat)
+
+/* __open handles cancellation. */
+LIBC_CANCEL_HANDLED ();
--- libc/nptl/pthreadP.h.jj 2003-01-05 20:44:18.000000000 +0100
+++ libc/nptl/pthreadP.h 2003-01-06 15:55:25.000000000 +0100
@@ -92,12 +92,19 @@ extern int __pthread_debug attribute_hid
/* Same as CANCEL_RESET, but for use in libc.so. */
# define LIBC_CANCEL_RESET(oldtype) \
__libc_disable_asynccancel (oldtype)
+# define LIBC_CANCEL_HANDLED() \
+ __asm (".globl " __SYMBOL_PREFIX "__libc_enable_asynccancel"); \
+ __asm (".globl " __SYMBOL_PREFIX "__libc_disable_asynccancel")
#elif defined NOT_IN_libc && defined IS_IN_libpthread
# define LIBC_CANCEL_ASYNC() CANCEL_ASYNC ()
# define LIBC_CANCEL_RESET(val) CANCEL_RESET (val)
+# define LIBC_CANCEL_HANDLED() \
+ __asm (".globl " __SYMBOL_PREFIX "__pthread_enable_asynccancel"); \
+ __asm (".globl " __SYMBOL_PREFIX "__pthread_disable_asynccancel")
#else
# define LIBC_CANCEL_ASYNC() 0 /* Just a dummy value. */
# define LIBC_CANCEL_RESET(val) ((void)(val)) /* Nothing, but evaluate it. */
+# define LIBC_CANCEL_HANDLED() /* Nothing. */
#endif
--- libc/nptl/tst-cancel-wrappers.sh.jj 2003-01-05 21:00:49.000000000 +0100
+++ libc/nptl/tst-cancel-wrappers.sh 2003-01-06 15:59:24.000000000 +0100
@@ -67,8 +67,7 @@ C["__xpg_sigpause"]=1
/:$/ {
if (seen)
{
- # pt-system.o* in NPTL calls __libc_system directly.
- if ((!seen_enable || !seen_disable) && !(object ~ /^pt-system.o/))
+ if (!seen_enable || !seen_disable)
{
printf "in '$1'(%s) %s'\''s cancellation missing\n", object, seen
ret = 1
--- libc/nptl/pt-system.c.jj 2002-12-28 11:35:31.000000000 +0100
+++ libc/nptl/pt-system.c 2003-01-06 16:00:03.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -28,3 +28,6 @@ system (const char *line)
{
return __libc_system (line);
}
+
+/* __libc_system in libc.so handles cancellation. */
+LIBC_CANCEL_HANDLED ();
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Kill tst-cancel-wrappers exceptions, replace with LIBC_CANCEL_HANDLED macro.
2003-01-06 14:42 [PATCH] Kill tst-cancel-wrappers exceptions, replace with LIBC_CANCEL_HANDLED macro Jakub Jelinek
@ 2003-01-07 0:13 ` Ulrich Drepper
0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2003-01-07 0:13 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Glibc hackers
Jakub Jelinek wrote:
> Instead of adding more and more exceptions (especially when some would need
> to be platform dependent), I've added LIBC_CANCEL_HANDLED() macro, which
> when added to a .c file (ideally with a comment describing how cancellation
> is handled instead) causes tst-cancel-wrappers to shut up for that
> particular file.
Sounds good, I've applied the patch. Thanks,
--
--------------. ,-. 444 Castro Street
Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA
Red Hat `--' drepper at redhat.com `---------------------------
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-01-07 0:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-06 14:42 [PATCH] Kill tst-cancel-wrappers exceptions, replace with LIBC_CANCEL_HANDLED macro Jakub Jelinek
2003-01-07 0:13 ` Ulrich Drepper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).