This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 02/13] nptl: Fix testcases for new pthread cancellation mechanism
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 7 Oct 2015 13:59:29 -0700 (PDT)
- Subject: Re: [PATCH 02/13] nptl: Fix testcases for new pthread cancellation mechanism
- Authentication-results: sourceware.org; auth=none
- References: <1444234995-9542-1-git-send-email-adhemerval dot zanella at linaro dot com> <1444234995-9542-3-git-send-email-adhemerval dot zanella at linaro dot com>
> diff --git a/nptl/tst-cancel2.c b/nptl/tst-cancel2.c
> index 1a74992..3d34169 100644
> --- a/nptl/tst-cancel2.c
> +++ b/nptl/tst-cancel2.c
> @@ -33,6 +33,9 @@ tf (void *arg)
> char buf[100000];
>
> while (write (fd[1], buf, sizeof (buf)) > 0);
> + /* The write can return a value higher than 0 (meaning partial write)
> + due the SIGCANCEL, but the thread may still pending cancellation. */
> + pthread_testcancel ();
"due to the"
"may still be pending"
The same comment with the same errors is repeated in several tests.
> --- a/nptl/tst-cancel4.c
> +++ b/nptl/tst-cancel4.c
> @@ -38,8 +38,10 @@
> #include <sys/un.h>
> #include <sys/wait.h>
>
> -#include "pthreadP.h"
> -
> +/* The signal used for asynchronous cancelation. */
> +#ifndef SIGCANCEL
> +# define SIGCANCEL __SIGRTMIN
> +#endif
What's the rationale for this change? If the test needs SIGCANCEL then it
is relying on implementation internals. If that is necessary for this
test, then it is better to use an internal header than to duplicate part of
its content. If some other part of pthreadP.h interferes with this code,
or if you just want to avoid unnecessary internals, then you can just
#include <nptl-signals.h> instead.
> + if (arg == NULL)
> + // XXX If somebody can provide a portable test case in which open()
> + // blocks we can enable this test to run in both rounds.
> + abort ();
You can create such a scenario in POSIX systems using mkfifo.