linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Robert Plantz" <plantz@sonoma.edu>
To: linux-assembly@vger.kernel.org
Subject: Re: sys_fork
Date: Tue, 29 Nov 2005 20:00:21 -0800	[thread overview]
Message-ID: <op.s01b2vwizyondc@localhost.localdomain> (raw)
In-Reply-To: <20051129222013.305cd393.rnsanchez@terra.com.br>

If you're going to use signals (a good idea), you should get a good book,  
like
Stevens or Robbins & Robbins. The signal coverage in Robbins & Robbins
is more up to date than the orginial Stevens. I haven't seen the second  
edition
of Stevens, but the descriptions say that signal coverage has been  
expanded.


On Tue, 29 Nov 2005 16:20:13 -0800, Ricardo Nabinger Sanchez  
<rnsanchez@terra.com.br> wrote:

> Quoting  HIToC <hitoc_mail@yahoo.it>
> Sent on  Tue, 29 Nov 2005 19:59:56 +0100
>
> Hello,
>
> I wouldn't recommend you to call wait4pid, because your process (the  
> accept
> () one) will block, and thus fork() will not be an advantage (you can do
> that naturally without forking).
>
> What would be a nice thing to do is to prepare a signal handler for
> SIG_CHILD, to clean up its children.  It is very single to use, all you
> need is to tell the kernel to use your custom function for handling
> SIG_CHILD, instead of the default action (which is to ignore the signal,
> and you'll end with a bunch of zombies).
>
> Btw, such a function is like this in C:
>
> void handle_sigchild() {
> 	wait();
> }
>
> notice that the process will not block, as the signal is being delivered
> because of a terminating child.  it will be cleaned even if the process  
> is
> blocked in accept().
>
> I'm almost sure that you'll also need to handle interrupted accept(),  
> which
> will return -1 and errno will have EINTR (interrupted system call).  in
> this case, call accept() again :)
>
> have fun :)
>

  reply	other threads:[~2005-11-30  4:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-26 17:06 sys_fork HIToC
2005-11-26 17:23 ` sys_fork Ricardo Nabinger Sanchez
2005-11-26 19:26 ` sys_fork Claudio Fontana
2005-11-27 18:22   ` sys_fork HIToC
2005-11-27 19:27     ` sys_fork Ricardo Nabinger Sanchez
2005-11-28 10:10       ` sys_fork HIToC
2005-11-28 13:48         ` sys_fork Frank Kotler
2005-11-28 19:25         ` sys_fork Ricardo Nabinger Sanchez
2005-11-29 18:59           ` sys_fork HIToC
2005-11-30  0:20             ` sys_fork Ricardo Nabinger Sanchez
2005-11-30  4:00               ` Robert Plantz [this message]
2005-11-30 10:26                 ` sys_fork Ricardo Nabinger Sanchez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.s01b2vwizyondc@localhost.localdomain \
    --to=plantz@sonoma.edu \
    --cc=linux-assembly@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).