Rizin
unix-like reverse engineering framework and cli tools
handle-inl.h File Reference
#include <assert.h>
#include <io.h>
#include "uv.h"
#include "internal.h"

Go to the source code of this file.

Macros

#define DECREASE_ACTIVE_COUNT(loop, handle)
 
#define INCREASE_ACTIVE_COUNT(loop, handle)
 
#define DECREASE_PENDING_REQ_COUNT(handle)
 
#define uv__handle_closing(handle)
 
#define uv__handle_close(handle)
 

Functions

static INLINE void uv_want_endgame (uv_loop_t *loop, uv_handle_t *handle)
 
static INLINE void uv_process_endgames (uv_loop_t *loop)
 
static INLINE HANDLE uv__get_osfhandle (int fd)
 

Macro Definition Documentation

◆ DECREASE_ACTIVE_COUNT

#define DECREASE_ACTIVE_COUNT (   loop,
  handle 
)
Value:
do { \
if (--(handle)->activecnt == 0 && \
uv__handle_stop((handle)); \
} \
assert((handle)->activecnt >= 0); \
} while (0)
static mcore_handle handle
Definition: asm_mcore.c:8
static struct sockaddr static addrlen static backlog const void static flags void flags
Definition: sfsocketcall.h:123
@ UV_HANDLE_CLOSING
Definition: uv-common.h:74

Definition at line 32 of file handle-inl.h.

◆ DECREASE_PENDING_REQ_COUNT

#define DECREASE_PENDING_REQ_COUNT (   handle)
Value:
do { \
assert(handle->reqs_pending > 0); \
handle->reqs_pending--; \
handle->reqs_pending == 0) { \
uv_want_endgame(loop, (uv_handle_t*)handle); \
} \
} while (0)
uv_loop_t * loop
Definition: main.c:7
if(dbg->bits==RZ_SYS_BITS_64)
Definition: windows-arm64.h:4

Definition at line 51 of file handle-inl.h.

◆ INCREASE_ACTIVE_COUNT

#define INCREASE_ACTIVE_COUNT (   loop,
  handle 
)
Value:
do { \
if ((handle)->activecnt++ == 0) { \
uv__handle_start((handle)); \
} \
assert((handle)->activecnt > 0); \
} while (0)

Definition at line 42 of file handle-inl.h.

◆ uv__handle_close

#define uv__handle_close (   handle)
Value:
do { \
QUEUE_REMOVE(&(handle)->handle_queue); \
uv__active_handle_rm((uv_handle_t*) (handle)); \
\
if ((handle)->close_cb) \
(handle)->close_cb((uv_handle_t*) (handle)); \
} while (0)
@ UV_HANDLE_CLOSED
Definition: uv-common.h:75

Definition at line 76 of file handle-inl.h.

◆ uv__handle_closing

#define uv__handle_closing (   handle)
Value:
do { \
assert(!((handle)->flags & UV_HANDLE_CLOSING)); \
uv__active_handle_add((uv_handle_t*) (handle)); \
\
} while (0)
@ UV_HANDLE_REF
Definition: uv-common.h:77
@ UV_HANDLE_ACTIVE
Definition: uv-common.h:76

Definition at line 63 of file handle-inl.h.

Function Documentation

◆ uv__get_osfhandle()

static INLINE HANDLE uv__get_osfhandle ( int  fd)
static

Definition at line 166 of file handle-inl.h.

167 {
168  /* _get_osfhandle() raises an assert in debug builds if the FD is invalid.
169  * But it also correctly checks the FD and returns INVALID_HANDLE_VALUE for
170  * invalid FDs in release builds (or if you let the assert continue). So this
171  * wrapper function disables asserts when calling _get_osfhandle. */
172 
173  HANDLE handle;
175  handle = (HANDLE) _get_osfhandle(fd);
177  return handle;
178 }
#define UV_BEGIN_DISABLE_CRT_ASSERT()
Definition: internal.h:56
#define UV_END_DISABLE_CRT_ASSERT()
Definition: internal.h:57
DWORD * HANDLE
static const z80_opcode fd[]
Definition: z80_tab.h:997

