From a4de4eb53951718b260fa79ae3535db795e1e6ef Mon Sep 17 00:00:00 2001 From: sin Date: Wed, 14 Aug 2013 14:38:56 +0100 Subject: [PATCH] Add pivot_root(8) --- Makefile | 1 + pivot_root.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 pivot_root.c 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; +}