Changeset a02224e in rtems
- Timestamp:
- 01/04/02 18:29:37 (22 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- b2709481
- Parents:
- b72e368c
- Files:
-
- 106 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/libcsupport/include/rtems/libio_.h
rb72e368c ra02224e 69 69 70 70 /* 71 * set_errno_and_return_minus_one72 *73 * Macro to ease common way to return an error.74 */75 76 #ifndef set_errno_and_return_minus_one77 #define set_errno_and_return_minus_one( _error ) \78 do { errno = (_error); return -1; } while(0)79 #endif80 81 /*82 71 * rtems_libio_iop 83 72 * … … 153 142 do { \ 154 143 if (((_iop)->flags & (_flag)) == 0) { \ 155 set_errno_and_return_minus_one( EINVAL ); \144 rtems_set_errno_and_return_minus_one( EINVAL ); \ 156 145 return -1; \ 157 146 } \ … … 252 241 #define _POSIX_types_Getlogin_buffer (rtems_current_user_env->login_buffer) 253 242 254 255 243 /* 256 244 * Instantiate a private copy of the per user information for the calling task. -
c/src/exec/libcsupport/src/cfsetispeed.c
rb72e368c ra02224e 25 25 26 26 #include <rtems/libio_.h> 27 #include <rtems/seterr.h> 27 28 28 29 int cfsetispeed( … … 32 33 { 33 34 if ( speed & ~CBAUD ) 34 set_errno_and_return_minus_one( EINVAL );35 rtems_set_errno_and_return_minus_one( EINVAL ); 35 36 36 37 tp->c_cflag = (tp->c_cflag & ~CIBAUD) | (speed * (CIBAUD / CBAUD)); -
c/src/exec/libcsupport/src/cfsetospeed.c
rb72e368c ra02224e 25 25 26 26 #include <rtems/libio_.h> 27 #include <rtems/seterr.h> 27 28 28 29 int cfsetospeed( … … 32 33 { 33 34 if ( speed & ~CBAUD ) 34 set_errno_and_return_minus_one( EINVAL );35 rtems_set_errno_and_return_minus_one( EINVAL ); 35 36 36 37 tp->c_cflag = (tp->c_cflag & ~CBAUD) | speed; -
c/src/exec/libcsupport/src/chdir.c
rb72e368c ra02224e 22 22 23 23 #include <rtems/libio_.h> 24 #include <rtems/seterr.h> 24 25 25 26 int chdir( … … 45 46 if ( !loc.ops->node_type_h ) { 46 47 rtems_filesystem_freenode( &loc ); 47 set_errno_and_return_minus_one( ENOTSUP );48 rtems_set_errno_and_return_minus_one( ENOTSUP ); 48 49 } 49 50 50 51 if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) { 51 52 rtems_filesystem_freenode( &loc ); 52 set_errno_and_return_minus_one( ENOTDIR );53 rtems_set_errno_and_return_minus_one( ENOTDIR ); 53 54 } 54 55 -
c/src/exec/libcsupport/src/chmod.c
rb72e368c ra02224e 24 24 25 25 #include <rtems/libio_.h> 26 #include <rtems/seterr.h> 26 27 27 28 int chmod( … … 40 41 if ( !loc.handlers ){ 41 42 rtems_filesystem_freenode( &loc ); 42 set_errno_and_return_minus_one( EBADF );43 rtems_set_errno_and_return_minus_one( EBADF ); 43 44 } 44 45 45 46 if ( !loc.handlers->fchmod_h ){ 46 47 rtems_filesystem_freenode( &loc ); 47 set_errno_and_return_minus_one( ENOTSUP );48 rtems_set_errno_and_return_minus_one( ENOTSUP ); 48 49 } 49 50 -
c/src/exec/libcsupport/src/chown.c
rb72e368c ra02224e 23 23 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int chown( … … 38 39 if ( !loc.ops->chown_h ) { 39 40 rtems_filesystem_freenode( &loc ); 40 set_errno_and_return_minus_one( ENOTSUP );41 rtems_set_errno_and_return_minus_one( ENOTSUP ); 41 42 } 42 43 -
c/src/exec/libcsupport/src/chroot.c
rb72e368c ra02224e 23 23 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int chroot( … … 35 36 rtems_libio_set_private_env(); /* try to set a new private env*/ 36 37 if (rtems_current_user_env == &rtems_global_user_env) /* not ok */ 37 set_errno_and_return_minus_one( ENOTSUP );38 rtems_set_errno_and_return_minus_one( ENOTSUP ); 38 39 }; 39 40 … … 43 44 if (result) { 44 45 rtems_filesystem_root = loc; /* restore the value */ 45 set_errno_and_return_minus_one( errno );46 rtems_set_errno_and_return_minus_one( errno ); 46 47 }; 47 48 rtems_filesystem_root = rtems_filesystem_current; -
c/src/exec/libcsupport/src/closedir.c
rb72e368c ra02224e 52 52 53 53 #include <rtems/libio_.h> 54 #include <rtems/seterr.h> 54 55 55 56 /* … … 63 64 64 65 if ( !dirp ) 65 set_errno_and_return_minus_one( EBADF );66 rtems_set_errno_and_return_minus_one( EBADF ); 66 67 67 68 fd = dirp->dd_fd; -
c/src/exec/libcsupport/src/eval.c
rb72e368c ra02224e 20 20 #include <rtems.h> 21 21 #include <rtems/libio_.h> 22 #include <rtems/seterr.h> 22 23 23 24 int rtems_filesystem_evaluate_path( … … 37 38 38 39 if ( !pathname ) 39 set_errno_and_return_minus_one( EFAULT );40 rtems_set_errno_and_return_minus_one( EFAULT ); 40 41 41 42 if ( !pathloc ) 42 set_errno_and_return_minus_one( EIO ); /* should never happen */43 rtems_set_errno_and_return_minus_one( EIO ); /* should never happen */ 43 44 44 45 /* … … 49 50 50 51 if ( !pathloc->ops->evalpath_h ) 51 set_errno_and_return_minus_one( ENOTSUP );52 rtems_set_errno_and_return_minus_one( ENOTSUP ); 52 53 53 54 result = (*pathloc->ops->evalpath_h)( &pathname[i], flags, pathloc ); … … 61 62 62 63 if ( !pathloc->ops->node_type_h ) 63 set_errno_and_return_minus_one( ENOTSUP );64 rtems_set_errno_and_return_minus_one( ENOTSUP ); 64 65 65 66 type = (*pathloc->ops->node_type_h)( pathloc ); … … 69 70 70 71 if ( !pathloc->ops->eval_link_h ) 71 set_errno_and_return_minus_one( ENOTSUP );72 rtems_set_errno_and_return_minus_one( ENOTSUP ); 72 73 73 74 result = (*pathloc->ops->eval_link_h)( pathloc, flags ); -
c/src/exec/libcsupport/src/fchdir.c
rb72e368c ra02224e 23 23 #include <rtems/libio.h> 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int fchdir( … … 45 46 46 47 if ( !iop->pathinfo.ops ) { 47 set_errno_and_return_minus_one( ENOTSUP );48 rtems_set_errno_and_return_minus_one( ENOTSUP ); 48 49 } 49 50 50 51 if ( !iop->pathinfo.ops->node_type_h ) { 51 set_errno_and_return_minus_one( ENOTSUP );52 rtems_set_errno_and_return_minus_one( ENOTSUP ); 52 53 } 53 54 54 55 if ( (*iop->pathinfo.ops->node_type_h)( &iop->pathinfo ) != 55 56 RTEMS_FILESYSTEM_DIRECTORY ) { 56 set_errno_and_return_minus_one( ENOTDIR );57 rtems_set_errno_and_return_minus_one( ENOTDIR ); 57 58 } 58 59 -
c/src/exec/libcsupport/src/fchmod.c
rb72e368c ra02224e 23 23 #include <rtems/libio.h> 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int fchmod( … … 42 43 43 44 if ( !iop->handlers->fchmod_h ) 44 set_errno_and_return_minus_one( ENOTSUP );45 rtems_set_errno_and_return_minus_one( ENOTSUP ); 45 46 46 47 return (*iop->pathinfo.handlers->fchmod_h)( &iop->pathinfo, mode ); -
c/src/exec/libcsupport/src/fdatasync.c
rb72e368c ra02224e 19 19 20 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 21 22 22 23 int fdatasync( … … 36 37 37 38 if ( !iop->handlers->fdatasync_h ) 38 set_errno_and_return_minus_one( ENOTSUP );39 rtems_set_errno_and_return_minus_one( ENOTSUP ); 39 40 40 41 return (*iop->handlers->fdatasync_h)( iop ); -
c/src/exec/libcsupport/src/fpathconf.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 #include <rtems/seterr.h> 19 20 20 21 #include <unistd.h> … … 79 80 break; 80 81 default: 81 set_errno_and_return_minus_one( EINVAL );82 rtems_set_errno_and_return_minus_one( EINVAL ); 82 83 break; 83 84 } -
c/src/exec/libcsupport/src/fstat.c
rb72e368c ra02224e 21 21 22 22 #include <rtems/libio_.h> 23 #include <rtems/seterr.h> 23 24 24 25 int fstat( … … 34 35 35 36 if ( !sbuf ) 36 set_errno_and_return_minus_one( EFAULT );37 rtems_set_errno_and_return_minus_one( EFAULT ); 37 38 38 39 /* … … 45 46 46 47 if ( !iop->handlers ) 47 set_errno_and_return_minus_one( EBADF );48 rtems_set_errno_and_return_minus_one( EBADF ); 48 49 49 50 if ( !iop->handlers->fstat_h ) 50 set_errno_and_return_minus_one( ENOTSUP );51 rtems_set_errno_and_return_minus_one( ENOTSUP ); 51 52 52 53 /* -
c/src/exec/libcsupport/src/fsync.c
rb72e368c ra02224e 19 19 20 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 21 22 22 23 int fsync( … … 36 37 37 38 if ( !iop->handlers ) 38 set_errno_and_return_minus_one( EBADF );39 rtems_set_errno_and_return_minus_one( EBADF ); 39 40 40 41 if ( !iop->handlers->fsync_h ) 41 set_errno_and_return_minus_one( ENOTSUP );42 rtems_set_errno_and_return_minus_one( ENOTSUP ); 42 43 43 44 return (*iop->handlers->fsync_h)( iop ); -
c/src/exec/libcsupport/src/ftruncate.c
rb72e368c ra02224e 20 20 21 21 #include <rtems/libio_.h> 22 #include <rtems/seterr.h> 22 23 23 24 int ftruncate( … … 43 44 loc = iop->pathinfo; 44 45 if ( !loc.ops->node_type_h ) 45 set_errno_and_return_minus_one( ENOTSUP );46 rtems_set_errno_and_return_minus_one( ENOTSUP ); 46 47 47 48 if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) 48 set_errno_and_return_minus_one( EISDIR );49 rtems_set_errno_and_return_minus_one( EISDIR ); 49 50 50 51 rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE ); 51 52 52 53 if ( !iop->handlers->ftruncate_h ) 53 set_errno_and_return_minus_one( ENOTSUP );54 rtems_set_errno_and_return_minus_one( ENOTSUP ); 54 55 55 56 return (*iop->handlers->ftruncate_h)( iop, length ); -
c/src/exec/libcsupport/src/getdents.c
rb72e368c ra02224e 25 25 26 26 #include <rtems/libio_.h> 27 #include <rtems/seterr.h> 27 28 28 29 int getdents( … … 46 47 loc = iop->pathinfo; 47 48 if ( !loc.ops->node_type_h ) 48 set_errno_and_return_minus_one( ENOTSUP );49 rtems_set_errno_and_return_minus_one( ENOTSUP ); 49 50 50 51 if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) 51 set_errno_and_return_minus_one( ENOTDIR );52 rtems_set_errno_and_return_minus_one( ENOTDIR ); 52 53 53 54 /* … … 57 58 58 59 if ( !iop->handlers->read_h ) 59 set_errno_and_return_minus_one( ENOTSUP );60 rtems_set_errno_and_return_minus_one( ENOTSUP ); 60 61 61 62 return (*iop->handlers->read_h)( iop, dd_buf, dd_len ); -
c/src/exec/libcsupport/src/ioctl.c
rb72e368c ra02224e 19 19 #endif 20 20 21 #include <stdarg.h> 22 21 23 #include <rtems/libio_.h> 24 #include <rtems/seterr.h> 22 25 23 26 #include <unistd.h> … … 47 50 48 51 if ( !iop->handlers ) 49 set_errno_and_return_minus_one( EBADF );52 rtems_set_errno_and_return_minus_one( EBADF ); 50 53 51 54 if ( !iop->handlers->ioctl_h ) 52 set_errno_and_return_minus_one( ENOTSUP );55 rtems_set_errno_and_return_minus_one( ENOTSUP ); 53 56 54 57 rc = (*iop->handlers->ioctl_h)( iop, command, buffer ); -
c/src/exec/libcsupport/src/link.c
rb72e368c ra02224e 21 21 22 22 #include <rtems/libio_.h> 23 #include <rtems/seterr.h> 23 24 24 25 int link( … … 49 50 if ( !parent_loc.ops->evalformake_h ) { 50 51 rtems_filesystem_freenode( &existing_loc ); 51 set_errno_and_return_minus_one( ENOTSUP );52 rtems_set_errno_and_return_minus_one( ENOTSUP ); 52 53 } 53 54 … … 55 56 if ( result != 0 ) { 56 57 rtems_filesystem_freenode( &existing_loc ); 57 set_errno_and_return_minus_one( result );58 rtems_set_errno_and_return_minus_one( result ); 58 59 } 59 60 … … 66 67 rtems_filesystem_freenode( &existing_loc ); 67 68 rtems_filesystem_freenode( &parent_loc ); 68 set_errno_and_return_minus_one( EXDEV );69 rtems_set_errno_and_return_minus_one( EXDEV ); 69 70 } 70 71 … … 72 73 rtems_filesystem_freenode( &existing_loc ); 73 74 rtems_filesystem_freenode( &parent_loc ); 74 set_errno_and_return_minus_one( ENOTSUP );75 rtems_set_errno_and_return_minus_one( ENOTSUP ); 75 76 } 76 77 -
c/src/exec/libcsupport/src/lseek.c
rb72e368c ra02224e 19 19 20 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 21 22 22 23 off_t lseek( … … 39 40 40 41 if ( !iop->handlers->lseek_h ) 41 set_errno_and_return_minus_one( ENOTSUP );42 rtems_set_errno_and_return_minus_one( ENOTSUP ); 42 43 43 44 /* … … 60 61 61 62 default: 62 set_errno_and_return_minus_one( EINVAL );63 rtems_set_errno_and_return_minus_one( EINVAL ); 63 64 } 64 65 -
c/src/exec/libcsupport/src/mknod.c
rb72e368c ra02224e 28 28 29 29 #include <rtems/libio_.h> 30 #include <rtems/seterr.h> 30 31 31 32 int mknod( … … 41 42 42 43 if ( !(mode & (S_IFREG|S_IFCHR|S_IFBLK|S_IFIFO) ) ) 43 set_errno_and_return_minus_one( EINVAL );44 rtems_set_errno_and_return_minus_one( EINVAL ); 44 45 45 46 if ( S_ISFIFO(mode) ) 46 set_errno_and_return_minus_one( ENOTSUP );47 rtems_set_errno_and_return_minus_one( ENOTSUP ); 47 48 48 49 rtems_filesystem_get_start_loc( pathname, &i, &temp_loc ); … … 50 51 if ( !temp_loc.ops->evalformake_h ) { 51 52 rtems_filesystem_freenode( &temp_loc ); 52 set_errno_and_return_minus_one( ENOTSUP );53 rtems_set_errno_and_return_minus_one( ENOTSUP ); 53 54 } 54 55 … … 63 64 if ( !temp_loc.ops->mknod_h ) { 64 65 rtems_filesystem_freenode( &temp_loc ); 65 set_errno_and_return_minus_one( ENOTSUP );66 rtems_set_errno_and_return_minus_one( ENOTSUP ); 66 67 } 67 68 -
c/src/exec/libcsupport/src/open.c
rb72e368c ra02224e 16 16 #endif 17 17 18 #include <stdarg.h> 19 #include <fcntl.h> 18 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 19 22 20 23 #include <unistd.h> … … 185 188 if ( loc_to_free ) 186 189 rtems_filesystem_freenode( loc_to_free ); 187 set_errno_and_return_minus_one( rc );190 rtems_set_errno_and_return_minus_one( rc ); 188 191 } 189 192 -
c/src/exec/libcsupport/src/read.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 #include <rtems/seterr.h> 19 20 20 21 ssize_t read( … … 39 40 40 41 if ( !iop->handlers->read_h ) 41 set_errno_and_return_minus_one( ENOTSUP );42 rtems_set_errno_and_return_minus_one( ENOTSUP ); 42 43 43 44 rc = (*iop->handlers->read_h)( iop, buffer, count ); -
c/src/exec/libcsupport/src/readlink.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 #include <rtems/seterr.h> 19 20 20 21 int readlink( … … 28 29 29 30 if (!buf) 30 set_errno_and_return_minus_one( EFAULT );31 rtems_set_errno_and_return_minus_one( EFAULT ); 31 32 32 33 result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE ); … … 36 37 if ( !loc.ops->node_type_h ){ 37 38 rtems_filesystem_freenode( &loc ); 38 set_errno_and_return_minus_one( ENOTSUP );39 rtems_set_errno_and_return_minus_one( ENOTSUP ); 39 40 } 40 41 41 42 if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK ){ 42 43 rtems_filesystem_freenode( &loc ); 43 set_errno_and_return_minus_one( EINVAL );44 rtems_set_errno_and_return_minus_one( EINVAL ); 44 45 } 45 46 46 47 if ( !loc.ops->readlink_h ){ 47 48 rtems_filesystem_freenode( &loc ); 48 set_errno_and_return_minus_one( ENOTSUP );49 rtems_set_errno_and_return_minus_one( ENOTSUP ); 49 50 } 50 51 -
c/src/exec/libcsupport/src/rmdir.c
rb72e368c ra02224e 23 23 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int rmdir( … … 45 46 if ( !loc.ops->node_type_h ){ 46 47 rtems_filesystem_freenode( &loc ); 47 set_errno_and_return_minus_one( ENOTSUP );48 rtems_set_errno_and_return_minus_one( ENOTSUP ); 48 49 } 49 50 50 51 if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){ 51 52 rtems_filesystem_freenode( &loc ); 52 set_errno_and_return_minus_one( ENOTDIR );53 rtems_set_errno_and_return_minus_one( ENOTDIR ); 53 54 } 54 55 … … 59 60 if ( !loc.handlers->rmnod_h ){ 60 61 rtems_filesystem_freenode( &loc ); 61 set_errno_and_return_minus_one( ENOTSUP );62 rtems_set_errno_and_return_minus_one( ENOTSUP ); 62 63 } 63 64 -
c/src/exec/libcsupport/src/stat.c
rb72e368c ra02224e 42 42 43 43 #include <rtems/libio_.h> 44 #include <rtems/seterr.h> 44 45 45 46 int _STAT_NAME( … … 56 57 57 58 if ( !buf ) 58 set_errno_and_return_minus_one( EFAULT );59 rtems_set_errno_and_return_minus_one( EFAULT ); 59 60 60 61 status = rtems_filesystem_evaluate_path( path, 0, &loc, _STAT_FOLLOW_LINKS ); … … 64 65 if ( !loc.handlers->fstat_h ){ 65 66 rtems_filesystem_freenode( &loc ); 66 set_errno_and_return_minus_one( ENOTSUP );67 rtems_set_errno_and_return_minus_one( ENOTSUP ); 67 68 } 68 69 -
c/src/exec/libcsupport/src/symlink.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 #include <rtems/seterr.h> 19 20 20 21 int symlink( … … 35 36 if ( !loc.ops->symlink_h ) { 36 37 rtems_filesystem_freenode( &loc ); 37 set_errno_and_return_minus_one( ENOTSUP );38 rtems_set_errno_and_return_minus_one( ENOTSUP ); 38 39 } 39 40 -
c/src/exec/libcsupport/src/tcsetattr.c
rb72e368c ra02224e 27 27 #include <rtems/libio.h> 28 28 #include <rtems/libio_.h> 29 #include <rtems/seterr.h> 29 30 30 31 int tcsetattr( … … 36 37 switch (opt) { 37 38 default: 38 set_errno_and_return_minus_one( ENOTSUP );39 rtems_set_errno_and_return_minus_one( ENOTSUP ); 39 40 40 41 case TCSADRAIN: -
c/src/exec/libcsupport/src/telldir.c
rb72e368c ra02224e 23 23 24 24 #include <rtems/libio_.h> 25 25 #include <rtems/seterr.h> 26 26 27 27 long telldir( … … 32 32 33 33 if ( !dirp ) 34 set_errno_and_return_minus_one( EBADF );34 rtems_set_errno_and_return_minus_one( EBADF ); 35 35 36 36 /* -
c/src/exec/libcsupport/src/ttyname.c
rb72e368c ra02224e 20 20 21 21 #include <rtems/libio_.h> 22 22 #include <rtems/seterr.h> 23 23 24 24 int ttyname_r( … … 37 37 /* Must be a terminal. */ 38 38 if (tcgetattr (fd, &tty) < 0) 39 set_errno_and_return_minus_one(EBADF);39 rtems_set_errno_and_return_minus_one(EBADF); 40 40 41 41 /* Must be a character device. */ 42 42 if (fstat (fd, &sb) || !S_ISCHR (sb.st_mode)) 43 set_errno_and_return_minus_one(EBADF);43 rtems_set_errno_and_return_minus_one(EBADF); 44 44 45 45 if ((dp = opendir (_PATH_DEV)) == NULL) 46 set_errno_and_return_minus_one(EBADF);46 rtems_set_errno_and_return_minus_one(EBADF); 47 47 48 48 for (rval = NULL; (dirp = readdir (dp)) != NULL ;) -
c/src/exec/libcsupport/src/ttyname_r.c
rb72e368c ra02224e 56 56 57 57 #include <rtems/libio_.h> 58 #include <rtems/seterr.h> 58 59 59 60 /* … … 76 77 /* Must be a terminal. */ 77 78 if (tcgetattr (fd, &tty) < 0) 78 set_errno_and_return_minus_one(EBADF);79 rtems_set_errno_and_return_minus_one(EBADF); 79 80 80 81 /* Must be a character device. */ 81 82 if (_fstat (fd, &sb) || !S_ISCHR (sb.st_mode)) 82 set_errno_and_return_minus_one(EBADF);83 rtems_set_errno_and_return_minus_one(EBADF); 83 84 84 85 if ((dp = opendir (_PATH_DEV)) == NULL) 85 set_errno_and_return_minus_one(EBADF);86 rtems_set_errno_and_return_minus_one(EBADF); 86 87 87 88 for (rval = NULL; (dirp = readdir (dp)) != NULL ;) -
c/src/exec/libcsupport/src/unlink.c
rb72e368c ra02224e 19 19 20 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 21 22 22 23 int unlink( … … 37 38 if ( !loc.ops->node_type_h ) { 38 39 rtems_filesystem_freenode( &loc ); 39 set_errno_and_return_minus_one( ENOTSUP );40 rtems_set_errno_and_return_minus_one( ENOTSUP ); 40 41 } 41 42 42 43 if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) { 43 44 rtems_filesystem_freenode( &loc ); 44 set_errno_and_return_minus_one( EISDIR );45 rtems_set_errno_and_return_minus_one( EISDIR ); 45 46 } 46 47 47 48 if ( !loc.ops->unlink_h ) { 48 49 rtems_filesystem_freenode( &loc ); 49 set_errno_and_return_minus_one( ENOTSUP );50 rtems_set_errno_and_return_minus_one( ENOTSUP ); 50 51 } 51 52 -
c/src/exec/libcsupport/src/unmount.c
rb72e368c ra02224e 32 32 33 33 #include <rtems/libio_.h> 34 #include <rtems/seterr.h> 34 35 35 36 /* … … 126 127 if ( !rtems_filesystem_nodes_equal( fs_root_loc, &loc) ){ 127 128 rtems_filesystem_freenode( &loc ); 128 set_errno_and_return_minus_one( EACCES );129 rtems_set_errno_and_return_minus_one( EACCES ); 129 130 } 130 131 … … 140 141 141 142 if ( !fs_mount_loc->ops->unmount_h ) 142 set_errno_and_return_minus_one( ENOTSUP );143 rtems_set_errno_and_return_minus_one( ENOTSUP ); 143 144 144 145 if ( !fs_root_loc->ops->fsunmount_me_h ) 145 set_errno_and_return_minus_one( ENOTSUP );146 rtems_set_errno_and_return_minus_one( ENOTSUP ); 146 147 147 148 … … 155 156 156 157 if ( rtems_filesystem_current.mt_entry == mt_entry ) 157 set_errno_and_return_minus_one( EBUSY );158 rtems_set_errno_and_return_minus_one( EBUSY ); 158 159 159 160 /* … … 162 163 163 164 if ( file_systems_below_this_mountpoint( path, fs_root_loc, mt_entry ) != 0 ) 164 set_errno_and_return_minus_one( EBUSY );165 rtems_set_errno_and_return_minus_one( EBUSY ); 165 166 166 167 /* … … 171 172 172 173 if ( rtems_libio_is_open_files_in_fs( mt_entry ) == 1 ) 173 set_errno_and_return_minus_one( EBUSY );174 rtems_set_errno_and_return_minus_one( EBUSY ); 174 175 175 176 /* -
c/src/exec/libcsupport/src/utime.c
rb72e368c ra02224e 21 21 22 22 #include <rtems/libio_.h> 23 #include <rtems/seterr.h> 23 24 24 25 int utime( … … 35 36 if ( !temp_loc.ops->utime_h ){ 36 37 rtems_filesystem_freenode( &temp_loc ); 37 set_errno_and_return_minus_one( ENOTSUP );38 rtems_set_errno_and_return_minus_one( ENOTSUP ); 38 39 } 39 40 -
c/src/exec/libcsupport/src/write.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 19 #include <rtems/seterr.h> 20 20 21 21 /* … … 47 47 48 48 if ( !iop->handlers->write_h ) 49 set_errno_and_return_minus_one( ENOTSUP );49 rtems_set_errno_and_return_minus_one( ENOTSUP ); 50 50 51 51 rc = (*iop->handlers->write_h)( iop, buffer, count ); -
c/src/lib/ChangeLog
rb72e368c ra02224e 1 2002-01-04 Ralf Corsepius <corsepiu@faw.uni-ulm.de> 2 3 * include/rtems/libio_.h: Remove set_errno_and_return_minus_one. 4 * libc/cfsetispeed.c: Include <rtems/seterr.h>. 5 Apply rtems_set_errno_and_return_minus_one. 6 * libc/cfsetospeed.c: Include <rtems/seterr.h>. 7 Apply rtems_set_errno_and_return_minus_one. 8 * libc/chdir.c: Include <rtems/seterr.h>. 9 Apply rtems_set_errno_and_return_minus_one. 10 * libc/chmod.c: Include <rtems/seterr.h>. 11 Apply rtems_set_errno_and_return_minus_one. 12 * libc/chown.c: Include <rtems/seterr.h>. 13 Apply rtems_set_errno_and_return_minus_one. 14 * libc/chroot.c: Include <rtems/seterr.h>. 15 Apply rtems_set_errno_and_return_minus_one. 16 * libc/closedir.c: Include <rtems/seterr.h>. 17 Apply rtems_set_errno_and_return_minus_one. 18 * libc/eval.c: Include <rtems/seterr.h>. 19 Apply rtems_set_errno_and_return_minus_one. 20 * libc/fchdir.c: Include <rtems/seterr.h>. 21 Apply rtems_set_errno_and_return_minus_one. 22 * libc/fchmod.c: Include <rtems/seterr.h>. 23 Apply rtems_set_errno_and_return_minus_one. 24 * libc/fdatasync.c: Include <rtems/seterr.h>. 25 Apply rtems_set_errno_and_return_minus_one. 26 * libc/fpathconf.c: Include <rtems/seterr.h>. 27 Apply rtems_set_errno_and_return_minus_one. 28 * libc/fstat.c: Include <rtems/seterr.h>. 29 Apply rtems_set_errno_and_return_minus_one. 30 * libc/fsync.c: Include <rtems/seterr.h>. 31 Apply rtems_set_errno_and_return_minus_one. 32 * libc/ftruncate.c: Include <rtems/seterr.h>. 33 Apply rtems_set_errno_and_return_minus_one. 34 * libc/getdents.c: Include <rtems/seterr.h>. 35 Apply rtems_set_errno_and_return_minus_one. 36 * libc/ioctl.c: Include <rtems/seterr.h>. 37 Apply rtems_set_errno_and_return_minus_one. 38 * libc/link.c: Include <rtems/seterr.h>. 39 Apply rtems_set_errno_and_return_minus_one. 40 * libc/lseek.c: Include <rtems/seterr.h>. 41 Apply rtems_set_errno_and_return_minus_one. 42 * libc/mknod.c: Include <rtems/seterr.h>. 43 Apply rtems_set_errno_and_return_minus_one. 44 * libc/open.c: Include <rtems/seterr.h>. 45 Apply rtems_set_errno_and_return_minus_one. 46 * libc/read.c: Include <rtems/seterr.h>. 47 Apply rtems_set_errno_and_return_minus_one. 48 * libc/readlink.c: Include <rtems/seterr.h>. 49 Apply rtems_set_errno_and_return_minus_one. 50 * libc/rmdir.c: Include <rtems/seterr.h>. 51 Apply rtems_set_errno_and_return_minus_one. 52 * libc/stat.c: Include <rtems/seterr.h>. 53 Apply rtems_set_errno_and_return_minus_one. 54 * libc/symlink.c: Include <rtems/seterr.h>. 55 Apply rtems_set_errno_and_return_minus_one. 56 * libc/tcsetattr.c: Include <rtems/seterr.h>. 57 Apply rtems_set_errno_and_return_minus_one. 58 * libc/telldir.c: Include <rtems/seterr.h>. 59 Apply rtems_set_errno_and_return_minus_one. 60 * libc/ttyname.c: Include <rtems/seterr.h>. 61 Apply rtems_set_errno_and_return_minus_one. 62 * libc/ttyname_r.c: Include <rtems/seterr.h>. 63 Apply rtems_set_errno_and_return_minus_one. 64 * libc/unlink.c: Include <rtems/seterr.h>. 65 Apply rtems_set_errno_and_return_minus_one. 66 * libc/unmount.c: Include <rtems/seterr.h>. 67 Apply rtems_set_errno_and_return_minus_one. 68 * libc/utime.c: Include <rtems/seterr.h>. 69 Apply rtems_set_errno_and_return_minus_one. 70 * libc/write.c: Include <rtems/seterr.h>. 71 Apply rtems_set_errno_and_return_minus_one. 72 1 73 2002-01-03 Ralf Corsepius <corsepiu@faw.uni-ulm.de> 2 74 -
c/src/lib/include/rtems/libio_.h
rb72e368c ra02224e 69 69 70 70 /* 71 * set_errno_and_return_minus_one72 *73 * Macro to ease common way to return an error.74 */75 76 #ifndef set_errno_and_return_minus_one77 #define set_errno_and_return_minus_one( _error ) \78 do { errno = (_error); return -1; } while(0)79 #endif80 81 /*82 71 * rtems_libio_iop 83 72 * … … 153 142 do { \ 154 143 if (((_iop)->flags & (_flag)) == 0) { \ 155 set_errno_and_return_minus_one( EINVAL ); \144 rtems_set_errno_and_return_minus_one( EINVAL ); \ 156 145 return -1; \ 157 146 } \ … … 252 241 #define _POSIX_types_Getlogin_buffer (rtems_current_user_env->login_buffer) 253 242 254 255 243 /* 256 244 * Instantiate a private copy of the per user information for the calling task. -
c/src/lib/libc/cfsetispeed.c
rb72e368c ra02224e 25 25 26 26 #include <rtems/libio_.h> 27 #include <rtems/seterr.h> 27 28 28 29 int cfsetispeed( … … 32 33 { 33 34 if ( speed & ~CBAUD ) 34 set_errno_and_return_minus_one( EINVAL );35 rtems_set_errno_and_return_minus_one( EINVAL ); 35 36 36 37 tp->c_cflag = (tp->c_cflag & ~CIBAUD) | (speed * (CIBAUD / CBAUD)); -
c/src/lib/libc/cfsetospeed.c
rb72e368c ra02224e 25 25 26 26 #include <rtems/libio_.h> 27 #include <rtems/seterr.h> 27 28 28 29 int cfsetospeed( … … 32 33 { 33 34 if ( speed & ~CBAUD ) 34 set_errno_and_return_minus_one( EINVAL );35 rtems_set_errno_and_return_minus_one( EINVAL ); 35 36 36 37 tp->c_cflag = (tp->c_cflag & ~CBAUD) | speed; -
c/src/lib/libc/chdir.c
rb72e368c ra02224e 22 22 23 23 #include <rtems/libio_.h> 24 #include <rtems/seterr.h> 24 25 25 26 int chdir( … … 45 46 if ( !loc.ops->node_type_h ) { 46 47 rtems_filesystem_freenode( &loc ); 47 set_errno_and_return_minus_one( ENOTSUP );48 rtems_set_errno_and_return_minus_one( ENOTSUP ); 48 49 } 49 50 50 51 if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) { 51 52 rtems_filesystem_freenode( &loc ); 52 set_errno_and_return_minus_one( ENOTDIR );53 rtems_set_errno_and_return_minus_one( ENOTDIR ); 53 54 } 54 55 -
c/src/lib/libc/chmod.c
rb72e368c ra02224e 24 24 25 25 #include <rtems/libio_.h> 26 #include <rtems/seterr.h> 26 27 27 28 int chmod( … … 40 41 if ( !loc.handlers ){ 41 42 rtems_filesystem_freenode( &loc ); 42 set_errno_and_return_minus_one( EBADF );43 rtems_set_errno_and_return_minus_one( EBADF ); 43 44 } 44 45 45 46 if ( !loc.handlers->fchmod_h ){ 46 47 rtems_filesystem_freenode( &loc ); 47 set_errno_and_return_minus_one( ENOTSUP );48 rtems_set_errno_and_return_minus_one( ENOTSUP ); 48 49 } 49 50 -
c/src/lib/libc/chown.c
rb72e368c ra02224e 23 23 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int chown( … … 38 39 if ( !loc.ops->chown_h ) { 39 40 rtems_filesystem_freenode( &loc ); 40 set_errno_and_return_minus_one( ENOTSUP );41 rtems_set_errno_and_return_minus_one( ENOTSUP ); 41 42 } 42 43 -
c/src/lib/libc/chroot.c
rb72e368c ra02224e 23 23 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int chroot( … … 35 36 rtems_libio_set_private_env(); /* try to set a new private env*/ 36 37 if (rtems_current_user_env == &rtems_global_user_env) /* not ok */ 37 set_errno_and_return_minus_one( ENOTSUP );38 rtems_set_errno_and_return_minus_one( ENOTSUP ); 38 39 }; 39 40 … … 43 44 if (result) { 44 45 rtems_filesystem_root = loc; /* restore the value */ 45 set_errno_and_return_minus_one( errno );46 rtems_set_errno_and_return_minus_one( errno ); 46 47 }; 47 48 rtems_filesystem_root = rtems_filesystem_current; -
c/src/lib/libc/closedir.c
rb72e368c ra02224e 52 52 53 53 #include <rtems/libio_.h> 54 #include <rtems/seterr.h> 54 55 55 56 /* … … 63 64 64 65 if ( !dirp ) 65 set_errno_and_return_minus_one( EBADF );66 rtems_set_errno_and_return_minus_one( EBADF ); 66 67 67 68 fd = dirp->dd_fd; -
c/src/lib/libc/eval.c
rb72e368c ra02224e 20 20 #include <rtems.h> 21 21 #include <rtems/libio_.h> 22 #include <rtems/seterr.h> 22 23 23 24 int rtems_filesystem_evaluate_path( … … 37 38 38 39 if ( !pathname ) 39 set_errno_and_return_minus_one( EFAULT );40 rtems_set_errno_and_return_minus_one( EFAULT ); 40 41 41 42 if ( !pathloc ) 42 set_errno_and_return_minus_one( EIO ); /* should never happen */43 rtems_set_errno_and_return_minus_one( EIO ); /* should never happen */ 43 44 44 45 /* … … 49 50 50 51 if ( !pathloc->ops->evalpath_h ) 51 set_errno_and_return_minus_one( ENOTSUP );52 rtems_set_errno_and_return_minus_one( ENOTSUP ); 52 53 53 54 result = (*pathloc->ops->evalpath_h)( &pathname[i], flags, pathloc ); … … 61 62 62 63 if ( !pathloc->ops->node_type_h ) 63 set_errno_and_return_minus_one( ENOTSUP );64 rtems_set_errno_and_return_minus_one( ENOTSUP ); 64 65 65 66 type = (*pathloc->ops->node_type_h)( pathloc ); … … 69 70 70 71 if ( !pathloc->ops->eval_link_h ) 71 set_errno_and_return_minus_one( ENOTSUP );72 rtems_set_errno_and_return_minus_one( ENOTSUP ); 72 73 73 74 result = (*pathloc->ops->eval_link_h)( pathloc, flags ); -
c/src/lib/libc/fchdir.c
rb72e368c ra02224e 23 23 #include <rtems/libio.h> 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int fchdir( … … 45 46 46 47 if ( !iop->pathinfo.ops ) { 47 set_errno_and_return_minus_one( ENOTSUP );48 rtems_set_errno_and_return_minus_one( ENOTSUP ); 48 49 } 49 50 50 51 if ( !iop->pathinfo.ops->node_type_h ) { 51 set_errno_and_return_minus_one( ENOTSUP );52 rtems_set_errno_and_return_minus_one( ENOTSUP ); 52 53 } 53 54 54 55 if ( (*iop->pathinfo.ops->node_type_h)( &iop->pathinfo ) != 55 56 RTEMS_FILESYSTEM_DIRECTORY ) { 56 set_errno_and_return_minus_one( ENOTDIR );57 rtems_set_errno_and_return_minus_one( ENOTDIR ); 57 58 } 58 59 -
c/src/lib/libc/fchmod.c
rb72e368c ra02224e 23 23 #include <rtems/libio.h> 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int fchmod( … … 42 43 43 44 if ( !iop->handlers->fchmod_h ) 44 set_errno_and_return_minus_one( ENOTSUP );45 rtems_set_errno_and_return_minus_one( ENOTSUP ); 45 46 46 47 return (*iop->pathinfo.handlers->fchmod_h)( &iop->pathinfo, mode ); -
c/src/lib/libc/fdatasync.c
rb72e368c ra02224e 19 19 20 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 21 22 22 23 int fdatasync( … … 36 37 37 38 if ( !iop->handlers->fdatasync_h ) 38 set_errno_and_return_minus_one( ENOTSUP );39 rtems_set_errno_and_return_minus_one( ENOTSUP ); 39 40 40 41 return (*iop->handlers->fdatasync_h)( iop ); -
c/src/lib/libc/fpathconf.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 #include <rtems/seterr.h> 19 20 20 21 #include <unistd.h> … … 79 80 break; 80 81 default: 81 set_errno_and_return_minus_one( EINVAL );82 rtems_set_errno_and_return_minus_one( EINVAL ); 82 83 break; 83 84 } -
c/src/lib/libc/fstat.c
rb72e368c ra02224e 21 21 22 22 #include <rtems/libio_.h> 23 #include <rtems/seterr.h> 23 24 24 25 int fstat( … … 34 35 35 36 if ( !sbuf ) 36 set_errno_and_return_minus_one( EFAULT );37 rtems_set_errno_and_return_minus_one( EFAULT ); 37 38 38 39 /* … … 45 46 46 47 if ( !iop->handlers ) 47 set_errno_and_return_minus_one( EBADF );48 rtems_set_errno_and_return_minus_one( EBADF ); 48 49 49 50 if ( !iop->handlers->fstat_h ) 50 set_errno_and_return_minus_one( ENOTSUP );51 rtems_set_errno_and_return_minus_one( ENOTSUP ); 51 52 52 53 /* -
c/src/lib/libc/fsync.c
rb72e368c ra02224e 19 19 20 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 21 22 22 23 int fsync( … … 36 37 37 38 if ( !iop->handlers ) 38 set_errno_and_return_minus_one( EBADF );39 rtems_set_errno_and_return_minus_one( EBADF ); 39 40 40 41 if ( !iop->handlers->fsync_h ) 41 set_errno_and_return_minus_one( ENOTSUP );42 rtems_set_errno_and_return_minus_one( ENOTSUP ); 42 43 43 44 return (*iop->handlers->fsync_h)( iop ); -
c/src/lib/libc/ftruncate.c
rb72e368c ra02224e 20 20 21 21 #include <rtems/libio_.h> 22 #include <rtems/seterr.h> 22 23 23 24 int ftruncate( … … 43 44 loc = iop->pathinfo; 44 45 if ( !loc.ops->node_type_h ) 45 set_errno_and_return_minus_one( ENOTSUP );46 rtems_set_errno_and_return_minus_one( ENOTSUP ); 46 47 47 48 if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) 48 set_errno_and_return_minus_one( EISDIR );49 rtems_set_errno_and_return_minus_one( EISDIR ); 49 50 50 51 rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE ); 51 52 52 53 if ( !iop->handlers->ftruncate_h ) 53 set_errno_and_return_minus_one( ENOTSUP );54 rtems_set_errno_and_return_minus_one( ENOTSUP ); 54 55 55 56 return (*iop->handlers->ftruncate_h)( iop, length ); -
c/src/lib/libc/getdents.c
rb72e368c ra02224e 25 25 26 26 #include <rtems/libio_.h> 27 #include <rtems/seterr.h> 27 28 28 29 int getdents( … … 46 47 loc = iop->pathinfo; 47 48 if ( !loc.ops->node_type_h ) 48 set_errno_and_return_minus_one( ENOTSUP );49 rtems_set_errno_and_return_minus_one( ENOTSUP ); 49 50 50 51 if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) 51 set_errno_and_return_minus_one( ENOTDIR );52 rtems_set_errno_and_return_minus_one( ENOTDIR ); 52 53 53 54 /* … … 57 58 58 59 if ( !iop->handlers->read_h ) 59 set_errno_and_return_minus_one( ENOTSUP );60 rtems_set_errno_and_return_minus_one( ENOTSUP ); 60 61 61 62 return (*iop->handlers->read_h)( iop, dd_buf, dd_len ); -
c/src/lib/libc/ioctl.c
rb72e368c ra02224e 19 19 #endif 20 20 21 #include <stdarg.h> 22 21 23 #include <rtems/libio_.h> 24 #include <rtems/seterr.h> 22 25 23 26 #include <unistd.h> … … 47 50 48 51 if ( !iop->handlers ) 49 set_errno_and_return_minus_one( EBADF );52 rtems_set_errno_and_return_minus_one( EBADF ); 50 53 51 54 if ( !iop->handlers->ioctl_h ) 52 set_errno_and_return_minus_one( ENOTSUP );55 rtems_set_errno_and_return_minus_one( ENOTSUP ); 53 56 54 57 rc = (*iop->handlers->ioctl_h)( iop, command, buffer ); -
c/src/lib/libc/link.c
rb72e368c ra02224e 21 21 22 22 #include <rtems/libio_.h> 23 #include <rtems/seterr.h> 23 24 24 25 int link( … … 49 50 if ( !parent_loc.ops->evalformake_h ) { 50 51 rtems_filesystem_freenode( &existing_loc ); 51 set_errno_and_return_minus_one( ENOTSUP );52 rtems_set_errno_and_return_minus_one( ENOTSUP ); 52 53 } 53 54 … … 55 56 if ( result != 0 ) { 56 57 rtems_filesystem_freenode( &existing_loc ); 57 set_errno_and_return_minus_one( result );58 rtems_set_errno_and_return_minus_one( result ); 58 59 } 59 60 … … 66 67 rtems_filesystem_freenode( &existing_loc ); 67 68 rtems_filesystem_freenode( &parent_loc ); 68 set_errno_and_return_minus_one( EXDEV );69 rtems_set_errno_and_return_minus_one( EXDEV ); 69 70 } 70 71 … … 72 73 rtems_filesystem_freenode( &existing_loc ); 73 74 rtems_filesystem_freenode( &parent_loc ); 74 set_errno_and_return_minus_one( ENOTSUP );75 rtems_set_errno_and_return_minus_one( ENOTSUP ); 75 76 } 76 77 -
c/src/lib/libc/lseek.c
rb72e368c ra02224e 19 19 20 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 21 22 22 23 off_t lseek( … … 39 40 40 41 if ( !iop->handlers->lseek_h ) 41 set_errno_and_return_minus_one( ENOTSUP );42 rtems_set_errno_and_return_minus_one( ENOTSUP ); 42 43 43 44 /* … … 60 61 61 62 default: 62 set_errno_and_return_minus_one( EINVAL );63 rtems_set_errno_and_return_minus_one( EINVAL ); 63 64 } 64 65 -
c/src/lib/libc/mknod.c
rb72e368c ra02224e 28 28 29 29 #include <rtems/libio_.h> 30 #include <rtems/seterr.h> 30 31 31 32 int mknod( … … 41 42 42 43 if ( !(mode & (S_IFREG|S_IFCHR|S_IFBLK|S_IFIFO) ) ) 43 set_errno_and_return_minus_one( EINVAL );44 rtems_set_errno_and_return_minus_one( EINVAL ); 44 45 45 46 if ( S_ISFIFO(mode) ) 46 set_errno_and_return_minus_one( ENOTSUP );47 rtems_set_errno_and_return_minus_one( ENOTSUP ); 47 48 48 49 rtems_filesystem_get_start_loc( pathname, &i, &temp_loc ); … … 50 51 if ( !temp_loc.ops->evalformake_h ) { 51 52 rtems_filesystem_freenode( &temp_loc ); 52 set_errno_and_return_minus_one( ENOTSUP );53 rtems_set_errno_and_return_minus_one( ENOTSUP ); 53 54 } 54 55 … … 63 64 if ( !temp_loc.ops->mknod_h ) { 64 65 rtems_filesystem_freenode( &temp_loc ); 65 set_errno_and_return_minus_one( ENOTSUP );66 rtems_set_errno_and_return_minus_one( ENOTSUP ); 66 67 } 67 68 -
c/src/lib/libc/open.c
rb72e368c ra02224e 16 16 #endif 17 17 18 #include <stdarg.h> 19 #include <fcntl.h> 18 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 19 22 20 23 #include <unistd.h> … … 185 188 if ( loc_to_free ) 186 189 rtems_filesystem_freenode( loc_to_free ); 187 set_errno_and_return_minus_one( rc );190 rtems_set_errno_and_return_minus_one( rc ); 188 191 } 189 192 -
c/src/lib/libc/read.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 #include <rtems/seterr.h> 19 20 20 21 ssize_t read( … … 39 40 40 41 if ( !iop->handlers->read_h ) 41 set_errno_and_return_minus_one( ENOTSUP );42 rtems_set_errno_and_return_minus_one( ENOTSUP ); 42 43 43 44 rc = (*iop->handlers->read_h)( iop, buffer, count ); -
c/src/lib/libc/readlink.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 #include <rtems/seterr.h> 19 20 20 21 int readlink( … … 28 29 29 30 if (!buf) 30 set_errno_and_return_minus_one( EFAULT );31 rtems_set_errno_and_return_minus_one( EFAULT ); 31 32 32 33 result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE ); … … 36 37 if ( !loc.ops->node_type_h ){ 37 38 rtems_filesystem_freenode( &loc ); 38 set_errno_and_return_minus_one( ENOTSUP );39 rtems_set_errno_and_return_minus_one( ENOTSUP ); 39 40 } 40 41 41 42 if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK ){ 42 43 rtems_filesystem_freenode( &loc ); 43 set_errno_and_return_minus_one( EINVAL );44 rtems_set_errno_and_return_minus_one( EINVAL ); 44 45 } 45 46 46 47 if ( !loc.ops->readlink_h ){ 47 48 rtems_filesystem_freenode( &loc ); 48 set_errno_and_return_minus_one( ENOTSUP );49 rtems_set_errno_and_return_minus_one( ENOTSUP ); 49 50 } 50 51 -
c/src/lib/libc/rmdir.c
rb72e368c ra02224e 23 23 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int rmdir( … … 45 46 if ( !loc.ops->node_type_h ){ 46 47 rtems_filesystem_freenode( &loc ); 47 set_errno_and_return_minus_one( ENOTSUP );48 rtems_set_errno_and_return_minus_one( ENOTSUP ); 48 49 } 49 50 50 51 if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){ 51 52 rtems_filesystem_freenode( &loc ); 52 set_errno_and_return_minus_one( ENOTDIR );53 rtems_set_errno_and_return_minus_one( ENOTDIR ); 53 54 } 54 55 … … 59 60 if ( !loc.handlers->rmnod_h ){ 60 61 rtems_filesystem_freenode( &loc ); 61 set_errno_and_return_minus_one( ENOTSUP );62 rtems_set_errno_and_return_minus_one( ENOTSUP ); 62 63 } 63 64 -
c/src/lib/libc/stat.c
rb72e368c ra02224e 42 42 43 43 #include <rtems/libio_.h> 44 #include <rtems/seterr.h> 44 45 45 46 int _STAT_NAME( … … 56 57 57 58 if ( !buf ) 58 set_errno_and_return_minus_one( EFAULT );59 rtems_set_errno_and_return_minus_one( EFAULT ); 59 60 60 61 status = rtems_filesystem_evaluate_path( path, 0, &loc, _STAT_FOLLOW_LINKS ); … … 64 65 if ( !loc.handlers->fstat_h ){ 65 66 rtems_filesystem_freenode( &loc ); 66 set_errno_and_return_minus_one( ENOTSUP );67 rtems_set_errno_and_return_minus_one( ENOTSUP ); 67 68 } 68 69 -
c/src/lib/libc/symlink.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 #include <rtems/seterr.h> 19 20 20 21 int symlink( … … 35 36 if ( !loc.ops->symlink_h ) { 36 37 rtems_filesystem_freenode( &loc ); 37 set_errno_and_return_minus_one( ENOTSUP );38 rtems_set_errno_and_return_minus_one( ENOTSUP ); 38 39 } 39 40 -
c/src/lib/libc/tcsetattr.c
rb72e368c ra02224e 27 27 #include <rtems/libio.h> 28 28 #include <rtems/libio_.h> 29 #include <rtems/seterr.h> 29 30 30 31 int tcsetattr( … … 36 37 switch (opt) { 37 38 default: 38 set_errno_and_return_minus_one( ENOTSUP );39 rtems_set_errno_and_return_minus_one( ENOTSUP ); 39 40 40 41 case TCSADRAIN: -
c/src/lib/libc/telldir.c
rb72e368c ra02224e 23 23 24 24 #include <rtems/libio_.h> 25 25 #include <rtems/seterr.h> 26 26 27 27 long telldir( … … 32 32 33 33 if ( !dirp ) 34 set_errno_and_return_minus_one( EBADF );34 rtems_set_errno_and_return_minus_one( EBADF ); 35 35 36 36 /* -
c/src/lib/libc/ttyname.c
rb72e368c ra02224e 20 20 21 21 #include <rtems/libio_.h> 22 22 #include <rtems/seterr.h> 23 23 24 24 int ttyname_r( … … 37 37 /* Must be a terminal. */ 38 38 if (tcgetattr (fd, &tty) < 0) 39 set_errno_and_return_minus_one(EBADF);39 rtems_set_errno_and_return_minus_one(EBADF); 40 40 41 41 /* Must be a character device. */ 42 42 if (fstat (fd, &sb) || !S_ISCHR (sb.st_mode)) 43 set_errno_and_return_minus_one(EBADF);43 rtems_set_errno_and_return_minus_one(EBADF); 44 44 45 45 if ((dp = opendir (_PATH_DEV)) == NULL) 46 set_errno_and_return_minus_one(EBADF);46 rtems_set_errno_and_return_minus_one(EBADF); 47 47 48 48 for (rval = NULL; (dirp = readdir (dp)) != NULL ;) -
c/src/lib/libc/ttyname_r.c
rb72e368c ra02224e 56 56 57 57 #include <rtems/libio_.h> 58 #include <rtems/seterr.h> 58 59 59 60 /* … … 76 77 /* Must be a terminal. */ 77 78 if (tcgetattr (fd, &tty) < 0) 78 set_errno_and_return_minus_one(EBADF);79 rtems_set_errno_and_return_minus_one(EBADF); 79 80 80 81 /* Must be a character device. */ 81 82 if (_fstat (fd, &sb) || !S_ISCHR (sb.st_mode)) 82 set_errno_and_return_minus_one(EBADF);83 rtems_set_errno_and_return_minus_one(EBADF); 83 84 84 85 if ((dp = opendir (_PATH_DEV)) == NULL) 85 set_errno_and_return_minus_one(EBADF);86 rtems_set_errno_and_return_minus_one(EBADF); 86 87 87 88 for (rval = NULL; (dirp = readdir (dp)) != NULL ;) -
c/src/lib/libc/unlink.c
rb72e368c ra02224e 19 19 20 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 21 22 22 23 int unlink( … … 37 38 if ( !loc.ops->node_type_h ) { 38 39 rtems_filesystem_freenode( &loc ); 39 set_errno_and_return_minus_one( ENOTSUP );40 rtems_set_errno_and_return_minus_one( ENOTSUP ); 40 41 } 41 42 42 43 if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) { 43 44 rtems_filesystem_freenode( &loc ); 44 set_errno_and_return_minus_one( EISDIR );45 rtems_set_errno_and_return_minus_one( EISDIR ); 45 46 } 46 47 47 48 if ( !loc.ops->unlink_h ) { 48 49 rtems_filesystem_freenode( &loc ); 49 set_errno_and_return_minus_one( ENOTSUP );50 rtems_set_errno_and_return_minus_one( ENOTSUP ); 50 51 } 51 52 -
c/src/lib/libc/unmount.c
rb72e368c ra02224e 32 32 33 33 #include <rtems/libio_.h> 34 #include <rtems/seterr.h> 34 35 35 36 /* … … 126 127 if ( !rtems_filesystem_nodes_equal( fs_root_loc, &loc) ){ 127 128 rtems_filesystem_freenode( &loc ); 128 set_errno_and_return_minus_one( EACCES );129 rtems_set_errno_and_return_minus_one( EACCES ); 129 130 } 130 131 … … 140 141 141 142 if ( !fs_mount_loc->ops->unmount_h ) 142 set_errno_and_return_minus_one( ENOTSUP );143 rtems_set_errno_and_return_minus_one( ENOTSUP ); 143 144 144 145 if ( !fs_root_loc->ops->fsunmount_me_h ) 145 set_errno_and_return_minus_one( ENOTSUP );146 rtems_set_errno_and_return_minus_one( ENOTSUP ); 146 147 147 148 … … 155 156 156 157 if ( rtems_filesystem_current.mt_entry == mt_entry ) 157 set_errno_and_return_minus_one( EBUSY );158 rtems_set_errno_and_return_minus_one( EBUSY ); 158 159 159 160 /* … … 162 163 163 164 if ( file_systems_below_this_mountpoint( path, fs_root_loc, mt_entry ) != 0 ) 164 set_errno_and_return_minus_one( EBUSY );165 rtems_set_errno_and_return_minus_one( EBUSY ); 165 166 166 167 /* … … 171 172 172 173 if ( rtems_libio_is_open_files_in_fs( mt_entry ) == 1 ) 173 set_errno_and_return_minus_one( EBUSY );174 rtems_set_errno_and_return_minus_one( EBUSY ); 174 175 175 176 /* -
c/src/lib/libc/utime.c
rb72e368c ra02224e 21 21 22 22 #include <rtems/libio_.h> 23 #include <rtems/seterr.h> 23 24 24 25 int utime( … … 35 36 if ( !temp_loc.ops->utime_h ){ 36 37 rtems_filesystem_freenode( &temp_loc ); 37 set_errno_and_return_minus_one( ENOTSUP );38 rtems_set_errno_and_return_minus_one( ENOTSUP ); 38 39 } 39 40 -
c/src/lib/libc/write.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 19 #include <rtems/seterr.h> 20 20 21 21 /* … … 47 47 48 48 if ( !iop->handlers->write_h ) 49 set_errno_and_return_minus_one( ENOTSUP );49 rtems_set_errno_and_return_minus_one( ENOTSUP ); 50 50 51 51 rc = (*iop->handlers->write_h)( iop, buffer, count ); -
cpukit/libcsupport/include/rtems/libio_.h
rb72e368c ra02224e 69 69 70 70 /* 71 * set_errno_and_return_minus_one72 *73 * Macro to ease common way to return an error.74 */75 76 #ifndef set_errno_and_return_minus_one77 #define set_errno_and_return_minus_one( _error ) \78 do { errno = (_error); return -1; } while(0)79 #endif80 81 /*82 71 * rtems_libio_iop 83 72 * … … 153 142 do { \ 154 143 if (((_iop)->flags & (_flag)) == 0) { \ 155 set_errno_and_return_minus_one( EINVAL ); \144 rtems_set_errno_and_return_minus_one( EINVAL ); \ 156 145 return -1; \ 157 146 } \ … … 252 241 #define _POSIX_types_Getlogin_buffer (rtems_current_user_env->login_buffer) 253 242 254 255 243 /* 256 244 * Instantiate a private copy of the per user information for the calling task. -
cpukit/libcsupport/src/cfsetispeed.c
rb72e368c ra02224e 25 25 26 26 #include <rtems/libio_.h> 27 #include <rtems/seterr.h> 27 28 28 29 int cfsetispeed( … … 32 33 { 33 34 if ( speed & ~CBAUD ) 34 set_errno_and_return_minus_one( EINVAL );35 rtems_set_errno_and_return_minus_one( EINVAL ); 35 36 36 37 tp->c_cflag = (tp->c_cflag & ~CIBAUD) | (speed * (CIBAUD / CBAUD)); -
cpukit/libcsupport/src/cfsetospeed.c
rb72e368c ra02224e 25 25 26 26 #include <rtems/libio_.h> 27 #include <rtems/seterr.h> 27 28 28 29 int cfsetospeed( … … 32 33 { 33 34 if ( speed & ~CBAUD ) 34 set_errno_and_return_minus_one( EINVAL );35 rtems_set_errno_and_return_minus_one( EINVAL ); 35 36 36 37 tp->c_cflag = (tp->c_cflag & ~CBAUD) | speed; -
cpukit/libcsupport/src/chdir.c
rb72e368c ra02224e 22 22 23 23 #include <rtems/libio_.h> 24 #include <rtems/seterr.h> 24 25 25 26 int chdir( … … 45 46 if ( !loc.ops->node_type_h ) { 46 47 rtems_filesystem_freenode( &loc ); 47 set_errno_and_return_minus_one( ENOTSUP );48 rtems_set_errno_and_return_minus_one( ENOTSUP ); 48 49 } 49 50 50 51 if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) { 51 52 rtems_filesystem_freenode( &loc ); 52 set_errno_and_return_minus_one( ENOTDIR );53 rtems_set_errno_and_return_minus_one( ENOTDIR ); 53 54 } 54 55 -
cpukit/libcsupport/src/chmod.c
rb72e368c ra02224e 24 24 25 25 #include <rtems/libio_.h> 26 #include <rtems/seterr.h> 26 27 27 28 int chmod( … … 40 41 if ( !loc.handlers ){ 41 42 rtems_filesystem_freenode( &loc ); 42 set_errno_and_return_minus_one( EBADF );43 rtems_set_errno_and_return_minus_one( EBADF ); 43 44 } 44 45 45 46 if ( !loc.handlers->fchmod_h ){ 46 47 rtems_filesystem_freenode( &loc ); 47 set_errno_and_return_minus_one( ENOTSUP );48 rtems_set_errno_and_return_minus_one( ENOTSUP ); 48 49 } 49 50 -
cpukit/libcsupport/src/chown.c
rb72e368c ra02224e 23 23 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int chown( … … 38 39 if ( !loc.ops->chown_h ) { 39 40 rtems_filesystem_freenode( &loc ); 40 set_errno_and_return_minus_one( ENOTSUP );41 rtems_set_errno_and_return_minus_one( ENOTSUP ); 41 42 } 42 43 -
cpukit/libcsupport/src/chroot.c
rb72e368c ra02224e 23 23 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int chroot( … … 35 36 rtems_libio_set_private_env(); /* try to set a new private env*/ 36 37 if (rtems_current_user_env == &rtems_global_user_env) /* not ok */ 37 set_errno_and_return_minus_one( ENOTSUP );38 rtems_set_errno_and_return_minus_one( ENOTSUP ); 38 39 }; 39 40 … … 43 44 if (result) { 44 45 rtems_filesystem_root = loc; /* restore the value */ 45 set_errno_and_return_minus_one( errno );46 rtems_set_errno_and_return_minus_one( errno ); 46 47 }; 47 48 rtems_filesystem_root = rtems_filesystem_current; -
cpukit/libcsupport/src/closedir.c
rb72e368c ra02224e 52 52 53 53 #include <rtems/libio_.h> 54 #include <rtems/seterr.h> 54 55 55 56 /* … … 63 64 64 65 if ( !dirp ) 65 set_errno_and_return_minus_one( EBADF );66 rtems_set_errno_and_return_minus_one( EBADF ); 66 67 67 68 fd = dirp->dd_fd; -
cpukit/libcsupport/src/eval.c
rb72e368c ra02224e 20 20 #include <rtems.h> 21 21 #include <rtems/libio_.h> 22 #include <rtems/seterr.h> 22 23 23 24 int rtems_filesystem_evaluate_path( … … 37 38 38 39 if ( !pathname ) 39 set_errno_and_return_minus_one( EFAULT );40 rtems_set_errno_and_return_minus_one( EFAULT ); 40 41 41 42 if ( !pathloc ) 42 set_errno_and_return_minus_one( EIO ); /* should never happen */43 rtems_set_errno_and_return_minus_one( EIO ); /* should never happen */ 43 44 44 45 /* … … 49 50 50 51 if ( !pathloc->ops->evalpath_h ) 51 set_errno_and_return_minus_one( ENOTSUP );52 rtems_set_errno_and_return_minus_one( ENOTSUP ); 52 53 53 54 result = (*pathloc->ops->evalpath_h)( &pathname[i], flags, pathloc ); … … 61 62 62 63 if ( !pathloc->ops->node_type_h ) 63 set_errno_and_return_minus_one( ENOTSUP );64 rtems_set_errno_and_return_minus_one( ENOTSUP ); 64 65 65 66 type = (*pathloc->ops->node_type_h)( pathloc ); … … 69 70 70 71 if ( !pathloc->ops->eval_link_h ) 71 set_errno_and_return_minus_one( ENOTSUP );72 rtems_set_errno_and_return_minus_one( ENOTSUP ); 72 73 73 74 result = (*pathloc->ops->eval_link_h)( pathloc, flags ); -
cpukit/libcsupport/src/fchdir.c
rb72e368c ra02224e 23 23 #include <rtems/libio.h> 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int fchdir( … … 45 46 46 47 if ( !iop->pathinfo.ops ) { 47 set_errno_and_return_minus_one( ENOTSUP );48 rtems_set_errno_and_return_minus_one( ENOTSUP ); 48 49 } 49 50 50 51 if ( !iop->pathinfo.ops->node_type_h ) { 51 set_errno_and_return_minus_one( ENOTSUP );52 rtems_set_errno_and_return_minus_one( ENOTSUP ); 52 53 } 53 54 54 55 if ( (*iop->pathinfo.ops->node_type_h)( &iop->pathinfo ) != 55 56 RTEMS_FILESYSTEM_DIRECTORY ) { 56 set_errno_and_return_minus_one( ENOTDIR );57 rtems_set_errno_and_return_minus_one( ENOTDIR ); 57 58 } 58 59 -
cpukit/libcsupport/src/fchmod.c
rb72e368c ra02224e 23 23 #include <rtems/libio.h> 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int fchmod( … … 42 43 43 44 if ( !iop->handlers->fchmod_h ) 44 set_errno_and_return_minus_one( ENOTSUP );45 rtems_set_errno_and_return_minus_one( ENOTSUP ); 45 46 46 47 return (*iop->pathinfo.handlers->fchmod_h)( &iop->pathinfo, mode ); -
cpukit/libcsupport/src/fdatasync.c
rb72e368c ra02224e 19 19 20 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 21 22 22 23 int fdatasync( … … 36 37 37 38 if ( !iop->handlers->fdatasync_h ) 38 set_errno_and_return_minus_one( ENOTSUP );39 rtems_set_errno_and_return_minus_one( ENOTSUP ); 39 40 40 41 return (*iop->handlers->fdatasync_h)( iop ); -
cpukit/libcsupport/src/fpathconf.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 #include <rtems/seterr.h> 19 20 20 21 #include <unistd.h> … … 79 80 break; 80 81 default: 81 set_errno_and_return_minus_one( EINVAL );82 rtems_set_errno_and_return_minus_one( EINVAL ); 82 83 break; 83 84 } -
cpukit/libcsupport/src/fstat.c
rb72e368c ra02224e 21 21 22 22 #include <rtems/libio_.h> 23 #include <rtems/seterr.h> 23 24 24 25 int fstat( … … 34 35 35 36 if ( !sbuf ) 36 set_errno_and_return_minus_one( EFAULT );37 rtems_set_errno_and_return_minus_one( EFAULT ); 37 38 38 39 /* … … 45 46 46 47 if ( !iop->handlers ) 47 set_errno_and_return_minus_one( EBADF );48 rtems_set_errno_and_return_minus_one( EBADF ); 48 49 49 50 if ( !iop->handlers->fstat_h ) 50 set_errno_and_return_minus_one( ENOTSUP );51 rtems_set_errno_and_return_minus_one( ENOTSUP ); 51 52 52 53 /* -
cpukit/libcsupport/src/fsync.c
rb72e368c ra02224e 19 19 20 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 21 22 22 23 int fsync( … … 36 37 37 38 if ( !iop->handlers ) 38 set_errno_and_return_minus_one( EBADF );39 rtems_set_errno_and_return_minus_one( EBADF ); 39 40 40 41 if ( !iop->handlers->fsync_h ) 41 set_errno_and_return_minus_one( ENOTSUP );42 rtems_set_errno_and_return_minus_one( ENOTSUP ); 42 43 43 44 return (*iop->handlers->fsync_h)( iop ); -
cpukit/libcsupport/src/ftruncate.c
rb72e368c ra02224e 20 20 21 21 #include <rtems/libio_.h> 22 #include <rtems/seterr.h> 22 23 23 24 int ftruncate( … … 43 44 loc = iop->pathinfo; 44 45 if ( !loc.ops->node_type_h ) 45 set_errno_and_return_minus_one( ENOTSUP );46 rtems_set_errno_and_return_minus_one( ENOTSUP ); 46 47 47 48 if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) 48 set_errno_and_return_minus_one( EISDIR );49 rtems_set_errno_and_return_minus_one( EISDIR ); 49 50 50 51 rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE ); 51 52 52 53 if ( !iop->handlers->ftruncate_h ) 53 set_errno_and_return_minus_one( ENOTSUP );54 rtems_set_errno_and_return_minus_one( ENOTSUP ); 54 55 55 56 return (*iop->handlers->ftruncate_h)( iop, length ); -
cpukit/libcsupport/src/getdents.c
rb72e368c ra02224e 25 25 26 26 #include <rtems/libio_.h> 27 #include <rtems/seterr.h> 27 28 28 29 int getdents( … … 46 47 loc = iop->pathinfo; 47 48 if ( !loc.ops->node_type_h ) 48 set_errno_and_return_minus_one( ENOTSUP );49 rtems_set_errno_and_return_minus_one( ENOTSUP ); 49 50 50 51 if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) 51 set_errno_and_return_minus_one( ENOTDIR );52 rtems_set_errno_and_return_minus_one( ENOTDIR ); 52 53 53 54 /* … … 57 58 58 59 if ( !iop->handlers->read_h ) 59 set_errno_and_return_minus_one( ENOTSUP );60 rtems_set_errno_and_return_minus_one( ENOTSUP ); 60 61 61 62 return (*iop->handlers->read_h)( iop, dd_buf, dd_len ); -
cpukit/libcsupport/src/ioctl.c
rb72e368c ra02224e 19 19 #endif 20 20 21 #include <stdarg.h> 22 21 23 #include <rtems/libio_.h> 24 #include <rtems/seterr.h> 22 25 23 26 #include <unistd.h> … … 47 50 48 51 if ( !iop->handlers ) 49 set_errno_and_return_minus_one( EBADF );52 rtems_set_errno_and_return_minus_one( EBADF ); 50 53 51 54 if ( !iop->handlers->ioctl_h ) 52 set_errno_and_return_minus_one( ENOTSUP );55 rtems_set_errno_and_return_minus_one( ENOTSUP ); 53 56 54 57 rc = (*iop->handlers->ioctl_h)( iop, command, buffer ); -
cpukit/libcsupport/src/link.c
rb72e368c ra02224e 21 21 22 22 #include <rtems/libio_.h> 23 #include <rtems/seterr.h> 23 24 24 25 int link( … … 49 50 if ( !parent_loc.ops->evalformake_h ) { 50 51 rtems_filesystem_freenode( &existing_loc ); 51 set_errno_and_return_minus_one( ENOTSUP );52 rtems_set_errno_and_return_minus_one( ENOTSUP ); 52 53 } 53 54 … … 55 56 if ( result != 0 ) { 56 57 rtems_filesystem_freenode( &existing_loc ); 57 set_errno_and_return_minus_one( result );58 rtems_set_errno_and_return_minus_one( result ); 58 59 } 59 60 … … 66 67 rtems_filesystem_freenode( &existing_loc ); 67 68 rtems_filesystem_freenode( &parent_loc ); 68 set_errno_and_return_minus_one( EXDEV );69 rtems_set_errno_and_return_minus_one( EXDEV ); 69 70 } 70 71 … … 72 73 rtems_filesystem_freenode( &existing_loc ); 73 74 rtems_filesystem_freenode( &parent_loc ); 74 set_errno_and_return_minus_one( ENOTSUP );75 rtems_set_errno_and_return_minus_one( ENOTSUP ); 75 76 } 76 77 -
cpukit/libcsupport/src/lseek.c
rb72e368c ra02224e 19 19 20 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 21 22 22 23 off_t lseek( … … 39 40 40 41 if ( !iop->handlers->lseek_h ) 41 set_errno_and_return_minus_one( ENOTSUP );42 rtems_set_errno_and_return_minus_one( ENOTSUP ); 42 43 43 44 /* … … 60 61 61 62 default: 62 set_errno_and_return_minus_one( EINVAL );63 rtems_set_errno_and_return_minus_one( EINVAL ); 63 64 } 64 65 -
cpukit/libcsupport/src/mknod.c
rb72e368c ra02224e 28 28 29 29 #include <rtems/libio_.h> 30 #include <rtems/seterr.h> 30 31 31 32 int mknod( … … 41 42 42 43 if ( !(mode & (S_IFREG|S_IFCHR|S_IFBLK|S_IFIFO) ) ) 43 set_errno_and_return_minus_one( EINVAL );44 rtems_set_errno_and_return_minus_one( EINVAL ); 44 45 45 46 if ( S_ISFIFO(mode) ) 46 set_errno_and_return_minus_one( ENOTSUP );47 rtems_set_errno_and_return_minus_one( ENOTSUP ); 47 48 48 49 rtems_filesystem_get_start_loc( pathname, &i, &temp_loc ); … … 50 51 if ( !temp_loc.ops->evalformake_h ) { 51 52 rtems_filesystem_freenode( &temp_loc ); 52 set_errno_and_return_minus_one( ENOTSUP );53 rtems_set_errno_and_return_minus_one( ENOTSUP ); 53 54 } 54 55 … … 63 64 if ( !temp_loc.ops->mknod_h ) { 64 65 rtems_filesystem_freenode( &temp_loc ); 65 set_errno_and_return_minus_one( ENOTSUP );66 rtems_set_errno_and_return_minus_one( ENOTSUP ); 66 67 } 67 68 -
cpukit/libcsupport/src/open.c
rb72e368c ra02224e 16 16 #endif 17 17 18 #include <stdarg.h> 19 #include <fcntl.h> 18 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 19 22 20 23 #include <unistd.h> … … 185 188 if ( loc_to_free ) 186 189 rtems_filesystem_freenode( loc_to_free ); 187 set_errno_and_return_minus_one( rc );190 rtems_set_errno_and_return_minus_one( rc ); 188 191 } 189 192 -
cpukit/libcsupport/src/read.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 #include <rtems/seterr.h> 19 20 20 21 ssize_t read( … … 39 40 40 41 if ( !iop->handlers->read_h ) 41 set_errno_and_return_minus_one( ENOTSUP );42 rtems_set_errno_and_return_minus_one( ENOTSUP ); 42 43 43 44 rc = (*iop->handlers->read_h)( iop, buffer, count ); -
cpukit/libcsupport/src/readlink.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 #include <rtems/seterr.h> 19 20 20 21 int readlink( … … 28 29 29 30 if (!buf) 30 set_errno_and_return_minus_one( EFAULT );31 rtems_set_errno_and_return_minus_one( EFAULT ); 31 32 32 33 result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE ); … … 36 37 if ( !loc.ops->node_type_h ){ 37 38 rtems_filesystem_freenode( &loc ); 38 set_errno_and_return_minus_one( ENOTSUP );39 rtems_set_errno_and_return_minus_one( ENOTSUP ); 39 40 } 40 41 41 42 if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK ){ 42 43 rtems_filesystem_freenode( &loc ); 43 set_errno_and_return_minus_one( EINVAL );44 rtems_set_errno_and_return_minus_one( EINVAL ); 44 45 } 45 46 46 47 if ( !loc.ops->readlink_h ){ 47 48 rtems_filesystem_freenode( &loc ); 48 set_errno_and_return_minus_one( ENOTSUP );49 rtems_set_errno_and_return_minus_one( ENOTSUP ); 49 50 } 50 51 -
cpukit/libcsupport/src/rmdir.c
rb72e368c ra02224e 23 23 24 24 #include <rtems/libio_.h> 25 #include <rtems/seterr.h> 25 26 26 27 int rmdir( … … 45 46 if ( !loc.ops->node_type_h ){ 46 47 rtems_filesystem_freenode( &loc ); 47 set_errno_and_return_minus_one( ENOTSUP );48 rtems_set_errno_and_return_minus_one( ENOTSUP ); 48 49 } 49 50 50 51 if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){ 51 52 rtems_filesystem_freenode( &loc ); 52 set_errno_and_return_minus_one( ENOTDIR );53 rtems_set_errno_and_return_minus_one( ENOTDIR ); 53 54 } 54 55 … … 59 60 if ( !loc.handlers->rmnod_h ){ 60 61 rtems_filesystem_freenode( &loc ); 61 set_errno_and_return_minus_one( ENOTSUP );62 rtems_set_errno_and_return_minus_one( ENOTSUP ); 62 63 } 63 64 -
cpukit/libcsupport/src/stat.c
rb72e368c ra02224e 42 42 43 43 #include <rtems/libio_.h> 44 #include <rtems/seterr.h> 44 45 45 46 int _STAT_NAME( … … 56 57 57 58 if ( !buf ) 58 set_errno_and_return_minus_one( EFAULT );59 rtems_set_errno_and_return_minus_one( EFAULT ); 59 60 60 61 status = rtems_filesystem_evaluate_path( path, 0, &loc, _STAT_FOLLOW_LINKS ); … … 64 65 if ( !loc.handlers->fstat_h ){ 65 66 rtems_filesystem_freenode( &loc ); 66 set_errno_and_return_minus_one( ENOTSUP );67 rtems_set_errno_and_return_minus_one( ENOTSUP ); 67 68 } 68 69 -
cpukit/libcsupport/src/symlink.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 #include <rtems/seterr.h> 19 20 20 21 int symlink( … … 35 36 if ( !loc.ops->symlink_h ) { 36 37 rtems_filesystem_freenode( &loc ); 37 set_errno_and_return_minus_one( ENOTSUP );38 rtems_set_errno_and_return_minus_one( ENOTSUP ); 38 39 } 39 40 -
cpukit/libcsupport/src/tcsetattr.c
rb72e368c ra02224e 27 27 #include <rtems/libio.h> 28 28 #include <rtems/libio_.h> 29 #include <rtems/seterr.h> 29 30 30 31 int tcsetattr( … … 36 37 switch (opt) { 37 38 default: 38 set_errno_and_return_minus_one( ENOTSUP );39 rtems_set_errno_and_return_minus_one( ENOTSUP ); 39 40 40 41 case TCSADRAIN: -
cpukit/libcsupport/src/telldir.c
rb72e368c ra02224e 23 23 24 24 #include <rtems/libio_.h> 25 25 #include <rtems/seterr.h> 26 26 27 27 long telldir( … … 32 32 33 33 if ( !dirp ) 34 set_errno_and_return_minus_one( EBADF );34 rtems_set_errno_and_return_minus_one( EBADF ); 35 35 36 36 /* -
cpukit/libcsupport/src/ttyname.c
rb72e368c ra02224e 20 20 21 21 #include <rtems/libio_.h> 22 22 #include <rtems/seterr.h> 23 23 24 24 int ttyname_r( … … 37 37 /* Must be a terminal. */ 38 38 if (tcgetattr (fd, &tty) < 0) 39 set_errno_and_return_minus_one(EBADF);39 rtems_set_errno_and_return_minus_one(EBADF); 40 40 41 41 /* Must be a character device. */ 42 42 if (fstat (fd, &sb) || !S_ISCHR (sb.st_mode)) 43 set_errno_and_return_minus_one(EBADF);43 rtems_set_errno_and_return_minus_one(EBADF); 44 44 45 45 if ((dp = opendir (_PATH_DEV)) == NULL) 46 set_errno_and_return_minus_one(EBADF);46 rtems_set_errno_and_return_minus_one(EBADF); 47 47 48 48 for (rval = NULL; (dirp = readdir (dp)) != NULL ;) -
cpukit/libcsupport/src/ttyname_r.c
rb72e368c ra02224e 56 56 57 57 #include <rtems/libio_.h> 58 #include <rtems/seterr.h> 58 59 59 60 /* … … 76 77 /* Must be a terminal. */ 77 78 if (tcgetattr (fd, &tty) < 0) 78 set_errno_and_return_minus_one(EBADF);79 rtems_set_errno_and_return_minus_one(EBADF); 79 80 80 81 /* Must be a character device. */ 81 82 if (_fstat (fd, &sb) || !S_ISCHR (sb.st_mode)) 82 set_errno_and_return_minus_one(EBADF);83 rtems_set_errno_and_return_minus_one(EBADF); 83 84 84 85 if ((dp = opendir (_PATH_DEV)) == NULL) 85 set_errno_and_return_minus_one(EBADF);86 rtems_set_errno_and_return_minus_one(EBADF); 86 87 87 88 for (rval = NULL; (dirp = readdir (dp)) != NULL ;) -
cpukit/libcsupport/src/unlink.c
rb72e368c ra02224e 19 19 20 20 #include <rtems/libio_.h> 21 #include <rtems/seterr.h> 21 22 22 23 int unlink( … … 37 38 if ( !loc.ops->node_type_h ) { 38 39 rtems_filesystem_freenode( &loc ); 39 set_errno_and_return_minus_one( ENOTSUP );40 rtems_set_errno_and_return_minus_one( ENOTSUP ); 40 41 } 41 42 42 43 if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) { 43 44 rtems_filesystem_freenode( &loc ); 44 set_errno_and_return_minus_one( EISDIR );45 rtems_set_errno_and_return_minus_one( EISDIR ); 45 46 } 46 47 47 48 if ( !loc.ops->unlink_h ) { 48 49 rtems_filesystem_freenode( &loc ); 49 set_errno_and_return_minus_one( ENOTSUP );50 rtems_set_errno_and_return_minus_one( ENOTSUP ); 50 51 } 51 52 -
cpukit/libcsupport/src/unmount.c
rb72e368c ra02224e 32 32 33 33 #include <rtems/libio_.h> 34 #include <rtems/seterr.h> 34 35 35 36 /* … … 126 127 if ( !rtems_filesystem_nodes_equal( fs_root_loc, &loc) ){ 127 128 rtems_filesystem_freenode( &loc ); 128 set_errno_and_return_minus_one( EACCES );129 rtems_set_errno_and_return_minus_one( EACCES ); 129 130 } 130 131 … … 140 141 141 142 if ( !fs_mount_loc->ops->unmount_h ) 142 set_errno_and_return_minus_one( ENOTSUP );143 rtems_set_errno_and_return_minus_one( ENOTSUP ); 143 144 144 145 if ( !fs_root_loc->ops->fsunmount_me_h ) 145 set_errno_and_return_minus_one( ENOTSUP );146 rtems_set_errno_and_return_minus_one( ENOTSUP ); 146 147 147 148 … … 155 156 156 157 if ( rtems_filesystem_current.mt_entry == mt_entry ) 157 set_errno_and_return_minus_one( EBUSY );158 rtems_set_errno_and_return_minus_one( EBUSY ); 158 159 159 160 /* … … 162 163 163 164 if ( file_systems_below_this_mountpoint( path, fs_root_loc, mt_entry ) != 0 ) 164 set_errno_and_return_minus_one( EBUSY );165 rtems_set_errno_and_return_minus_one( EBUSY ); 165 166 166 167 /* … … 171 172 172 173 if ( rtems_libio_is_open_files_in_fs( mt_entry ) == 1 ) 173 set_errno_and_return_minus_one( EBUSY );174 rtems_set_errno_and_return_minus_one( EBUSY ); 174 175 175 176 /* -
cpukit/libcsupport/src/utime.c
rb72e368c ra02224e 21 21 22 22 #include <rtems/libio_.h> 23 #include <rtems/seterr.h> 23 24 24 25 int utime( … … 35 36 if ( !temp_loc.ops->utime_h ){ 36 37 rtems_filesystem_freenode( &temp_loc ); 37 set_errno_and_return_minus_one( ENOTSUP );38 rtems_set_errno_and_return_minus_one( ENOTSUP ); 38 39 } 39 40 -
cpukit/libcsupport/src/write.c
rb72e368c ra02224e 17 17 18 18 #include <rtems/libio_.h> 19 19 #include <rtems/seterr.h> 20 20 21 21 /* … … 47 47 48 48 if ( !iop->handlers->write_h ) 49 set_errno_and_return_minus_one( ENOTSUP );49 rtems_set_errno_and_return_minus_one( ENOTSUP ); 50 50 51 51 rc = (*iop->handlers->write_h)( iop, buffer, count );
Note: See TracChangeset
for help on using the changeset viewer.