References fd, handle, HANDLE, UV_BEGIN_DISABLE_CRT_ASSERT, and UV_END_DISABLE_CRT_ASSERT.

Referenced by fs__fchmod(), fs__fstat(), fs__ftruncate(), fs__futime(), fs__read(), fs__sync_impl(), fs__write(), uv__duplicate_fd(), uv_get_osfhandle(), uv_guess_handle(), uv_pipe_open(), uv_poll_init(), and uv_tty_init().

◆ uv_process_endgames()

static INLINE void uv_process_endgames ( uv_loop_t loop)
static

Definition at line 98 of file handle-inl.h.

98  {
100 
101  while (loop->endgame_handles) {
102  handle = loop->endgame_handles;
103  loop->endgame_handles = handle->endgame_next;
104 
105  handle->flags &= ~UV_HANDLE_ENDGAME_QUEUED;
106 
107  switch (handle->type) {
108  case UV_TCP:
110  break;
111 
112  case UV_NAMED_PIPE:
114  break;
115 
116  case UV_TTY:
118  break;
119 
120  case UV_UDP:
122  break;
123 
124  case UV_POLL:
126  break;
127 
128  case UV_TIMER:
131  break;
132 
133  case UV_PREPARE:
134  case UV_CHECK:
135  case UV_IDLE:
137  break;
138 
139  case UV_ASYNC:
141  break;
142 
143  case UV_SIGNAL:
145  break;
146 
147  case UV_PROCESS:
149  break;
150 
151  case UV_FS_EVENT:
153  break;
154 
155  case UV_FS_POLL:
157  break;
158 
159  default:
160  assert(0);
161  break;
162  }
163  }
164 }
void uv_fs_event_endgame(uv_loop_t *loop, uv_fs_event_t *handle)
Definition: fs-event.c:597
#define uv__handle_close(handle)
Definition: handle-inl.h:76
assert(limit<=UINT32_MAX/2)
Definition: uv.h:844
Definition: uv.h:767
Definition: uv.h:793
Definition: uv.h:547
Definition: uv.h:860
Definition: uv.h:714
Definition: uv.h:638
void uv_tcp_endgame(uv_loop_t *loop, uv_tcp_t *handle)
Definition: tcp.c:208
void uv_poll_endgame(uv_loop_t *loop, uv_poll_t *handle)
Definition: poll.c:576
void uv_loop_watcher_endgame(uv_loop_t *loop, uv_handle_t *handle)
Definition: loop-watcher.c:29
void uv_pipe_endgame(uv_loop_t *loop, uv_pipe_t *handle)
Definition: pipe.c:382
void uv_signal_endgame(uv_loop_t *loop, uv_signal_t *handle)
Definition: signal.c:272
void uv__fs_poll_endgame(uv_loop_t *loop, uv_fs_poll_t *handle)
void uv_tty_endgame(uv_loop_t *loop, uv_tty_t *handle)
Definition: tty.c:2270
void uv_process_endgame(uv_loop_t *loop, uv_process_t *handle)
Definition: process.c:924
void uv_udp_endgame(uv_loop_t *loop, uv_udp_t *handle)
Definition: udp.c:183
void uv__timer_close(uv_timer_t *handle)
Definition: timer.c:182
@ UV_HANDLE_ENDGAME_QUEUED
Definition: uv-common.h:79
void uv_async_endgame(uv_loop_t *loop, uv_async_t *handle)
Definition: async.c:31

References assert(), handle, loop, uv__fs_poll_endgame(), uv__handle_close, uv__timer_close(), uv_async_endgame(), uv_fs_event_endgame(), UV_HANDLE_ENDGAME_QUEUED, uv_loop_watcher_endgame(), uv_pipe_endgame(), uv_poll_endgame(), uv_process_endgame(), uv_signal_endgame(), uv_tcp_endgame(), uv_tty_endgame(), and uv_udp_endgame().

Referenced by uv_run().

◆ uv_want_endgame()