mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
add _fd to stdin, stderr stdout in struct virDomainObj for compilation on MinGW
This commit is contained in:
parent
43c7f972aa
commit
413c5dbf07
@ -1,3 +1,8 @@
|
|||||||
|
Tue Aug 12 17:30:50 JST 2008 Atsushi SAKAI <sakaia@jp.fujitsu.com>
|
||||||
|
|
||||||
|
* src/domain_conf.h src/qemu_driver.c: name changing of
|
||||||
|
stdin, stdout, stderr to add _fd for compilation on MinGW
|
||||||
|
|
||||||
Tue Aug 12 17:20:36 JST 2008 Atsushi SAKAI <sakaia@jp.fujitsu.com>
|
Tue Aug 12 17:20:36 JST 2008 Atsushi SAKAI <sakaia@jp.fujitsu.com>
|
||||||
|
|
||||||
* src/domain.conf.c src/network_conf.c src/util.c src/virsh.c
|
* src/domain.conf.c src/network_conf.c src/util.c src/virsh.c
|
||||||
|
@ -444,9 +444,9 @@ struct _virDomainDef {
|
|||||||
typedef struct _virDomainObj virDomainObj;
|
typedef struct _virDomainObj virDomainObj;
|
||||||
typedef virDomainObj *virDomainObjPtr;
|
typedef virDomainObj *virDomainObjPtr;
|
||||||
struct _virDomainObj {
|
struct _virDomainObj {
|
||||||
int stdin;
|
int stdin_fd;
|
||||||
int stdout;
|
int stdout_fd;
|
||||||
int stderr;
|
int stderr_fd;
|
||||||
int monitor;
|
int monitor;
|
||||||
int logfile;
|
int logfile;
|
||||||
int pid;
|
int pid;
|
||||||
|
@ -636,7 +636,7 @@ static int qemudWaitForMonitor(virConnectPtr conn,
|
|||||||
virDomainObjPtr vm) {
|
virDomainObjPtr vm) {
|
||||||
char buf[1024]; /* Plenty of space to get startup greeting */
|
char buf[1024]; /* Plenty of space to get startup greeting */
|
||||||
int ret = qemudReadMonitorOutput(conn,
|
int ret = qemudReadMonitorOutput(conn,
|
||||||
driver, vm, vm->stderr,
|
driver, vm, vm->stderr_fd,
|
||||||
buf, sizeof(buf),
|
buf, sizeof(buf),
|
||||||
qemudFindCharDevicePTYs,
|
qemudFindCharDevicePTYs,
|
||||||
"console");
|
"console");
|
||||||
@ -950,7 +950,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
|||||||
errno, strerror(errno));
|
errno, strerror(errno));
|
||||||
|
|
||||||
ret = virExecNonBlock(conn, argv, &vm->pid,
|
ret = virExecNonBlock(conn, argv, &vm->pid,
|
||||||
vm->stdin, &vm->stdout, &vm->stderr);
|
vm->stdin_fd, &vm->stdout_fd, &vm->stderr_fd);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
vm->def->id = driver->nextvmid++;
|
vm->def->id = driver->nextvmid++;
|
||||||
vm->state = migrateFrom ? VIR_DOMAIN_PAUSED : VIR_DOMAIN_RUNNING;
|
vm->state = migrateFrom ? VIR_DOMAIN_PAUSED : VIR_DOMAIN_RUNNING;
|
||||||
@ -968,11 +968,11 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
if ((virEventAddHandle(vm->stdout,
|
if ((virEventAddHandle(vm->stdout_fd,
|
||||||
POLLIN | POLLERR | POLLHUP,
|
POLLIN | POLLERR | POLLHUP,
|
||||||
qemudDispatchVMEvent,
|
qemudDispatchVMEvent,
|
||||||
driver) < 0) ||
|
driver) < 0) ||
|
||||||
(virEventAddHandle(vm->stderr,
|
(virEventAddHandle(vm->stderr_fd,
|
||||||
POLLIN | POLLERR | POLLHUP,
|
POLLIN | POLLERR | POLLHUP,
|
||||||
qemudDispatchVMEvent,
|
qemudDispatchVMEvent,
|
||||||
driver) < 0) ||
|
driver) < 0) ||
|
||||||
@ -1025,22 +1025,22 @@ static void qemudShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
kill(vm->pid, SIGTERM);
|
kill(vm->pid, SIGTERM);
|
||||||
|
|
||||||
qemudVMData(driver, vm, vm->stdout);
|
qemudVMData(driver, vm, vm->stdout_fd);
|
||||||
qemudVMData(driver, vm, vm->stderr);
|
qemudVMData(driver, vm, vm->stderr_fd);
|
||||||
|
|
||||||
virEventRemoveHandle(vm->stdout);
|
virEventRemoveHandle(vm->stdout_fd);
|
||||||
virEventRemoveHandle(vm->stderr);
|
virEventRemoveHandle(vm->stderr_fd);
|
||||||
|
|
||||||
if (close(vm->logfile) < 0)
|
if (close(vm->logfile) < 0)
|
||||||
qemudLog(QEMUD_WARN, _("Unable to close logfile %d: %s\n"),
|
qemudLog(QEMUD_WARN, _("Unable to close logfile %d: %s\n"),
|
||||||
errno, strerror(errno));
|
errno, strerror(errno));
|
||||||
close(vm->stdout);
|
close(vm->stdout_fd);
|
||||||
close(vm->stderr);
|
close(vm->stderr_fd);
|
||||||
if (vm->monitor != -1)
|
if (vm->monitor != -1)
|
||||||
close(vm->monitor);
|
close(vm->monitor);
|
||||||
vm->logfile = -1;
|
vm->logfile = -1;
|
||||||
vm->stdout = -1;
|
vm->stdout_fd = -1;
|
||||||
vm->stderr = -1;
|
vm->stderr_fd = -1;
|
||||||
vm->monitor = -1;
|
vm->monitor = -1;
|
||||||
|
|
||||||
if (waitpid(vm->pid, NULL, WNOHANG) != vm->pid) {
|
if (waitpid(vm->pid, NULL, WNOHANG) != vm->pid) {
|
||||||
@ -1613,8 +1613,8 @@ static void qemudDispatchVMEvent(int fd, int events, void *opaque) {
|
|||||||
|
|
||||||
while (vm) {
|
while (vm) {
|
||||||
if (virDomainIsActive(vm) &&
|
if (virDomainIsActive(vm) &&
|
||||||
(vm->stdout == fd ||
|
(vm->stdout_fd == fd ||
|
||||||
vm->stderr == fd))
|
vm->stderr_fd == fd))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
vm = vm->next;
|
vm = vm->next;
|
||||||
@ -2754,10 +2754,10 @@ static int qemudDomainRestore(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set the migration source and start it up. */
|
/* Set the migration source and start it up. */
|
||||||
vm->stdin = fd;
|
vm->stdin_fd = fd;
|
||||||
ret = qemudStartVMDaemon(conn, driver, vm, "stdio");
|
ret = qemudStartVMDaemon(conn, driver, vm, "stdio");
|
||||||
close(fd);
|
close(fd);
|
||||||
vm->stdin = -1;
|
vm->stdin_fd = -1;
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||||
"%s", _("failed to start VM"));
|
"%s", _("failed to start VM"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user