Macros | Enumerations | Functions
uv-common.h File Reference
#include <assert.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include "uv.h"
#include "uv/tree.h"
#include "queue.h"
#include "strscpy.h"
Include dependency graph for uv-common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ARRAY_SIZE(a)   (sizeof(a) / sizeof((a)[0]))
 
#define container_of(ptr, type, member)   ((type *) ((char *) (ptr) - offsetof(type, member)))
 
#define STATIC_ASSERT(expr)   void uv__static_assert(int static_assert_failed[1 - 2 * !(expr)])
 
#define uv__active_handle_add(h)
 
#define uv__active_handle_rm(h)
 
#define UV__ERR(x)   (x)
 
#define uv__handle_init(loop_, h, type_)
 
#define uv__handle_platform_init(h)   ((h)->next_closing = NULL)
 
#define uv__handle_ref(h)
 
#define uv__handle_start(h)
 
#define uv__handle_stop(h)
 
#define uv__handle_unref(h)
 
#define uv__has_active_handles(loop)   ((loop)->active_handles > 0)
 
#define uv__has_active_reqs(loop)   ((loop)->active_reqs.count > 0)
 
#define uv__has_ref(h)   (((h)->flags & UV_HANDLE_REF) != 0)
 
#define uv__is_active(h)   (((h)->flags & UV_HANDLE_ACTIVE) != 0)
 
#define uv__is_closing(h)   (((h)->flags & (UV_HANDLE_CLOSING | UV_HANDLE_CLOSED)) != 0)
 
#define uv__req_init(loop, req, typ)
 
#define uv__req_register(loop, req)
 
#define uv__req_unregister(loop, req)
 
#define UV_REQ_INIT(req, typ)
 

Enumerations

enum  {
  UV_HANDLE_CLOSING = 0x00000001, UV_HANDLE_CLOSED = 0x00000002, UV_HANDLE_ACTIVE = 0x00000004, UV_HANDLE_REF = 0x00000008,
  UV_HANDLE_INTERNAL = 0x00000010, UV_HANDLE_ENDGAME_QUEUED = 0x00000020, UV_HANDLE_LISTENING = 0x00000040, UV_HANDLE_CONNECTION = 0x00000080,
  UV_HANDLE_SHUTTING = 0x00000100, UV_HANDLE_SHUT = 0x00000200, UV_HANDLE_READ_PARTIAL = 0x00000400, UV_HANDLE_READ_EOF = 0x00000800,
  UV_HANDLE_READING = 0x00001000, UV_HANDLE_BOUND = 0x00002000, UV_HANDLE_READABLE = 0x00004000, UV_HANDLE_WRITABLE = 0x00008000,
  UV_HANDLE_READ_PENDING = 0x00010000, UV_HANDLE_SYNC_BYPASS_IOCP = 0x00020000, UV_HANDLE_ZERO_READ = 0x00040000, UV_HANDLE_EMULATE_IOCP = 0x00080000,
  UV_HANDLE_BLOCKING_WRITES = 0x00100000, UV_HANDLE_CANCELLATION_PENDING = 0x00200000, UV_HANDLE_IPV6 = 0x00400000, UV_HANDLE_TCP_NODELAY = 0x01000000,
  UV_HANDLE_TCP_KEEPALIVE = 0x02000000, UV_HANDLE_TCP_SINGLE_ACCEPT = 0x04000000, UV_HANDLE_TCP_ACCEPT_STATE_CHANGING = 0x08000000, UV_HANDLE_TCP_SOCKET_CLOSED = 0x10000000,
  UV_HANDLE_SHARED_TCP_SOCKET = 0x20000000, UV_HANDLE_UDP_PROCESSING = 0x01000000, UV_HANDLE_UDP_CONNECTED = 0x02000000, UV_HANDLE_UDP_RECVMMSG = 0x04000000,
  UV_HANDLE_NON_OVERLAPPED_PIPE = 0x01000000, UV_HANDLE_PIPESERVER = 0x02000000, UV_HANDLE_TTY_READABLE = 0x01000000, UV_HANDLE_TTY_RAW = 0x02000000,
  UV_HANDLE_TTY_SAVED_POSITION = 0x04000000, UV_HANDLE_TTY_SAVED_ATTRIBUTES = 0x08000000, UV_SIGNAL_ONE_SHOT_DISPATCHED = 0x01000000, UV_SIGNAL_ONE_SHOT = 0x02000000,
  UV_HANDLE_POLL_SLOW = 0x01000000
}
 
