aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichal Privoznik <mprivozn@redhat.com>2020-06-22 20:19:35 +0200
committerMichael Roth <mdroth@linux.vnet.ibm.com>2020-07-13 17:44:58 -0500
commite47f4765afcab2b78dfa5b0115abf64d1d49a5d3 (patch)
tree742e33d46437b3f323f14290732020d1e9df05d0 /include
parent844bd70b5652f30bbace89499f513e3fbbb6457a (diff)
downloadqemu-e47f4765afcab2b78dfa5b0115abf64d1d49a5d3.zip
qemu-e47f4765afcab2b78dfa5b0115abf64d1d49a5d3.tar.gz
qemu-e47f4765afcab2b78dfa5b0115abf64d1d49a5d3.tar.bz2
util: Introduce qemu_get_host_name()
This function offers operating system agnostic way to fetch host name. It is implemented for both POSIX-like and Windows systems. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/qemu/osdep.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 979a403..4841b5c 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -655,4 +655,14 @@ static inline void qemu_reset_optind(void)
#endif
}
+/**
+ * qemu_get_host_name:
+ * @errp: Error object
+ *
+ * Operating system agnostic way of querying host name.
+ *
+ * Returns allocated hostname (caller should free), NULL on failure.
+ */
+char *qemu_get_host_name(Error **errp);
+
#endif