From owner-freebsd-questions@FreeBSD.ORG Tue May 21 10:14:51 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BA3794EF for ; Tue, 21 May 2013 10:14:51 +0000 (UTC) (envelope-from vilibald.wanca@gmail.com) Received: from mail-pb0-x22d.google.com (mail-pb0-x22d.google.com [IPv6:2607:f8b0:400e:c01::22d]) by mx1.freebsd.org (Postfix) with ESMTP id 9DE0B64A for ; Tue, 21 May 2013 10:14:51 +0000 (UTC) Received: by mail-pb0-f45.google.com with SMTP id mc17so460469pbc.32 for ; Tue, 21 May 2013 03:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=sFdM2TeaDqLiP8v5l9zB4I/GRj3rAZWwVkXkYZCgAFI=; b=eZMar7+InT6PHc1x7nVDcJtkw0XZimMREi8HhmE6UrFZn/jnPIsukgxD6dN4h3gJ8l ow5KzQCo546PJRurfotT/LkiM8lb4BwA22GEYylmkVHLai5x/X86t9jfg87ZizScj1ce sEGtwnVhF5SSOmG/f3+xJoyK8Q9xa7BQK2SsJFdzNkYkAK6+h9kPSsBJdFjaeHRct3an j+9iGiQEfTxY1QEfbI13TzTEpVInjxL3z75vlumBfQU4NAiD4yRWPcHHvoNUw76MByy1 LDE3Z/AHzRi38H4uWoPHw4r18hB+Iieos/tyT9Qp2I++RnDl0GBqvf8K+l0I8DWACtRM tdnQ== MIME-Version: 1.0 X-Received: by 10.66.89.65 with SMTP id bm1mr2330193pab.179.1369131291429; Tue, 21 May 2013 03:14:51 -0700 (PDT) Received: by 10.68.6.4 with HTTP; Tue, 21 May 2013 03:14:51 -0700 (PDT) Date: Tue, 21 May 2013 12:14:51 +0200 Message-ID: Subject: Re: signal vs. sigaction and SIGCHLD From: vilibald wanca To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2013 10:14:51 -0000 Doesn't wait call suspend the calling process until the child is terminated? >From man page for wait: The wait() function suspends execution of its calling process until status information is available for a terminated child process But in your case the child process is not terminated. If you use the same pid = waitpid(-1, &tstat, WUNTRACED); in case of signal you'll get the same result as with sigaction, or that's what I suspect to happen, haven't had a chance test it. Vilda 2013/5/21 Polytropon > > On Tue, 21 May 2013 15:24:26 +1000, Noel Hunt wrote: > > If I recompile with `#undef SIGACTION', waithandler is not > > called. > > > > I should add that even with the sigaction(2) interface, without > > the `sigprocmask' call, it still doesn't work, which suggests > > that SIGCHLD is being blocked. > > > > Can anyone explain why? > > From reading "man 3 signal", I get the following impression: > > No Name Default Action Description > 20 SIGCHLD discard signal child status has changed > > The default action is to discard the signal, so the following > paragraph could make sense: > > The sig argument specifies which signal was received. The func procedure > allows a user to choose the action upon receipt of a signal. To set the > default action of the signal to occur as listed above, func should be > SIG_DFL. A SIG_DFL resets the default action. To ignore the signal func > should be SIG_IGN. This will cause subsequent instances of the signal to > be ignored and pending instances to be discarded. If SIG_IGN is not > used, further occurrences of the signal are automatically blocked and > func is called. > > From my limited understanding, maybe this could help you find > an explanation of the observed behaviour? > > Also compare /usr/include/sys/signal.h for the definition of > the involved typedef's. > > > -- > Polytropon > Magdeburg, Germany > Happy FreeBSD user since 4.0 > Andra moi ennepe, Mousa, ... > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"