CLEANFILES =
DAEMON_SOURCES = \
- event.c event.h \
libvirtd.c libvirtd.h \
remote.c remote.h \
dispatch.c dispatch.h \
#include "remote_driver.h"
#include "conf.h"
#include "event.h"
-#include "src/util/event.h"
+#include "event_poll.h"
#include "memory.h"
#include "stream.h"
#include "hooks.h"
return NULL;
}
- if (virEventInit() < 0) {
+ if (virEventPollInit() < 0) {
VIR_ERROR0(_("Failed to initialize event system"));
virMutexDestroy(&server->lock);
if (virCondDestroy(&server->job) < 0)
# endif
#endif
- virEventRegisterImpl(virEventAddHandleImpl,
- virEventUpdateHandleImpl,
- virEventRemoveHandleImpl,
- virEventAddTimeoutImpl,
- virEventUpdateTimeoutImpl,
- virEventRemoveTimeoutImpl);
+ virEventRegisterImpl(virEventPollAddHandle,
+ virEventPollUpdateHandle,
+ virEventPollRemoveHandle,
+ virEventPollAddTimeout,
+ virEventPollUpdateTimeout,
+ virEventPollRemoveTimeout);
return server;
}
static int qemudOneLoop(void) {
sig_atomic_t errors;
- if (virEventRunOnce() < 0)
+ if (virEventPollRunOnce() < 0)
return -1;
/* Check for any signal handling errors and log them. */
#include "libvirtd.h"
#include "mdns.h"
#include "event.h"
-#include "src/util/event.h"
+#include "event_poll.h"
#include "memory.h"
#define AVAHI_DEBUG(fmt, ...) VIR_DEBUG(fmt, __VA_ARGS__)
static void libvirtd_mdns_watch_dispatch(int watch, int fd, int events, void *opaque)
{
AvahiWatch *w = (AvahiWatch*)opaque;
- int fd_events = virEventHandleTypeToPollEvent(events);
+ int fd_events = virEventPollToNativeEvents(events);
AVAHI_DEBUG("Dispatch watch %d FD %d Event %d", watch, fd, fd_events);
w->revents = fd_events;
w->callback(w, fd, fd_events, w->userdata);
w->userdata = userdata;
AVAHI_DEBUG("New handle %p FD %d Event %d", w, w->fd, event);
- hEvents = virPollEventToEventHandleType(event);
+ hEvents = virEventPollFromNativeEvents(event);
if ((w->watch = virEventAddHandle(fd, hEvents,
libvirtd_mdns_watch_dispatch,
w,
util/conf.c util/conf.h \
util/cgroup.c util/cgroup.h \
util/event.c util/event.h \
+ util/event_poll.c util/event_poll.h \
util/files.c util/files.h \
util/hash.c util/hash.h \
util/hooks.c util/hooks.h \
virEventUpdateTimeout;
+# event_poll.h
+virEventPollToNativeEvents;
+virEventPollFromNativeEvents;
+virEventPollRunOnce;
+virEventPollInit;
+virEventPollRemoveTimeout;
+virEventPollUpdateTimeout;
+virEventPollAddTimeout;
+virEventPollRemoveHandle;
+virEventPollUpdateHandle;
+virEventPollAddHandle;
+
+
# fdstream.h
virFDStreamOpen;
virFDStreamConnectUNIX;
#include "threads.h"
#include "logging.h"
-#include "event.h"
+#include "event_poll.h"
#include "memory.h"
#include "util.h"
#include "ignore-value.h"
#define EVENT_DEBUG(fmt, ...) VIR_DEBUG(fmt, __VA_ARGS__)
-static int virEventInterruptLocked(void);
+static int virEventPollInterruptLocked(void);
/* State for a single file handle being monitored */
-struct virEventHandle {
+struct virEventPollHandle {
int watch;
int fd;
int events;
};
/* State for a single timer being generated */
-struct virEventTimeout {
+struct virEventPollTimeout {
int timer;
int frequency;
unsigned long long expiresAt;
int deleted;
};
-/* Allocate extra slots for virEventHandle/virEventTimeout
+/* Allocate extra slots for virEventPollHandle/virEventPollTimeout
records in this multiple */
#define EVENT_ALLOC_EXTENT 10
/* State for the main event loop */
-struct virEventLoop {
+struct virEventPollLoop {
virMutex lock;
int running;
virThread leader;
int wakeupfd[2];
size_t handlesCount;
size_t handlesAlloc;
- struct virEventHandle *handles;
+ struct virEventPollHandle *handles;
size_t timeoutsCount;
size_t timeoutsAlloc;
- struct virEventTimeout *timeouts;
+ struct virEventPollTimeout *timeouts;
};
/* Only have one event loop */
-static struct virEventLoop eventLoop;
+static struct virEventPollLoop eventLoop;
/* Unique ID for the next FD watch to be registered */
static int nextWatch = 1;
* NB, it *must* be safe to call this from within a callback
* For this reason we only ever append to existing list.
*/
-int virEventAddHandleImpl(int fd, int events,
+int virEventPollAddHandle(int fd, int events,
virEventHandleCallback cb,
void *opaque,
virFreeCallback ff) {
eventLoop.handles[eventLoop.handlesCount].watch = watch;
eventLoop.handles[eventLoop.handlesCount].fd = fd;
eventLoop.handles[eventLoop.handlesCount].events =
- virEventHandleTypeToPollEvent(events);
+ virEventPollToNativeEvents(events);
eventLoop.handles[eventLoop.handlesCount].cb = cb;
eventLoop.handles[eventLoop.handlesCount].ff = ff;
eventLoop.handles[eventLoop.handlesCount].opaque = opaque;
eventLoop.handlesCount++;
- virEventInterruptLocked();
+ virEventPollInterruptLocked();
virMutexUnlock(&eventLoop.lock);
return watch;
}
-void virEventUpdateHandleImpl(int watch, int events) {
+void virEventPollUpdateHandle(int watch, int events) {
int i;
EVENT_DEBUG("Update handle w=%d e=%d", watch, events);
for (i = 0 ; i < eventLoop.handlesCount ; i++) {
if (eventLoop.handles[i].watch == watch) {
eventLoop.handles[i].events =
- virEventHandleTypeToPollEvent(events);
- virEventInterruptLocked();
+ virEventPollToNativeEvents(events);
+ virEventPollInterruptLocked();
break;
}
}
* For this reason we only ever set a flag in the existing list.
* Actual deletion will be done out-of-band
*/
-int virEventRemoveHandleImpl(int watch) {
+int virEventPollRemoveHandle(int watch) {
int i;
EVENT_DEBUG("Remove handle w=%d", watch);
if (eventLoop.handles[i].watch == watch) {
EVENT_DEBUG("mark delete %d %d", i, eventLoop.handles[i].fd);
eventLoop.handles[i].deleted = 1;
- virEventInterruptLocked();
+ virEventPollInterruptLocked();
virMutexUnlock(&eventLoop.lock);
return 0;
}
* NB, it *must* be safe to call this from within a callback
* For this reason we only ever append to existing list.
*/
-int virEventAddTimeoutImpl(int frequency,
+int virEventPollAddTimeout(int frequency,
virEventTimeoutCallback cb,
void *opaque,
virFreeCallback ff) {
eventLoop.timeoutsCount++;
ret = nextTimer-1;
- virEventInterruptLocked();
+ virEventPollInterruptLocked();
virMutexUnlock(&eventLoop.lock);
return ret;
}
-void virEventUpdateTimeoutImpl(int timer, int frequency) {
+void virEventPollUpdateTimeout(int timer, int frequency) {
struct timeval tv;
int i;
EVENT_DEBUG("Updating timer %d timeout with %d ms freq", timer, frequency);
frequency >= 0 ? frequency +
(((unsigned long long)tv.tv_sec)*1000) +
(((unsigned long long)tv.tv_usec)/1000) : 0;
- virEventInterruptLocked();
+ virEventPollInterruptLocked();
break;
}
}
* For this reason we only ever set a flag in the existing list.
* Actual deletion will be done out-of-band
*/
-int virEventRemoveTimeoutImpl(int timer) {
+int virEventPollRemoveTimeout(int timer) {
int i;
EVENT_DEBUG("Remove timer %d", timer);
if (eventLoop.timeouts[i].timer == timer) {
eventLoop.timeouts[i].deleted = 1;
- virEventInterruptLocked();
+ virEventPollInterruptLocked();
virMutexUnlock(&eventLoop.lock);
return 0;
}
* no timeout is pending
* returns: 0 on success, -1 on error
*/
-static int virEventCalculateTimeout(int *timeout) {
+static int virEventPollCalculateTimeout(int *timeout) {
unsigned long long then = 0;
int i;
EVENT_DEBUG("Calculate expiry of %zu timers", eventLoop.timeoutsCount);
* file handles. The caller must free the returned data struct
* returns: the pollfd array, or NULL on error
*/
-static struct pollfd *virEventMakePollFDs(int *nfds) {
+static struct pollfd *virEventPollMakePollFDs(int *nfds) {
struct pollfd *fds;
int i;
*
* Returns 0 upon success, -1 if an error occurred
*/
-static int virEventDispatchTimeouts(void) {
+static int virEventPollDispatchTimeouts(void) {
struct timeval tv;
unsigned long long now;
int i;
*
* Returns 0 upon success, -1 if an error occurred
*/
-static int virEventDispatchHandles(int nfds, struct pollfd *fds) {
+static int virEventPollDispatchHandles(int nfds, struct pollfd *fds) {
int i, n;
VIR_DEBUG("Dispatch %d", nfds);
virEventHandleCallback cb = eventLoop.handles[i].cb;
int watch = eventLoop.handles[i].watch;
void *opaque = eventLoop.handles[i].opaque;
- int hEvents = virPollEventToEventHandleType(fds[n].revents);
+ int hEvents = virEventPollFromNativeEvents(fds[n].revents);
EVENT_DEBUG("Dispatch n=%d f=%d w=%d e=%d %p", i,
fds[n].fd, watch, fds[n].revents, opaque);
virMutexUnlock(&eventLoop.lock);
* were previously marked as deleted. This asynchronous
* cleanup is needed to make dispatch re-entrant safe.
*/
-static int virEventCleanupTimeouts(void) {
+static void virEventPollCleanupTimeouts(void) {
int i;
size_t gap;
VIR_DEBUG("Cleanup %zu", eventLoop.timeoutsCount);
if ((i+1) < eventLoop.timeoutsCount) {
memmove(eventLoop.timeouts+i,
eventLoop.timeouts+i+1,
- sizeof(struct virEventTimeout)*(eventLoop.timeoutsCount
+ sizeof(struct virEventPollTimeout)*(eventLoop.timeoutsCount
-(i+1)));
}
eventLoop.timeoutsCount--;
eventLoop.timeoutsCount, eventLoop.timeoutsAlloc, gap);
VIR_SHRINK_N(eventLoop.timeouts, eventLoop.timeoutsAlloc, gap);
}
- return 0;
}
/* Used post dispatch to actually remove any handles that
* were previously marked as deleted. This asynchronous
* cleanup is needed to make dispatch re-entrant safe.
*/
-static int virEventCleanupHandles(void) {
+static void virEventPollCleanupHandles(void) {
int i;
size_t gap;
VIR_DEBUG("Cleanup %zu", eventLoop.handlesCount);
if ((i+1) < eventLoop.handlesCount) {
memmove(eventLoop.handles+i,
eventLoop.handles+i+1,
- sizeof(struct virEventHandle)*(eventLoop.handlesCount
+ sizeof(struct virEventPollHandle)*(eventLoop.handlesCount
-(i+1)));
}
eventLoop.handlesCount--;
eventLoop.handlesCount, eventLoop.handlesAlloc, gap);
VIR_SHRINK_N(eventLoop.handles, eventLoop.handlesAlloc, gap);
}
- return 0;
}
/*
* Run a single iteration of the event loop, blocking until
* at least one file handle has an event, or a timer expires
*/
-int virEventRunOnce(void) {
+int virEventPollRunOnce(void) {
struct pollfd *fds = NULL;
int ret, timeout, nfds;
eventLoop.running = 1;
virThreadSelf(&eventLoop.leader);
- if (virEventCleanupTimeouts() < 0 ||
- virEventCleanupHandles() < 0)
- goto error;
+ virEventPollCleanupTimeouts();
+ virEventPollCleanupHandles();
- if (!(fds = virEventMakePollFDs(&nfds)) ||
- virEventCalculateTimeout(&timeout) < 0)
+ if (!(fds = virEventPollMakePollFDs(&nfds)) ||
+ virEventPollCalculateTimeout(&timeout) < 0)
goto error;
virMutexUnlock(&eventLoop.lock);
EVENT_DEBUG("Poll got %d event(s)", ret);
virMutexLock(&eventLoop.lock);
- if (virEventDispatchTimeouts() < 0)
+ if (virEventPollDispatchTimeouts() < 0)
goto error;
if (ret > 0 &&
- virEventDispatchHandles(nfds, fds) < 0)
+ virEventPollDispatchHandles(nfds, fds) < 0)
goto error;
- if (virEventCleanupTimeouts() < 0 ||
- virEventCleanupHandles() < 0)
- goto error;
+ virEventPollCleanupTimeouts();
+ virEventPollCleanupHandles();
eventLoop.running = 0;
virMutexUnlock(&eventLoop.lock);
}
-static void virEventHandleWakeup(int watch ATTRIBUTE_UNUSED,
- int fd,
- int events ATTRIBUTE_UNUSED,
- void *opaque ATTRIBUTE_UNUSED)
+static void virEventPollHandleWakeup(int watch ATTRIBUTE_UNUSED,
+ int fd,
+ int events ATTRIBUTE_UNUSED,
+ void *opaque ATTRIBUTE_UNUSED)
{
char c;
virMutexLock(&eventLoop.lock);
virMutexUnlock(&eventLoop.lock);
}
-int virEventInit(void)
+int virEventPollInit(void)
{
- if (virMutexInit(&eventLoop.lock) < 0)
+ if (virMutexInit(&eventLoop.lock) < 0) {
return -1;
+ }
if (pipe(eventLoop.wakeupfd) < 0 ||
virSetNonBlock(eventLoop.wakeupfd[0]) < 0 ||
virSetNonBlock(eventLoop.wakeupfd[1]) < 0 ||
virSetCloseExec(eventLoop.wakeupfd[0]) < 0 ||
- virSetCloseExec(eventLoop.wakeupfd[1]) < 0)
+ virSetCloseExec(eventLoop.wakeupfd[1]) < 0) {
return -1;
+ }
- if (virEventAddHandleImpl(eventLoop.wakeupfd[0],
+ if (virEventPollAddHandle(eventLoop.wakeupfd[0],
VIR_EVENT_HANDLE_READABLE,
- virEventHandleWakeup, NULL, NULL) < 0)
+ virEventPollHandleWakeup, NULL, NULL) < 0) {
return -1;
+ }
return 0;
}
-static int virEventInterruptLocked(void)
+static int virEventPollInterruptLocked(void)
{
char c = '\0';
return 0;
}
-int virEventInterrupt(void)
+int virEventPollInterrupt(void)
{
int ret;
virMutexLock(&eventLoop.lock);
- ret = virEventInterruptLocked();
+ ret = virEventPollInterruptLocked();
virMutexUnlock(&eventLoop.lock);
return ret;
}
int
-virEventHandleTypeToPollEvent(int events)
+virEventPollToNativeEvents(int events)
{
int ret = 0;
if(events & VIR_EVENT_HANDLE_READABLE)
}
int
-virPollEventToEventHandleType(int events)
+virEventPollFromNativeEvents(int events)
{
int ret = 0;
if(events & POLLIN)
* Author: Daniel P. Berrange <berrange@redhat.com>
*/
-#ifndef __VIRTD_EVENT_H__
-# define __VIRTD_EVENT_H__
+#ifndef __VIR_EVENT_POLL_H__
+# define __VIR_EVENT_POLL_H__
# include "internal.h"
/**
- * virEventAddHandleImpl: register a callback for monitoring file handle events
+ * virEventPollAddHandle: register a callback for monitoring file handle events
*
* @fd: file handle to monitor for events
* @events: bitset of events to watch from POLLnnn constants
*
* returns -1 if the file handle cannot be registered, 0 upon success
*/
-int virEventAddHandleImpl(int fd, int events,
- virEventHandleCallback cb,
- void *opaque,
- virFreeCallback ff);
+int virEventPollAddHandle(int fd, int events,
+ virEventHandleCallback cb,
+ void *opaque,
+ virFreeCallback ff);
/**
- * virEventUpdateHandleImpl: change event set for a monitored file handle
+ * virEventPollUpdateHandle: change event set for a monitored file handle
*
* @watch: watch whose handle to update
* @events: bitset of events to watch from POLLnnn constants
*
* Will not fail if fd exists
*/
-void virEventUpdateHandleImpl(int watch, int events);
+void virEventPollUpdateHandle(int watch, int events);
/**
- * virEventRemoveHandleImpl: unregister a callback from a file handle
+ * virEventPollRemoveHandle: unregister a callback from a file handle
*
* @watch: watch whose handle to remove
*
* returns -1 if the file handle was not registered, 0 upon success
*/
-int virEventRemoveHandleImpl(int watch);
+int virEventPollRemoveHandle(int watch);
/**
- * virEventAddTimeoutImpl: register a callback for a timer event
+ * virEventPollAddTimeout: register a callback for a timer event
*
* @frequency: time between events in milliseconds
* @cb: callback to invoke when an event occurs
* returns -1 if the file handle cannot be registered, a positive
* integer timer id upon success
*/
-int virEventAddTimeoutImpl(int frequency,
- virEventTimeoutCallback cb,
- void *opaque,
- virFreeCallback ff);
+int virEventPollAddTimeout(int frequency,
+ virEventTimeoutCallback cb,
+ void *opaque,
+ virFreeCallback ff);
/**
- * virEventUpdateTimeoutImpl: change frequency for a timer
+ * virEventPollUpdateTimeout: change frequency for a timer
*
* @timer: timer id to change
* @frequency: time between events in milliseconds
*
* Will not fail if timer exists
*/
-void virEventUpdateTimeoutImpl(int timer, int frequency);
+void virEventPollUpdateTimeout(int timer, int frequency);
/**
- * virEventRemoveTimeoutImpl: unregister a callback for a timer
+ * virEventPollRemoveTimeout: unregister a callback for a timer
*
* @timer: the timer id to remove
*
* returns -1 if the timer was not registered, 0 upon success
*/
-int virEventRemoveTimeoutImpl(int timer);
+int virEventPollRemoveTimeout(int timer);
/**
- * virEventInit: Initialize the event loop
+ * virEventPollInit: Initialize the event loop
*
* returns -1 if initialization failed
*/
-int virEventInit(void);
+int virEventPollInit(void);
/**
- * virEventRunOnce: run a single iteration of the event loop.
+ * virEventPollRunOnce: run a single iteration of the event loop.
*
* Blocks the caller until at least one file handle has an
* event or the first timer expires.
*
* returns -1 if the event monitoring failed
*/
-int virEventRunOnce(void);
+int virEventPollRunOnce(void);
-int
-virEventHandleTypeToPollEvent(int events);
-int
-virPollEventToEventHandleType(int events);
+int virEventPollFromNativeEvents(int events);
+int virEventPollToNativeEvents(int events);
/**
- * virEventInterrupt: wakeup any thread waiting in poll()
+ * virEventPollInterrupt: wakeup any thread waiting in poll()
*
* return -1 if wakup failed
*/
-int virEventInterrupt(void);
+int virEventPollInterrupt(void);
#endif /* __VIRTD_EVENT_H__ */
if WITH_LIBVIRTD
eventtest_SOURCES = \
- eventtest.c testutils.h testutils.c ../daemon/event.c
+ eventtest.c testutils.h testutils.c
eventtest_LDADD = -lrt $(LDADDS)
endif
#include "threads.h"
#include "logging.h"
#include "util.h"
-#include "../daemon/event.h"
+#include "event.h"
+#include "event_poll.h"
#define NUM_FDS 31
#define NUM_TIME 31
info->error = EV_ERROR_NONE;
if (info->delete != -1)
- virEventRemoveHandleImpl(info->delete);
+ virEventPollRemoveHandle(info->delete);
}
info->error = EV_ERROR_NONE;
if (info->delete != -1)
- virEventRemoveTimeoutImpl(info->delete);
+ virEventPollRemoveTimeout(info->delete);
}
static pthread_mutex_t eventThreadMutex = PTHREAD_MUTEX_INITIALIZER;
eventThreadRunOnce = 0;
pthread_mutex_unlock(&eventThreadMutex);
- virEventRunOnce();
+ virEventPollRunOnce();
pthread_mutex_lock(&eventThreadMutex);
eventThreadJobDone = 1;
return EXIT_FAILURE;
}
- virEventInit();
+ virEventPollInit();
for (i = 0 ; i < NUM_FDS ; i++) {
handles[i].delete = -1;
handles[i].watch =
- virEventAddHandleImpl(handles[i].pipeFD[0],
+ virEventPollAddHandle(handles[i].pipeFD[0],
VIR_EVENT_HANDLE_READABLE,
testPipeReader,
&handles[i], NULL);
timers[i].delete = -1;
timers[i].timeout = -1;
timers[i].timer =
- virEventAddTimeoutImpl(timers[i].timeout,
+ virEventPollAddTimeout(timers[i].timeout,
testTimer,
&timers[i], NULL);
}
/* Now lets delete one before starting poll(), and
* try triggering another handle */
- virEventRemoveHandleImpl(handles[0].watch);
+ virEventPollRemoveHandle(handles[0].watch);
startJob();
if (safewrite(handles[1].pipeFD[1], &one, 1) != 1)
return EXIT_FAILURE;
/* NB: this case is subject to a bit of a race condition.
* We yield & sleep, and pray that the other thread gets
- * scheduled before we run EventRemoveHandleImpl */
+ * scheduled before we run EventRemoveHandle */
startJob();
pthread_mutex_unlock(&eventThreadMutex);
sched_yield();
usleep(100 * 1000);
pthread_mutex_lock(&eventThreadMutex);
- virEventRemoveHandleImpl(handles[1].watch);
+ virEventPollRemoveHandle(handles[1].watch);
if (finishJob("Interrupted during poll", -1, -1) != EXIT_SUCCESS)
return EXIT_FAILURE;
/* Run a timer on its own */
- virEventUpdateTimeoutImpl(timers[1].timer, 100);
+ virEventPollUpdateTimeout(timers[1].timer, 100);
startJob();
if (finishJob("Firing a timer", -1, 1) != EXIT_SUCCESS)
return EXIT_FAILURE;
- virEventUpdateTimeoutImpl(timers[1].timer, -1);
+ virEventPollUpdateTimeout(timers[1].timer, -1);
resetAll();
/* Now lets delete one before starting poll(), and
* try triggering another timer */
- virEventUpdateTimeoutImpl(timers[1].timer, 100);
- virEventRemoveTimeoutImpl(timers[0].timer);
+ virEventPollUpdateTimeout(timers[1].timer, 100);
+ virEventPollRemoveTimeout(timers[0].timer);
startJob();
if (finishJob("Deleted before poll", -1, 1) != EXIT_SUCCESS)
return EXIT_FAILURE;
- virEventUpdateTimeoutImpl(timers[1].timer, -1);
+ virEventPollUpdateTimeout(timers[1].timer, -1);
resetAll();
/* NB: this case is subject to a bit of a race condition.
* We yield & sleep, and pray that the other thread gets
- * scheduled before we run EventRemoveTimeoutImpl */
+ * scheduled before we run EventRemoveTimeout */
startJob();
pthread_mutex_unlock(&eventThreadMutex);
sched_yield();
usleep(100 * 1000);
pthread_mutex_lock(&eventThreadMutex);
- virEventRemoveTimeoutImpl(timers[1].timer);
+ virEventPollRemoveTimeout(timers[1].timer);
if (finishJob("Interrupted during poll", -1, -1) != EXIT_SUCCESS)
return EXIT_FAILURE;
* before poll() exits for the first safewrite(). We don't
* see a hard failure in other cases, so nothing to worry
* about */
- virEventUpdateTimeoutImpl(timers[2].timer, 100);
- virEventUpdateTimeoutImpl(timers[3].timer, 100);
+ virEventPollUpdateTimeout(timers[2].timer, 100);
+ virEventPollUpdateTimeout(timers[3].timer, 100);
startJob();
timers[2].delete = timers[3].timer;
if (finishJob("Deleted during dispatch", -1, 2) != EXIT_SUCCESS)
return EXIT_FAILURE;
- virEventUpdateTimeoutImpl(timers[2].timer, -1);
+ virEventPollUpdateTimeout(timers[2].timer, -1);
resetAll();
/* Extreme fun, lets delete ourselves during dispatch */
- virEventUpdateTimeoutImpl(timers[2].timer, 100);
+ virEventPollUpdateTimeout(timers[2].timer, 100);
startJob();
timers[2].delete = timers[2].timer;
if (finishJob("Deleted during dispatch", -1, 2) != EXIT_SUCCESS)
return EXIT_FAILURE;
for (i = 0 ; i < NUM_FDS - 1 ; i++)
- virEventRemoveHandleImpl(handles[i].watch);
+ virEventPollRemoveHandle(handles[i].watch);
for (i = 0 ; i < NUM_TIME - 1 ; i++)
- virEventRemoveTimeoutImpl(timers[i].timer);
+ virEventPollRemoveTimeout(timers[i].timer);
resetAll();
handles[0].pipeFD[0] = handles[1].pipeFD[0];
handles[0].pipeFD[1] = handles[1].pipeFD[1];
- handles[0].watch = virEventAddHandleImpl(handles[0].pipeFD[0],
+ handles[0].watch = virEventPollAddHandle(handles[0].pipeFD[0],
0,
testPipeReader,
&handles[0], NULL);
- handles[1].watch = virEventAddHandleImpl(handles[1].pipeFD[0],
+ handles[1].watch = virEventPollAddHandle(handles[1].pipeFD[0],
VIR_EVENT_HANDLE_READABLE,
testPipeReader,
&handles[1], NULL);
virsh_SOURCES = \
console.c console.h \
- ../daemon/event.c ../daemon/event.h \
virsh.c
virsh_LDFLAGS = $(WARN_LDFLAGS) $(COVERAGE_LDFLAGS)
# include "memory.h"
# include "virterror_internal.h"
-# include "daemon/event.h"
-# include "src/util/event.h"
+# include "event.h"
+# include "event_poll.h"
/* ie Ctrl-] as per telnet */
# define CTRL_CLOSE_BRACKET '\35'
NULL);
while (!con->quit) {
- if (virEventRunOnce() < 0)
+ if (virEventPollRunOnce() < 0)
break;
}
#include "xml.h"
#include "libvirt/libvirt-qemu.h"
#include "files.h"
-#include "../daemon/event.h"
+#include "event_poll.h"
#include "configmake.h"
#include "threads.h"
#include "command.h"
/* set up the signals handlers to catch disconnections */
vshSetupSignals();
- virEventRegisterImpl(virEventAddHandleImpl,
- virEventUpdateHandleImpl,
- virEventRemoveHandleImpl,
- virEventAddTimeoutImpl,
- virEventUpdateTimeoutImpl,
- virEventRemoveTimeoutImpl);
- virEventInit();
+ virEventRegisterImpl(virEventPollAddHandle,
+ virEventPollUpdateHandle,
+ virEventPollRemoveHandle,
+ virEventPollAddTimeout,
+ virEventPollUpdateTimeout,
+ virEventPollRemoveTimeout);
+ virEventPollInit();
ctl->conn = virConnectOpenAuth(ctl->name,
virConnectAuthPtrDefault,