Ticket #1839: pr1839_49.diff

File pr1839_49.diff, 8.7 KB (added by Joel Sherrill, on 07/22/11 at 15:13:35)

Patch to system calls for 4.9

  • cpukit/libcsupport/include/rtems/libio_.h

    ? cpukit/libcsupport/src/.write.c.rej.swp
    RCS file: /usr1/CVS/rtems/cpukit/libcsupport/include/rtems/libio_.h,v
    retrieving revision 1.28.2.1
    diff -u -r1.28.2.1 libio_.h
     
    124124  } while (0)
    125125
    126126/*
    127  *  rtems_libio_check_permissions
     127 *  rtems_libio_check_permissions_with_error
    128128 *
    129129 *  Macro to check if a file descriptor is open for this operation.
     130 *  On failure, return the user specified error.
    130131 */
    131132
    132 #define rtems_libio_check_permissions(_iop, _flag)    \
    133   do {                                                \
    134       if (((_iop)->flags & (_flag)) == 0) {           \
    135             rtems_set_errno_and_return_minus_one( EINVAL ); \
    136             return -1;                                \
    137       }                                               \
     133#define rtems_libio_check_permissions_with_error(_iop, _flag, _errno) \
     134  do {                                                      \
     135      if (((_iop)->flags & (_flag)) == 0) {                 \
     136            rtems_set_errno_and_return_minus_one( _errno ); \
     137            return -1;                                      \
     138      }                                                     \
    138139  } while (0)
    139140
    140141/*
     142 *  rtems_libio_check_permissions
     143 *
     144 *  Macro to check if a file descriptor is open for this operation.
     145 *  On failure, return EINVAL
     146 */
     147
     148#define rtems_libio_check_permissions(_iop, _flag) \
     149   rtems_libio_check_permissions_with_error(_iop, _flag, EINVAL )
     150
     151/*
    141152 *  rtems_filesystem_freenode
    142153 *
    143154 *  Macro to free a node.
  • cpukit/libcsupport/src/fchdir.c

    RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/fchdir.c,v
    retrieving revision 1.8
    diff -u -r1.8 fchdir.c
     
    11/*
    22 *  fchdir() - compatible with SVr4, 4.4BSD and X/OPEN - Change Directory
    33 *
    4  *  COPYRIGHT (c) 1989-2000.
     4 *  COPYRIGHT (c) 1989-2011.
    55 *  On-Line Applications Research Corporation (OAR).
    66 *
    77 *  The license and distribution terms for this file may be
     
    3636  rtems_libio_check_is_open(iop);
    3737
    3838  /*
    39    *  Now process the fchmod().
    40    */
    41 
    42   rtems_libio_check_permissions( iop, LIBIO_FLAGS_READ );
    43 
    44   /*
    4539   * Verify you can change directory into this node.
    4640   */
    4741
  • cpukit/libcsupport/src/fdatasync.c

    RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/fdatasync.c,v
    retrieving revision 1.10
    diff -u -r1.10 fdatasync.c
     
    11/*
    22 *  fdatasync() - POSIX 1003.1b 6.6.2 - Synchronize the Data of a File
    33 *
    4  *  COPYRIGHT (c) 1989-1999.
     4 *  COPYRIGHT (c) 1989-2011.
    55 *  On-Line Applications Research Corporation (OAR).
    66 *
    77 *  The license and distribution terms for this file may be
     
    2929  rtems_libio_check_fd( fd );
    3030  iop = rtems_libio_iop( fd );
    3131  rtems_libio_check_is_open(iop);
    32   rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
     32  rtems_libio_check_permissions_with_error( iop, LIBIO_FLAGS_WRITE, EBADF );
    3333
    3434  /*
    3535   *  Now process the fdatasync().
  • cpukit/libcsupport/src/fpathconf.c

    RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/fpathconf.c,v
    retrieving revision 1.9
    diff -u -r1.9 fpathconf.c
     
    11/*
    22 *  fpathconf() - POSIX 1003.1b - 5.7.1 - Configurable Pathname Varables
    33 *
    4  *  COPYRIGHT (c) 1989-1999.
     4 *  COPYRIGHT (c) 1989-2011.
    55 *  On-Line Applications Research Corporation (OAR).
    66 *
    77 *  The license and distribution terms for this file may be
     
    3333  rtems_libio_check_fd(fd);
    3434  iop = rtems_libio_iop(fd);
    3535  rtems_libio_check_is_open(iop);
    36   rtems_libio_check_permissions(iop, LIBIO_FLAGS_READ);
    3736
    3837  /*
    3938   *  Now process the information request.
  • cpukit/libcsupport/src/fsync.c

    RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/fsync.c,v
    retrieving revision 1.11
    diff -u -r1.11 fsync.c
     
    11/*
    22 *  fsync() - POSIX 1003.1b 6.6.1 - Synchronize the State of a File
    33 *
    4  *  COPYRIGHT (c) 1989-1999.
     4 *  COPYRIGHT (c) 1989-2011.
    55 *  On-Line Applications Research Corporation (OAR).
    66 *
    77 *  The license and distribution terms for this file may be
     
    2929  rtems_libio_check_fd( fd );
    3030  iop = rtems_libio_iop( fd );
    3131  rtems_libio_check_is_open(iop);
    32   rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
    3332
    3433  /*
    3534   *  Now process the fsync().
  • cpukit/libcsupport/src/read.c

    RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/read.c,v
    retrieving revision 1.13
    diff -u -r1.13 read.c
     
    11/*
    22 *  read() - POSIX 1003.1b 6.4.1 - Read From a File
    33 *
    4  *  COPYRIGHT (c) 1989-1999.
     4 *  COPYRIGHT (c) 1989-2011.
    55 *  On-Line Applications Research Corporation (OAR).
    66 *
    77 *  The license and distribution terms for this file may be
     
    3232  rtems_libio_check_is_open( iop );
    3333  rtems_libio_check_buffer( buffer );
    3434  rtems_libio_check_count( count );
    35   rtems_libio_check_permissions( iop, LIBIO_FLAGS_READ );
     35  rtems_libio_check_permissions_with_error( iop, LIBIO_FLAGS_READ, EBADF );
    3636
    3737  /*
    3838   *  Now process the read().
  • cpukit/libcsupport/src/readv.c

    RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/readv.c,v
    retrieving revision 1.2
    diff -u -r1.2 readv.c
     
    55 *
    66 *  http://www.opengroup.org/onlinepubs/009695399/functions/readv.html
    77 *
    8  *  COPYRIGHT (c) 1989-2007.
     8 *  COPYRIGHT (c) 1989-2011.
    99 *  On-Line Applications Research Corporation (OAR).
    1010 *
    1111 *  The license and distribution terms for this file may be
     
    4040  rtems_libio_check_fd( fd );
    4141  iop = rtems_libio_iop( fd );
    4242  rtems_libio_check_is_open( iop );
    43   rtems_libio_check_permissions( iop, LIBIO_FLAGS_READ );
     43  rtems_libio_check_permissions_with_error( iop, LIBIO_FLAGS_READ, EBADF );
    4444
    4545  /*
    4646   *  Argument validation on IO vector
  • cpukit/libcsupport/src/write.c

    RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/write.c,v
    retrieving revision 1.16
    diff -u -r1.16 write.c
     
    11/*
    22 *  write() - POSIX 1003.1b 6.4.2 - Write to a File
    33 *
    4  *  COPYRIGHT (c) 1989-2007.
     4 *  COPYRIGHT (c) 1989-2011.
    55 *  On-Line Applications Research Corporation (OAR).
    66 *
    77 *  The license and distribution terms for this file may be
     
    3939  rtems_libio_check_is_open( iop );
    4040  rtems_libio_check_buffer( buffer );
    4141  rtems_libio_check_count( count );
    42   rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
     42  rtems_libio_check_permissions_with_error( iop, LIBIO_FLAGS_WRITE, EBADF );
    4343
    4444  /*
    4545   *  Now process the write() request.
  • cpukit/libcsupport/src/writev.c

    RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/writev.c,v
    retrieving revision 1.2
    diff -u -r1.2 writev.c
     
    55 *
    66 *  http://www.opengroup.org/onlinepubs/009695399/functions/writev.html
    77 *
    8  *  COPYRIGHT (c) 1989-2007.
     8 *  COPYRIGHT (c) 1989-2011.
    99 *  On-Line Applications Research Corporation (OAR).
    1010 *
    1111 *  The license and distribution terms for this file may be
     
    4141  rtems_libio_check_fd( fd );
    4242  iop = rtems_libio_iop( fd );
    4343  rtems_libio_check_is_open( iop );
    44   rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
     44  rtems_libio_check_permissions_with_error( iop, LIBIO_FLAGS_WRITE, EBADF );
    4545
    4646  /*
    4747   *  Argument validation on IO vector