summaryrefslogtreecommitdiff
path: root/util-linux/pivot_root.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-02-24 19:17:07 +0000
committerEric Andersen <andersen@codepoet.org>2001-02-24 19:17:07 +0000
commitd160a27ec15b9304e6576616639f0f347022a258 (patch)
tree1732d8e76fe36c67099357c3076ceb5cc60ac084 /util-linux/pivot_root.c
parentdc12190ba258dcaa3b5758fabf0e92f8e8380b26 (diff)
downloadbusybox-w32-d160a27ec15b9304e6576616639f0f347022a258.tar.gz
busybox-w32-d160a27ec15b9304e6576616639f0f347022a258.tar.bz2
busybox-w32-d160a27ec15b9304e6576616639f0f347022a258.zip
Stub out the syscall, not the whole application. The stubbed
out syscall sets errno properly and whines about missing kernel support. -Erik
Diffstat (limited to 'util-linux/pivot_root.c')
-rw-r--r--util-linux/pivot_root.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/util-linux/pivot_root.c b/util-linux/pivot_root.c
index d34dcd7cc..4d7f8a3d1 100644
--- a/util-linux/pivot_root.c
+++ b/util-linux/pivot_root.c
@@ -3,24 +3,35 @@
3 * pivot_root.c - Change root file system. Based on util-linux 2.10s 3 * pivot_root.c - Change root file system. Based on util-linux 2.10s
4 * 4 *
5 * busyboxed by Evin Robertson 5 * busyboxed by Evin Robertson
6 * pivot_root syscall stubbed by Erik Andersen, so it will compile
7 * regardless of the kernel being used.
6 */ 8 */
7#include <stdlib.h> 9#include <stdlib.h>
8#include <stdio.h> 10#include <stdio.h>
11#include <errno.h>
9#include <sys/syscall.h> 12#include <sys/syscall.h>
10#include <linux/unistd.h> 13#include <linux/unistd.h>
11#include "busybox.h" 14#include "busybox.h"
12 15
13#ifndef __NR_pivot_root 16#ifndef __NR_pivot_root
14#warning This kernel does not support the pivot_root syscall 17#warning This kernel does not support the pivot_root syscall
15#warning The pivot_root application is being stubbed out... 18#warning The pivot_root system call is being stubbed out...
16int pivot_root_main(int argc, char **argv) 19int pivot_root(const char * new_root,const char * put_old)
17{ 20{
18 printf("Please recompile with a kernel supporting the pivot_root syscall.\n"); 21 /* BusyBox was compiled against a kernel that did not support
19 return 0; 22 * the pivot_root system call. To make this application work,
23 * you will need to recompile with a kernel supporting the
24 * pivot_root system call.
25 */
26 fprintf(stderr, "\n\nTo make this application work, you will need to recompile\n");
27 fprintf(stderr, "with a kernel supporting the pivot_root system call. -Erik\n\n");
28 errno=ENOSYS;
29 return -1;
20} 30}
21#else 31#else
22
23static _syscall2(int,pivot_root,const char *,new_root,const char *,put_old) 32static _syscall2(int,pivot_root,const char *,new_root,const char *,put_old)
33#endif
34
24 35
25 36
26int pivot_root_main(int argc, char **argv) 37int pivot_root_main(int argc, char **argv)
@@ -28,13 +39,12 @@ int pivot_root_main(int argc, char **argv)
28 if (argc != 3) 39 if (argc != 3)
29 show_usage(); 40 show_usage();
30 41
31 if (pivot_root(argv[1],argv[2]) < 0) 42 if (pivot_root(argv[1],argv[2]) < 0)
32 perror_msg_and_die("pivot_root"); 43 perror_msg_and_die("pivot_root");
33 44
34 return EXIT_SUCCESS; 45 return EXIT_SUCCESS;
35 46
36} 47}
37#endif
38 48
39 49
40/* 50/*