From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 30 18:10:19 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9C3DD16A41F for ; Sun, 30 Oct 2005 18:10:19 +0000 (GMT) (envelope-from micheel_d23@yahoo.com.tr) Received: from web26508.mail.ukl.yahoo.com (web26508.mail.ukl.yahoo.com [217.146.176.45]) by mx1.FreeBSD.org (Postfix) with SMTP id D089643D48 for ; Sun, 30 Oct 2005 18:10:18 +0000 (GMT) (envelope-from micheel_d23@yahoo.com.tr) Received: (qmail 25045 invoked by uid 60001); 30 Oct 2005 18:10:17 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.tr; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=0+5eEWvrFUDaeK4FuT0Wa6v8bVzGr661Y+xKOaIxJaiabbNGq/CzhXuqZWSUegDXesr9sBiAjPF356K2ge/yQUC25E84aJ8tbPhSTUCbChPTZrlKXWJNXFfGamKWtof0RB9Fral4nesbag5+Ut1kOT+5rUkWz/6OihFQYUqxVd0= ; Message-ID: <20051030181017.25043.qmail@web26508.mail.ukl.yahoo.com> Received: from [81.214.137.234] by web26508.mail.ukl.yahoo.com via HTTP; Sun, 30 Oct 2005 20:10:17 EET Date: Sun, 30 Oct 2005 20:10:17 +0200 (EET) From: micheel drippee To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: signal handling in child process. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Oct 2005 18:10:19 -0000 hello, i have a daemon program and installed a signal_handler() function for it. from signal_handler: case SIGCHLD: if ((wait(&status)) == -1) return; if (WIFSIGNALED(status)) return; if (WIFSTOPPED(status)) return; if (WIFEXITED(status)) return; break; in child process i am doing a fork() and then execve. switch((pid = vfork())) { case -1: error... case 0: execve(); default: if (wait(&stat) == -1) { syslog(LOG_ERR, "wait: %s", strerror(errno)); return -1; } } The problem is that: when the executing program is exited wait() returns error. 'No child processes' I determined that, my signal handler catchs SIGCHLD when the process finish. And then waits it. So the child process cannot wait its own child. How can i solve this problem? I found a solution but i am not sure if it is best way. I ignore SIGCHLD in child before execve. signal(SIGCHLD, SIG_IGN); What is your comments. thank you.. -mch ___________________________________________________________________ Yahoo! kullaniyor musunuz? http://tr.mail.yahoo.com Istenmeyen postadan biktiniz mi? Istenmeyen postadan en iyi korunma Yahoo! Posta’da