Revision 3290c4aa 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 |
|
|
96 | 100 |
#ifdef _WIN32 |
97 | 101 |
#include <windows.h> |
98 | 102 |
#endif |
... | ... | |
3733 | 3737 |
return popt; |
3734 | 3738 |
} |
3735 | 3739 |
|
3740 |
static void qmp_add_default(void) |
|
3741 |
{ |
|
3742 |
char buffer[4096]; |
|
3743 |
const char *home; |
|
3744 |
static uint8_t null_uuid[16]; |
|
3745 |
uint8_t uuid[16]; |
|
3746 |
|
|
3747 |
home = getenv("HOME"); |
|
3748 |
if (!home) { |
|
3749 |
return; |
|
3750 |
} |
|
3751 |
|
|
3752 |
if (memcmp(qemu_uuid, null_uuid, sizeof(null_uuid)) == 0) { |
|
3753 |
#if defined(CONFIG_UUID) |
|
3754 |
uuid_generate(uuid); |
|
3755 |
#else |
|
3756 |
return; |
|
3757 |
#endif |
|
3758 |
} else { |
|
3759 |
memcpy(uuid, qemu_uuid, sizeof(qemu_uuid)); |
|
3760 |
} |
|
3761 |
|
|
3762 |
snprintf(buffer, sizeof(buffer), "%s/.qemu", home); |
|
3763 |
if (mkdir(buffer, 0755) == -1 && errno != EEXIST) { |
|
3764 |
fprintf(stderr, "could not open default QMP port\n"); |
|
3765 |
return; |
|
3766 |
} |
|
3767 |
|
|
3768 |
snprintf(buffer, sizeof(buffer), "%s/.qemu/qmp", home); |
|
3769 |
if (mkdir(buffer, 0755) == -1 && errno != EEXIST) { |
|
3770 |
fprintf(stderr, "could not open default QMP port\n"); |
|
3771 |
return; |
|
3772 |
} |
|
3773 |
|
|
3774 |
snprintf(buffer, sizeof(buffer), |
|
3775 |
"unix:%s/.qemu/qmp/" UUID_FMT ".sock,server,nowait", |
|
3776 |
home, |
|
3777 |
uuid[0], uuid[1], uuid[2], uuid[3], |
|
3778 |
uuid[4], uuid[5], uuid[6], uuid[7], |
|
3779 |
uuid[8], uuid[9], uuid[10], uuid[11], |
|
3780 |
uuid[12], uuid[13], uuid[14], uuid[15]); |
|
3781 |
|
|
3782 |
monitor_parse(buffer, "control"); |
|
3783 |
} |
|
3784 |
|
|
3736 | 3785 |
int main(int argc, char **argv, char **envp) |
3737 | 3786 |
{ |
3738 | 3787 |
const char *gdbstub_dev = NULL; |
... | ... | |
4659 | 4708 |
if (default_virtcon) |
4660 | 4709 |
add_device_config(DEV_VIRTCON, "vc:80Cx24C"); |
4661 | 4710 |
} |
4711 |
if (default_qmp) { |
|
4712 |
qmp_add_default(); |
|
4713 |
} |
|
4662 | 4714 |
if (default_vga) |
4663 | 4715 |
vga_interface_type = VGA_CIRRUS; |
4664 | 4716 |
|
Also available in: Unified diff