File indexing completed on 2025-05-11 08:24:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifdef HAVE_CONFIG_H
0016 #include "config.h"
0017 #endif
0018
0019 #include <stdio.h>
0020 #include <unistd.h>
0021 #include <string.h>
0022 #include <errno.h>
0023
0024 #include <rtems.h>
0025 #include <rtems/shell.h>
0026 #include "internal.h"
0027
0028 static int rtems_shell_main_chroot(
0029 int argc,
0030 char * argv[]
0031 )
0032 {
0033 char *new_root = "/";
0034
0035 if (argc == 2)
0036 new_root = argv[1];
0037
0038 if ( chroot(new_root) < 0 ) {
0039 fprintf(stderr,"chroot %s (%s)\n", new_root, strerror(errno));
0040 return -1;
0041 }
0042
0043 return 0;
0044 }
0045
0046 rtems_shell_cmd_t rtems_shell_CHROOT_Command = {
0047 "chroot",
0048 "chroot [dir] # change the root directory",
0049 "files",
0050 rtems_shell_main_chroot,
0051 NULL,
0052 NULL
0053 };