Lines Matching refs:handle

37     uv_fs_event_t* handle) {  in uv__fs_event_queue_readdirchanges()  argument
38 assert(handle->dir_handle != INVALID_HANDLE_VALUE); in uv__fs_event_queue_readdirchanges()
39 assert(!handle->req_pending); in uv__fs_event_queue_readdirchanges()
41 memset(&(handle->req.u.io.overlapped), 0, in uv__fs_event_queue_readdirchanges()
42 sizeof(handle->req.u.io.overlapped)); in uv__fs_event_queue_readdirchanges()
43 if (!ReadDirectoryChangesW(handle->dir_handle, in uv__fs_event_queue_readdirchanges()
44 handle->buffer, in uv__fs_event_queue_readdirchanges()
46 (handle->flags & UV_FS_EVENT_RECURSIVE) ? TRUE : FALSE, in uv__fs_event_queue_readdirchanges()
56 &handle->req.u.io.overlapped, in uv__fs_event_queue_readdirchanges()
59 SET_REQ_ERROR(&handle->req, GetLastError()); in uv__fs_event_queue_readdirchanges()
60 uv__insert_pending_req(loop, (uv_req_t*)&handle->req); in uv__fs_event_queue_readdirchanges()
63 handle->req_pending = 1; in uv__fs_event_queue_readdirchanges()
140 int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { in uv_fs_event_init() argument
141 uv__handle_init(loop, (uv_handle_t*) handle, UV_FS_EVENT); in uv_fs_event_init()
142 handle->dir_handle = INVALID_HANDLE_VALUE; in uv_fs_event_init()
143 handle->buffer = NULL; in uv_fs_event_init()
144 handle->req_pending = 0; in uv_fs_event_init()
145 handle->filew = NULL; in uv_fs_event_init()
146 handle->short_filew = NULL; in uv_fs_event_init()
147 handle->dirw = NULL; in uv_fs_event_init()
149 UV_REQ_INIT(&handle->req, UV_FS_EVENT_REQ); in uv_fs_event_init()
150 handle->req.data = handle; in uv_fs_event_init()
156 int uv_fs_event_start(uv_fs_event_t* handle, in uv_fs_event_start() argument
169 if (uv__is_active(handle)) in uv_fs_event_start()
172 handle->cb = cb; in uv_fs_event_start()
173 handle->path = uv__strdup(path); in uv_fs_event_start()
174 if (!handle->path) { in uv_fs_event_start()
178 uv__handle_start(handle); in uv_fs_event_start()
245 if (uv__split_path(pathw, &dir, &handle->filew) != 0) { in uv_fs_event_start()
250 if (uv__split_path(short_path, NULL, &handle->short_filew) != 0) { in uv_fs_event_start()
260 handle->dir_handle = CreateFileW(dir_to_watch, in uv_fs_event_start()
275 if (handle->dir_handle == INVALID_HANDLE_VALUE) { in uv_fs_event_start()
280 if (CreateIoCompletionPort(handle->dir_handle, in uv_fs_event_start()
281 handle->loop->iocp, in uv_fs_event_start()
282 (ULONG_PTR)handle, in uv_fs_event_start()
288 if (!handle->buffer) { in uv_fs_event_start()
289 handle->buffer = (char*)uv__malloc(uv_directory_watcher_buffer_size); in uv_fs_event_start()
291 if (!handle->buffer) { in uv_fs_event_start()
295 memset(&(handle->req.u.io.overlapped), 0, in uv_fs_event_start()
296 sizeof(handle->req.u.io.overlapped)); in uv_fs_event_start()
298 if (!ReadDirectoryChangesW(handle->dir_handle, in uv_fs_event_start()
299 handle->buffer, in uv_fs_event_start()
311 &handle->req.u.io.overlapped, in uv_fs_event_start()
318 handle->dirw = pathw; in uv_fs_event_start()
319 handle->req_pending = 1; in uv_fs_event_start()
326 if (handle->path) { in uv_fs_event_start()
327 uv__free(handle->path); in uv_fs_event_start()
328 handle->path = NULL; in uv_fs_event_start()
331 if (handle->filew) { in uv_fs_event_start()
332 uv__free(handle->filew); in uv_fs_event_start()
333 handle->filew = NULL; in uv_fs_event_start()
336 if (handle->short_filew) { in uv_fs_event_start()
337 uv__free(handle->short_filew); in uv_fs_event_start()
338 handle->short_filew = NULL; in uv_fs_event_start()
343 if (handle->dir_handle != INVALID_HANDLE_VALUE) { in uv_fs_event_start()
344 CloseHandle(handle->dir_handle); in uv_fs_event_start()
345 handle->dir_handle = INVALID_HANDLE_VALUE; in uv_fs_event_start()
348 if (handle->buffer) { in uv_fs_event_start()
349 uv__free(handle->buffer); in uv_fs_event_start()
350 handle->buffer = NULL; in uv_fs_event_start()
353 if (uv__is_active(handle)) in uv_fs_event_start()
354 uv__handle_stop(handle); in uv_fs_event_start()
362 int uv_fs_event_stop(uv_fs_event_t* handle) { in uv_fs_event_stop() argument
363 if (!uv__is_active(handle)) in uv_fs_event_stop()
366 if (handle->dir_handle != INVALID_HANDLE_VALUE) { in uv_fs_event_stop()
367 CloseHandle(handle->dir_handle); in uv_fs_event_stop()
368 handle->dir_handle = INVALID_HANDLE_VALUE; in uv_fs_event_stop()
371 uv__handle_stop(handle); in uv_fs_event_stop()
373 if (handle->filew) { in uv_fs_event_stop()
374 uv__free(handle->filew); in uv_fs_event_stop()
375 handle->filew = NULL; in uv_fs_event_stop()
378 if (handle->short_filew) { in uv_fs_event_stop()
379 uv__free(handle->short_filew); in uv_fs_event_stop()
380 handle->short_filew = NULL; in uv_fs_event_stop()
383 if (handle->path) { in uv_fs_event_stop()
384 uv__free(handle->path); in uv_fs_event_stop()
385 handle->path = NULL; in uv_fs_event_stop()
388 if (handle->dirw) { in uv_fs_event_stop()
389 uv__free(handle->dirw); in uv_fs_event_stop()
390 handle->dirw = NULL; in uv_fs_event_stop()
417 uv_fs_event_t* handle) { in uv__process_fs_event_req() argument
426 assert(handle->req_pending); in uv__process_fs_event_req()
427 handle->req_pending = 0; in uv__process_fs_event_req()
433 if (!uv__is_active(handle)) { in uv__process_fs_event_req()
434 if (handle->flags & UV_HANDLE_CLOSING) { in uv__process_fs_event_req()
435 uv__want_endgame(loop, (uv_handle_t*) handle); in uv__process_fs_event_req()
440 file_info = (FILE_NOTIFY_INFORMATION*)(handle->buffer + offset); in uv__process_fs_event_req()
454 if (handle->dirw || in uv__process_fs_event_req()
455 file_info_cmp(handle->filew, in uv__process_fs_event_req()
458 file_info_cmp(handle->short_filew, in uv__process_fs_event_req()
462 if (handle->dirw) { in uv__process_fs_event_req()
472 size = wcslen(handle->dirw) + in uv__process_fs_event_req()
480 _snwprintf(filenamew, size, L"%s\\%.*s", handle->dirw, in uv__process_fs_event_req()
509 handle->dirw, in uv__process_fs_event_req()
530 filenamew = handle->filew; in uv__process_fs_event_req()
542 handle->cb(handle, filename, UV_RENAME, 0); in uv__process_fs_event_req()
546 handle->cb(handle, filename, UV_CHANGE, 0); in uv__process_fs_event_req()
558 } while (offset && !(handle->flags & UV_HANDLE_CLOSING)); in uv__process_fs_event_req()
560 handle->cb(handle, NULL, UV_CHANGE, 0); in uv__process_fs_event_req()
571 handle->dirw != NULL && in uv__process_fs_event_req()
572 GetFileInformationByHandleEx(handle->dir_handle, in uv__process_fs_event_req()
578 uv__convert_utf16_to_utf8(handle->dirw, -1, &filename); in uv__process_fs_event_req()
579 handle->cb(handle, filename, UV_RENAME, 0); in uv__process_fs_event_req()
581 handle->cb(handle, NULL, 0, uv_translate_sys_error(err)); in uv__process_fs_event_req()
585 if (handle->flags & UV_HANDLE_CLOSING) { in uv__process_fs_event_req()
586 uv__want_endgame(loop, (uv_handle_t*)handle); in uv__process_fs_event_req()
587 } else if (uv__is_active(handle)) { in uv__process_fs_event_req()
588 uv__fs_event_queue_readdirchanges(loop, handle); in uv__process_fs_event_req()
593 void uv__fs_event_close(uv_loop_t* loop, uv_fs_event_t* handle) { in uv__fs_event_close() argument
594 uv_fs_event_stop(handle); in uv__fs_event_close()
596 uv__handle_closing(handle); in uv__fs_event_close()
598 if (!handle->req_pending) { in uv__fs_event_close()
599 uv__want_endgame(loop, (uv_handle_t*)handle); in uv__fs_event_close()
605 void uv__fs_event_endgame(uv_loop_t* loop, uv_fs_event_t* handle) { in uv__fs_event_endgame() argument
606 if ((handle->flags & UV_HANDLE_CLOSING) && !handle->req_pending) { in uv__fs_event_endgame()
607 assert(!(handle->flags & UV_HANDLE_CLOSED)); in uv__fs_event_endgame()
609 if (handle->buffer) { in uv__fs_event_endgame()
610 uv__free(handle->buffer); in uv__fs_event_endgame()
611 handle->buffer = NULL; in uv__fs_event_endgame()
614 uv__handle_close(handle); in uv__fs_event_endgame()