mirror of
https://github.com/darlinghq/darling-libkqueue.git
synced 2024-11-23 03:39:51 +00:00
Fixes for launchd
This commit is contained in:
parent
284c5896a6
commit
3605093fd5
@ -377,14 +377,20 @@ kevent64_impl(int kqfd, const struct kevent64_s *changelist, int nchanges,
|
||||
if (nevents > MAX_KEVENT)
|
||||
nevents = MAX_KEVENT;
|
||||
if (nevents > 0) {
|
||||
rv = kqops.kevent_wait(kq, nevents, (flags & KEVENT_FLAG_IMMEDIATE) ? (&timeout_zero) : timeout);
|
||||
const struct timespec* ts = (flags & KEVENT_FLAG_IMMEDIATE) ? (&timeout_zero) : timeout;
|
||||
again:
|
||||
rv = kqops.kevent_wait(kq, nevents, ts);
|
||||
dbg_printf("kqops.kevent_wait returned %d", rv);
|
||||
if (fastpath(rv > 0)) {
|
||||
kqueue_lock(kq);
|
||||
rv = kqops.kevent_copyout(kq, rv, eventlist, nevents);
|
||||
kqueue_unlock(kq);
|
||||
} else if (rv == 0) {
|
||||
}
|
||||
if (rv == 0) {
|
||||
/* Timeout reached */
|
||||
/* Avoid returning 0 when waiting indefinitely in case of spurious wakeups */
|
||||
if (ts == NULL)
|
||||
goto again;
|
||||
} else {
|
||||
dbg_printf("(%u) kevent_wait failed", myid);
|
||||
goto out;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include "api.h"
|
||||
|
||||
#include "private.h"
|
||||
@ -37,11 +38,14 @@ int
|
||||
evfilt_machport_copyout(struct kevent64_s *dst, struct knote *src, void *ptr)
|
||||
{
|
||||
struct epoll_event * const ev = (struct epoll_event *) ptr;
|
||||
uint64_t val;
|
||||
|
||||
epoll_event_dump(ev);
|
||||
kevent_int_to_64(&src->kev, dst);
|
||||
dst->data = 1024; // TODO: dummy value (message size)
|
||||
|
||||
read(src->kn_epollfd, &val, sizeof(val));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user