• Christian Brauner's avatar
    fork: introduce kernel_clone() · cad6967a
    Christian Brauner authored
    The old _do_fork() helper doesn't follow naming conventions of in-kernel
    helpers for syscalls. The process creation cleanup in [1] didn't change the
    name to something more reasonable mainly because _do_fork() was used in quite a
    few places. So sending this as a separate series seemed the better strategy.
    
    This commit does two things:
    1. renames _do_fork() to kernel_clone() but keeps _do_fork() as a simple static
       inline wrapper around kernel_clone().
    2. Changes the return type from long to pid_t. This aligns kernel_thread() and
       kernel_clone(). Also, the return value from kernel_clone that is surfaced in
       fork(), vfork(), clone(), and clone3() is taken from pid_vrn() which returns
       a pid_t too.
    
    Follow-up patches will switch each caller of _do_fork() and each place where it
    is referenced over to kernel_clone(). After all these changes are done, we can
    remove _do_fork() completely and will only be left with kernel_clone().
    
    [1]: 9ba27414 ("Merge tag 'fork-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux")
    Signed-off-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20200819104655.436656-2-christian.brauner@ubuntu.com
    cad6967a
fork.c 73.3 KB