Lines Matching defs:handle

425 static int uv__fs_event_rearm(uv_fs_event_t *handle) {
426 if (handle->fd == PORT_DELETED)
429 if (port_associate(handle->loop->fs_fd,
431 (uintptr_t) &handle->fo,
433 handle) == -1) {
436 handle->fd = PORT_LOADED;
445 uv_fs_event_t *handle = NULL;
474 handle = (uv_fs_event_t*) pe.portev_user;
477 if (uv__is_closing(handle)) {
478 uv__handle_stop(handle);
479 uv__make_close_pending((uv_handle_t*) handle);
489 handle->fd = PORT_FIRED;
490 handle->cb(handle, NULL, events, 0);
492 if (handle->fd != PORT_DELETED) {
493 r = uv__fs_event_rearm(handle);
495 handle->cb(handle, NULL, 0, r);
498 while (handle->fd != PORT_DELETED);
502 int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) {
503 uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT);
508 int uv_fs_event_start(uv_fs_event_t* handle,
516 if (uv__is_active(handle))
520 if (handle->loop->fs_fd == -1) {
524 handle->loop->fs_fd = portfd;
528 uv__handle_start(handle);
529 handle->path = uv__strdup(path);
530 handle->fd = PORT_UNUSED;
531 handle->cb = cb;
533 memset(&handle->fo, 0, sizeof handle->fo);
534 handle->fo.fo_name = handle->path;
535 err = uv__fs_event_rearm(handle);
537 uv_fs_event_stop(handle);
542 uv__io_init(&handle->loop->fs_event_watcher, uv__fs_event_read, portfd);
543 uv__io_start(handle->loop, &handle->loop->fs_event_watcher, POLLIN);
550 static int uv__fs_event_stop(uv_fs_event_t* handle) {
553 if (!uv__is_active(handle))
556 if (handle->fd == PORT_LOADED) {
557 ret = port_dissociate(handle->loop->fs_fd,
559 (uintptr_t) &handle->fo);
562 handle->fd = PORT_DELETED;
563 uv__free(handle->path);
564 handle->path = NULL;
565 handle->fo.fo_name = NULL;
567 uv__handle_stop(handle);
572 int uv_fs_event_stop(uv_fs_event_t* handle) {
573 (void) uv__fs_event_stop(handle);
577 void uv__fs_event_close(uv_fs_event_t* handle) {
582 * handle, causing a use-after-free problem when the event is processed.
586 if (uv__fs_event_stop(handle) == 0)
587 uv__make_close_pending((uv_handle_t*) handle);
592 int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) {
597 int uv_fs_event_start(uv_fs_event_t* handle,
605 int uv_fs_event_stop(uv_fs_event_t* handle) {
610 void uv__fs_event_close(uv_fs_event_t* handle) {