Re: clone return code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Daniel 'NebuchadnezzaR' Dehennin <sparc@xxxxxxxxxxxx>
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?
-
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux