|
@@ -886,41 +886,6 @@ void sigaction_invoke(struct sigaction *action,
|
|
action->sa_sigaction(info->ssi_signo, &si, NULL);
|
|
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)
|
|
size_t qemu_get_host_physmem(void)
|
|
{
|
|
{
|
|
#ifdef _SC_PHYS_PAGES
|
|
#ifdef _SC_PHYS_PAGES
|