Rizin
unix-like reverse engineering framework and cli tools
|
#include "uv.h"
#include "internal.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <unistd.h>
#include <limits.h>
Go to the source code of this file.
Macros | |
#define | RETRY_ON_WRITE_ERROR(errno) (errno == EINTR) |
#define | IS_TRANSIENT_WRITE_ERROR(errno, send_handle) (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS) |
#define | UV_DEC_BACKLOG(w) /* no-op */ |
#define | UV__CMSG_FD_COUNT 64 |
#define | UV__CMSG_FD_SIZE (UV__CMSG_FD_COUNT * sizeof(int)) |
#define UV__CMSG_FD_SIZE (UV__CMSG_FD_COUNT * sizeof(int)) |
|
static |
Definition at line 679 of file stream.c.
References assert(), err, NULL, QUEUE_EMPTY, req, UV__ERR, uv__io_stop(), uv__req_unregister, uv__stream_fd, uv__stream_osx_interrupt_select(), UV_HANDLE_CLOSING, UV_HANDLE_SHUT, and UV_HANDLE_SHUTTING.
Referenced by uv__stream_io().
Definition at line 497 of file stream.c.
References err, loop, O_RDONLY, uv__accept(), uv__close(), and uv__open_cloexec().
Referenced by uv__server_io().
|
static |
Definition at line 788 of file stream.c.
References handle.
Referenced by uv__write(), and uv_write2().
uv_handle_type uv__handle_type | ( | int | fd | ) |
Definition at line 958 of file stream.c.
References AF_INET, AF_INET6, AF_UNIX, fd, len, memset(), SO_TYPE, SOCK_DGRAM, SOCK_STREAM, SOL_SOCKET, type, and UV_UNKNOWN_HANDLE.
Referenced by uv_pipe_pending_type().
|
static |
Definition at line 1116 of file stream.c.
References assert(), uv_buf_t::base, buflen, CMSG_SPACE, count, EAGAIN, ECONNRESET, EINTR, err, uv_buf_t::len, msg, NULL, read(), UV__CMSG_FD_SIZE, UV__ERR, uv__handle_stop, uv__io_active(), uv__io_start(), uv__io_stop(), uv__recvmsg(), uv__stream_eof(), uv__stream_fd, uv__stream_osx_interrupt_select(), uv__stream_recv_cmsg(), uv_buf_init(), UV_HANDLE_READ_PARTIAL, and UV_HANDLE_READING.
Referenced by uv__stream_io().
Definition at line 528 of file stream.c.
References assert(), container_of, err, loop, nanosleep, NULL, timeout, uv__accept(), uv__emfile_trick(), UV__ERR, uv__io_start(), uv__io_stop(), uv__stream_fd, UV_DEC_BACKLOG, UV_HANDLE_CLOSING, UV_HANDLE_TCP_SINGLE_ACCEPT, and w.
Referenced by uv_pipe_listen(), and uv_tcp_listen().
void uv__stream_close | ( | uv_stream_t * | handle | ) |
Definition at line 1633 of file stream.c.
References assert(), uv__stream_queued_fds_s::fds, handle, i, NULL, uv__stream_queued_fds_s::offset, s, STDERR_FILENO, uv__close(), uv__free(), uv__handle_stop, uv__io_active(), uv__io_close(), uv__stream_osx_interrupt_select(), uv_close(), UV_HANDLE_READABLE, UV_HANDLE_WRITABLE, uv_read_stop(), uv_sem_destroy(), uv_sem_post(), and uv_thread_join().
Referenced by uv__pipe_close(), uv__process_close_stream(), uv__tcp_close(), and uv_close().
|
static |
We get called here from directly following a call to connect(2). In order to determine if we've errored out or succeeded must call getsockopt.
Definition at line 1344 of file stream.c.
References assert(), EINPROGRESS, error(), int, NULL, QUEUE_EMPTY, req, SO_ERROR, SOL_SOCKET, UV__ERR, uv__io_stop(), uv__req_unregister, uv__stream_fd, uv__stream_flush_write_queue(), and uv__write_callbacks().
Referenced by uv__stream_io().
void uv__stream_destroy | ( | uv_stream_t * | stream | ) |
Definition at line 458 of file stream.c.
References assert(), NULL, uv__io_active(), uv__req_unregister, uv__stream_flush_write_queue(), uv__write_callbacks(), and UV_HANDLE_CLOSED.
Referenced by uv__finish_close().
|
static |
Definition at line 1001 of file stream.c.
References uv__handle_stop, uv__io_active(), uv__io_stop(), uv__stream_osx_interrupt_select(), UV_HANDLE_READ_EOF, and UV_HANDLE_READING.
Referenced by uv__read(), and uv__stream_io().
void uv__stream_flush_write_queue | ( | uv_stream_t * | stream, |
int | error | ||
) |
Definition at line 443 of file stream.c.
References error(), queue, QUEUE_DATA, QUEUE_EMPTY, QUEUE_HEAD, QUEUE_INSERT_TAIL, QUEUE_REMOVE, and req.
Referenced by uv__stream_connect(), and uv__stream_destroy().
void uv__stream_init | ( | uv_loop_t * | loop, |
uv_stream_t * | stream, | ||
uv_handle_type | type | ||
) |
Definition at line 85 of file stream.c.
References err, loop, NULL, O_RDONLY, QUEUE_INIT, type, uv__handle_init, uv__io_init(), uv__open_cloexec(), and uv__stream_io().
Referenced by uv_pipe_init(), uv_tcp_init_ex(), and uv_tty_init().
Definition at line 1287 of file stream.c.
References assert(), container_of, NULL, QUEUE_EMPTY, uv__drain(), uv__read(), uv__stream_connect(), uv__stream_eof(), uv__stream_fd, uv__write(), uv__write_callbacks(), UV_HANDLE_CLOSING, UV_HANDLE_READ_EOF, UV_HANDLE_READ_PARTIAL, UV_HANDLE_READING, and w.
Referenced by uv__stream_init().
int uv__stream_open | ( | uv_stream_t * | stream, |
int | fd, | ||
int | flags | ||
) |
Definition at line 406 of file stream.c.
References assert(), EINVAL, ENOTSOCK, fd, flags, SO_OOBINLINE, SOL_SOCKET, UV__ERR, uv__tcp_keepalive(), uv__tcp_nodelay(), UV_HANDLE_TCP_KEEPALIVE, and UV_HANDLE_TCP_NODELAY.
Referenced by new_socket(), uv__process_open_stream(), uv_accept(), uv_pipe_connect(), uv_pipe_open(), uv_tcp_open(), and uv_tty_init().
|
static |
Definition at line 123 of file stream.c.
References assert(), EINTR, NULL, r, s, and write.
Referenced by uv__drain(), uv__read(), uv__stream_close(), uv__stream_eof(), uv__write(), uv_read_start(), uv_read_stop(), uv_shutdown(), uv_try_write(), and uv_write2().
|
static |
Definition at line 1012 of file stream.c.
References fd, uv__stream_queued_fds_s::fds, NULL, uv__stream_queued_fds_s::offset, uv__stream_queued_fds_s::size, uv__malloc(), and uv__realloc().
Referenced by uv__stream_recv_cmsg().
|
static |
Definition at line 1060 of file stream.c.
References assert(), CMSG_DATA, CMSG_FIRSTHDR, cmsghdr::cmsg_len, CMSG_LEN, CMSG_NXTHDR, cmsghdr::cmsg_type, count, test_evm::end, err, i, msg, NULL, SCM_RIGHTS, start, uv__close(), uv__stream_queue_fd(), and while().
Referenced by uv__read().
|
static |
Definition at line 802 of file stream.c.
References assert(), CMSG_DATA, CMSG_FIRSTHDR, cmsghdr::cmsg_len, CMSG_LEN, cmsghdr::cmsg_level, CMSG_SPACE, cmsghdr::cmsg_type, err, error(), iov, IS_TRANSIENT_WRITE_ERROR, memset(), msg, n, NULL, queue, QUEUE_DATA, QUEUE_EMPTY, QUEUE_HEAD, req, RETRY_ON_WRITE_ERROR, SCM_RIGHTS, SOL_SOCKET, start, UV__ERR, uv__getiovmax(), uv__handle_fd(), uv__handle_stop, uv__io_active(), uv__io_start(), uv__io_stop(), uv__is_closing, uv__stream_fd, uv__stream_osx_interrupt_select(), uv__write_req_finish(), uv__write_req_update(), uv__writev(), and UV_HANDLE_BLOCKING_WRITES.
Referenced by uv__stream_io(), and uv_write2().
|
static |
Definition at line 927 of file stream.c.
References NULL, queue, QUEUE_DATA, QUEUE_EMPTY, QUEUE_HEAD, QUEUE_MOVE, QUEUE_REMOVE, req, uv__free(), uv__req_unregister, and uv__write_req_size().
Referenced by uv__stream_connect(), uv__stream_destroy(), and uv__stream_io().
|
static |
Definition at line 762 of file stream.c.
References NULL, QUEUE_INSERT_TAIL, QUEUE_REMOVE, req, uv__free(), and uv__io_feed().
Referenced by uv__write().
|
static |
Definition at line 719 of file stream.c.
References assert(), NULL, req, and uv__count_bufs().
Referenced by uv__write_callbacks(), and uv_try_write().
|
static |
Definition at line 711 of file stream.c.
References fd, n, write, and writev.
Referenced by uv__write().
int uv_accept | ( | uv_stream_t * | server, |
uv_stream_t * | client | ||
) |
int uv_is_readable | ( | const uv_stream_t * | stream | ) |
int uv_is_writable | ( | const uv_stream_t * | stream | ) |
int uv_listen | ( | uv_stream_t * | stream, |
int | backlog, | ||
uv_connection_cb | cb | ||
) |
int uv_read_start | ( | uv_stream_t * | stream, |
uv_alloc_cb | alloc_cb, | ||
uv_read_cb | read_cb | ||
) |
int uv_read_stop | ( | uv_stream_t * | stream | ) |
int uv_shutdown | ( | uv_shutdown_t * | req, |
uv_stream_t * | stream, | ||
uv_shutdown_cb | cb | ||
) |
int uv_stream_set_blocking | ( | uv_stream_t * | handle, |
int | blocking | ||
) |
Definition at line 1507 of file stream.c.
void uv_try_write_cb | ( | uv_write_t * | req, |
int | status | ||
) |
Definition at line 1501 of file stream.c.
Referenced by uv_try_write().
int uv_write | ( | uv_write_t * | req, |
uv_stream_t * | handle, | ||
const uv_buf_t | bufs[], | ||
unsigned int | nbufs, | ||
uv_write_cb | cb | ||
) |
Definition at line 1492 of file stream.c.
Referenced by uv_try_write(), and uv_write2().
int uv_write2 | ( | uv_write_t * | req, |
uv_stream_t * | stream, | ||
const uv_buf_t | bufs[], | ||
unsigned int | nbufs, | ||
uv_stream_t * | send_handle, | ||
uv_write_cb | cb | ||
) |
Definition at line 1393 of file stream.c.
Referenced by uv_write().