Changeset 3ef8798 in rtems


Ignore:
Timestamp:
Mar 6, 1999, 6:09:15 PM (23 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
a4dc7e0
Parents:
eaefca90
Message:

Added F_GETFL support so the fdopen() implementation in newlib 1.8.1
would work. At the same time, the initial implementation of F_SETFL
was added. A support routine was added to convert internal libio
flags back to the POSIX style. Eventually the internal representation
should be eliminated in the interest of simplicity and code reduction.
This problem was reported by Jake Janovetz <janovetz@…>.

Files:
12 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/include/rtems/libio_.h

    reaefca90 r3ef8798  
    222222);
    223223
     224unsigned32 rtems_libio_to_fcntl_flags(
     225  unsigned32 flags
     226);
     227
    224228void rtems_libio_free(
    225229  rtems_libio_t *iop
  • c/src/exec/libcsupport/include/rtems/libio_.h

    reaefca90 r3ef8798  
    222222);
    223223
     224unsigned32 rtems_libio_to_fcntl_flags(
     225  unsigned32 flags
     226);
     227
    224228void rtems_libio_free(
    225229  rtems_libio_t *iop
  • c/src/exec/libcsupport/src/fcntl.c

    reaefca90 r3ef8798  
    3030  rtems_libio_t *diop;
    3131  int            fd2;
     32  int            flags;
    3233 
    3334  va_start( ap, cmd );
     
    8586
    8687    case F_GETFL:        /* more flags (cloexec) */
    87       return -1;
     88      return rtems_libio_to_fcntl_flags( iop->flags );
    8889
    8990    case F_SETFL:
    90       return -1;
     91      flags = rtems_libio_fcntl_flags( va_arg( ap, int ) );
     92
     93      /*
     94       *  XXX Double check this in the POSIX spec.  According to the Linux
     95       *  XXX man page, only these flags can be added.
     96       */
     97
     98      flags &= ~(O_APPEND | O_NONBLOCK);
     99
     100      /*
     101       *  XXX If we are turning on append, should we seek to the end?
     102       */
     103
     104      iop->flags |= flags;
     105      return 0;
    91106
    92107    case F_GETLK:
  • c/src/exec/libcsupport/src/libio.c

    reaefca90 r3ef8798  
    145145     rtems_assoc_local_by_remote_bitfield(status_flags_assoc, fcntl_flags);
    146146  return flags;
     147}
     148
     149/*
     150 *  rtems_libio_to_fcntl_flags
     151 *
     152 *  Convert RTEMS internal flags to UNIX fnctl(2) flags
     153 */
     154
     155unsigned32 rtems_libio_to_fcntl_flags(
     156  unsigned32 flags
     157)
     158{
     159  unsigned32 fcntl_flags = 0;
     160
     161  fcntl_flags = rtems_assoc_remote_by_local( access_modes_assoc, flags );
     162  fcntl_flags |=
     163     rtems_assoc_remote_by_local_bitfield(status_flags_assoc, flags);
     164  return fcntl_flags;
    147165}
    148166
  • c/src/lib/include/rtems/libio_.h

    reaefca90 r3ef8798  
    222222);
    223223
     224unsigned32 rtems_libio_to_fcntl_flags(
     225  unsigned32 flags
     226);
     227
    224228void rtems_libio_free(
    225229  rtems_libio_t *iop
  • c/src/lib/libc/fcntl.c

    reaefca90 r3ef8798  
    3030  rtems_libio_t *diop;
    3131  int            fd2;
     32  int            flags;
    3233 
    3334  va_start( ap, cmd );
     
    8586
    8687    case F_GETFL:        /* more flags (cloexec) */
    87       return -1;
     88      return rtems_libio_to_fcntl_flags( iop->flags );
    8889
    8990    case F_SETFL:
    90       return -1;
     91      flags = rtems_libio_fcntl_flags( va_arg( ap, int ) );
     92
     93      /*
     94       *  XXX Double check this in the POSIX spec.  According to the Linux
     95       *  XXX man page, only these flags can be added.
     96       */
     97
     98      flags &= ~(O_APPEND | O_NONBLOCK);
     99
     100      /*
     101       *  XXX If we are turning on append, should we seek to the end?
     102       */
     103
     104      iop->flags |= flags;
     105      return 0;
    91106
    92107    case F_GETLK:
  • c/src/lib/libc/libio.c

    reaefca90 r3ef8798  
    145145     rtems_assoc_local_by_remote_bitfield(status_flags_assoc, fcntl_flags);
    146146  return flags;
     147}
     148
     149/*
     150 *  rtems_libio_to_fcntl_flags
     151 *
     152 *  Convert RTEMS internal flags to UNIX fnctl(2) flags
     153 */
     154
     155unsigned32 rtems_libio_to_fcntl_flags(
     156  unsigned32 flags
     157)
     158{
     159  unsigned32 fcntl_flags = 0;
     160
     161  fcntl_flags = rtems_assoc_remote_by_local( access_modes_assoc, flags );
     162  fcntl_flags |=
     163     rtems_assoc_remote_by_local_bitfield(status_flags_assoc, flags);
     164  return fcntl_flags;
    147165}
    148166
  • c/src/lib/libc/libio_.h

    reaefca90 r3ef8798  
    222222);
    223223
     224unsigned32 rtems_libio_to_fcntl_flags(
     225  unsigned32 flags
     226);
     227
    224228void rtems_libio_free(
    225229  rtems_libio_t *iop
  • cpukit/include/rtems/libio_.h

    reaefca90 r3ef8798  
    222222);
    223223
     224unsigned32 rtems_libio_to_fcntl_flags(
     225  unsigned32 flags
     226);
     227
    224228void rtems_libio_free(
    225229  rtems_libio_t *iop
  • cpukit/libcsupport/include/rtems/libio_.h

    reaefca90 r3ef8798  
    222222);
    223223
     224unsigned32 rtems_libio_to_fcntl_flags(
     225  unsigned32 flags
     226);
     227
    224228void rtems_libio_free(
    225229  rtems_libio_t *iop
  • cpukit/libcsupport/src/fcntl.c

    reaefca90 r3ef8798  
    3030  rtems_libio_t *diop;
    3131  int            fd2;
     32  int            flags;
    3233 
    3334  va_start( ap, cmd );
     
    8586
    8687    case F_GETFL:        /* more flags (cloexec) */
    87       return -1;
     88      return rtems_libio_to_fcntl_flags( iop->flags );
    8889
    8990    case F_SETFL:
    90       return -1;
     91      flags = rtems_libio_fcntl_flags( va_arg( ap, int ) );
     92
     93      /*
     94       *  XXX Double check this in the POSIX spec.  According to the Linux
     95       *  XXX man page, only these flags can be added.
     96       */
     97
     98      flags &= ~(O_APPEND | O_NONBLOCK);
     99
     100      /*
     101       *  XXX If we are turning on append, should we seek to the end?
     102       */
     103
     104      iop->flags |= flags;
     105      return 0;
    91106
    92107    case F_GETLK:
  • cpukit/libcsupport/src/libio.c

    reaefca90 r3ef8798  
    145145     rtems_assoc_local_by_remote_bitfield(status_flags_assoc, fcntl_flags);
    146146  return flags;
     147}
     148
     149/*
     150 *  rtems_libio_to_fcntl_flags
     151 *
     152 *  Convert RTEMS internal flags to UNIX fnctl(2) flags
     153 */
     154
     155unsigned32 rtems_libio_to_fcntl_flags(
     156  unsigned32 flags
     157)
     158{
     159  unsigned32 fcntl_flags = 0;
     160
     161  fcntl_flags = rtems_assoc_remote_by_local( access_modes_assoc, flags );
     162  fcntl_flags |=
     163     rtems_assoc_remote_by_local_bitfield(status_flags_assoc, flags);
     164  return fcntl_flags;
    147165}
    148166
Note: See TracChangeset for help on using the changeset viewer.