fs: add ksys_dup{,3}() helper; remove in-kernel calls to sys_dup{,3}()
Using ksys_dup() and ksys_dup3() as helper functions allows us to
avoid the in-kernel calls to the sys_dup() and sys_dup3() syscalls.
The ksys_ prefix denotes that these functions are meant as a drop-in
replacement for the syscalls. In particular, they use the same
calling convention as sys_dup{,3}().
In the near future, the fs-external callers of ksys_dup{,3}() should be
converted to call do_dup2() directly. Then, ksys_dup{,3}() can be moved
within sys_dup{,3}() again.
This patch is part of a series which removes in-kernel calls to syscalls.
On this basis, the syscall entry path can be streamlined. For details, see
http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
@@ -39,8 +39,8 @@ static int init_linuxrc(struct subprocess_info *info, struct cred *new)
|
||||
sys_unshare(CLONE_FS | CLONE_FILES);
|
||||
/* stdin/stdout/stderr for /linuxrc */
|
||||
sys_open("/dev/console", O_RDWR, 0);
|
||||
sys_dup(0);
|
||||
sys_dup(0);
|
||||
ksys_dup(0);
|
||||
ksys_dup(0);
|
||||
/* move initrd over / and chdir/chroot in initrd root */
|
||||
sys_chdir("/root");
|
||||
ksys_mount(".", "/", NULL, MS_MOVE, NULL);
|
||||
|
||||
Reference in New Issue
Block a user