diff --git a/Makefile b/Makefile index d30db0c..9bba950 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ SRC = \ lsmod.c \ mkswap.c \ mount.c \ + pivot_root.c \ reboot.c \ rmmod.c \ stat.c \ diff --git a/pivot_root.c b/pivot_root.c new file mode 100644 index 0000000..9c0746d --- /dev/null +++ b/pivot_root.c @@ -0,0 +1,28 @@ +/* See LICENSE file for copyright and license details. */ +#include +#include +#include +#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; +}