This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Ulrich Drepper <drepper@redhat.com> writes: |> Andreas Schwab <schwab@suse.de> writes: |> |> > When sigaction in libpthread is called the first time for a signal we |> > don't know whether the old signal handler is SIG_DFL or SIG_IGN, so we |> > must return the value that the kernel reports. |> |> Thanks, I've applied this. But it would really help if we could get |> test cases. Yes. 2002-01-12 Andreas Schwab <schwab@suse.de> * Makefile (test-srcs): Add tst-signal. (tests): Run tst-signal. (distribute): Add tst-signal.sh. * tst-signal.c, tst-signal.sh: New files. --- linuxthreads/Makefile.~1.47.~ Thu Nov 29 10:40:10 2001 +++ linuxthreads/Makefile Sat Jan 12 20:18:51 2002 @@ -25,7 +25,7 @@ Banner) headers := pthread.h semaphore.h -distribute := internals.h queue.h restart.h spinlock.h +distribute := internals.h queue.h restart.h spinlock.h tst-signal.sh routines := weaks no-tsd @@ -61,6 +61,7 @@ tests = ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 $(librt-tests) ex12 ex13 joinrace \ tststack $(tests-nodelete-$(have-z-nodelete)) ecmutex ex14 ex15 ex16 \ ex17 ex18 tst-cancel tst-context +test-srcs = tst-signal ifeq (yes,$(build-shared)) tests-nodelete-yes = unload @@ -88,11 +89,11 @@ # Make sure we link with the thread library. ifeq ($(build-shared),yes) -$(addprefix $(objpfx),$(tests)): $(objpfx)libpthread.so +$(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.so $(addprefix $(objpfx),$(librt-tests)): $(common-objpfx)rt/librt.so $(objpfx)unload: $(common-objpfx)dlfcn/libdl.so else -$(addprefix $(objpfx),$(tests)): $(objpfx)libpthread.a +$(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.a $(addprefix $(objpfx),$(librt-tests)): $(common-objpfx)rt/librt.a endif ifeq ($(build-bounded),yes) @@ -128,3 +129,11 @@ otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ $(resolvobjdir)/libresolv.a endif + +ifeq (no,$(cross-compiling)) +ifeq (yes,$(build-shared)) +tests: $(objpfx)tst-signal.out +$(objpfx)tst-signal.out: tst-signal.sh $(objpfx)tst-signal + $(SHELL) -e $< $(common-objpfx) +endif +endif --- /dev/null Mon May 28 21:24:31 2001 +++ linuxthreads/tst-signal.c Sat Jan 12 20:24:28 2002 @@ -0,0 +1,64 @@ +/* Test sigaction wrapper. */ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Schwab <schwab@suse.de>. + + 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 <stdio.h> +#include <stdlib.h> +#include <signal.h> + +int +main (int argc, char *argv[]) +{ + struct sigaction old_sa, new_sa; + + if (sigaction (SIGHUP, NULL, &old_sa) < 0) + { + printf ("cannot get signal action for SIGHUP: %m\n"); + exit (1); + } + + if (old_sa.sa_handler != SIG_IGN) + { + printf ("SIGHUP action should be SIG_IGN, is %p\n", + (void *) old_sa.sa_handler); + exit (1); + } + + new_sa.sa_handler = SIG_DFL; + if (sigaction (SIGHUP, &new_sa, NULL) < 0) + { + printf ("cannot set signal action for SIGHUP: %m\n"); + exit (1); + } + + if (sigaction (SIGHUP, NULL, &old_sa) < 0) + { + printf ("cannot get signal action for SIGHUP: %m\n"); + exit (1); + } + + if (old_sa.sa_handler != SIG_DFL) + { + printf ("SIGHUP action should be SIG_DFL, is %p\n", + (void *) old_sa.sa_handler); + exit (1); + } + + return 0; +} --- /dev/null Mon May 28 21:24:31 2001 +++ linuxthreads/tst-signal.sh Sat Jan 12 20:16:15 2002 @@ -0,0 +1,28 @@ +#! /bin/sh +# Testing the sigaction wrapper. +# Copyright (C) 2002 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 +# 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. + +common_objpfx=$1; shift + +# set up to ignore SIGHUP +trap '' 1 + +exec ${common_objpfx}elf/ld.so --library-path $common_objpfx:${common_objpfx}linuxthreads \ + ${common_objpfx}linuxthreads/tst-signal -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |