Home
last modified time | relevance | path

Searched refs:fd (Results 1 – 25 of 79) sorted by relevance

1234

/libuv/test/
H A Dtest-fs-fd-hash.c43 void assert_existent(int fd) { in assert_existent() argument
51 assert_nonexistent(fd); in assert_insertion()
52 info.flags = fd + FD_DIFF; in assert_insertion()
53 uv__fd_hash_add(fd, &info); in assert_insertion()
54 assert_existent(fd); in assert_insertion()
57 void assert_removal(int fd) { in assert_removal() argument
59 assert_existent(fd); in assert_removal()
62 assert_nonexistent(fd); in assert_removal()
69 for (fd = 0; fd < HASH_MAX; fd += HASH_INC) { \
77 for (fd = 1; fd < BUCKET_MAX; fd += BUCKET_INC) { \
[all …]
H A Dtest-pipe-set-non-blocking.c26 uv_file fd; member
44 uv_errno = uv_fs_read(NULL, &req, ctx->fd, bufs, 1, -1, NULL); in thread_main()
74 uv_file fd[2]; in TEST_IMPL() local
81 ASSERT_OK(uv_pipe(fd, 0, 0)); in TEST_IMPL()
82 ASSERT_OK(uv_pipe_open(&pipe_handle, fd[1])); in TEST_IMPL()
84 fd[1] = -1; /* fd[1] is owned by pipe_handle now. */ in TEST_IMPL()
86 ctx.fd = fd[0]; in TEST_IMPL()
122 ASSERT_OK(_close(fd[0])); /* fd[1] is closed by uv_close(). */ in TEST_IMPL()
124 ASSERT_OK(close(fd[0])); /* fd[1] is closed by uv_close(). */ in TEST_IMPL()
126 fd[0] = -1; in TEST_IMPL()
H A Dtest-handle-fileno.c50 uv_os_fd_t fd; in TEST_IMPL() local
63 r = uv_fileno((uv_handle_t*) &idle, &fd); in TEST_IMPL()
69 r = uv_fileno((uv_handle_t*) &tcp, &fd); in TEST_IMPL()
73 r = uv_fileno((uv_handle_t*) &tcp, &fd); in TEST_IMPL()
76 r = uv_fileno((uv_handle_t*) &tcp, &fd); in TEST_IMPL()
81 r = uv_fileno((uv_handle_t*) &udp, &fd); in TEST_IMPL()
85 r = uv_fileno((uv_handle_t*) &udp, &fd); in TEST_IMPL()
88 r = uv_fileno((uv_handle_t*) &udp, &fd); in TEST_IMPL()
93 r = uv_fileno((uv_handle_t*) &pipe, &fd); in TEST_IMPL()
97 r = uv_fileno((uv_handle_t*) &pipe, &fd); in TEST_IMPL()
[all …]
H A Dtest-tty.c351 int fd; in TEST_IMPL() local
356 if (fd != -1) { in TEST_IMPL()
358 ASSERT_OK(close(fd)); in TEST_IMPL()
366 if (fd != -1) { in TEST_IMPL()
368 ASSERT_OK(close(fd)); in TEST_IMPL()
373 if (fd != -1) { in TEST_IMPL()
375 ASSERT_OK(close(fd)); in TEST_IMPL()
378 fd = open("/dev/tty", O_RDWR); in TEST_IMPL()
379 if (fd != -1) { in TEST_IMPL()
390 if (fd != -1) { in TEST_IMPL()
[all …]
H A Dtest-poll.c643 int fd[2]; local
650 ASSERT_NE(fd[0], -1);
659 ASSERT_NE(fd[0], -1);
664 ASSERT_OK(pipe(fd));
672 ASSERT_NE(fd[0], -1);
674 ASSERT_NE(fd[1], -1);
692 int fd; local
695 ASSERT_NE(fd, -1);
714 int fd; local
716 fd = kqueue();
[all …]
H A Dtest-close-fd.c55 uv_file fd[2]; in TEST_IMPL() local
58 ASSERT_OK(uv_pipe(fd, 0, 0)); in TEST_IMPL()
60 ASSERT_OK(uv_pipe_open(&pipe_handle, fd[0])); in TEST_IMPL()
62 fd[0] = -1; in TEST_IMPL()
64 ASSERT_EQ(1, uv_fs_write(NULL, &req, fd[1], bufs, 1, -1, NULL)); in TEST_IMPL()
68 ASSERT_OK(_close(fd[1])); in TEST_IMPL()
70 ASSERT_OK(close(fd[1])); in TEST_IMPL()
72 fd[1] = -1; in TEST_IMPL()
H A Dtest-osx-select.c51 int fd; in TEST_IMPL() local
57 fd = open("/dev/tty", O_RDONLY); in TEST_IMPL()
58 if (fd < 0) { in TEST_IMPL()
64 r = uv_tty_init(uv_default_loop(), &tty, fd, 1); in TEST_IMPL()
74 r = ioctl(fd, TIOCSTI, str + i); in TEST_IMPL()
89 int fd; in TEST_IMPL() local
110 fd = open("/dev/tty", O_RDONLY); in TEST_IMPL()
111 if (fd < 0) { in TEST_IMPL()
117 r = uv_tty_init(uv_default_loop(), &tty, fd, 1); in TEST_IMPL()
128 r = ioctl(fd, TIOCSTI, str + i); in TEST_IMPL()
H A Dtest-pipe-close-stdout-read-stdin.c58 int fd[2]; in TEST_IMPL() local
63 r = pipe(fd); in TEST_IMPL()
77 close(fd[1]); in TEST_IMPL()
79 r = read(fd[0], &buf, 1); in TEST_IMPL()
82 r = dup(fd[0]); in TEST_IMPL()
107 close(fd[1]); in TEST_IMPL()
108 close(fd[0]); in TEST_IMPL()
H A Dtest-udp-create-socket-early.c38 uv_os_fd_t fd; in TEST_IMPL() local
46 r = uv_fileno((const uv_handle_t*) &client, &fd); in TEST_IMPL()
51 ASSERT_NE(fd, INVALID_FD); in TEST_IMPL()
57 ASSERT_PTR_NE(fd, INVALID_FD); in TEST_IMPL()
81 uv_os_fd_t fd; in TEST_IMPL() local
92 r = uv_fileno((const uv_handle_t*) &client, &fd); in TEST_IMPL()
97 ASSERT_NE(fd, INVALID_FD); in TEST_IMPL()
107 ASSERT_PTR_NE(fd, INVALID_FD); in TEST_IMPL()
/libuv/src/unix/
H A Dtty.c62 #define isatty(fd) isreallyatty(fd) argument
150 type = uv_guess_handle(fd); in uv_tty_init()
182 if (uv__tty_is_slave(fd) && ttyname_r(fd, path, sizeof(path)) == 0) in uv_tty_init()
206 fd = newfd; in uv_tty_init()
217 uv__nonblock(fd, 1); in uv_tty_init()
284 int fd; in uv_tty_set_mode() local
290 fd = uv__stream_fd(tty); in uv_tty_set_mode()
306 orig_termios_fd = fd; in uv_tty_set_mode()
340 int fd; in uv__tty_close() local
342 fd = handle->io_watcher.fd; in uv__tty_close()
[all …]
H A Dposix-poll.c93 if (loop->poll_fds[i].fd == w->fd) { in uv__pollfds_add()
102 pe->fd = w->fd; in uv__pollfds_add()
111 if (loop->poll_fds[i].fd == fd) { in uv__pollfds_del()
121 if (-1 != fd) in uv__pollfds_del()
147 int fd; in uv__io_poll() local
269 fd = pe->fd; in uv__io_poll()
272 if (fd == -1) in uv__io_poll()
275 assert(fd >= 0); in uv__io_poll()
350 assert(fd >= 0); in uv__platform_invalidate_fd()
355 if (loop->poll_fds[i].fd == fd) { in uv__platform_invalidate_fd()
[all …]
H A Dos390-syscalls.c243 if (fd >= lst->size || lst->items[fd].fd == -1) { in epoll_ctl()
248 lst->items[fd].fd = -1; in epoll_ctl()
256 if (lst->items[fd].fd != -1) { in epoll_ctl()
261 lst->items[fd].fd = fd; in epoll_ctl()
265 if (fd >= lst->size - 1 || lst->items[fd].fd == -1) { in epoll_ctl()
334 ev.fd = pfd->fd; in epoll_wait()
344 ev.fd = msg_fd.fd; in epoll_wait()
363 if (fd < lst->size && lst->items != NULL && lst->items[fd].fd != -1) in epoll_file_close()
364 lst->items[fd].fd = -1; in epoll_file_close()
394 int fd; in mkdtemp() local
[all …]
H A Drandom-devurandom.c36 int fd; in uv__random_readpath() local
38 fd = uv__open_cloexec(path, O_RDONLY); in uv__random_readpath()
40 if (fd < 0) in uv__random_readpath()
41 return fd; in uv__random_readpath()
43 if (uv__fstat(fd, &s)) { in uv__random_readpath()
44 uv__close(fd); in uv__random_readpath()
49 uv__close(fd); in uv__random_readpath()
55 n = read(fd, (char*) buf + pos, buflen - pos); in uv__random_readpath()
59 uv__close(fd); in uv__random_readpath()
64 uv__close(fd); in uv__random_readpath()
[all …]
H A Dprocess.c190 int fd; in uv__process_init_stdio() local
208 fd = container->data.fd; in uv__process_init_stdio()
281 int fd; in uv__process_child_init() local
311 for (fd = 0; fd < stdio_count; fd++) { in uv__process_child_init()
329 for (fd = 0; fd < stdio_count; fd++) { in uv__process_child_init()
356 fd = dup2(use_fd, fd); in uv__process_child_init()
534 int fd; in uv__spawn_set_posix_spawn_file_actions() local
563 for (fd = 0; fd < stdio_count; fd++) { in uv__spawn_set_posix_spawn_file_actions()
588 for (fd = 0; fd < stdio_count; fd++) { in uv__spawn_set_posix_spawn_file_actions()
597 fd, in uv__spawn_set_posix_spawn_file_actions()
[all …]
H A Dkqueue.c106 if (uv__fstat(fd, &sb)) in uv__io_check_fd()
178 int fd; in uv__io_poll() local
199 assert(w->fd >= 0); in uv__io_poll()
337 fd = ev->ident; in uv__io_poll()
354 if (fd == -1) in uv__io_poll()
356 w = loop->watchers[fd]; in uv__io_poll()
367 assert(fd == w->fd); in uv__io_poll()
485 assert(fd >= 0); in uv__platform_invalidate_fd()
571 int fd; in uv_fs_event_start() local
586 if (fd == -1) { in uv_fs_event_start()
[all …]
H A Dasync.c98 busy = (_Atomic int*) &handle->u.fd; in uv_async_send()
126 busy = (_Atomic int*) &handle->u.fd; in uv__async_spin()
216 int fd; local
221 fd = loop->async_wfd;
224 if (fd == -1) {
228 fd = loop->async_io_watcher.fd; /* eventfd */
234 fd = loop->async_io_watcher.fd; /* magic number for EVFILT_USER */
244 r = write(fd, buf, len);
356 loop->async_io_watcher.fd = -1;
384 h->u.fd = 0;
[all …]
H A Dcore.c240 int fd; in uv__socket_sockopt() local
249 fd = ((uv_udp_t *) handle)->io_watcher.fd; in uv__socket_sockopt()
542 int fd; in uv__open_file() local
799 int fd; in uv_disable_stdio_inheritance() local
804 for (fd = 0; ; fd++) in uv_disable_stdio_inheritance()
805 if (uv__cloexec(fd, 1) && fd > 15) in uv_disable_stdio_inheritance()
909 w->fd = fd; in uv__io_init()
1046 int fd; in uv__open_cloexec() local
1052 return fd; in uv__open_cloexec()
1055 int fd; in uv__open_cloexec()
[all …]
H A Dtcp.c38 static int maybe_bind_socket(int fd) { in maybe_bind_socket() argument
45 if (getsockname(fd, &s.addr, &slen)) in maybe_bind_socket()
57 if (bind(fd, &s.addr, slen)) in maybe_bind_socket()
135 if (tcp->io_watcher.fd != -1) in uv_tcp_init_ex()
136 uv__close(tcp->io_watcher.fd); in uv_tcp_init_ex()
137 tcp->io_watcher.fd = -1; in uv_tcp_init_ex()
180 if (setsockopt(tcp->io_watcher.fd, in uv__tcp_bind()
397 int fd; in uv_tcp_close_reset() local
404 fd = uv__stream_fd(handle); in uv_tcp_close_reset()
440 if (listen(tcp->io_watcher.fd, backlog)) in uv__tcp_listen()
[all …]
H A Dsunos.c69 int fd; in uv__platform_loop_init() local
74 fd = port_create(); in uv__platform_loop_init()
75 if (fd == -1) in uv__platform_loop_init()
80 uv__close(fd); in uv__platform_loop_init()
83 loop->backend_fd = fd; in uv__platform_loop_init()
120 assert(fd >= 0); in uv__platform_invalidate_fd()
164 int fd; in uv__io_poll() local
291 if (fd == -1) in uv__io_poll()
627 int fd; in uv_resident_set_memory() local
630 if (fd == -1) in uv_resident_set_memory()
[all …]
H A Dudp.c58 handle->io_watcher.fd = -1; in uv__udp_close()
520 int fd; in uv__udp_bind() local
531 fd = handle->io_watcher.fd; in uv__udp_bind()
532 if (fd == -1) { in uv__udp_bind()
536 fd = err; in uv__udp_bind()
537 handle->io_watcher.fd = fd; in uv__udp_bind()
1030 int fd; in uv__udp_init_ex() local
1032 fd = -1; in uv__udp_init_ex()
1035 if (fd < 0) in uv__udp_init_ex()
1036 return fd; in uv__udp_init_ex()
[all …]
H A Dpoll.c68 int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd) { in uv_poll_init() argument
71 if (uv__fd_exists(loop, fd)) in uv_poll_init()
74 err = uv__io_check_fd(loop, fd); in uv_poll_init()
81 err = uv__nonblock(fd, 1); in uv_poll_init()
84 err = uv__nonblock_fcntl(fd, 1); in uv_poll_init()
91 uv__io_init(&handle->io_watcher, uv__poll_io, fd); in uv_poll_init()
108 uv__platform_invalidate_fd(handle->loop, handle->io_watcher.fd); in uv__poll_stop()
131 if (uv__fd_exists(handle->loop, w->fd)) in uv_poll_start()
132 if (watchers[w->fd] != w) in uv_poll_start()
H A Dinternal.h247 int uv__cloexec(int fd, int set);
248 int uv__nonblock_ioctl(int fd, int set);
249 int uv__nonblock_fcntl(int fd, int set);
250 int uv__close(int fd); /* preserves errno */
251 int uv__close_nocheckstdio(int fd);
252 int uv__close_nocancel(int fd);
254 int uv__sock_reuseport(int fd);
265 int uv__io_check_fd(uv_loop_t* loop, int fd);
268 int uv__fd_exists(uv_loop_t* loop, int fd);
296 int uv__tcp_nodelay(int fd, int on);
[all …]
H A Dstream.c55 int fd; member
151 int fd; in uv__stream_osx_select() local
157 fd = s->fd; in uv__stream_osx_select()
160 max_fd = fd; in uv__stream_osx_select()
326 max_fd = *fd; in uv__stream_try_select()
340 s->fd = *fd; in uv__stream_try_select()
408 if (!(stream->io_watcher.fd == -1 || stream->io_watcher.fd == fd)) in uv__stream_open()
434 stream->io_watcher.fd = fd; in uv__stream_open()
511 int fd; in uv__server_io() local
985 int fd; in uv__stream_recv_cmsg() local
[all …]
H A Daix.c120 pc.fd = fd; in uv__io_check_fd()
171 pc.fd = w->fd; in uv__io_poll()
182 pqry.fd = pc.fd; in uv__io_poll()
299 pc.fd = pe->fd; in uv__io_poll()
598 if (*fd < 0) in uv__setup_ahafs()
1013 int fd; in uv_resident_set_memory() local
1018 if (fd == -1) in uv_resident_set_memory()
1027 uv__close(fd); in uv_resident_set_memory()
1303 assert(fd >= 0); in uv__platform_invalidate_fd()
1311 if ((int) events[i].fd == fd) in uv__platform_invalidate_fd()
[all …]
/libuv/src/win/
H A Dfs-fd-hash-inl.h54 uv_file fd; member
94 unsigned bucket = fd % ARRAY_SIZE(uv__fd_hash); \
102 if (group_ptr->entries[i].fd == fd) { \
122 INLINE static int uv__fd_hash_get(int fd, struct uv__fd_info_s* info) { in uv__fd_hash_get() argument
137 INLINE static void uv__fd_hash_add(int fd, struct uv__fd_info_s* info) { in uv__fd_hash_add() argument
159 entry_ptr->fd = fd; in uv__fd_hash_add()
167 INLINE static int uv__fd_hash_remove(int fd, struct uv__fd_info_s* info) { in uv__fd_hash_remove() argument

Completed in 46 milliseconds

1234