Re: [PATCH] fix do_fork() return value

From: Rusty Russell (rusty@rustcorp.com.au)
Date: Mon May 19 2003 - 21:46:44 EST


# Noticed by Julie DeWandel <jdewand@redhat.com>.
#
# do_fork() needs to return the pid (or error), not the pointer to the
# resulting process structure. The process structure may not even be
# valid any more, since do_fork() has already woken the process up (and as
# a result it might already have done its thing and gone away).
#
# Besides, doing it this way cleans up the users, which all really just
# wanted the pid or error number _anyway_.

Just FYI: the change was done in the first place to allow spawning a
new init thread as CPUs come up. But now we have copy_process it can
be done neatly (it should also be done out of keventd so we get a
clean thread, but that's another story).

Note that this version also has a (theoretical) race, except hidden
by the time to wrap PIDs ie. "never happens".

Thanks!
Rusty.

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri May 23 2003 - 22:00:38 EST