mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 01:43:23 +00:00
Make RPC call dispatch threaded
This commit is contained in:
parent
458a673cb7
commit
61674cc17d
@ -1,3 +1,12 @@
|
|||||||
|
Tue Jan 20 16:36:53 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
Make RPC call dispatch threaded
|
||||||
|
* src/libvirt_private.syms, src/util.h, src/util.c: Add
|
||||||
|
a general virSetNonBlock() helper with portability to
|
||||||
|
Win32
|
||||||
|
* src/remote_internal.c: Re-factor I/O to allow RPC calls
|
||||||
|
from multiple threads to be handled concurrently.
|
||||||
|
|
||||||
Tue Jan 20 17:08:20 CET 2009 Daniel Veillard <veillard@redhat.com>
|
Tue Jan 20 17:08:20 CET 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
* src/domain_conf.h src/lxc_driver.c src/uml_driver.c: virDomainObj
|
* src/domain_conf.h src/lxc_driver.c src/uml_driver.c: virDomainObj
|
||||||
|
@ -290,6 +290,7 @@ virEnumToString;
|
|||||||
virEventAddHandle;
|
virEventAddHandle;
|
||||||
virEventRemoveHandle;
|
virEventRemoveHandle;
|
||||||
virExec;
|
virExec;
|
||||||
|
virSetNonBlock;
|
||||||
virFormatMacAddr;
|
virFormatMacAddr;
|
||||||
virGetHostname;
|
virGetHostname;
|
||||||
virParseMacAddr;
|
virParseMacAddr;
|
||||||
|
File diff suppressed because it is too large
Load Diff
33
src/util.c
33
src/util.c
@ -34,6 +34,7 @@
|
|||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#if HAVE_SYS_WAIT_H
|
#if HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#endif
|
#endif
|
||||||
@ -155,8 +156,28 @@ virArgvToString(const char *const *argv)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int virSetNonBlock(int fd) {
|
||||||
|
#ifndef WIN32
|
||||||
|
int flags;
|
||||||
|
if ((flags = fcntl(fd, F_GETFL)) < 0)
|
||||||
|
return -1;
|
||||||
|
flags |= O_NONBLOCK;
|
||||||
|
if ((fcntl(fd, F_SETFL, flags)) < 0)
|
||||||
|
return -1;
|
||||||
|
#else
|
||||||
|
unsigned long flag = 1;
|
||||||
|
|
||||||
#ifndef __MINGW32__
|
/* This is actually Gnulib's replacement rpl_ioctl function.
|
||||||
|
* We can't call ioctlsocket directly in any case.
|
||||||
|
*/
|
||||||
|
if (ioctl (fd, FIONBIO, (void *) &flag) == -1)
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
|
|
||||||
static int virSetCloseExec(int fd) {
|
static int virSetCloseExec(int fd) {
|
||||||
int flags;
|
int flags;
|
||||||
@ -168,16 +189,6 @@ static int virSetCloseExec(int fd) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virSetNonBlock(int fd) {
|
|
||||||
int flags;
|
|
||||||
if ((flags = fcntl(fd, F_GETFL)) < 0)
|
|
||||||
return -1;
|
|
||||||
flags |= O_NONBLOCK;
|
|
||||||
if ((fcntl(fd, F_SETFL, flags)) < 0)
|
|
||||||
return -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
__virExec(virConnectPtr conn,
|
__virExec(virConnectPtr conn,
|
||||||
const char *const*argv,
|
const char *const*argv,
|
||||||
|
@ -38,6 +38,8 @@ enum {
|
|||||||
VIR_EXEC_DAEMON = (1 << 1),
|
VIR_EXEC_DAEMON = (1 << 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int virSetNonBlock(int fd);
|
||||||
|
|
||||||
int virExec(virConnectPtr conn,
|
int virExec(virConnectPtr conn,
|
||||||
const char *const*argv,
|
const char *const*argv,
|
||||||
const char *const*envp,
|
const char *const*envp,
|
||||||
|
Loading…
Reference in New Issue
Block a user