Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Aug 2001 09:09:32 -0700 (PDT)
From:      Hans Zaunere <zaunere@yahoo.com>
To:        freebsd-hackers@freebsd.org
Subject:   Signal Handling
Message-ID:  <20010813160932.30924.qmail@web12801.mail.yahoo.com>

next in thread | raw e-mail | index | archive | help

In a program that I am working on, I've decided to
catch signal 15, which then calls execl() in the
handler to reload the program from the on-disk binary.
 I am able to send it the signal, it reloads, and
works fine.  However I could not send the signal again
and have the program respond.  I then learned, with
some help, that the signal needs to be unblocked after
each call.  It now works as intended.

However in reading about this, in Steven's Advanced
Programming in the UNIX Environment, he states: 
"Naturally a signal that is being caught by a process
that calls exec cannot be caught in the new program,
since the address of the signal-catching function in
the caller probably has no meaning in the new program
file that is execed. Page. 273)

This makes sense to me, however doesn't seem to be the
case.  Three questions:

1) Why, in the first place, does a signal become
blocked after it is recieved?  Why does the kernel
want to do this?

2) If a 10k binary is running, the signal is sent, and
the program is reloaded from disk, but is 100k (or 1k
even) how does the signal handling function get
called, taking into account what Stevens says.  Steven
states that the sigmask remains for calls across exec,
so wouldn't the wrong address to the handler function
be used?

3) Is my using of exec, in fact, the best way to
reload the program on the fly, from within itself? 
What would be the best, robust, way to do this in the
future?

Thank you all for your time,

Hans
zaunere@yahoo.com

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010813160932.30924.qmail>