This is the mail archive of the
glibc-linux@ricardo.ecn.wfu.edu
mailing list for the glibc project.
Re: Problem with glibc, sigaction, linux-2.0.36
- To: Mathias Weidner <mw@kdg.de>
- Subject: Re: Problem with glibc, sigaction, linux-2.0.36
- From: Andreas Jaeger <aj@arthur.rhein-neckar.de>
- Date: 11 Jun 1999 08:42:16 +0200
- Cc: glibc-linux@ricardo.ecn.wfu.edu
- References: <Pine.LNX.4.04.9906110749150.23188-100000@gruen.intern.kdg.de>
- Reply-To: glibc-linux@ricardo.ecn.wfu.edu
>>>>> Mathias Weidner writes:
> Hello,
> this week I stumbled over a problem with a program that repetitive sets an
> signal handler for SIGALRM and then sets a timer and counts a variable in
> an endless loop. I compiled the program and noticed that it doesn't seem
> to do anything other then count. Tracking this down with gdb and strace I
> found the problem in not getting SIGALRM after the second signal(). I got
> hold on a precompiled version of the program which worked. Apparently this
> one is linked against libc5. I did an strace on the precompiled version
> too and noticed the difference in the system call to sigaction(). Here is
> an excerpt of the relevant portions of the trace.
> -------- with libc5 ---------
> sigaction(SIGALRM, {0x804ca45, [], 0}, {SIG_DFL}) = 0
> setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 16665}},{it_interval={0, 0}, it_value={0, 0}}) = 0
> --- SIGALRM (Alarm clock) ---
> sigaction(SIGALRM, {0x804ca45, [], 0}, {SIG_DFL}) = 0
> setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 16665}},{it_interval={0, 0}, it_value={0, 0}}) = 0
> --- SIGALRM (Alarm clock) ---
> sigaction(SIGALRM, {0x804ca45, [], 0}, {SIG_DFL}) = 0
> setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 16665}},{it_interval={0, 0}, it_value={0, 0}}) = 0
> --- SIGALRM (Alarm clock) ---
> ... this works many times
That's libc5's signal implementation.
> --------- with glibc ---------
> sigaction(SIGALRM, {0x804c9c4, [],SA_STACK|SA_RESTART|SA_NOMASK|SA_ONESHOT|0x40e6672}, {SIG_DFL}) = 0
> setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 16665}},{it_interval={0, 0}, it_value={0, 0}}) = 0
> --- SIGALRM (Alarm clock) ---
> sigaction(SIGALRM, {0x804c9c4, [],SA_STACK|SA_RESTART|SA_NOMASK|SA_ONESHOT|0x40e6672}, {0x804c9c4, [],SA_STACK|0x4feb0}) = 0
> setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 16665}},{it_interval={0, 0}, it_value={0, 0}}) = 0
> --- SIGINT (Interrupt) ---
> +++ killed by SIGINT +++
> ... this was killed by me after several minutes
Perfectly working glibc2 implementation of signal. Did you check the
meaning of SA_RESTART and SA_ONESHOT?
Read the glibc 2 FAQ that comes with every glibc release (current
version is online accessible via
http://sourceware.cygnus.com/glibc/glibc-faq.html).
Andreas
--
Andreas Jaeger aj@arthur.rhein-neckar.de jaeger@informatik.uni-kl.de
for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de