enum  uv__work_kind { UV__WORK_CPU, UV__WORK_FAST_IO, UV__WORK_SLOW_IO }
 

Functions

void * uv__calloc (size_t count, size_t size)
 
size_t uv__count_bufs (const uv_buf_t bufs[], unsigned int nbufs)
 
void uv__free (void *ptr)
 
uv_dirent_type_t uv__fs_get_dirent_type (uv__dirent_t *dent)
 
void uv__fs_poll_close (uv_fs_poll_t *handle)
 
void uv__fs_readdir_cleanup (uv_fs_t *req)
 
void uv__fs_scandir_cleanup (uv_fs_t *req)
 
int uv__getaddrinfo_translate_error (int sys_err)
 
void uv__loop_close (uv_loop_t *loop)
 
int uv__loop_configure (uv_loop_t *loop, uv_loop_option option, va_list ap)
 
void * uv__malloc (size_t size)
 
int uv__next_timeout (const uv_loop_t *loop)
 
void * uv__realloc (void *ptr, size_t size)
 
void * uv__reallocf (void *ptr, size_t size)
 
void uv__run_timers (uv_loop_t *loop)
 
int uv__socket_sockopt (uv_handle_t *handle, int optname, int *value)
 
char * uv__strdup (const char *s)
 
char * uv__strndup (const char *s, size_t n)
 
int uv__tcp_bind (uv_tcp_t *tcp, const struct sockaddr *addr, unsigned int addrlen, unsigned int flags)
 
int uv__tcp_connect (uv_connect_t *req, uv_tcp_t *handle, const struct sockaddr *addr, unsigned int addrlen, uv_connect_cb cb)
 
void uv__timer_close (uv_timer_t *handle)
 
int uv__udp_bind (uv_udp_t *handle, const struct sockaddr *addr, unsigned int addrlen, unsigned int flags)
 
int uv__udp_connect (uv_udp_t *handle, const struct sockaddr *addr, unsigned int addrlen)
 
int uv__udp_disconnect (uv_udp_t *handle)
 
int uv__udp_is_connected (uv_udp_t *handle)
 
int uv__udp_recv_start (uv_udp_t *handle, uv_alloc_cb alloccb, uv_udp_recv_cb recv_cb)
 
int uv__udp_recv_stop (uv_udp_t *handle)
 
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_try_send (uv_udp_t *handle, const uv_buf_t bufs[], unsigned int nbufs, const struct sockaddr *addr, unsigned int addrlen)
 
void uv__work_done (uv_async_t *handle)
 
void uv__work_submit (uv_loop_t *loop, struct uv__work *w, enum uv__work_kind kind, void(*work)(struct uv__work *w), void(*done)(struct uv__work *w, int status))
 

Macro Definition Documentation

◆ ARRAY_SIZE

#define ARRAY_SIZE (   a)    (sizeof(a) / sizeof((a)[0]))

Definition at line 55 of file uv-common.h.

◆ container_of

#define container_of (   ptr,
  type,
  member 
)    ((type *) ((char *) (ptr) - offsetof(type, member)))

Definition at line 57 of file uv-common.h.

◆ STATIC_ASSERT

#define STATIC_ASSERT (   expr)    void uv__static_assert(int static_assert_failed[1 - 2 * !(expr)])

Definition at line 60 of file uv-common.h.

◆ uv__active_handle_add

#define uv__active_handle_add (   h)
Value:
do { \
(h)->loop->active_handles++; \
} \
while (0)

Definition at line 223 of file uv-common.h.

◆ uv__active_handle_rm

#define uv__active_handle_rm (   h)
Value:
do { \
(h)->loop->active_handles--; \
} \
while (0)

Definition at line 229 of file uv-common.h.

◆ UV__ERR

#define UV__ERR (   x)    (x)

