1/* See LICENSE file for copyright and license details. */
2
3#include <sys/syscall.h>
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <unistd.h>
8
9#include "util.h"
10
11static void
12usage(void)
13{
14 eprintf("usage: %s new-root put-old\n", argv0);
15}
16
17// ?man pivot_root: change the root filesystem
18// ?man arguments: new-root put-old
19// ?man change the root filesystem of the current process
20int
21main(int argc, char *argv[])
22{
23 ARGBEGIN
24 {
25 default:
26 usage();
27 }
28 ARGEND;
29
30 if (argc < 2)
31 usage();
32
33 if (syscall(SYS_pivot_root, argv[0], argv[1]) < 0)
34 eprintf("pivot_root:");
35
36 return 0;
37}