32 #include <sys/inotify.h>
33 #include <sys/types.h>
47 #define CAST(p) ((struct watcher_root*)(p))
52 if (
a->wd <
b->wd)
return -1;
53 if (
a->wd >
b->wd)
return 1;
63 unsigned int revents);
71 if (
loop->inotify_fd != -1)
74 fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
97 if (old_watchers !=
NULL) {
101 loop->inotify_watchers = old_watchers;
110 CAST(&old_watchers), tmp_watcher_list_iter) {
162 inotify_rm_watch(
loop->inotify_fd,
w->wd);
169 unsigned int events) {
170 const struct inotify_event*
e;
195 e = (
const struct inotify_event*)
p;
198 if (
e->mask & (IN_ATTRIB|IN_MODIFY))
200 if (
e->mask & ~(IN_ATTRIB|IN_MODIFY))
211 path =
e->len ? (
const char*) (
e + 1) : uv__basename_r(
w->path);
233 h->cb(
h,
path, events, 0);
252 unsigned int flags) {
275 wd = inotify_add_watch(
handle->loop->inotify_fd,
path, events);
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
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
#define RB_INSERT(name, x, y)
#define RB_FOREACH_SAFE(x, name, head, y)
#define RB_REMOVE(name, x, y)
#define RB_FIND(name, x, y)
static struct watcher_list * find_watcher(uv_loop_t *loop, int wd)
void uv__fs_event_close(uv_fs_event_t *handle)
int uv__inotify_fork(uv_loop_t *loop, void *old_watchers)
int uv_fs_event_stop(uv_fs_event_t *handle)
int uv_fs_event_start(uv_fs_event_t *handle, uv_fs_event_cb cb, const char *path, unsigned int flags)
static void maybe_free_watcher_list(struct watcher_list *w, uv_loop_t *loop)
int uv_fs_event_init(uv_loop_t *loop, uv_fs_event_t *handle)
static int init_inotify(uv_loop_t *loop)
static void uv__inotify_read(uv_loop_t *loop, uv__io_t *w, unsigned int revents)
static int compare_watchers(const struct watcher_list *a, const struct watcher_list *b)
assert(limit<=UINT32_MAX/2)
#define QUEUE_DATA(ptr, type, field)
#define QUEUE_INSERT_TAIL(h, q)
static struct sockaddr static addrlen static backlog const void static flags void flags
struct watcher_list * rbh_root
void uv__io_start(uv_loop_t *loop, uv__io_t *w, unsigned int events)
void uv__io_init(uv__io_t *w, uv__io_cb cb, int fd)
RB_GENERATE_STATIC(uv__signal_tree_s, uv_signal_s, tree_entry, uv__signal_compare)
char * uv__strdup(const char *s)
void * uv__malloc(size_t size)
#define uv__handle_init(loop_, h, type_)
#define uv__handle_stop(h)
#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[]
int read(izstream &zs, T *x, Items items)