Definition at line 48 of file uv-common.h.

◆ uv__handle_init

#define uv__handle_init (   loop_,
  h,
  type_ 
)
Value:
do { \
(h)->loop = (loop_); \
(h)->type = (type_); \
(h)->flags = UV_HANDLE_REF; /* Ref the loop when active. */ \
QUEUE_INSERT_TAIL(&(loop_)->handle_queue, &(h)->handle_queue); \
uv__handle_platform_init(h); \
} \
while (0)

Definition at line 284 of file uv-common.h.

◆ uv__handle_platform_init

#define uv__handle_platform_init (   h)    ((h)->next_closing = NULL)

Definition at line 281 of file uv-common.h.

◆ uv__handle_ref

#define uv__handle_ref (   h)
Value:
do { \
if (((h)->flags & UV_HANDLE_REF) != 0) break; \
(h)->flags |= UV_HANDLE_REF; \
if (((h)->flags & UV_HANDLE_CLOSING) != 0) break; \
} \
while (0)

Definition at line 257 of file uv-common.h.

◆ uv__handle_start

#define uv__handle_start (   h)
Value:
do { \
if (((h)->flags & UV_HANDLE_ACTIVE) != 0) break; \
} \
while (0)

Definition at line 241 of file uv-common.h.

◆ uv__handle_stop

#define uv__handle_stop (   h)
Value:
do { \
if (((h)->flags & UV_HANDLE_ACTIVE) == 0) break; \
(h)->flags &= ~UV_HANDLE_ACTIVE; \
} \
while (0)

Definition at line 249 of file uv-common.h.

◆ uv__handle_unref

#define uv__handle_unref (   h)
Value:
do { \
if (((h)->flags & UV_HANDLE_REF) == 0) break; \
(h)->flags &= ~UV_HANDLE_REF; \
if (((h)->flags & UV_HANDLE_CLOSING) != 0) break; \
} \
while (0)

Definition at line 266 of file uv-common.h.

◆ uv__has_active_handles

#define uv__has_active_handles (   loop)    ((loop)->active_handles > 0)

Definition at line 220 of file uv-common.h.

◆ uv__has_active_reqs

#define uv__has_active_reqs (   loop)    ((loop)->active_reqs.count > 0)

Definition at line 204 of file uv-common.h.

◆ uv__has_ref

#define uv__has_ref (   h)    (((h)->flags & UV_HANDLE_REF) != 0)

Definition at line 275 of file uv-common.h.

◆ uv__is_active

#define uv__is_active (   h)    (((h)->flags & UV_HANDLE_ACTIVE) != 0)

Definition at line 235 of file uv-common.h.

◆ uv__is_closing

#define uv__is_closing (   h)    (((h)->flags & (UV_HANDLE_CLOSING | UV_HANDLE_CLOSED)) != 0)

Definition at line 238 of file uv-common.h.

◆ uv__req_init

#define uv__req_init (   loop,
  req,
  typ 
)
Value:
do { \
UV_REQ_INIT(req, typ); \
uv__req_register(loop, req); \
} \
while (0)

Definition at line 312 of file uv-common.h.

◆ uv__req_register

#define uv__req_register (   loop,
  req 
)
Value:
do { \
(loop)->active_reqs.count++; \
} \
while (0)

Definition at line 207 of file uv-common.h.

◆ uv__req_unregister

#define uv__req_unregister (   loop,
  req 
)
Value:
do { \
(loop)->active_reqs.count--; \
} \
while (0)

Definition at line 213 of file uv-common.h.

◆ UV_REQ_INIT

#define UV_REQ_INIT (   req,
  typ 
)
Value:
do { \
(req)->type = (typ); \
} \
while (0)

