Revision 5ec9cc64 vl.c
b/vl.c | ||
---|---|---|
93 | 93 |
#include <libvdeplug.h> |
94 | 94 |
#endif |
95 | 95 |
|
96 |
#if defined(CONFIG_UUID) |
|
97 |
#include <uuid/uuid.h> |
|
98 |
#endif |
|
99 |
|
|
100 | 96 |
#ifdef _WIN32 |
101 | 97 |
#include <windows.h> |
102 | 98 |
#endif |
... | ... | |
3708 | 3704 |
return popt; |
3709 | 3705 |
} |
3710 | 3706 |
|
3711 |
static void qmp_add_default(void) |
|
3712 |
{ |
|
3713 |
char buffer[4096]; |
|
3714 |
const char *home; |
|
3715 |
static uint8_t null_uuid[16]; |
|
3716 |
uint8_t uuid[16]; |
|
3717 |
int ret; |
|
3718 |
|
|
3719 |
home = getenv("HOME"); |
|
3720 |
if (!home) { |
|
3721 |
return; |
|
3722 |
} |
|
3723 |
|
|
3724 |
if (memcmp(qemu_uuid, null_uuid, sizeof(null_uuid)) == 0) { |
|
3725 |
#if defined(CONFIG_UUID) |
|
3726 |
uuid_generate(uuid); |
|
3727 |
#else |
|
3728 |
return; |
|
3729 |
#endif |
|
3730 |
} else { |
|
3731 |
memcpy(uuid, qemu_uuid, sizeof(qemu_uuid)); |
|
3732 |
} |
|
3733 |
|
|
3734 |
snprintf(buffer, sizeof(buffer), "%s/.qemu", home); |
|
3735 |
#ifdef __MINGW32__ |
|
3736 |
ret = mkdir(buffer); |
|
3737 |
#else |
|
3738 |
ret = mkdir(buffer, 0755); |
|
3739 |
#endif |
|
3740 |
if (ret == -1 && errno != EEXIST) { |
|
3741 |
fprintf(stderr, "could not open default QMP port\n"); |
|
3742 |
return; |
|
3743 |
} |
|
3744 |
|
|
3745 |
snprintf(buffer, sizeof(buffer), "%s/.qemu/qmp", home); |
|
3746 |
#ifdef __MINGW32__ |
|
3747 |
ret = mkdir(buffer); |
|
3748 |
#else |
|
3749 |
ret = mkdir(buffer, 0755); |
|
3750 |
#endif |
|
3751 |
if (ret == -1 && errno != EEXIST) { |
|
3752 |
fprintf(stderr, "could not open default QMP port\n"); |
|
3753 |
return; |
|
3754 |
} |
|
3755 |
|
|
3756 |
snprintf(buffer, sizeof(buffer), |
|
3757 |
"unix:%s/.qemu/qmp/" UUID_FMT ".sock,server,nowait", |
|
3758 |
home, |
|
3759 |
uuid[0], uuid[1], uuid[2], uuid[3], |
|
3760 |
uuid[4], uuid[5], uuid[6], uuid[7], |
|
3761 |
uuid[8], uuid[9], uuid[10], uuid[11], |
|
3762 |
uuid[12], uuid[13], uuid[14], uuid[15]); |
|
3763 |
|
|
3764 |
monitor_parse(buffer, "control"); |
|
3765 |
} |
|
3766 |
|
|
3767 | 3707 |
int main(int argc, char **argv, char **envp) |
3768 | 3708 |
{ |
3769 | 3709 |
const char *gdbstub_dev = NULL; |
... | ... | |
4680 | 4620 |
if (default_virtcon) |
4681 | 4621 |
add_device_config(DEV_VIRTCON, "vc:80Cx24C"); |
4682 | 4622 |
} |
4683 |
if (default_qmp) { |
|
4684 |
qmp_add_default(); |
|
4685 |
} |
|
4686 | 4623 |
if (default_vga) |
4687 | 4624 |
vga_interface_type = VGA_CIRRUS; |
4688 | 4625 |
|
Also available in: Unified diff