summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2001-01-26 14:12:48 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2001-01-26 14:12:48 +0000
commit37535317d9612bb365a3dce08b0b1d2d71e387b3 (patch)
tree72f4dbb6405ebc2af27e656c69adda17b374b85a
parent2001-01-25 Eric Norum <eric.norum@usask.ca> (diff)
downloadrtems-37535317d9612bb365a3dce08b0b1d2d71e387b3.tar.bz2
2001-01-25 Joel Sherrill <joel@OARcorp.com>
* cpu.c, rtems/score/cpu.h: Bug report from Peter Mueller <peter.o.mueller@gmx.de> because of not correcting for the ISR vector table now being allocated from the workspace.
-rw-r--r--c/src/exec/libcsupport/src/Makefile.am2
-rw-r--r--c/src/exec/libcsupport/src/chroot.c59
-rw-r--r--c/src/lib/ChangeLog6
-rw-r--r--c/src/lib/libc/Makefile.am2
-rw-r--r--c/src/lib/libc/chroot.c59
-rw-r--r--cpukit/libcsupport/src/chroot.c59
6 files changed, 185 insertions, 2 deletions
diff --git a/c/src/exec/libcsupport/src/Makefile.am b/c/src/exec/libcsupport/src/Makefile.am
index 2c68aa9377..03ac3854c3 100644
--- a/c/src/exec/libcsupport/src/Makefile.am
+++ b/c/src/exec/libcsupport/src/Makefile.am
@@ -23,7 +23,7 @@ SYSTEM_CALL_C_FILES = open.c close.c read.c write.c lseek.c ioctl.c mkdir.c \
mknod.c mkfifo.c rmdir.c chdir.c chmod.c fchdir.c fchmod.c chown.c \
link.c unlink.c umask.c ftruncate.c utime.c fstat.c fcntl.c fpathconf.c \
getdents.c fsync.c fdatasync.c pipe.c dup.c dup2.c symlink.c readlink.c \
- creat.c
+ creat.c chroot.c
DIRECTORY_SCAN_C_FILES = opendir.c closedir.c readdir.c rewinddir.c \
scandir.c seekdir.c telldir.c getcwd.c
diff --git a/c/src/exec/libcsupport/src/chroot.c b/c/src/exec/libcsupport/src/chroot.c
new file mode 100644
index 0000000000..b48082bda7
--- /dev/null
+++ b/c/src/exec/libcsupport/src/chroot.c
@@ -0,0 +1,59 @@
+/*
+ * chroot() - Change Root Directory
+ * Author: fernando.ruiz@ctv.es
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+
+#include <unistd.h>
+#include <errno.h>
+
+#include <rtems/libio_.h>
+
+int chroot(
+ const char *pathname
+)
+{
+ int result;
+ rtems_filesystem_location_info_t loc;
+
+ if (rtems_current_user_env == &rtems_global_user_env)
+ set_errno_and_return_minus_one( ENOTSUP );
+
+ loc = rtems_filesystem_root;i /* save the value */
+
+ /* if has been already changed */
+ rtems_filesystem_root = rtems_global_user_env.filesystem_root;
+
+ result = chdir(pathname);
+ if (result) {
+ rtems_filesystem_root = loc; /* restore the value */
+ set_errno_and_return_minus_one( errno );
+ };
+ rtems_filesystem_root = rtems_filesystem_current;
+
+ result = chdir("/");
+ if (result) {
+ rtems_filesystem_root = loc; /* restore the value */
+ set_errno_and_return_minus_one( errno );
+ };
+
+ /*XXX : Call this? Sorry but I don't known if it is necesary */
+ /* The old root.
+ rtems_filesystem_freenode( &loc );
+ */
+ return 0;
+}
diff --git a/c/src/lib/ChangeLog b/c/src/lib/ChangeLog
index e53afe276f..75de54613c 100644
--- a/c/src/lib/ChangeLog
+++ b/c/src/lib/ChangeLog
@@ -2,6 +2,12 @@
2001-01-25 Fernando Ruiz <fernando.ruiz@ctv.es>
* Alternate email is correo@fernando-ruiz.com
+ * libc/chroot.c: New file.
+ * libc/Makefile.am: Reflect above.
+
+2001-01-25 Fernando Ruiz <fernando.ruiz@ctv.es>
+
+ * Alternate email is correo@fernando-ruiz.com
* libc/privateenv.c: New file.
* include/rtems/libio_.h, libc/Makefile.am, libc/base_fs.c,
libc/unmount.c: Moved default umask, current working directory,
diff --git a/c/src/lib/libc/Makefile.am b/c/src/lib/libc/Makefile.am
index 2c68aa9377..03ac3854c3 100644
--- a/c/src/lib/libc/Makefile.am
+++ b/c/src/lib/libc/Makefile.am
@@ -23,7 +23,7 @@ SYSTEM_CALL_C_FILES = open.c close.c read.c write.c lseek.c ioctl.c mkdir.c \
mknod.c mkfifo.c rmdir.c chdir.c chmod.c fchdir.c fchmod.c chown.c \
link.c unlink.c umask.c ftruncate.c utime.c fstat.c fcntl.c fpathconf.c \
getdents.c fsync.c fdatasync.c pipe.c dup.c dup2.c symlink.c readlink.c \
- creat.c
+ creat.c chroot.c
DIRECTORY_SCAN_C_FILES = opendir.c closedir.c readdir.c rewinddir.c \
scandir.c seekdir.c telldir.c getcwd.c
diff --git a/c/src/lib/libc/chroot.c b/c/src/lib/libc/chroot.c
new file mode 100644
index 0000000000..b48082bda7
--- /dev/null
+++ b/c/src/lib/libc/chroot.c
@@ -0,0 +1,59 @@
+/*
+ * chroot() - Change Root Directory
+ * Author: fernando.ruiz@ctv.es
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+
+#include <unistd.h>
+#include <errno.h>
+
+#include <rtems/libio_.h>
+
+int chroot(
+ const char *pathname
+)
+{
+ int result;
+ rtems_filesystem_location_info_t loc;
+
+ if (rtems_current_user_env == &rtems_global_user_env)
+ set_errno_and_return_minus_one( ENOTSUP );
+
+ loc = rtems_filesystem_root;i /* save the value */
+
+ /* if has been already changed */
+ rtems_filesystem_root = rtems_global_user_env.filesystem_root;
+
+ result = chdir(pathname);
+ if (result) {
+ rtems_filesystem_root = loc; /* restore the value */
+ set_errno_and_return_minus_one( errno );
+ };
+ rtems_filesystem_root = rtems_filesystem_current;
+
+ result = chdir("/");
+ if (result) {
+ rtems_filesystem_root = loc; /* restore the value */
+ set_errno_and_return_minus_one( errno );
+ };
+
+ /*XXX : Call this? Sorry but I don't known if it is necesary */
+ /* The old root.
+ rtems_filesystem_freenode( &loc );
+ */
+ return 0;
+}
diff --git a/cpukit/libcsupport/src/chroot.c b/cpukit/libcsupport/src/chroot.c
new file mode 100644
index 0000000000..b48082bda7
--- /dev/null
+++ b/cpukit/libcsupport/src/chroot.c
@@ -0,0 +1,59 @@
+/*
+ * chroot() - Change Root Directory
+ * Author: fernando.ruiz@ctv.es
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+
+#include <unistd.h>
+#include <errno.h>
+
+#include <rtems/libio_.h>
+
+int chroot(
+ const char *pathname
+)
+{
+ int result;
+ rtems_filesystem_location_info_t loc;
+
+ if (rtems_current_user_env == &rtems_global_user_env)
+ set_errno_and_return_minus_one( ENOTSUP );
+
+ loc = rtems_filesystem_root;i /* save the value */
+
+ /* if has been already changed */
+ rtems_filesystem_root = rtems_global_user_env.filesystem_root;
+
+ result = chdir(pathname);
+ if (result) {
+ rtems_filesystem_root = loc; /* restore the value */
+ set_errno_and_return_minus_one( errno );
+ };
+ rtems_filesystem_root = rtems_filesystem_current;
+
+ result = chdir("/");
+ if (result) {
+ rtems_filesystem_root = loc; /* restore the value */
+ set_errno_and_return_minus_one( errno );
+ };
+
+ /*XXX : Call this? Sorry but I don't known if it is necesary */
+ /* The old root.
+ rtems_filesystem_freenode( &loc );
+ */
+ return 0;
+}