Definition at line 305 of file uv-common.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
UV_HANDLE_CLOSING 
UV_HANDLE_CLOSED 
UV_HANDLE_ACTIVE 
UV_HANDLE_REF 
UV_HANDLE_INTERNAL 
UV_HANDLE_ENDGAME_QUEUED 
UV_HANDLE_LISTENING 
UV_HANDLE_CONNECTION 
UV_HANDLE_SHUTTING 
UV_HANDLE_SHUT 
UV_HANDLE_READ_PARTIAL 
UV_HANDLE_READ_EOF 
UV_HANDLE_READING 
UV_HANDLE_BOUND 
UV_HANDLE_READABLE 
UV_HANDLE_WRITABLE 
UV_HANDLE_READ_PENDING 
UV_HANDLE_SYNC_BYPASS_IOCP 
UV_HANDLE_ZERO_READ 
UV_HANDLE_EMULATE_IOCP 
UV_HANDLE_BLOCKING_WRITES 
UV_HANDLE_CANCELLATION_PENDING 
UV_HANDLE_IPV6 
UV_HANDLE_TCP_NODELAY 
UV_HANDLE_TCP_KEEPALIVE 
UV_HANDLE_TCP_SINGLE_ACCEPT 
UV_HANDLE_TCP_ACCEPT_STATE_CHANGING 
UV_HANDLE_TCP_SOCKET_CLOSED 
UV_HANDLE_SHARED_TCP_SOCKET 
UV_HANDLE_UDP_PROCESSING 
UV_HANDLE_UDP_CONNECTED 
UV_HANDLE_UDP_RECVMMSG 
UV_HANDLE_NON_OVERLAPPED_PIPE 
UV_HANDLE_PIPESERVER 
UV_HANDLE_TTY_READABLE 
UV_HANDLE_TTY_RAW 
UV_HANDLE_TTY_SAVED_POSITION 
UV_HANDLE_TTY_SAVED_ATTRIBUTES 
UV_SIGNAL_ONE_SHOT_DISPATCHED 
UV_SIGNAL_ONE_SHOT 
UV_HANDLE_POLL_SLOW 

Definition at line 64 of file uv-common.h.

◆ uv__work_kind

Enumerator
UV__WORK_CPU 
UV__WORK_FAST_IO 
UV__WORK_SLOW_IO 

Definition at line 178 of file uv-common.h.

Function Documentation

◆ uv__calloc()

void* uv__calloc ( size_t  count,
size_t  size 
)

Definition at line 92 of file uv-common.c.

◆ uv__count_bufs()

size_t uv__count_bufs ( const uv_buf_t  bufs[],
unsigned int  nbufs 
)

Definition at line 543 of file uv-common.c.

◆ uv__free()

void uv__free ( void *  ptr)

Definition at line 81 of file uv-common.c.

◆ uv__fs_get_dirent_type()

uv_dirent_type_t uv__fs_get_dirent_type ( uv__dirent_t dent)

Definition at line 658 of file uv-common.c.

◆ uv__fs_poll_close()

void uv__fs_poll_close ( uv_fs_poll_t handle)

Definition at line 164 of file fs-poll.c.

◆ uv__fs_readdir_cleanup()

void uv__fs_readdir_cleanup ( uv_fs_t req)

Definition at line 694 of file uv-common.c.

◆ uv__fs_scandir_cleanup()

void uv__fs_scandir_cleanup ( uv_fs_t req)

Definition at line 605 of file uv-common.c.

◆ uv__getaddrinfo_translate_error()

int uv__getaddrinfo_translate_error ( int  sys_err)

Definition at line 42 of file unix/getaddrinfo.c.

◆ uv__loop_close()

void uv__loop_close ( uv_loop_t loop)

Definition at line 146 of file loop.c.

◆ uv__loop_configure()

int uv__loop_configure ( uv_loop_t loop,
uv_loop_option  option,
va_list  ap 
)

Definition at line 185 of file loop.c.

◆ uv__malloc()

void* uv__malloc ( size_t  size)

Definition at line 75 of file uv-common.c.

◆ uv__next_timeout()

int uv__next_timeout ( const uv_loop_t loop)

Definition at line 133 of file timer.c.

◆ uv__realloc()

void* uv__realloc ( void *  ptr,
size_t  size 
)

Definition at line 96 of file uv-common.c.

◆ uv__reallocf()

void* uv__reallocf ( void *  ptr,
size_t  size 
)

Definition at line 103 of file uv-common.c.

◆ uv__run_timers()

void uv__run_timers ( uv_loop_t loop)

