This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Problem with glibc, sigaction, linux-2.0.36


>>>>> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]