Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] iperf: fix build on !MMU platforms
Date: Fri, 11 May 2012 22:23:48 +0200	[thread overview]
Message-ID: <4FAD7554.50605@mind.be> (raw)
In-Reply-To: <87ipg7iurd.fsf@macbook.be.48ers.dk>

On 05/07/12 22:47, Peter Korsgaard wrote:
>>>>>> "Thomas" == Thomas Petazzoni<thomas.petazzoni@free-electrons.com>  writes:
>
>   Thomas>  Build tested on sh2a and blackfin architectures.
>
> Thanks. Have you sent these patches upstream?
>
>   Thomas>  ++++ b/src/Listener.cpp
>   Thomas>  +@@ -679,7 +679,11 @@
>   Thomas>  +     pid_t pid;
>   Thomas>  +
>   Thomas>  +     /* Create a child process&  if successful, exit from the parent process */
>   Thomas>  ++#ifndef HAVE_FORK
>   Thomas>  ++    if ( (pid = vfork()) == -1 ) {
>   Thomas>  ++#else
>   Thomas>  +     if ( (pid = fork()) == -1 ) {
>   Thomas>  ++#endif
>   Thomas>  +         fprintf( stderr, "error in first child create\n");
>   Thomas>  +         exit(0);
>
> I believe you aren't allowed to call exit() after vfork (but should use
> _exit() instead).
>
> http://unix.stackexchange.com/questions/5364/why-should-a-child-of-a-vfork-or-fork-call-exit-instead-of-exit

  This particular exit is OK, because it is in the error case.
It's the one below that is not OK.  Or rather, nothing is OK, because
the child process after a vfork is not supposed to do anything except
exec() or _exit() - it certainly shouldn't return from the function.
In fact, on Linux the parent process is suspended until the child either
_exit()s or exec()s, so it doesn't daemonize at all.

  I'm not sure how you can daemonize in a posixly-correct way on a NOMMU
target.  But since we're running on Linux, we can just use daemon(),
right?  Both glibc and uclibc define it AFAIK.

  Regards,
  Arnout

-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

      reply	other threads:[~2012-05-11 20:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-07 16:39 [Buildroot] [PATCH 1/2] iperf: fix build on !MMU platforms Thomas Petazzoni
2012-05-07 16:39 ` [Buildroot] [PATCH 2/2] dropbear: fix " Thomas Petazzoni
2012-05-07 20:47 ` [Buildroot] [PATCH 1/2] iperf: fix build " Peter Korsgaard
2012-05-11 20:23   ` Arnout Vandecappelle [this message]

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=4FAD7554.50605@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /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