Definition at line 154 of file timer.c.

◆ uv__socket_sockopt()

int uv__socket_sockopt ( uv_handle_t handle,
int  optname,
int value 
)

Definition at line 184 of file unix/core.c.

◆ uv__strdup()

char* uv__strdup ( const char *  s)

Definition at line 55 of file uv-common.c.

◆ uv__strndup()

char* uv__strndup ( const char *  s,
size_t  n 
)

Definition at line 63 of file uv-common.c.

◆ uv__tcp_bind()

int uv__tcp_bind ( uv_tcp_t tcp,
const struct sockaddr *  addr,
unsigned int  addrlen,
unsigned int  flags 
)

Definition at line 148 of file unix/tcp.c.

◆ uv__tcp_connect()

int uv__tcp_connect ( uv_connect_t req,
uv_tcp_t handle,
const struct sockaddr *  addr,
unsigned int  addrlen,
uv_connect_cb  cb 
)

Definition at line 204 of file unix/tcp.c.

◆ uv__timer_close()

void uv__timer_close ( uv_timer_t handle)

Definition at line 174 of file timer.c.

◆ uv__udp_bind()

int uv__udp_bind ( uv_udp_t handle,
const struct sockaddr *  addr,
unsigned int  addrlen,
unsigned int  flags 
)

Definition at line 503 of file unix/udp.c.

◆ uv__udp_connect()

int uv__udp_connect ( uv_udp_t handle,
const struct sockaddr *  addr,
unsigned int  addrlen 
)

Definition at line 605 of file unix/udp.c.

◆ uv__udp_disconnect()

int uv__udp_disconnect ( uv_udp_t handle)

Definition at line 628 of file unix/udp.c.

◆ uv__udp_is_connected()

int uv__udp_is_connected ( uv_udp_t handle)

Definition at line 363 of file uv-common.c.

◆ uv__udp_recv_start()

int uv__udp_recv_start ( uv_udp_t handle,
uv_alloc_cb  alloccb,
uv_udp_recv_cb  recv_cb 
)

Definition at line 1304 of file unix/udp.c.

◆ uv__udp_recv_stop()

int uv__udp_recv_stop ( uv_udp_t handle)

Definition at line 1329 of file unix/udp.c.

◆ uv__udp_send()

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 
)

Definition at line 649 of file unix/udp.c.

◆ uv__udp_try_send()

int uv__udp_try_send ( uv_udp_t handle,
const uv_buf_t  bufs[],
unsigned int  nbufs,
const struct sockaddr *  addr,
unsigned int  addrlen 
)

Definition at line 715 of file unix/udp.c.

◆ uv__work_done()

void uv__work_done ( uv_async_t handle)

Definition at line 295 of file threadpool.c.

◆ uv__work_submit()

void uv__work_submit ( uv_loop_t loop,
struct uv__work w,
enum uv__work_kind  kind,
void(*)(struct uv__work *w)  work,
void(*)(struct uv__work *w, int status done 
)

Definition at line 256 of file threadpool.c.

async_greeter_server_with_graceful_shutdown.loop
loop
Definition: async_greeter_server_with_graceful_shutdown.py:59
type_
std::string type_
Definition: client_channel_stress_test.cc:212
uv__active_handle_add
#define uv__active_handle_add(h)
Definition: uv-common.h:223
req
static uv_connect_t req
Definition: test-connection-fail.c:30
uv__active_handle_rm
#define uv__active_handle_rm(h)
Definition: uv-common.h:229
uv__has_active_reqs
#define uv__has_active_reqs(loop)
Definition: uv-common.h:204
UV_HANDLE_CLOSING
@ UV_HANDLE_CLOSING
Definition: uv-common.h:66
absl::flags_internal
Definition: abseil-cpp/absl/flags/commandlineflag.h:40
UV_HANDLE_REF
@ UV_HANDLE_REF
Definition: uv-common.h:69
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
absl::str_format_internal::LengthMod::h
@ h
if
if(p->owned &&p->wrapped !=NULL)
Definition: call.c:42
UV_HANDLE_ACTIVE
@ UV_HANDLE_ACTIVE
Definition: uv-common.h:68


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:37