/libuv/test/ |
H A D | test-fs-fd-hash.c | 43 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 D | test-pipe-set-non-blocking.c | 26 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 D | test-handle-fileno.c | 50 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 D | test-tty.c | 351 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 D | test-close-fd.c | 55 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 D | test-osx-select.c | 51 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 D | test-pipe-close-stdout-read-stdin.c | 58 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 D | test-udp-create-socket-early.c | 38 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 D | posix-poll.c | 93 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 D | os390-syscalls.c | 243 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 D | random-devurandom.c | 36 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 D | process.c | 189 int fd; in uv__process_init_stdio() local 207 fd = container->data.fd; in uv__process_init_stdio() 280 int fd; in uv__process_child_init() local 310 for (fd = 0; fd < stdio_count; fd++) { in uv__process_child_init() 328 for (fd = 0; fd < stdio_count; fd++) { in uv__process_child_init() 355 fd = dup2(use_fd, fd); in uv__process_child_init() 533 int fd; in uv__spawn_set_posix_spawn_file_actions() local 562 for (fd = 0; fd < stdio_count; fd++) { in uv__spawn_set_posix_spawn_file_actions() 587 for (fd = 0; fd < stdio_count; fd++) { in uv__spawn_set_posix_spawn_file_actions() 596 fd, in uv__spawn_set_posix_spawn_file_actions() [all …]
|
H A D | tty.c | 62 #define isatty(fd) isreallyatty(fd) argument 73 rc = tcsetattr(fd, how, term); in uv__tcsetattr() 116 if (uv__fstat(fd, &sb) != 0) in uv__tty_is_slave() 131 result = ptsname(fd) == NULL; in uv__tty_is_slave() 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() [all …]
|
H A D | async.c | 70 busy = (_Atomic int*) &handle->u.fd; in uv_async_send() 98 busy = (_Atomic int*) &handle->u.fd; in uv__async_spin() 143 r = read(w->fd, buf, sizeof(buf)); in uv__async_io() 184 int fd; in uv__async_send() local 189 fd = loop->async_wfd; in uv__async_send() 192 if (fd == -1) { in uv__async_send() 196 fd = loop->async_io_watcher.fd; /* eventfd */ in uv__async_send() 201 r = write(fd, buf, len); in uv__async_send() 273 loop->async_io_watcher.fd = -1; in uv__async_stop() 301 h->u.fd = 0; in uv__async_fork() [all …]
|
H A D | core.c | 230 int fd; in uv__socket_sockopt() local 239 fd = ((uv_udp_t *) handle)->io_watcher.fd; in uv__socket_sockopt() 532 int fd; in uv__open_file() local 789 int fd; in uv_disable_stdio_inheritance() local 794 for (fd = 0; ; fd++) in uv_disable_stdio_inheritance() 795 if (uv__cloexec(fd, 1) && fd > 15) in uv_disable_stdio_inheritance() 899 w->fd = fd; in uv__io_init() 1036 int fd; in uv__open_cloexec() local 1042 return fd; in uv__open_cloexec() 1045 int fd; in uv__open_cloexec() [all …]
|
H A D | tcp.c | 38 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() 151 static int uv__tcp_reuseport(int fd) { in uv__tcp_reuseport() argument 183 (void) (fd); in uv__tcp_reuseport() 224 if (setsockopt(tcp->io_watcher.fd, in uv__tcp_bind() 441 int fd; in uv_tcp_close_reset() local [all …]
|
H A D | kqueue.c | 151 int fd; in uv__io_poll() local 172 assert(w->fd >= 0); in uv__io_poll() 310 fd = ev->ident; in uv__io_poll() 327 if (fd == -1) in uv__io_poll() 329 w = loop->watchers[fd]; in uv__io_poll() 447 assert(fd >= 0); in uv__platform_invalidate_fd() 533 int fd; in uv_fs_event_start() local 548 if (fd == -1) { in uv_fs_event_start() 561 if (uv__fstat(fd, &statbuf)) in uv_fs_event_start() 571 uv__close_nocheckstdio(fd); in uv_fs_event_start() [all …]
|
H A D | sunos.c | 69 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 D | poll.c | 68 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 D | udp.c | 58 handle->io_watcher.fd = -1; in uv__udp_close() 504 int fd; in uv__udp_bind() local 514 fd = handle->io_watcher.fd; in uv__udp_bind() 515 if (fd == -1) { in uv__udp_bind() 519 fd = err; in uv__udp_bind() 520 handle->io_watcher.fd = fd; in uv__udp_bind() 530 err = uv__set_reuse(fd); in uv__udp_bind() 1007 int fd; in uv__udp_init_ex() local 1009 fd = -1; in uv__udp_init_ex() 1012 if (fd < 0) in uv__udp_init_ex() [all …]
|
H A D | stream.c | 55 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 984 int fd; in uv__stream_recv_cmsg() local [all …]
|
H A D | aix.c | 120 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 …]
|
H A D | internal.h | 239 int uv__cloexec(int fd, int set); 240 int uv__nonblock_ioctl(int fd, int set); 241 int uv__nonblock_fcntl(int fd, int set); 242 int uv__close(int fd); /* preserves errno */ 243 int uv__close_nocheckstdio(int fd); 244 int uv__close_nocancel(int fd); 250 void uv__io_init(uv__io_t* w, uv__io_cb cb, int fd); 256 int uv__io_check_fd(uv_loop_t* loop, int fd); 259 int uv__fd_exists(uv_loop_t* loop, int fd); 287 int uv__tcp_nodelay(int fd, int on); [all …]
|
H A D | qnx.c | 38 msg.i.fd = -1; in get_mem_info() 97 int fd; in uv_resident_set_memory() local 100 fd = uv__open_cloexec("/proc/self/ctl", O_RDONLY); in uv_resident_set_memory() 101 if (fd == -1) in uv_resident_set_memory() 104 if (devctl(fd, DCMD_PROC_ASINFO, &asinfo, sizeof(asinfo), 0) == -1) { in uv_resident_set_memory() 105 uv__close(fd); in uv_resident_set_memory() 109 uv__close(fd); in uv_resident_set_memory()
|
/libuv/src/win/ |
H A D | fs-fd-hash-inl.h | 54 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
|