diff options
author | Gary Benson <gbenson@redhat.com> | 2015-04-02 13:38:28 +0100 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2015-04-02 13:38:28 +0100 |
commit | 9b15c1f0419ae693fdcf6cca399e9a916e14c48e (patch) | |
tree | 9e17d419e6ef53e2a22b4e993b71d8af96382186 /gdb/target.c | |
parent | 3d5ff6205b2e62388280661769cc0555a58a1358 (diff) | |
download | gdb-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/target.c')
-rw-r--r-- | gdb/target.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c index 6f6029b..306c21d 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2839,6 +2839,25 @@ target_fileio_pread (int fd, gdb_byte *read_buf, int len, return ret; } +/* See target.h. */ +int +target_fileio_fstat (int fd, struct stat *sb, int *target_errno) +{ + fileio_fh_t *fh = fileio_fd_to_fh (fd); + int ret = -1; + + if (is_closed_fileio_fh (fh->fd)) + *target_errno = EBADF; + else + ret = fh->t->to_fileio_fstat (fh->t, fh->fd, sb, target_errno); + + if (targetdebug) + fprintf_unfiltered (gdb_stdlog, + "target_fileio_fstat (%d) = %d (%d)\n", + fd, ret, ret != -1 ? 0 : *target_errno); + return ret; +} + /* Close FD on the target. Return 0, or -1 if an error occurs (and set *TARGET_ERRNO). */ int |