mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 22:44:02 +08:00
2002-01-04 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* include/rtems/libio_.h: Remove set_errno_and_return_minus_one. * libc/cfsetispeed.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/cfsetospeed.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/chdir.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/chmod.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/chown.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/chroot.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/closedir.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/eval.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/fchdir.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/fchmod.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/fdatasync.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/fpathconf.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/fstat.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/fsync.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/ftruncate.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/getdents.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/ioctl.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/link.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/lseek.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/mknod.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/open.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/read.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/readlink.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/rmdir.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/stat.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/symlink.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/tcsetattr.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/telldir.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/ttyname.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/ttyname_r.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/unlink.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/unmount.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/utime.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one. * libc/write.c: Include <rtems/seterr.h>. Apply rtems_set_errno_and_return_minus_one.
This commit is contained in:
@@ -67,17 +67,6 @@ extern rtems_libio_t *rtems_libio_iops;
|
||||
extern rtems_libio_t *rtems_libio_last_iop;
|
||||
extern rtems_libio_t *rtems_libio_iop_freelist;
|
||||
|
||||
/*
|
||||
* set_errno_and_return_minus_one
|
||||
*
|
||||
* Macro to ease common way to return an error.
|
||||
*/
|
||||
|
||||
#ifndef set_errno_and_return_minus_one
|
||||
#define set_errno_and_return_minus_one( _error ) \
|
||||
do { errno = (_error); return -1; } while(0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rtems_libio_iop
|
||||
*
|
||||
@@ -152,7 +141,7 @@ extern rtems_libio_t *rtems_libio_iop_freelist;
|
||||
#define rtems_libio_check_permissions(_iop, _flag) \
|
||||
do { \
|
||||
if (((_iop)->flags & (_flag)) == 0) { \
|
||||
set_errno_and_return_minus_one( EINVAL ); \
|
||||
rtems_set_errno_and_return_minus_one( EINVAL ); \
|
||||
return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
@@ -251,7 +240,6 @@ extern rtems_user_env_t rtems_global_user_env;
|
||||
#define _POSIX_types_Egid (rtems_current_user_env->egid)
|
||||
#define _POSIX_types_Getlogin_buffer (rtems_current_user_env->login_buffer)
|
||||
|
||||
|
||||
/*
|
||||
* Instantiate a private copy of the per user information for the calling task.
|
||||
*/
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <termios.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int cfsetispeed(
|
||||
struct termios *tp,
|
||||
@@ -31,7 +32,7 @@ int cfsetispeed(
|
||||
)
|
||||
{
|
||||
if ( speed & ~CBAUD )
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
tp->c_cflag = (tp->c_cflag & ~CIBAUD) | (speed * (CIBAUD / CBAUD));
|
||||
return 0;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <termios.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int cfsetospeed(
|
||||
struct termios *tp,
|
||||
@@ -31,7 +32,7 @@ int cfsetospeed(
|
||||
)
|
||||
{
|
||||
if ( speed & ~CBAUD )
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
tp->c_cflag = (tp->c_cflag & ~CBAUD) | speed;
|
||||
return 0;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int chdir(
|
||||
const char *pathname
|
||||
@@ -44,12 +45,12 @@ int chdir(
|
||||
|
||||
if ( !loc.ops->node_type_h ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTDIR );
|
||||
rtems_set_errno_and_return_minus_one( ENOTDIR );
|
||||
}
|
||||
|
||||
rtems_filesystem_freenode( &rtems_filesystem_current );
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int chmod(
|
||||
const char *path,
|
||||
@@ -39,12 +40,12 @@ int chmod(
|
||||
|
||||
if ( !loc.handlers ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( EBADF );
|
||||
rtems_set_errno_and_return_minus_one( EBADF );
|
||||
}
|
||||
|
||||
if ( !loc.handlers->fchmod_h ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.handlers->fchmod_h)( &loc, mode );
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <rtems/libio.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int chown(
|
||||
const char *path,
|
||||
@@ -37,7 +38,7 @@ int chown(
|
||||
|
||||
if ( !loc.ops->chown_h ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.ops->chown_h)( &loc, owner, group );
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int chroot(
|
||||
const char *pathname
|
||||
@@ -34,7 +35,7 @@ int chroot(
|
||||
if (rtems_current_user_env == &rtems_global_user_env) {
|
||||
rtems_libio_set_private_env(); /* try to set a new private env*/
|
||||
if (rtems_current_user_env == &rtems_global_user_env) /* not ok */
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
};
|
||||
|
||||
loc = rtems_filesystem_root; /* save the value */
|
||||
@@ -42,7 +43,7 @@ int chroot(
|
||||
result = chdir(pathname);
|
||||
if (result) {
|
||||
rtems_filesystem_root = loc; /* restore the value */
|
||||
set_errno_and_return_minus_one( errno );
|
||||
rtems_set_errno_and_return_minus_one( errno );
|
||||
};
|
||||
rtems_filesystem_root = rtems_filesystem_current;
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ static char sccsid[] = "@(#)closedir.c 5.9 (Berkeley) 2/23/91";
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
/*
|
||||
* close a directory.
|
||||
@@ -62,7 +63,7 @@ closedir(dirp)
|
||||
int fd;
|
||||
|
||||
if ( !dirp )
|
||||
set_errno_and_return_minus_one( EBADF );
|
||||
rtems_set_errno_and_return_minus_one( EBADF );
|
||||
|
||||
fd = dirp->dd_fd;
|
||||
dirp->dd_fd = -1;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int rtems_filesystem_evaluate_path(
|
||||
const char *pathname,
|
||||
@@ -36,10 +37,10 @@ int rtems_filesystem_evaluate_path(
|
||||
*/
|
||||
|
||||
if ( !pathname )
|
||||
set_errno_and_return_minus_one( EFAULT );
|
||||
rtems_set_errno_and_return_minus_one( EFAULT );
|
||||
|
||||
if ( !pathloc )
|
||||
set_errno_and_return_minus_one( EIO ); /* should never happen */
|
||||
rtems_set_errno_and_return_minus_one( EIO ); /* should never happen */
|
||||
|
||||
/*
|
||||
* Evaluate the path using the optable evalpath.
|
||||
@@ -48,7 +49,7 @@ int rtems_filesystem_evaluate_path(
|
||||
rtems_filesystem_get_start_loc( pathname, &i, pathloc );
|
||||
|
||||
if ( !pathloc->ops->evalpath_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
result = (*pathloc->ops->evalpath_h)( &pathname[i], flags, pathloc );
|
||||
|
||||
@@ -60,7 +61,7 @@ int rtems_filesystem_evaluate_path(
|
||||
if ( (result == 0) && follow_link ) {
|
||||
|
||||
if ( !pathloc->ops->node_type_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
type = (*pathloc->ops->node_type_h)( pathloc );
|
||||
|
||||
@@ -68,7 +69,7 @@ int rtems_filesystem_evaluate_path(
|
||||
( type == RTEMS_FILESYSTEM_SYM_LINK ) ) {
|
||||
|
||||
if ( !pathloc->ops->eval_link_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
result = (*pathloc->ops->eval_link_h)( pathloc, flags );
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <rtems.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int fchdir(
|
||||
int fd
|
||||
@@ -44,16 +45,16 @@ int fchdir(
|
||||
*/
|
||||
|
||||
if ( !iop->pathinfo.ops ) {
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( !iop->pathinfo.ops->node_type_h ) {
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( (*iop->pathinfo.ops->node_type_h)( &iop->pathinfo ) !=
|
||||
RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||
set_errno_and_return_minus_one( ENOTDIR );
|
||||
rtems_set_errno_and_return_minus_one( ENOTDIR );
|
||||
}
|
||||
|
||||
rtems_filesystem_freenode( &rtems_filesystem_current );
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <rtems.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int fchmod(
|
||||
int fd,
|
||||
@@ -41,7 +42,7 @@ int fchmod(
|
||||
rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
|
||||
|
||||
if ( !iop->handlers->fchmod_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
return (*iop->pathinfo.handlers->fchmod_h)( &iop->pathinfo, mode );
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int fdatasync(
|
||||
int fd
|
||||
@@ -35,7 +36,7 @@ int fdatasync(
|
||||
*/
|
||||
|
||||
if ( !iop->handlers->fdatasync_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
return (*iop->handlers->fdatasync_h)( iop );
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#endif
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
@@ -78,7 +79,7 @@ long fpathconf(
|
||||
return_value = the_limits->posix_sync_io;
|
||||
break;
|
||||
default:
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int fstat(
|
||||
int fd,
|
||||
@@ -33,7 +34,7 @@ int fstat(
|
||||
*/
|
||||
|
||||
if ( !sbuf )
|
||||
set_errno_and_return_minus_one( EFAULT );
|
||||
rtems_set_errno_and_return_minus_one( EFAULT );
|
||||
|
||||
/*
|
||||
* Now process the stat() request.
|
||||
@@ -44,10 +45,10 @@ int fstat(
|
||||
rtems_libio_check_is_open(iop);
|
||||
|
||||
if ( !iop->handlers )
|
||||
set_errno_and_return_minus_one( EBADF );
|
||||
rtems_set_errno_and_return_minus_one( EBADF );
|
||||
|
||||
if ( !iop->handlers->fstat_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
/*
|
||||
* Zero out the stat structure so the various support
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int fsync(
|
||||
int fd
|
||||
@@ -35,10 +36,10 @@ int fsync(
|
||||
*/
|
||||
|
||||
if ( !iop->handlers )
|
||||
set_errno_and_return_minus_one( EBADF );
|
||||
rtems_set_errno_and_return_minus_one( EBADF );
|
||||
|
||||
if ( !iop->handlers->fsync_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
return (*iop->handlers->fsync_h)( iop );
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int ftruncate(
|
||||
int fd,
|
||||
@@ -42,15 +43,15 @@ int ftruncate(
|
||||
|
||||
loc = iop->pathinfo;
|
||||
if ( !loc.ops->node_type_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY )
|
||||
set_errno_and_return_minus_one( EISDIR );
|
||||
rtems_set_errno_and_return_minus_one( EISDIR );
|
||||
|
||||
rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
|
||||
|
||||
if ( !iop->handlers->ftruncate_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
return (*iop->handlers->ftruncate_h)( iop, length );
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int getdents(
|
||||
int dd_fd,
|
||||
@@ -45,10 +46,10 @@ int getdents(
|
||||
*/
|
||||
loc = iop->pathinfo;
|
||||
if ( !loc.ops->node_type_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
|
||||
set_errno_and_return_minus_one( ENOTDIR );
|
||||
rtems_set_errno_and_return_minus_one( ENOTDIR );
|
||||
|
||||
/*
|
||||
* Return the number of bytes that were actually transfered as a result
|
||||
@@ -56,7 +57,7 @@ int getdents(
|
||||
*/
|
||||
|
||||
if ( !iop->handlers->read_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
return (*iop->handlers->read_h)( iop, dd_buf, dd_len );
|
||||
}
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -46,10 +49,10 @@ int ioctl(
|
||||
*/
|
||||
|
||||
if ( !iop->handlers )
|
||||
set_errno_and_return_minus_one( EBADF );
|
||||
rtems_set_errno_and_return_minus_one( EBADF );
|
||||
|
||||
if ( !iop->handlers->ioctl_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
rc = (*iop->handlers->ioctl_h)( iop, command, buffer );
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int link(
|
||||
const char *existing,
|
||||
@@ -48,13 +49,13 @@ int link(
|
||||
|
||||
if ( !parent_loc.ops->evalformake_h ) {
|
||||
rtems_filesystem_freenode( &existing_loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*parent_loc.ops->evalformake_h)( &new[i], &parent_loc, &name_start );
|
||||
if ( result != 0 ) {
|
||||
rtems_filesystem_freenode( &existing_loc );
|
||||
set_errno_and_return_minus_one( result );
|
||||
rtems_set_errno_and_return_minus_one( result );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -65,13 +66,13 @@ int link(
|
||||
if ( parent_loc.mt_entry != existing_loc.mt_entry ) {
|
||||
rtems_filesystem_freenode( &existing_loc );
|
||||
rtems_filesystem_freenode( &parent_loc );
|
||||
set_errno_and_return_minus_one( EXDEV );
|
||||
rtems_set_errno_and_return_minus_one( EXDEV );
|
||||
}
|
||||
|
||||
if ( !parent_loc.ops->link_h ) {
|
||||
rtems_filesystem_freenode( &existing_loc );
|
||||
rtems_filesystem_freenode( &parent_loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*parent_loc.ops->link_h)( &existing_loc, &parent_loc, name_start );
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
off_t lseek(
|
||||
int fd,
|
||||
@@ -38,7 +39,7 @@ off_t lseek(
|
||||
*/
|
||||
|
||||
if ( !iop->handlers->lseek_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
/*
|
||||
* Now process the lseek().
|
||||
@@ -59,7 +60,7 @@ off_t lseek(
|
||||
break;
|
||||
|
||||
default:
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int mknod(
|
||||
const char *pathname,
|
||||
@@ -40,16 +41,16 @@ int mknod(
|
||||
int result;
|
||||
|
||||
if ( !(mode & (S_IFREG|S_IFCHR|S_IFBLK|S_IFIFO) ) )
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
if ( S_ISFIFO(mode) )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
rtems_filesystem_get_start_loc( pathname, &i, &temp_loc );
|
||||
|
||||
if ( !temp_loc.ops->evalformake_h ) {
|
||||
rtems_filesystem_freenode( &temp_loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*temp_loc.ops->evalformake_h)(
|
||||
@@ -62,7 +63,7 @@ int mknod(
|
||||
|
||||
if ( !temp_loc.ops->mknod_h ) {
|
||||
rtems_filesystem_freenode( &temp_loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*temp_loc.ops->mknod_h)( name_start, mode, dev, &temp_loc );
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -184,7 +187,7 @@ done:
|
||||
rtems_libio_free( iop );
|
||||
if ( loc_to_free )
|
||||
rtems_filesystem_freenode( loc_to_free );
|
||||
set_errno_and_return_minus_one( rc );
|
||||
rtems_set_errno_and_return_minus_one( rc );
|
||||
}
|
||||
|
||||
return iop - rtems_libio_iops;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#endif
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
ssize_t read(
|
||||
int fd,
|
||||
@@ -38,7 +39,7 @@ ssize_t read(
|
||||
*/
|
||||
|
||||
if ( !iop->handlers->read_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
rc = (*iop->handlers->read_h)( iop, buffer, count );
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#endif
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int readlink(
|
||||
const char *pathname,
|
||||
@@ -27,7 +28,7 @@ int readlink(
|
||||
int result;
|
||||
|
||||
if (!buf)
|
||||
set_errno_and_return_minus_one( EFAULT );
|
||||
rtems_set_errno_and_return_minus_one( EFAULT );
|
||||
|
||||
result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE );
|
||||
if ( result != 0 )
|
||||
@@ -35,17 +36,17 @@ int readlink(
|
||||
|
||||
if ( !loc.ops->node_type_h ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
}
|
||||
|
||||
if ( !loc.ops->readlink_h ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.ops->readlink_h)( &loc, buf, bufsize );
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int rmdir(
|
||||
const char *pathname
|
||||
@@ -44,12 +45,12 @@ int rmdir(
|
||||
|
||||
if ( !loc.ops->node_type_h ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTDIR );
|
||||
rtems_set_errno_and_return_minus_one( ENOTDIR );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -58,7 +59,7 @@ int rmdir(
|
||||
|
||||
if ( !loc.handlers->rmnod_h ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.handlers->rmnod_h)( &loc );
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int _STAT_NAME(
|
||||
const char *path,
|
||||
@@ -55,7 +56,7 @@ int _STAT_NAME(
|
||||
*/
|
||||
|
||||
if ( !buf )
|
||||
set_errno_and_return_minus_one( EFAULT );
|
||||
rtems_set_errno_and_return_minus_one( EFAULT );
|
||||
|
||||
status = rtems_filesystem_evaluate_path( path, 0, &loc, _STAT_FOLLOW_LINKS );
|
||||
if ( status != 0 )
|
||||
@@ -63,7 +64,7 @@ int _STAT_NAME(
|
||||
|
||||
if ( !loc.handlers->fstat_h ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#endif
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int symlink(
|
||||
const char *actualpath,
|
||||
@@ -34,7 +35,7 @@ int symlink(
|
||||
|
||||
if ( !loc.ops->symlink_h ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.ops->symlink_h)( &loc, actualpath, name_start);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int tcsetattr(
|
||||
int fd,
|
||||
@@ -35,7 +36,7 @@ int tcsetattr(
|
||||
{
|
||||
switch (opt) {
|
||||
default:
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
case TCSADRAIN:
|
||||
if (ioctl( fd, RTEMS_IO_TCDRAIN, NULL ) < 0)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
long telldir(
|
||||
DIR *dirp
|
||||
@@ -31,7 +31,7 @@ long telldir(
|
||||
rtems_libio_t *iop;
|
||||
|
||||
if ( !dirp )
|
||||
set_errno_and_return_minus_one( EBADF );
|
||||
rtems_set_errno_and_return_minus_one( EBADF );
|
||||
|
||||
/*
|
||||
* Get the file control block structure associated with the
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int ttyname_r(
|
||||
int fd,
|
||||
@@ -36,14 +36,14 @@ int ttyname_r(
|
||||
|
||||
/* Must be a terminal. */
|
||||
if (tcgetattr (fd, &tty) < 0)
|
||||
set_errno_and_return_minus_one(EBADF);
|
||||
rtems_set_errno_and_return_minus_one(EBADF);
|
||||
|
||||
/* Must be a character device. */
|
||||
if (fstat (fd, &sb) || !S_ISCHR (sb.st_mode))
|
||||
set_errno_and_return_minus_one(EBADF);
|
||||
rtems_set_errno_and_return_minus_one(EBADF);
|
||||
|
||||
if ((dp = opendir (_PATH_DEV)) == NULL)
|
||||
set_errno_and_return_minus_one(EBADF);
|
||||
rtems_set_errno_and_return_minus_one(EBADF);
|
||||
|
||||
for (rval = NULL; (dirp = readdir (dp)) != NULL ;)
|
||||
{
|
||||
|
||||
@@ -55,6 +55,7 @@ static char sccsid[] = "@(#)ttyname.c 5.10 (Berkeley) 5/6/91";
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
/*
|
||||
* ttyname_r() - POSIX 1003.1b 4.7.2 - Demetermine Terminal Device Name
|
||||
@@ -75,14 +76,14 @@ int ttyname_r(
|
||||
|
||||
/* Must be a terminal. */
|
||||
if (tcgetattr (fd, &tty) < 0)
|
||||
set_errno_and_return_minus_one(EBADF);
|
||||
rtems_set_errno_and_return_minus_one(EBADF);
|
||||
|
||||
/* Must be a character device. */
|
||||
if (_fstat (fd, &sb) || !S_ISCHR (sb.st_mode))
|
||||
set_errno_and_return_minus_one(EBADF);
|
||||
rtems_set_errno_and_return_minus_one(EBADF);
|
||||
|
||||
if ((dp = opendir (_PATH_DEV)) == NULL)
|
||||
set_errno_and_return_minus_one(EBADF);
|
||||
rtems_set_errno_and_return_minus_one(EBADF);
|
||||
|
||||
for (rval = NULL; (dirp = readdir (dp)) != NULL ;)
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int unlink(
|
||||
const char *path
|
||||
@@ -36,17 +37,17 @@ int unlink(
|
||||
|
||||
if ( !loc.ops->node_type_h ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( EISDIR );
|
||||
rtems_set_errno_and_return_minus_one( EISDIR );
|
||||
}
|
||||
|
||||
if ( !loc.ops->unlink_h ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.ops->unlink_h)( &loc );
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
/*
|
||||
* Data structures and routines private to mount/unmount pair.
|
||||
@@ -125,7 +126,7 @@ int unmount(
|
||||
|
||||
if ( !rtems_filesystem_nodes_equal( fs_root_loc, &loc) ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( EACCES );
|
||||
rtems_set_errno_and_return_minus_one( EACCES );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -139,10 +140,10 @@ int unmount(
|
||||
*/
|
||||
|
||||
if ( !fs_mount_loc->ops->unmount_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
if ( !fs_root_loc->ops->fsunmount_me_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
|
||||
/*
|
||||
@@ -154,14 +155,14 @@ int unmount(
|
||||
*/
|
||||
|
||||
if ( rtems_filesystem_current.mt_entry == mt_entry )
|
||||
set_errno_and_return_minus_one( EBUSY );
|
||||
rtems_set_errno_and_return_minus_one( EBUSY );
|
||||
|
||||
/*
|
||||
* Verify there are no file systems below the path specified
|
||||
*/
|
||||
|
||||
if ( file_systems_below_this_mountpoint( path, fs_root_loc, mt_entry ) != 0 )
|
||||
set_errno_and_return_minus_one( EBUSY );
|
||||
rtems_set_errno_and_return_minus_one( EBUSY );
|
||||
|
||||
/*
|
||||
* Run the file descriptor table to determine if there are any file
|
||||
@@ -170,7 +171,7 @@ int unmount(
|
||||
*/
|
||||
|
||||
if ( rtems_libio_is_open_files_in_fs( mt_entry ) == 1 )
|
||||
set_errno_and_return_minus_one( EBUSY );
|
||||
rtems_set_errno_and_return_minus_one( EBUSY );
|
||||
|
||||
/*
|
||||
* Allow the file system being unmounted on to do its cleanup.
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int utime(
|
||||
const char *path,
|
||||
@@ -34,7 +35,7 @@ int utime(
|
||||
|
||||
if ( !temp_loc.ops->utime_h ){
|
||||
rtems_filesystem_freenode( &temp_loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*temp_loc.ops->utime_h)( &temp_loc, times->actime, times->modtime );
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#endif
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
/*
|
||||
* write
|
||||
@@ -46,7 +46,7 @@ ssize_t write(
|
||||
*/
|
||||
|
||||
if ( !iop->handlers->write_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
rc = (*iop->handlers->write_h)( iop, buffer, count );
|
||||
|
||||
|
||||
@@ -1,3 +1,75 @@
|
||||
2002-01-04 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
|
||||
|
||||
* include/rtems/libio_.h: Remove set_errno_and_return_minus_one.
|
||||
* libc/cfsetispeed.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/cfsetospeed.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/chdir.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/chmod.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/chown.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/chroot.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/closedir.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/eval.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/fchdir.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/fchmod.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/fdatasync.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/fpathconf.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/fstat.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/fsync.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/ftruncate.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/getdents.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/ioctl.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/link.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/lseek.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/mknod.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/open.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/read.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/readlink.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/rmdir.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/stat.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/symlink.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/tcsetattr.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/telldir.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/ttyname.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/ttyname_r.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/unlink.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/unmount.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/utime.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
* libc/write.c: Include <rtems/seterr.h>.
|
||||
Apply rtems_set_errno_and_return_minus_one.
|
||||
|
||||
2002-01-03 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
|
||||
|
||||
* libc/printk.c: Include rtems/bspIo.h instead of bspIo.h.
|
||||
|
||||
@@ -67,17 +67,6 @@ extern rtems_libio_t *rtems_libio_iops;
|
||||
extern rtems_libio_t *rtems_libio_last_iop;
|
||||
extern rtems_libio_t *rtems_libio_iop_freelist;
|
||||
|
||||
/*
|
||||
* set_errno_and_return_minus_one
|
||||
*
|
||||
* Macro to ease common way to return an error.
|
||||
*/
|
||||
|
||||
#ifndef set_errno_and_return_minus_one
|
||||
#define set_errno_and_return_minus_one( _error ) \
|
||||
do { errno = (_error); return -1; } while(0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rtems_libio_iop
|
||||
*
|
||||
@@ -152,7 +141,7 @@ extern rtems_libio_t *rtems_libio_iop_freelist;
|
||||
#define rtems_libio_check_permissions(_iop, _flag) \
|
||||
do { \
|
||||
if (((_iop)->flags & (_flag)) == 0) { \
|
||||
set_errno_and_return_minus_one( EINVAL ); \
|
||||
rtems_set_errno_and_return_minus_one( EINVAL ); \
|
||||
return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
@@ -251,7 +240,6 @@ extern rtems_user_env_t rtems_global_user_env;
|
||||
#define _POSIX_types_Egid (rtems_current_user_env->egid)
|
||||
#define _POSIX_types_Getlogin_buffer (rtems_current_user_env->login_buffer)
|
||||
|
||||
|
||||
/*
|
||||
* Instantiate a private copy of the per user information for the calling task.
|
||||
*/
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <termios.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int cfsetispeed(
|
||||
struct termios *tp,
|
||||
@@ -31,7 +32,7 @@ int cfsetispeed(
|
||||
)
|
||||
{
|
||||
if ( speed & ~CBAUD )
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
tp->c_cflag = (tp->c_cflag & ~CIBAUD) | (speed * (CIBAUD / CBAUD));
|
||||
return 0;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <termios.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int cfsetospeed(
|
||||
struct termios *tp,
|
||||
@@ -31,7 +32,7 @@ int cfsetospeed(
|
||||
)
|
||||
{
|
||||
if ( speed & ~CBAUD )
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
tp->c_cflag = (tp->c_cflag & ~CBAUD) | speed;
|
||||
return 0;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int chdir(
|
||||
const char *pathname
|
||||
@@ -44,12 +45,12 @@ int chdir(
|
||||
|
||||
if ( !loc.ops->node_type_h ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTDIR );
|
||||
rtems_set_errno_and_return_minus_one( ENOTDIR );
|
||||
}
|
||||
|
||||
rtems_filesystem_freenode( &rtems_filesystem_current );
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int chmod(
|
||||
const char *path,
|
||||
@@ -39,12 +40,12 @@ int chmod(
|
||||
|
||||
if ( !loc.handlers ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( EBADF );
|
||||
rtems_set_errno_and_return_minus_one( EBADF );
|
||||
}
|
||||
|
||||
if ( !loc.handlers->fchmod_h ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.handlers->fchmod_h)( &loc, mode );
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <rtems/libio.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int chown(
|
||||
const char *path,
|
||||
@@ -37,7 +38,7 @@ int chown(
|
||||
|
||||
if ( !loc.ops->chown_h ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.ops->chown_h)( &loc, owner, group );
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int chroot(
|
||||
const char *pathname
|
||||
@@ -34,7 +35,7 @@ int chroot(
|
||||
if (rtems_current_user_env == &rtems_global_user_env) {
|
||||
rtems_libio_set_private_env(); /* try to set a new private env*/
|
||||
if (rtems_current_user_env == &rtems_global_user_env) /* not ok */
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
};
|
||||
|
||||
loc = rtems_filesystem_root; /* save the value */
|
||||
@@ -42,7 +43,7 @@ int chroot(
|
||||
result = chdir(pathname);
|
||||
if (result) {
|
||||
rtems_filesystem_root = loc; /* restore the value */
|
||||
set_errno_and_return_minus_one( errno );
|
||||
rtems_set_errno_and_return_minus_one( errno );
|
||||
};
|
||||
rtems_filesystem_root = rtems_filesystem_current;
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ static char sccsid[] = "@(#)closedir.c 5.9 (Berkeley) 2/23/91";
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
/*
|
||||
* close a directory.
|
||||
@@ -62,7 +63,7 @@ closedir(dirp)
|
||||
int fd;
|
||||
|
||||
if ( !dirp )
|
||||
set_errno_and_return_minus_one( EBADF );
|
||||
rtems_set_errno_and_return_minus_one( EBADF );
|
||||
|
||||
fd = dirp->dd_fd;
|
||||
dirp->dd_fd = -1;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int rtems_filesystem_evaluate_path(
|
||||
const char *pathname,
|
||||
@@ -36,10 +37,10 @@ int rtems_filesystem_evaluate_path(
|
||||
*/
|
||||
|
||||
if ( !pathname )
|
||||
set_errno_and_return_minus_one( EFAULT );
|
||||
rtems_set_errno_and_return_minus_one( EFAULT );
|
||||
|
||||
if ( !pathloc )
|
||||
set_errno_and_return_minus_one( EIO ); /* should never happen */
|
||||
rtems_set_errno_and_return_minus_one( EIO ); /* should never happen */
|
||||
|
||||
/*
|
||||
* Evaluate the path using the optable evalpath.
|
||||
@@ -48,7 +49,7 @@ int rtems_filesystem_evaluate_path(
|
||||
rtems_filesystem_get_start_loc( pathname, &i, pathloc );
|
||||
|
||||
if ( !pathloc->ops->evalpath_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
result = (*pathloc->ops->evalpath_h)( &pathname[i], flags, pathloc );
|
||||
|
||||
@@ -60,7 +61,7 @@ int rtems_filesystem_evaluate_path(
|
||||
if ( (result == 0) && follow_link ) {
|
||||
|
||||
if ( !pathloc->ops->node_type_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
type = (*pathloc->ops->node_type_h)( pathloc );
|
||||
|
||||
@@ -68,7 +69,7 @@ int rtems_filesystem_evaluate_path(
|
||||
( type == RTEMS_FILESYSTEM_SYM_LINK ) ) {
|
||||
|
||||
if ( !pathloc->ops->eval_link_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
result = (*pathloc->ops->eval_link_h)( pathloc, flags );
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <rtems.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int fchdir(
|
||||
int fd
|
||||
@@ -44,16 +45,16 @@ int fchdir(
|
||||
*/
|
||||
|
||||
if ( !iop->pathinfo.ops ) {
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( !iop->pathinfo.ops->node_type_h ) {
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( (*iop->pathinfo.ops->node_type_h)( &iop->pathinfo ) !=
|
||||
RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||
set_errno_and_return_minus_one( ENOTDIR );
|
||||
rtems_set_errno_and_return_minus_one( ENOTDIR );
|
||||
}
|
||||
|
||||
rtems_filesystem_freenode( &rtems_filesystem_current );
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <rtems.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int fchmod(
|
||||
int fd,
|
||||
@@ -41,7 +42,7 @@ int fchmod(
|
||||
rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
|
||||
|
||||
if ( !iop->handlers->fchmod_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
return (*iop->pathinfo.handlers->fchmod_h)( &iop->pathinfo, mode );
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int fdatasync(
|
||||
int fd
|
||||
@@ -35,7 +36,7 @@ int fdatasync(
|
||||
*/
|
||||
|
||||
if ( !iop->handlers->fdatasync_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
return (*iop->handlers->fdatasync_h)( iop );
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#endif
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
@@ -78,7 +79,7 @@ long fpathconf(
|
||||
return_value = the_limits->posix_sync_io;
|
||||
break;
|
||||
default:
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int fstat(
|
||||
int fd,
|
||||
@@ -33,7 +34,7 @@ int fstat(
|
||||
*/
|
||||
|
||||
if ( !sbuf )
|
||||
set_errno_and_return_minus_one( EFAULT );
|
||||
rtems_set_errno_and_return_minus_one( EFAULT );
|
||||
|
||||
/*
|
||||
* Now process the stat() request.
|
||||
@@ -44,10 +45,10 @@ int fstat(
|
||||
rtems_libio_check_is_open(iop);
|
||||
|
||||
if ( !iop->handlers )
|
||||
set_errno_and_return_minus_one( EBADF );
|
||||
rtems_set_errno_and_return_minus_one( EBADF );
|
||||
|
||||
if ( !iop->handlers->fstat_h )
|
||||
set_errno_and_return_minus_one( ENOTSUP );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
/*
|
||||
* Zero out the stat structure so the various support
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user