This is the mail archive of the libc-hacker@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: too early, no vfork


> Cc: Linus Torvalds <torvalds@transmeta.com>
> Reply-To: drepper@cygnus.com (Ulrich Drepper)
> From: Ulrich Drepper <drepper@cygnus.com>
> Date: 19 Jan 1999 17:15:13 -0800
> 
> I was too early in saying vfork works.  And braindead on top of this.
> 
> In fact it is impossible to use clone to write vfork on ix86 without
> using malloc.  The problem is that the syscall needs %eax, %ebx, and
> %ecx.  But we have two values to save: %ebx and the return address.
> But there is only %edx available.  The only possible user-level
> implementation would have to allocate some memory outside the stack,
> store the two values and keep the pointer in %edx.  But this is of
> course unacceptable.

Why not just use static data?  You'd have to have a lock, of course,
to make it thread-safe, but you need only allocate and release the
lock in the parent.  The user wouldn't be able to call vfork from
inside the vfork child, but I don't think they would expect to be able
to do that (or, to be more precise, once they read the documentation
they'll know they can't do that).

Admittedly, it's ugly.  But then again, this is vfork we're talking
about.
-- 
Geoffrey Keating <geoffk@ozemail.com.au>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]