[Ilugc] Signals!!

  • From: binand@xxxxxxxxx (Binand Sethumadhavan)
  • Date: Thu Jun 2 18:27:29 2005

On 02 Jun 2005 17:04:30 +0530, Raja Mallik <raja.mallik@xxxxxxxxxxx> wrote:

Pl, find this file attached..

Seems to me that either the shell or sleep() is blocking SIGUSR1. It
doesn't seem to block SIGUSR2, though.

strace output:

rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1], NULL, 8) = 0
nanosleep({1, 0}, {1, 0})               = 0

Suggestions:

Don't use system(). It is bad to use library calls from a signal handler anyway.
Don't use sleep(). Use select() to sleep.

Binand

Other related posts: