summaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2015-04-21 12:07:54 +0100
committerGary Benson <gbenson@redhat.com>2015-04-21 12:09:24 +0100
commit819843c7029916120aa2929f80e0d7276177a7fb (patch)
treef00b335b1e3b2af0368862d09736e8e135f2da27 /gdb/gdbserver
parent43236bb2551a9783ff0de5e95bf75f905300eb06 (diff)
downloadbinutils-gdb-819843c7029916120aa2929f80e0d7276177a7fb.tar.gz
Introduce new shared function fileio_to_host_openflags
This commit introduces a new shared function to replace identical functions in GDB and gdbserver.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog6
-rw-r--r--gdb/gdbserver/hostio.c34
2 files changed, 7 insertions, 33 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 94834504eb1..10d01c12019 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,9 @@
+2015-04-21 Gary Benson <gbenson@redhat.com>
+
+ * hostio.c (fileio_open_flags_to_host): Factored out to
+ fileio_to_host_openflags in common/fileio.c. Single use
+ updated.
+
2015-04-17 Max Filippov <jcmvbkbc@gmail.com>
* linux-xtensa-low.c (xtensa_fill_gregset)
diff --git a/gdb/gdbserver/hostio.c b/gdb/gdbserver/hostio.c
index b03b5ad11bf..9e858d91b3d 100644
--- a/gdb/gdbserver/hostio.c
+++ b/gdb/gdbserver/hostio.c
@@ -243,38 +243,6 @@ hostio_reply_with_data (char *own_buf, char *buffer, int len,
return input_index;
}
-static int
-fileio_open_flags_to_host (int fileio_open_flags, int *open_flags_p)
-{
- int open_flags = 0;
-
- if (fileio_open_flags & ~FILEIO_O_SUPPORTED)
- return -1;
-
- if (fileio_open_flags & FILEIO_O_CREAT)
- open_flags |= O_CREAT;
- if (fileio_open_flags & FILEIO_O_EXCL)
- open_flags |= O_EXCL;
- if (fileio_open_flags & FILEIO_O_TRUNC)
- open_flags |= O_TRUNC;
- if (fileio_open_flags & FILEIO_O_APPEND)
- open_flags |= O_APPEND;
- if (fileio_open_flags & FILEIO_O_RDONLY)
- open_flags |= O_RDONLY;
- if (fileio_open_flags & FILEIO_O_WRONLY)
- open_flags |= O_WRONLY;
- if (fileio_open_flags & FILEIO_O_RDWR)
- open_flags |= O_RDWR;
-/* On systems supporting binary and text mode, always open files in
- binary mode. */
-#ifdef O_BINARY
- open_flags |= O_BINARY;
-#endif
-
- *open_flags_p = open_flags;
- return 0;
-}
-
static void
handle_open (char *own_buf)
{
@@ -291,7 +259,7 @@ handle_open (char *own_buf)
|| require_comma (&p)
|| require_int (&p, &mode)
|| require_end (p)
- || fileio_open_flags_to_host (fileio_flags, &flags))
+ || fileio_to_host_openflags (fileio_flags, &flags))
{
hostio_packet_error (own_buf);
return;