mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
Make RPC call dispatch threaded
This commit is contained in:
1 parent
458a673cb7
commit
61674cc17d
5 files changed
+895
-457
No files matched your search
@@ -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>
|
||||
|
||||
* src/domain_conf.h src/lxc_driver.c src/uml_driver.c: virDomainObj
|
||||
|
||||
@@ -290,6 +290,7 @@ virEnumToString;
|
||||
virEventAddHandle;
|
||||
virEventRemoveHandle;
|
||||
virExec;
|
||||
virSetNonBlock;
|
||||
virFormatMacAddr;
|
||||
virGetHostname;
|
||||
virParseMacAddr;
|
||||
|
||||
+861
-446
File diff suppressed because it is too large.
Load diff
+22
-11
@@ -34,6 +34,7 @@
|
||||
#include <poll.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#if HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
@@ -155,8 +156,28 @@ virArgvToString(const char *const *argv)
|
||||
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) {
|
||||
int flags;
|
||||
@@ -168,16 +189,6 @@ static int virSetCloseExec(int fd) {
|
||||
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
|
||||
__virExec(virConnectPtr conn,
|
||||
const char *const*argv,
|
||||
|
||||
@@ -38,6 +38,8 @@ enum {
|
||||
VIR_EXEC_DAEMON = (1 << 1),
|
||||
};
|
||||
|
||||
int virSetNonBlock(int fd);
|
||||
|
||||
int virExec(virConnectPtr conn,
|
||||
const char *const*argv,
|
||||
const char *const*envp,
|
||||
|
||||
Reference in new issue
Block a user