diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2012-01-20 09:47:32 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2012-01-20 09:47:32 +0000 |
commit | b9e7b9c3de60f6aef716ac169d82418ea27d4331 (patch) | |
tree | d50dcabd991b1b7fa639b51eba142bd39db2f4b8 /gdb/target.c | |
parent | 7313baad7c73664bed62b87481cbb078d71e84f4 (diff) | |
download | gdb-b9e7b9c3de60f6aef716ac169d82418ea27d4331.zip gdb-b9e7b9c3de60f6aef716ac169d82418ea27d4331.tar.gz gdb-b9e7b9c3de60f6aef716ac169d82418ea27d4331.tar.bz2 |
ChangeLog:
* configure.ac [AC_CHECK_FUNCS]: Check for readlink.
* config.in, configure: Regenerate.
* target.h (struct target_ops): Add to_fileio_readlink.
(target_fileio_readlink): Add prototype.
* target.c (target_fileio_readlink): New function.
* inf-child.c: Conditionally include <sys/param.h>.
(inf_child_fileio_readlink): New function.
(inf_child_target): Install it.
* remote.c (PACKET_vFile_readlink): New enum value.
(remote_hostio_readlink): New function.
(init_remote_ops): Install it.
(_initialize_remote): Handle vFile:readlink packet type.
doc/ChangeLog:
* gdb.texinfo (Remote Configuration): Document
"set remote hostio-readlink-packet" command.
(General Query Packets): Document vFile:readlink packet.
gdbserver/ChangeLog:
* hostio.c (handle_readlink): New function.
(handle_vFile): Call it to handle "vFile:readlink" packets.
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c index 595c2ce..32260e1 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3318,6 +3318,33 @@ target_fileio_unlink (const char *filename, int *target_errno) return -1; } +/* Read value of symbolic link FILENAME on the target. Return a + null-terminated string allocated via xmalloc, or NULL if an error + occurs (and set *TARGET_ERRNO). */ +char * +target_fileio_readlink (const char *filename, int *target_errno) +{ + struct target_ops *t; + + for (t = default_fileio_target (); t != NULL; t = t->beneath) + { + if (t->to_fileio_readlink != NULL) + { + char *ret = t->to_fileio_readlink (filename, target_errno); + + if (targetdebug) + fprintf_unfiltered (gdb_stdlog, + "target_fileio_readlink (%s) = %s (%d)\n", + filename, ret? ret : "(nil)", + ret? 0 : *target_errno); + return ret; + } + } + + *target_errno = FILEIO_ENOSYS; + return NULL; +} + static void target_fileio_close_cleanup (void *opaque) { |