ubase

suckless linux base utils
git clone git://git.2f30.org/ubase
Log | Files | Refs | README | LICENSE

commit a4de4eb53951718b260fa79ae3535db795e1e6ef
parent 76614ae86b9b8a3d0fa3e75f8d1ada3df33d7d66
Author: sin <sin@2f30.org>
Date:   Wed, 14 Aug 2013 14:38:56 +0100

Add pivot_root(8)

Diffstat:
MMakefile | 1+
Apivot_root.c | 28++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)

diff --git 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 @@ -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; +}