From cb5b9388dad6d0524322d45eafaa7b5d7b00b554 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 27 Dec 2003 07:38:25 +0000 Subject: Update. 2003-12-23 Jakub Jelinek * sysdeps/unix/sysv/linux/raise.c (raise): Protect pid = selftid setting with __ASSUME_TGKILL || defined __NR_tgkill. If pid is 0, set it to selftid. * sysdeps/unix/sysv/linux/getpid.c (really_getpid): Make inline. Don't set self->pid but self->tid. If self->pid == 0 and self->tid != 0, return self->tid without doing a syscall. * descr.h (struct pthread): Move pid field after tid. * Makefile (tests): Add tst-raise1. * tst-raise1.c: New file. --- nptl/tst-raise1.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 nptl/tst-raise1.c (limited to 'nptl/tst-raise1.c') diff --git a/nptl/tst-raise1.c b/nptl/tst-raise1.c new file mode 100644 index 0000000000..9c291e6c1f --- /dev/null +++ b/nptl/tst-raise1.c @@ -0,0 +1,42 @@ +#include +#include +#include +#include + +volatile int count; + +void +sh (int sig) +{ + ++count; +} + +int +main (void) +{ + struct sigaction sa; + sa.sa_handler = sh; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + if (sigaction (SIGUSR1, &sa, NULL) < 0) + { + printf ("sigaction failed: %m\n"); + exit (1); + } + if (raise (SIGUSR1) < 0) + { + printf ("first raise failed: %m\n"); + exit (1); + } + if (raise (SIGUSR1) < 0) + { + printf ("second raise failed: %m\n"); + exit (1); + } + if (count != 2) + { + printf ("signal handler not called 2 times\n"); + exit (1); + } + exit (0); +} -- cgit v1.2.3