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.
This commit is contained in:
Joel Sherrill
2001-01-26 14:12:48 +00:00
parent 809feccc93
commit 37535317d9
6 changed files with 185 additions and 2 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -1,4 +1,10 @@
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

View File

@@ -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

59
c/src/lib/libc/chroot.c Normal file
View File

@@ -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;
}

View File

@@ -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;
}