All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@davemloft.net>
To: sparclinux@vger.kernel.org
Subject: Re: clone return code
Date: Wed, 05 Apr 2006 21:21:38 +0000	[thread overview]
Message-ID: <20060405.142138.12167410.davem@davemloft.net> (raw)
In-Reply-To: <87psjvu4wa.fsf@thorr.asgardr.info>

From: Daniel 'NebuchadnezzaR' Dehennin <sparc@asgardr.info>
Date: Wed, 05 Apr 2006 22:46:45 +0200

> Sorry if that question seems idiot but is it normal that clone return
> the parent pid in the child ?
> 
> Is seems that on other architectures it have the same behavior than
> fork: return 0 in the child.

The system call convention follows that of SunOS on which
the syscall handling was based.  Return "1" in the %o1
register in the child and "0" in the parent, and that's how
the the call sites distinguish the two cases.

GLIBC's fork() and clone() stubs interpret this properly and
give the expected return values.

If you want to implement your own direct calls to these
system calls you'll need to handle the return values
properly, else just call the glibc provided stubs directly
which will do this for you.

Why is this an issue?

  reply	other threads:[~2006-04-05 21:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-05 20:46 clone return code Daniel 'NebuchadnezzaR' Dehennin
2006-04-05 21:21 ` David S. Miller [this message]
2006-04-05 21:55 ` Daniel 'NebuchadnezzaR' Dehennin

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=20060405.142138.12167410.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=sparclinux@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.