aboutsummaryrefslogtreecommitdiff
path: root/gdb/inf-child.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2015-04-02 13:38:28 +0100
committerGary Benson <gbenson@redhat.com>2015-04-02 13:38:28 +0100
commit9b15c1f0419ae693fdcf6cca399e9a916e14c48e (patch)
tree9e17d419e6ef53e2a22b4e993b71d8af96382186 /gdb/inf-child.c
parent3d5ff6205b2e62388280661769cc0555a58a1358 (diff)
downloadgdb-9b15c1f0419ae693fdcf6cca399e9a916e14c48e.zip
gdb-9b15c1f0419ae693fdcf6cca399e9a916e14c48e.tar.gz
gdb-9b15c1f0419ae693fdcf6cca399e9a916e14c48e.tar.bz2
Introduce target_fileio_fstat
This commit introduces a new target method target_fileio_fstat which can be used to retrieve information about files opened with target_fileio_open. gdb/ChangeLog: * target.h (struct target_ops) <to_fileio_fstat>: New field. (target_fileio_fstat): New declaration. * target.c (target_fileio_fstat): New function. * inf-child.c (inf_child_fileio_fstat): Likewise. (inf_child_target): Initialize to_fileio_fstat. * remote.c (init_remote_ops): Likewise.
Diffstat (limited to 'gdb/inf-child.c')
-rw-r--r--gdb/inf-child.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index 494f4b8..b7161ab 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -374,6 +374,20 @@ inf_child_fileio_pread (struct target_ops *self,
return ret;
}
+/* Implementation of to_fileio_fstat. */
+static int
+inf_child_fileio_fstat (struct target_ops *self, int fd,
+ struct stat *sb, int *target_errno)
+{
+ int ret;
+
+ ret = fstat (fd, sb);
+ if (ret == -1)
+ *target_errno = inf_child_errno_to_fileio_error (errno);
+
+ return ret;
+}
+
/* Close FD on the target. Return 0, or -1 if an error occurs
(and set *TARGET_ERRNO). */
static int
@@ -500,6 +514,7 @@ inf_child_target (void)
t->to_fileio_open = inf_child_fileio_open;
t->to_fileio_pwrite = inf_child_fileio_pwrite;
t->to_fileio_pread = inf_child_fileio_pread;
+ t->to_fileio_fstat = inf_child_fileio_fstat;
t->to_fileio_close = inf_child_fileio_close;
t->to_fileio_unlink = inf_child_fileio_unlink;
t->to_fileio_readlink = inf_child_fileio_readlink;