29 #include <sys/sysctl.h>
30 #include <sys/types.h>
31 #include <sys/event.h>
45 #define EV_OOBAND EV_FLAG1
52 loop->backend_fd = kqueue();
53 if (
loop->backend_fd == -1)
62 #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
63 static int uv__has_forked_with_cfrunloop;
68 loop->backend_fd = -1;
73 #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
99 EV_SET(&ev,
fd, EVFILT_READ, EV_ADD, 0, 0, 0);
103 EV_SET(&ev,
fd, EVFILT_READ, EV_DELETE, 0, 0, 0);
113 struct kevent events[1024];
116 unsigned int nevents;
117 unsigned int revents;
135 if (
loop->nfds == 0) {
152 if ((
w->events & POLLIN) == 0 && (
w->pevents & POLLIN) != 0) {
159 fflags = NOTE_ATTRIB | NOTE_WRITE | NOTE_RENAME
160 | NOTE_DELETE | NOTE_EXTEND | NOTE_REVOKE;
161 op = EV_ADD | EV_ONESHOT;
164 EV_SET(events + nevents,
w->fd,
filter,
op, fflags, 0, 0);
167 if (kevent(
loop->backend_fd, events, nevents,
NULL, 0,
NULL))
173 if ((
w->events & POLLOUT) == 0 && (
w->pevents & POLLOUT) != 0) {
174 EV_SET(events + nevents,
w->fd, EVFILT_WRITE, EV_ADD, 0, 0, 0);
177 if (kevent(
loop->backend_fd, events, nevents,
NULL, 0,
NULL))
184 EV_SET(events + nevents,
w->fd,
EV_OOBAND, EV_ADD, 0, 0, 0);
187 if (kevent(
loop->backend_fd, events, nevents,
NULL, 0,
NULL))
193 w->events =
w->pevents;
200 sigaddset(pset, SIGPROF);
215 for (;; nevents = 0) {
228 pthread_sigmask(SIG_BLOCK, pset,
NULL);
238 pthread_sigmask(SIG_UNBLOCK, pset,
NULL);
247 if (reset_timeout != 0) {
264 if (reset_timeout != 0) {
283 loop->watchers[
loop->nwatchers] = (
void*) events;
296 struct kevent events[1];
298 EV_SET(events + 0,
fd, ev->filter, EV_DELETE, 0, 0, 0);
306 if (ev->filter == EVFILT_VNODE) {
310 w->cb(
loop,
w, ev->fflags);
317 if (ev->filter == EVFILT_READ) {
318 if (
w->pevents & POLLIN) {
320 w->rcount = ev->data;
323 struct kevent events[1];
324 EV_SET(events + 0,
fd, ev->filter, EV_DELETE, 0, 0, 0);
334 w->rcount = ev->data;
337 struct kevent events[1];
338 EV_SET(events + 0,
fd, ev->filter, EV_DELETE, 0, 0, 0);
345 if (ev->filter == EVFILT_WRITE) {
346 if (
w->pevents & POLLOUT) {
348 w->wcount = ev->data;
351 struct kevent events[1];
352 EV_SET(events + 0,
fd, ev->filter, EV_DELETE, 0, 0, 0);
359 if (ev->flags & EV_ERROR)
371 if (
w == &
loop->signal_io_watcher) {
381 if (reset_timeout != 0) {
386 if (have_signals != 0) {
388 loop->signal_io_watcher.cb(
loop, &
loop->signal_io_watcher, POLLIN);
394 if (have_signals != 0)
415 diff =
loop->time - base;
425 struct kevent* events;
432 events = (
struct kevent*)
loop->watchers[
loop->nwatchers];
439 if ((
int) events[
i].ident ==
fd)
440 events[
i].ident = -1;
449 #if defined(F_GETPATH)
451 char pathbuf[MAXPATHLEN];
456 if (fflags & (NOTE_ATTRIB | NOTE_EXTEND))
462 #if defined(F_GETPATH)
467 if (
fcntl(
handle->event_watcher.fd, F_GETPATH, pathbuf) == 0)
468 path = uv__basename_r(pathbuf);
472 if (
handle->event_watcher.fd == -1)
476 fflags = NOTE_ATTRIB | NOTE_WRITE | NOTE_RENAME
477 | NOTE_DELETE | NOTE_EXTEND | NOTE_REVOKE;
479 EV_SET(&ev,
w->fd, EVFILT_VNODE, EV_ADD | EV_ONESHOT, fflags, 0, 0);
495 unsigned int flags) {
497 #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
517 #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
527 if (!(statbuf.st_mode & S_IFDIR))
534 handle->event_watcher.fd = -1;
564 #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
570 if (
handle->event_watcher.fd != -1) {
573 handle->event_watcher.fd = -1;
static mcore_handle handle
static static fork const void static count static fd const char const char static newpath const char static path const char path
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset fstat
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags fcntl
int uv__fsevents_init(uv_fs_event_t *handle)
int uv__fsevents_close(uv_fs_event_t *handle)
void uv__fs_event_close(uv_fs_event_t *handle)
int uv_fs_event_stop(uv_fs_event_t *handle)
void uv__platform_invalidate_fd(uv_loop_t *loop, int fd)
void uv__io_poll(uv_loop_t *loop, int timeout)
int uv__io_check_fd(uv_loop_t *loop, int fd)
int uv_fs_event_start(uv_fs_event_t *handle, uv_fs_event_cb cb, const char *path, unsigned int flags)
int uv__io_fork(uv_loop_t *loop)
int uv_fs_event_init(uv_loop_t *loop, uv_fs_event_t *handle)
int uv__kqueue_init(uv_loop_t *loop)
static void uv__fs_event(uv_loop_t *loop, uv__io_t *w, unsigned int fflags)
static const char struct stat static buf struct stat static buf static vhangup int struct rusage static rusage struct sysinfo static info unsigned static __unused struct utsname static buf const char static size const char static name static pid unsigned static persona static fsgid const void static flags const struct iovec static count static fd const void static len static munlockall struct sched_param static p static sched_yield static policy const struct timespec struct timespec static rem uid_t uid_t uid_t static suid struct pollfd unsigned nfds
assert(limit<=UINT32_MAX/2)
static bool filter(RzParse *p, ut64 addr, RzFlag *f, RzAnalysisHint *hint, char *data, char *str, int len, bool big_endian)
#define QUEUE_DATA(ptr, type, field)
#define container_of(ptr, type, member)
static struct sockaddr static addrlen static backlog const void static flags void flags
_W64 unsigned int uintptr_t
int uv__close_nocheckstdio(int fd)
void uv__io_start(uv_loop_t *loop, uv__io_t *w, unsigned int events)
void uv__io_close(uv_loop_t *loop, uv__io_t *w)
void uv__io_init(uv__io_t *w, uv__io_cb cb, int fd)
#define SAVE_ERRNO(block)
char * uv__strdup(const char *s)
void uv__metrics_update_idle_time(uv_loop_t *loop)
void uv__metrics_set_provider_entry_time(uv_loop_t *loop)
#define uv__load_relaxed(p)
#define uv__handle_init(loop_, h, type_)
#define uv__store_relaxed(p, v)
#define uv__handle_stop(h)
#define uv__get_internal_fields(loop)
#define uv__handle_start(h)
void(* uv_fs_event_cb)(uv_fs_event_t *handle, const char *filename, int events, int status)
static const z80_opcode fd[]