Lines Matching defs:handle
462 uv_fs_event_t* handle;
471 handle = container_of(w, uv_fs_event_t, event_watcher);
484 if (fcntl(handle->event_watcher.fd, F_GETPATH, pathbuf) == 0)
494 if (handle->event_watcher.fd != -1 &&
495 (!uv__fstat(handle->event_watcher.fd, &statbuf) && !(statbuf.st_mode & S_IFDIR))) {
503 if (fcntl(handle->event_watcher.fd, F_KINFO, &kf) == 0)
507 handle->cb(handle, path, events, 0);
509 if (handle->event_watcher.fd == -1)
523 int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) {
524 uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT);
529 int uv_fs_event_start(uv_fs_event_t* handle,
538 if (uv__is_active(handle))
541 handle->cb = cb;
542 handle->path = uv__strdup(path);
543 if (handle->path == NULL)
547 fd = open(handle->path, O_RDONLY);
549 uv__free(handle->path);
550 handle->path = NULL;
556 handle->cf_cb = NULL;
557 handle->realpath = NULL;
558 handle->realpath_len = 0;
559 handle->cf_flags = flags;
572 handle->event_watcher.fd = -1;
573 r = uv__fsevents_init(handle);
575 uv__handle_start(handle);
577 uv__free(handle->path);
578 handle->path = NULL;
585 uv__handle_start(handle);
586 uv__io_init(&handle->event_watcher, uv__fs_event, fd);
587 uv__io_start(handle->loop, &handle->event_watcher, POLLIN);
593 int uv_fs_event_stop(uv_fs_event_t* handle) {
597 if (!uv__is_active(handle))
600 uv__handle_stop(handle);
605 if (handle->cf_cb != NULL)
606 r = uv__fsevents_close(handle);
609 if (handle->event_watcher.fd != -1) {
610 uv__io_close(handle->loop, &handle->event_watcher);
611 uv__close(handle->event_watcher.fd);
612 handle->event_watcher.fd = -1;
615 uv__free(handle->path);
616 handle->path = NULL;
622 void uv__fs_event_close(uv_fs_event_t* handle) {
623 uv_fs_event_stop(handle);