summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-03-08 21:39:16 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-03-08 21:39:16 +0000
commit3195d9c0a5ad0d0af6b99b3946a870428ad99ac6 (patch)
treee8b076382f519b4cbc9d8e8503594d64e8decfd3
parent1bb170208b975bf062b0487fa0431750aa2ff127 (diff)
downloadrtems-3195d9c0a5ad0d0af6b99b3946a870428ad99ac6.tar.bz2
Added code to translate internal libio flags to POSIX style flags.
-rw-r--r--c/src/exec/libcsupport/src/libio.c23
-rw-r--r--c/src/lib/libc/libio.c23
-rw-r--r--cpukit/libcsupport/src/libio.c23
3 files changed, 60 insertions, 9 deletions
diff --git a/c/src/exec/libcsupport/src/libio.c b/c/src/exec/libcsupport/src/libio.c
index bedd4a920e..3ea32222f3 100644
--- a/c/src/exec/libcsupport/src/libio.c
+++ b/c/src/exec/libcsupport/src/libio.c
@@ -158,9 +158,26 @@ unsigned32 rtems_libio_to_fcntl_flags(
{
unsigned32 fcntl_flags = 0;
- fcntl_flags = rtems_assoc_remote_by_local( access_modes_assoc, flags );
- fcntl_flags |=
- rtems_assoc_remote_by_local_bitfield(status_flags_assoc, flags);
+ if ( (flags & LIBIO_FLAGS_READ_WRITE) == LIBIO_FLAGS_READ_WRITE ) {
+ fcntl_flags |= O_RDWR;
+ } else if ( (flags & LIBIO_FLAGS_READ) == LIBIO_FLAGS_READ) {
+ fcntl_flags |= O_RDONLY;
+ } else if ( (flags & LIBIO_FLAGS_WRITE) == LIBIO_FLAGS_WRITE) {
+ fcntl_flags |= O_WRONLY;
+ }
+
+ if ( (flags & LIBIO_FLAGS_NO_DELAY) == LIBIO_FLAGS_NO_DELAY ) {
+ fcntl_flags |= O_NDELAY;
+ }
+
+ if ( (flags & LIBIO_FLAGS_APPEND) == LIBIO_FLAGS_APPEND ) {
+ fcntl_flags |= O_APPEND;
+ }
+
+ if ( (flags & LIBIO_FLAGS_CREATE) == LIBIO_FLAGS_CREATE ) {
+ fcntl_flags |= O_CREAT;
+ }
+
return fcntl_flags;
}
diff --git a/c/src/lib/libc/libio.c b/c/src/lib/libc/libio.c
index bedd4a920e..3ea32222f3 100644
--- a/c/src/lib/libc/libio.c
+++ b/c/src/lib/libc/libio.c
@@ -158,9 +158,26 @@ unsigned32 rtems_libio_to_fcntl_flags(
{
unsigned32 fcntl_flags = 0;
- fcntl_flags = rtems_assoc_remote_by_local( access_modes_assoc, flags );
- fcntl_flags |=
- rtems_assoc_remote_by_local_bitfield(status_flags_assoc, flags);
+ if ( (flags & LIBIO_FLAGS_READ_WRITE) == LIBIO_FLAGS_READ_WRITE ) {
+ fcntl_flags |= O_RDWR;
+ } else if ( (flags & LIBIO_FLAGS_READ) == LIBIO_FLAGS_READ) {
+ fcntl_flags |= O_RDONLY;
+ } else if ( (flags & LIBIO_FLAGS_WRITE) == LIBIO_FLAGS_WRITE) {
+ fcntl_flags |= O_WRONLY;
+ }
+
+ if ( (flags & LIBIO_FLAGS_NO_DELAY) == LIBIO_FLAGS_NO_DELAY ) {
+ fcntl_flags |= O_NDELAY;
+ }
+
+ if ( (flags & LIBIO_FLAGS_APPEND) == LIBIO_FLAGS_APPEND ) {
+ fcntl_flags |= O_APPEND;
+ }
+
+ if ( (flags & LIBIO_FLAGS_CREATE) == LIBIO_FLAGS_CREATE ) {
+ fcntl_flags |= O_CREAT;
+ }
+
return fcntl_flags;
}
diff --git a/cpukit/libcsupport/src/libio.c b/cpukit/libcsupport/src/libio.c
index bedd4a920e..3ea32222f3 100644
--- a/cpukit/libcsupport/src/libio.c
+++ b/cpukit/libcsupport/src/libio.c
@@ -158,9 +158,26 @@ unsigned32 rtems_libio_to_fcntl_flags(
{
unsigned32 fcntl_flags = 0;
- fcntl_flags = rtems_assoc_remote_by_local( access_modes_assoc, flags );
- fcntl_flags |=
- rtems_assoc_remote_by_local_bitfield(status_flags_assoc, flags);
+ if ( (flags & LIBIO_FLAGS_READ_WRITE) == LIBIO_FLAGS_READ_WRITE ) {
+ fcntl_flags |= O_RDWR;
+ } else if ( (flags & LIBIO_FLAGS_READ) == LIBIO_FLAGS_READ) {
+ fcntl_flags |= O_RDONLY;
+ } else if ( (flags & LIBIO_FLAGS_WRITE) == LIBIO_FLAGS_WRITE) {
+ fcntl_flags |= O_WRONLY;
+ }
+
+ if ( (flags & LIBIO_FLAGS_NO_DELAY) == LIBIO_FLAGS_NO_DELAY ) {
+ fcntl_flags |= O_NDELAY;
+ }
+
+ if ( (flags & LIBIO_FLAGS_APPEND) == LIBIO_FLAGS_APPEND ) {
+ fcntl_flags |= O_APPEND;
+ }
+
+ if ( (flags & LIBIO_FLAGS_CREATE) == LIBIO_FLAGS_CREATE ) {
+ fcntl_flags |= O_CREAT;
+ }
+
return fcntl_flags;
}