From owner-freebsd-hackers Mon Aug 13 9: 9:36 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from web12801.mail.yahoo.com (web12801.mail.yahoo.com [216.136.174.36]) by hub.freebsd.org (Postfix) with SMTP id 1507937B408 for ; Mon, 13 Aug 2001 09:09:33 -0700 (PDT) (envelope-from zaunere@yahoo.com) Message-ID: <20010813160932.30924.qmail@web12801.mail.yahoo.com> Received: from [128.122.155.151] by web12801.mail.yahoo.com; Mon, 13 Aug 2001 09:09:32 PDT Date: Mon, 13 Aug 2001 09:09:32 -0700 (PDT) From: Hans Zaunere Subject: Signal Handling To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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