This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Remove unused fork implementations
From: "Joseph S. Myers" <joseph@codesourcery.com>
Date: Tue, 24 Apr 2012 21:21:50 +0000 (UTC)
> On Tue, 24 Apr 2012, Roland McGrath wrote:
>
>> It's still possible to configure for *-linux-gnu without nptl
>> (given --disable-sanity), in which case those files would be used.
>
> The sysdeps/unix files still wouldn't be used because fork is in
> sysdeps/unix/sysv/linux/syscalls.list, which will take precedence. I
> guess this case is relevant to the removal of
> sysdeps/unix/sysv/linux/sparc/fork.S (and the IA64 version in ports),
> though - David, should that file be kept on that basis, or is removing
> both SPARC versions of fork.S OK?
You cannot remove the Linux sparc fork.S, otherwise the return values
will be wrong. We need special assembler after the system call trap
because the fork system call on sparc returns two values.
In the parent:
%o0 = child's PID
%o1 = 0
In the child:
%o0 = parent's PID
%o1 = 1
Therefore, we have to frob the return value of the child in %o0 so
that zero is returned instead of that parent's PID.
And that's what the Linux sparc specific fork.S code is doing.