aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2022-04-20 17:26:14 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2022-04-21 17:09:09 +0400
commit548fb0da730072d8c96b40ce29b024dd16cbab92 (patch)
tree97f39a8685323b6050c51d545299de81b1be1290 /util
parent756a98dd701ec3a9127c700ba9e7e93254b05f28 (diff)
downloadqemu-548fb0da730072d8c96b40ce29b024dd16cbab92.zip
qemu-548fb0da730072d8c96b40ce29b024dd16cbab92.tar.gz
qemu-548fb0da730072d8c96b40ce29b024dd16cbab92.tar.bz2
qga: move qga_get_host_name()
The function is specific to qemu-ga, no need to share it in QEMU. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-Id: <20220420132624.2439741-32-marcandre.lureau@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/oslib-posix.c35
-rw-r--r--util/oslib-win32.c13
2 files changed, 0 insertions, 48 deletions
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 161f112..fd2bdc9 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -886,41 +886,6 @@ void sigaction_invoke(struct sigaction *action,
action->sa_sigaction(info->ssi_signo, &si, NULL);
}
-#ifndef HOST_NAME_MAX
-# ifdef _POSIX_HOST_NAME_MAX
-# define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
-# else
-# define HOST_NAME_MAX 255
-# endif
-#endif
-
-char *qemu_get_host_name(Error **errp)
-{
- long len = -1;
- g_autofree char *hostname = NULL;
-
-#ifdef _SC_HOST_NAME_MAX
- len = sysconf(_SC_HOST_NAME_MAX);
-#endif /* _SC_HOST_NAME_MAX */
-
- if (len < 0) {
- len = HOST_NAME_MAX;
- }
-
- /* Unfortunately, gethostname() below does not guarantee a
- * NULL terminated string. Therefore, allocate one byte more
- * to be sure. */
- hostname = g_new0(char, len + 1);
-
- if (gethostname(hostname, len) < 0) {
- error_setg_errno(errp, errno,
- "cannot get hostname");
- return NULL;
- }
-
- return g_steal_pointer(&hostname);
-}
-
size_t qemu_get_host_physmem(void)
{
#ifdef _SC_PHYS_PAGES
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 1e05c31..b897d75 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -573,19 +573,6 @@ bool qemu_write_pidfile(const char *filename, Error **errp)
return true;
}
-char *qemu_get_host_name(Error **errp)
-{
- wchar_t tmp[MAX_COMPUTERNAME_LENGTH + 1];
- DWORD size = G_N_ELEMENTS(tmp);
-
- if (GetComputerNameW(tmp, &size) == 0) {
- error_setg_win32(errp, GetLastError(), "failed close handle");
- return NULL;
- }
-
- return g_utf16_to_utf8(tmp, size, NULL, NULL, NULL);
-}
-
size_t qemu_get_host_physmem(void)
{
MEMORYSTATUSEX statex;