ubase

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

pivot_root.c (440B)


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