fix do_fork() return value
# Noticed by Julie DeWandel <[email protected]>.
#
# 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.
Hi!
Quoted 10 lines
# Noticed by Julie DeWandel <[email protected]>.
#
#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_.
Quoted 7 lines
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_processit 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".
We have more such wrappers. IIRC, it is possible to go into /proc/PID/something, and just stay there, kill the process, and wait for PIDs to wrap around, fun stuff happens...
Pavel
Signature · 2 lines
When do you have a heart between your knees? [Johanka's followup: and *two* hearts?]