56 size_t len = strlen(
s) + 1;
65 size_t len = strlen(
s);
118 if (malloc_func ==
NULL || realloc_func ==
NULL ||
119 calloc_func ==
NULL || free_func ==
NULL) {
131 #define XX(uc, lc) case UV_##uc: return sizeof(uv_##lc##_t);
172 return copy !=
NULL ? copy :
"Unknown system error";
175 #define UV_ERR_NAME_GEN_R(name, _) \
177 uv__strscpy(buf, #name, buflen); break;
185 #undef UV_ERR_NAME_GEN_R
188 #define UV_ERR_NAME_GEN(name, _) case UV_ ## name: return #name;
195 #undef UV_ERR_NAME_GEN
198 #define UV_STRERROR_GEN_R(name, msg) \
200 snprintf(buf, buflen, "%s", msg); break;
208 #undef UV_STRERROR_GEN_R
211 #define UV_STRERROR_GEN(name, msg) case UV_ ## name: return msg;
218 #undef UV_STRERROR_GEN
226 addr->sin_len =
sizeof(*addr);
233 char address_part[40];
234 size_t address_part_size;
235 const char* zone_index;
241 addr->sin6_len =
sizeof(*addr);
244 zone_index = strchr(
ip,
'%');
245 if (zone_index !=
NULL) {
246 address_part_size = zone_index -
ip;
247 if (address_part_size >=
sizeof(address_part))
248 address_part_size =
sizeof(address_part) - 1;
250 memcpy(address_part,
ip, address_part_size);
251 address_part[address_part_size] =
'\0';
257 addr->sin6_scope_id = atoi(zone_index);
259 addr->sin6_scope_id = if_nametoindex(zone_index);
279 unsigned int flags) {
282 if (
handle->type != UV_TCP)
297 unsigned extra_flags;
307 extra_flags =
flags & ~0xFF;
328 unsigned int flags) {
331 if (
handle->type != UV_UDP)
351 if (
handle->type != UV_TCP)
368 if (
handle->type != UV_UDP)
394 struct sockaddr_storage
addr;
396 if (
handle->type != UV_UDP)
410 if (
handle->type != UV_UDP)
417 return UV_EDESTADDRREQ;
424 #if defined(AF_UNIX) && !defined(_WIN32)
471 if (
handle->type != UV_UDP || alloc_cb ==
NULL || recv_cb ==
NULL)
479 if (
handle->type != UV_UDP)
520 #define X(uc, lc) case UV_##uc: type = #lc; break;
523 default:
type =
"<unknown>";
527 "[%c%c%c] %-8s %p\n",
578 for (
i = 0;
i < nbufs;
i++)
600 required_len = strlen(
handle->path);
601 if (required_len >= *
size) {
602 *
size = required_len + 1;
607 *
size = required_len;
608 buffer[required_len] =
'\0';
619 return &
req->fs.info.nbufs;
630 # define uv__fs_scandir_free uv__free
632 # define uv__fs_scandir_free free
641 if (*nbufs > 0 && *nbufs != (
unsigned int)
req->result)
643 for (; *nbufs < (
unsigned int)
req->result; (*nbufs)++)
674 if (*nbufs == (
unsigned int)
req->result) {
680 dent = dents[(*nbufs)++];
691 #ifdef HAVE_DIRENT_TYPES
692 switch (dent->d_type) {
739 for (
i = 0;
i <
req->result; ++
i) {
830 if (
loop != default_loop)
860 static int was_shutdown;
void uv__process_title_cleanup(void)
static mcore_handle handle
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec req
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd domain
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
RZ_API void Ht_() free(HtName_(Ht) *ht)
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * realloc(void *ptr, size_t size)
void * malloc(size_t size)
void * calloc(size_t number, size_t size)
static const void static count static fd struct stat static buf struct pollfd unsigned static timeout void static offset void static length char static len const struct iovec static count unsigned long static filedes static sched_yield static flags static oldfd static pause unsigned static seconds static protocol struct sockaddr addrlen
int uv__loop_configure(uv_loop_t *loop, uv_loop_option option, va_list ap)
void uv__loop_close(uv_loop_t *loop)
assert(limit<=UINT32_MAX/2)
#define QUEUE_FOREACH(q, h)
#define QUEUE_DATA(ptr, type, field)
#define QUEUE_INSERT_TAIL(h, q)
static struct sockaddr static addrlen static backlog const void static flags void flags
uv_malloc_func local_malloc
uv_calloc_func local_calloc
uv_realloc_func local_realloc
uint64_t provider_idle_time
uint64_t provider_entry_time
int uv__socket_sockopt(uv_handle_t *handle, int optname, int *value)
void uv__signal_cleanup(void)
static char bufs[4][128]
Buffers for uint64_to_str() and uint64_to_nicestr()
void uv__threadpool_cleanup(void)
int uv__tcp_connect(uv_connect_t *req, uv_tcp_t *handle, const struct sockaddr *addr, unsigned int addrlen, uv_connect_cb cb)
int uv__tcp_bind(uv_tcp_t *tcp, const struct sockaddr *addr, unsigned int addrlen, unsigned int flags)
int uv__udp_init_ex(uv_loop_t *loop, uv_udp_t *handle, unsigned flags, int domain)
int uv__udp_send(uv_udp_send_t *req, uv_udp_t *handle, const uv_buf_t bufs[], unsigned int nbufs, const struct sockaddr *addr, unsigned int addrlen, uv_udp_send_cb send_cb)
int uv__udp_recv_start(uv_udp_t *handle, uv_alloc_cb alloc_cb, uv_udp_recv_cb recv_cb)
int uv__udp_disconnect(uv_udp_t *handle)
int uv__udp_connect(uv_udp_t *handle, const struct sockaddr *addr, unsigned int addrlen)
int uv__udp_recv_stop(uv_udp_t *handle)
int uv__udp_try_send(uv_udp_t *handle, const uv_buf_t bufs[], unsigned int nbufs, const struct sockaddr *addr, unsigned int addrlen)
int uv__udp_bind(uv_udp_t *handle, const struct sockaddr *addr, unsigned int addrlen, unsigned int flags)
#define uv__fs_scandir_free
int uv_udp_init_ex(uv_loop_t *loop, uv_udp_t *handle, unsigned flags)
void uv_free_cpu_info(uv_cpu_info_t *cpu_infos, int count)
int uv__udp_is_connected(uv_udp_t *handle)
void * uv__reallocf(void *ptr, size_t size)
size_t uv_handle_size(uv_handle_type type)
int uv_tcp_bind(uv_tcp_t *handle, const struct sockaddr *addr, unsigned int flags)
uint64_t uv_metrics_idle_time(uv_loop_t *loop)
int uv_replace_allocator(uv_malloc_func malloc_func, uv_realloc_func realloc_func, uv_calloc_func calloc_func, uv_free_func free_func)
static uv_loop_t * default_loop_ptr
int uv_ip4_addr(const char *ip, int port, struct sockaddr_in *addr)
void uv_library_shutdown(void)
uv_loop_t * uv_default_loop(void)
char * uv_err_name_r(int err, char *buf, size_t buflen)
void uv_print_all_handles(uv_loop_t *loop, FILE *stream)
char * uv__strndup(const char *s, size_t n)
void * uv__realloc(void *ptr, size_t size)
#define UV_STRERROR_GEN(name, msg)
size_t uv__count_bufs(const uv_buf_t bufs[], unsigned int nbufs)
uv_buf_t uv_buf_init(char *base, unsigned int len)
int uv_loop_close(uv_loop_t *loop)
int uv_udp_recv_stop(uv_udp_t *handle)
int uv_fs_scandir_next(uv_fs_t *req, uv_dirent_t *ent)
int uv_loop_configure(uv_loop_t *loop, uv_loop_option option,...)
int uv_ip4_name(const struct sockaddr_in *src, char *dst, size_t size)
#define UV_ERR_NAME_GEN(name, _)
int uv_udp_recv_start(uv_udp_t *handle, uv_alloc_cb alloc_cb, uv_udp_recv_cb recv_cb)
const char * uv_strerror(int err)
int uv_ip6_name(const struct sockaddr_in6 *src, char *dst, size_t size)
void uv__fs_scandir_cleanup(uv_fs_t *req)
char * uv__strdup(const char *s)
void uv_print_active_handles(uv_loop_t *loop, FILE *stream)
int uv__udp_check_before_send(uv_udp_t *handle, const struct sockaddr *addr)
static unsigned int * uv__get_nbufs(uv_fs_t *req)
uv_loop_t * uv_loop_new(void)
void uv_loop_delete(uv_loop_t *loop)
int uv_ip6_addr(const char *ip, int port, struct sockaddr_in6 *addr)
void * uv__malloc(size_t size)
void * uv__calloc(size_t count, size_t size)
void uv_os_free_environ(uv_env_item_t *envitems, int count)
void uv__fs_readdir_cleanup(uv_fs_t *req)
int uv_has_ref(const uv_handle_t *handle)
void uv_walk(uv_loop_t *loop, uv_walk_cb walk_cb, void *arg)
int uv_udp_bind(uv_udp_t *handle, const struct sockaddr *addr, unsigned int flags)
int uv_udp_init(uv_loop_t *loop, uv_udp_t *handle)
char * uv_strerror_r(int err, char *buf, size_t buflen)
static void uv__print_handles(uv_loop_t *loop, int only_active, FILE *stream)
size_t uv_req_size(uv_req_type type)
int uv_tcp_connect(uv_connect_t *req, uv_tcp_t *handle, const struct sockaddr *addr, uv_connect_cb cb)
void uv_stop(uv_loop_t *loop)
void uv__metrics_update_idle_time(uv_loop_t *loop)
int uv_send_buffer_size(uv_handle_t *handle, int *value)
static uv_loop_t default_loop_struct
void uv_ref(uv_handle_t *handle)
uv_dirent_type_t uv__fs_get_dirent_type(uv__dirent_t *dent)
int uv_udp_send(uv_udp_send_t *req, uv_udp_t *handle, const uv_buf_t bufs[], unsigned int nbufs, const struct sockaddr *addr, uv_udp_send_cb send_cb)
size_t uv_loop_size(void)
void uv_unref(uv_handle_t *handle)
static uv__allocator_t uv__allocator
uint64_t uv_now(const uv_loop_t *loop)
int uv_fs_event_getpath(uv_fs_event_t *handle, char *buffer, size_t *size)
#define UV_ERR_NAME_GEN_R(name, _)
#define UV_STRERROR_GEN_R(name, msg)
static const char * uv__unknown_err_code(int err)
int uv_udp_try_send(uv_udp_t *handle, const uv_buf_t bufs[], unsigned int nbufs, const struct sockaddr *addr)
const char * uv_err_name(int err)
int uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr)
int uv_recv_buffer_size(uv_handle_t *handle, int *value)
void uv__metrics_set_provider_entry_time(uv_loop_t *loop)
@ UV_HANDLE_UDP_CONNECTED
#define uv__handle_unref(h)
#define uv__load_relaxed(p)
#define uv__store_relaxed(p, v)
#define uv__has_active_reqs(loop)
#define uv__get_loop_metrics(loop)
#define uv__get_internal_fields(loop)
#define uv__handle_ref(h)
UV_EXTERN void uv_mutex_lock(uv_mutex_t *handle)
void(* uv_free_func)(void *ptr)
UV_EXTERN uint64_t uv_hrtime(void)
void *(* uv_malloc_func)(size_t size)
UV_EXTERN int uv_loop_init(uv_loop_t *loop)
UV_EXTERN void uv_mutex_unlock(uv_mutex_t *handle)
void *(* uv_calloc_func)(size_t count, size_t size)
UV_EXTERN int uv_inet_ntop(int af, const void *src, char *dst, size_t size)
void(* uv_udp_recv_cb)(uv_udp_t *handle, ssize_t nread, const uv_buf_t *buf, const struct sockaddr *addr, unsigned flags)
void(* uv_udp_send_cb)(uv_udp_send_t *req, int status)
void(* uv_alloc_cb)(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf)
void *(* uv_realloc_func)(void *ptr, size_t size)
#define UV_REQ_TYPE_MAP(XX)
void(* uv_connect_cb)(uv_connect_t *req, int status)
void(* uv_walk_cb)(uv_handle_t *handle, void *arg)
#define UV_HANDLE_TYPE_MAP(XX)
UV_EXTERN int uv_udp_getpeername(const uv_udp_t *handle, struct sockaddr *name, int *namelen)
UV_EXTERN int uv_inet_pton(int af, const char *src, void *dst)
struct uv_loop_s uv_loop_t