Add pivot_root(8)
This commit is contained in:
parent
76614ae86b
commit
a4de4eb539
1
Makefile
1
Makefile
@ -17,6 +17,7 @@ SRC = \
|
|||||||
lsmod.c \
|
lsmod.c \
|
||||||
mkswap.c \
|
mkswap.c \
|
||||||
mount.c \
|
mount.c \
|
||||||
|
pivot_root.c \
|
||||||
reboot.c \
|
reboot.c \
|
||||||
rmmod.c \
|
rmmod.c \
|
||||||
stat.c \
|
stat.c \
|
||||||
|
28
pivot_root.c
Normal file
28
pivot_root.c
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage(void)
|
||||||
|
{
|
||||||
|
eprintf("usage: %s new-root put-old\n", argv0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
ARGBEGIN {
|
||||||
|
default:
|
||||||
|
usage();
|
||||||
|
} ARGEND;
|
||||||
|
|
||||||
|
if (argc < 2)
|
||||||
|
usage();
|
||||||
|
|
||||||
|
if (syscall(SYS_pivot_root, argv[0], argv[1]) < 0)
|
||||||
|
eprintf("pivot_root:");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user