+/* 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). */
+static char *
+inf_child_fileio_readlink (const char *filename, int *target_errno)
+{
+ /* We support readlink only on systems that also provide a compile-time
+ maximum path length (PATH_MAX), at least for now. */
+#if defined (HAVE_READLINK) && defined (PATH_MAX)
+ char buf[PATH_MAX];
+ int len;
+ char *ret;
+
+ len = readlink (filename, buf, sizeof buf);
+ if (len < 0)
+ {
+ *target_errno = inf_child_errno_to_fileio_error (errno);
+ return NULL;
+ }
+
+ ret = xmalloc (len + 1);
+ memcpy (ret, buf, len);
+ ret[len] = '\0';
+ return ret;
+#else
+ *target_errno = FILEIO_ENOSYS;
+ return NULL;
+#endif
+}
+
+static int
+inf_child_use_agent (int use)
+{
+ if (agent_loaded_p ())
+ {
+ use_agent = use;
+ return 1;
+ }
+ else
+ return 0;
+}
+
+static int
+inf_child_can_use_agent (void)
+{
+ return agent_loaded_p ();
+}