/src/CMake/Utilities/cmlibuv/src/uv-common.h
Line | Count | Source |
1 | | /* Copyright Joyent, Inc. and other Node contributors. All rights reserved. |
2 | | * |
3 | | * Permission is hereby granted, free of charge, to any person obtaining a copy |
4 | | * of this software and associated documentation files (the "Software"), to |
5 | | * deal in the Software without restriction, including without limitation the |
6 | | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
7 | | * sell copies of the Software, and to permit persons to whom the Software is |
8 | | * furnished to do so, subject to the following conditions: |
9 | | * |
10 | | * The above copyright notice and this permission notice shall be included in |
11 | | * all copies or substantial portions of the Software. |
12 | | * |
13 | | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
14 | | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
15 | | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
16 | | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
17 | | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
18 | | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
19 | | * IN THE SOFTWARE. |
20 | | */ |
21 | | |
22 | | /* |
23 | | * This file is private to libuv. It provides common functionality to both |
24 | | * Windows and Unix backends. |
25 | | */ |
26 | | |
27 | | #ifndef UV_COMMON_H_ |
28 | | #define UV_COMMON_H_ |
29 | | |
30 | | #include <assert.h> |
31 | | #include <stdarg.h> |
32 | | #include <stddef.h> |
33 | | #include <stdint.h> |
34 | | #include <string.h> |
35 | | |
36 | | #include "uv.h" |
37 | | #include "uv/tree.h" |
38 | | #include "queue.h" |
39 | | #include "strscpy.h" |
40 | | |
41 | | #ifndef _MSC_VER |
42 | | # include <stdatomic.h> |
43 | | #endif |
44 | | |
45 | | #if EDOM > 0 |
46 | 0 | # define UV__ERR(x) (-(x)) |
47 | | #else |
48 | | # define UV__ERR(x) (x) |
49 | | #endif |
50 | | |
51 | | #if !defined(snprintf) && defined(_MSC_VER) && _MSC_VER < 1900 |
52 | | extern int snprintf(char*, size_t, const char*, ...); |
53 | | #endif |
54 | | |
55 | 0 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
56 | 0 | #define ARRAY_END(a) ((a) + ARRAY_SIZE(a)) |
57 | | |
58 | | #define container_of(ptr, type, member) \ |
59 | 0 | ((type *) ((char *) (ptr) - offsetof(type, member))) |
60 | | |
61 | | /* C11 defines static_assert to be a macro which calls _Static_assert. */ |
62 | | #if defined(static_assert) |
63 | 0 | #define STATIC_ASSERT(expr) static_assert(expr, #expr) |
64 | | #else |
65 | | #define STATIC_ASSERT(expr) \ |
66 | | void uv__static_assert(int static_assert_failed[1 - 2 * !(expr)]) |
67 | | #endif |
68 | | |
69 | | #ifdef _MSC_VER |
70 | | #define uv__exchange_int_relaxed(p, v) \ |
71 | | InterlockedExchangeNoFence((LONG volatile*)(p), v) |
72 | | #else |
73 | | #define uv__exchange_int_relaxed(p, v) \ |
74 | 0 | atomic_exchange_explicit((_Atomic int*)(p), v, memory_order_relaxed) |
75 | | #endif |
76 | | |
77 | 0 | #define UV__UDP_DGRAM_MAXSIZE (64 * 1024) |
78 | | |
79 | | /* Handle flags. Some flags are specific to Windows or UNIX. */ |
80 | | enum { |
81 | | /* Used by all handles. */ |
82 | | UV_HANDLE_CLOSING = 0x00000001, |
83 | | UV_HANDLE_CLOSED = 0x00000002, |
84 | | UV_HANDLE_ACTIVE = 0x00000004, |
85 | | UV_HANDLE_REF = 0x00000008, |
86 | | UV_HANDLE_INTERNAL = 0x00000010, |
87 | | UV_HANDLE_ENDGAME_QUEUED = 0x00000020, |
88 | | |
89 | | /* Used by streams. */ |
90 | | UV_HANDLE_LISTENING = 0x00000040, |
91 | | UV_HANDLE_CONNECTION = 0x00000080, |
92 | | UV_HANDLE_SHUT = 0x00000200, |
93 | | UV_HANDLE_READ_EOF = 0x00000800, |
94 | | |
95 | | /* Used by streams and UDP handles. */ |
96 | | UV_HANDLE_READING = 0x00001000, |
97 | | UV_HANDLE_BOUND = 0x00002000, |
98 | | UV_HANDLE_READABLE = 0x00004000, |
99 | | UV_HANDLE_WRITABLE = 0x00008000, |
100 | | UV_HANDLE_READ_PENDING = 0x00010000, |
101 | | UV_HANDLE_SYNC_BYPASS_IOCP = 0x00020000, |
102 | | UV_HANDLE_ZERO_READ = 0x00040000, |
103 | | UV_HANDLE_EMULATE_IOCP = 0x00080000, |
104 | | UV_HANDLE_BLOCKING_WRITES = 0x00100000, |
105 | | UV_HANDLE_CANCELLATION_PENDING = 0x00200000, |
106 | | |
107 | | /* Used by uv_tcp_t and uv_udp_t handles */ |
108 | | UV_HANDLE_IPV6 = 0x00400000, |
109 | | |
110 | | /* Only used by uv_tcp_t handles. */ |
111 | | UV_HANDLE_TCP_NODELAY = 0x01000000, |
112 | | UV_HANDLE_TCP_KEEPALIVE = 0x02000000, |
113 | | UV_HANDLE_TCP_SINGLE_ACCEPT = 0x04000000, |
114 | | UV_HANDLE_TCP_ACCEPT_STATE_CHANGING = 0x08000000, |
115 | | UV_HANDLE_SHARED_TCP_SOCKET = 0x10000000, |
116 | | |
117 | | /* Only used by uv_udp_t handles. */ |
118 | | UV_HANDLE_UDP_PROCESSING = 0x01000000, |
119 | | UV_HANDLE_UDP_CONNECTED = 0x02000000, |
120 | | UV_HANDLE_UDP_RECVMMSG = 0x04000000, |
121 | | |
122 | | /* Only used by uv_pipe_t handles. */ |
123 | | UV_HANDLE_NON_OVERLAPPED_PIPE = 0x01000000, |
124 | | UV_HANDLE_PIPESERVER = 0x02000000, |
125 | | |
126 | | /* Only used by uv_tty_t handles. */ |
127 | | UV_HANDLE_TTY_READABLE = 0x01000000, |
128 | | UV_HANDLE_UNUSED0 = 0x02000000, |
129 | | UV_HANDLE_TTY_SAVED_POSITION = 0x04000000, |
130 | | UV_HANDLE_TTY_SAVED_ATTRIBUTES = 0x08000000, |
131 | | |
132 | | /* Only used by uv_signal_t handles. */ |
133 | | UV_SIGNAL_ONE_SHOT_DISPATCHED = 0x01000000, |
134 | | UV_SIGNAL_ONE_SHOT = 0x02000000, |
135 | | |
136 | | /* Only used by uv_poll_t handles. */ |
137 | | UV_HANDLE_POLL_SLOW = 0x01000000, |
138 | | |
139 | | /* Only used by uv_process_t handles. */ |
140 | | UV_HANDLE_REAP = 0x10000000 |
141 | | }; |
142 | | |
143 | 0 | static inline int uv__is_raw_tty_mode(uv_tty_mode_t m) { |
144 | 0 | return m == UV_TTY_MODE_RAW || m == UV_TTY_MODE_RAW_VT; |
145 | 0 | } Unexecuted instantiation: timer.c:uv__is_raw_tty_mode Unexecuted instantiation: uv-common.c:uv__is_raw_tty_mode Unexecuted instantiation: async.c:uv__is_raw_tty_mode Unexecuted instantiation: core.c:uv__is_raw_tty_mode Unexecuted instantiation: fs.c:uv__is_raw_tty_mode Unexecuted instantiation: loop-watcher.c:uv__is_raw_tty_mode Unexecuted instantiation: loop.c:uv__is_raw_tty_mode Unexecuted instantiation: pipe.c:uv__is_raw_tty_mode Unexecuted instantiation: poll.c:uv__is_raw_tty_mode Unexecuted instantiation: process.c:uv__is_raw_tty_mode Unexecuted instantiation: signal.c:uv__is_raw_tty_mode Unexecuted instantiation: stream.c:uv__is_raw_tty_mode Unexecuted instantiation: tcp.c:uv__is_raw_tty_mode Unexecuted instantiation: thread.c:uv__is_raw_tty_mode Unexecuted instantiation: tty.c:uv__is_raw_tty_mode Unexecuted instantiation: udp.c:uv__is_raw_tty_mode Unexecuted instantiation: linux.c:uv__is_raw_tty_mode Unexecuted instantiation: proctitle.c:uv__is_raw_tty_mode Unexecuted instantiation: fs-poll.c:uv__is_raw_tty_mode Unexecuted instantiation: inet.c:uv__is_raw_tty_mode Unexecuted instantiation: threadpool.c:uv__is_raw_tty_mode |
146 | | |
147 | | int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap); |
148 | | |
149 | | void uv__loop_close(uv_loop_t* loop); |
150 | | |
151 | | int uv__read_start(uv_stream_t* stream, |
152 | | uv_alloc_cb alloc_cb, |
153 | | uv_read_cb read_cb); |
154 | | |
155 | | int uv__tcp_bind(uv_tcp_t* tcp, |
156 | | const struct sockaddr* addr, |
157 | | unsigned int addrlen, |
158 | | unsigned int flags); |
159 | | |
160 | | int uv__tcp_connect(uv_connect_t* req, |
161 | | uv_tcp_t* handle, |
162 | | const struct sockaddr* addr, |
163 | | unsigned int addrlen, |
164 | | uv_connect_cb cb); |
165 | | |
166 | | int uv__udp_init_ex(uv_loop_t* loop, |
167 | | uv_udp_t* handle, |
168 | | unsigned flags, |
169 | | int domain); |
170 | | |
171 | | int uv__udp_bind(uv_udp_t* handle, |
172 | | const struct sockaddr* addr, |
173 | | unsigned int addrlen, |
174 | | unsigned int flags); |
175 | | |
176 | | int uv__udp_connect(uv_udp_t* handle, |
177 | | const struct sockaddr* addr, |
178 | | unsigned int addrlen); |
179 | | |
180 | | int uv__udp_disconnect(uv_udp_t* handle); |
181 | | |
182 | | int uv__udp_is_connected(uv_udp_t* handle); |
183 | | |
184 | | int uv__udp_send(uv_udp_send_t* req, |
185 | | uv_udp_t* handle, |
186 | | const uv_buf_t bufs[], |
187 | | unsigned int nbufs, |
188 | | const struct sockaddr* addr, |
189 | | unsigned int addrlen, |
190 | | uv_udp_send_cb send_cb); |
191 | | |
192 | | int uv__udp_try_send(uv_udp_t* handle, |
193 | | const uv_buf_t bufs[], |
194 | | unsigned int nbufs, |
195 | | const struct sockaddr* addr, |
196 | | unsigned int addrlen); |
197 | | |
198 | | int uv__udp_try_send2(uv_udp_t* handle, |
199 | | unsigned int count, |
200 | | uv_buf_t* bufs[/*count*/], |
201 | | unsigned int nbufs[/*count*/], |
202 | | struct sockaddr* addrs[/*count*/]); |
203 | | |
204 | | int uv__udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloccb, |
205 | | uv_udp_recv_cb recv_cb); |
206 | | |
207 | | int uv__udp_recv_stop(uv_udp_t* handle); |
208 | | |
209 | | void uv__fs_poll_close(uv_fs_poll_t* handle); |
210 | | |
211 | | int uv__getaddrinfo_translate_error(int sys_err); /* EAI_* error. */ |
212 | | |
213 | | enum uv__work_kind { |
214 | | UV__WORK_CPU, |
215 | | UV__WORK_FAST_IO, |
216 | | UV__WORK_SLOW_IO |
217 | | }; |
218 | | |
219 | | void uv__work_submit(uv_loop_t* loop, |
220 | | struct uv__work *w, |
221 | | enum uv__work_kind kind, |
222 | | void (*work)(struct uv__work *w), |
223 | | void (*done)(struct uv__work *w, int status)); |
224 | | |
225 | | void uv__work_done(uv_async_t* handle); |
226 | | |
227 | | size_t uv__count_bufs(const uv_buf_t bufs[], unsigned int nbufs); |
228 | | |
229 | | int uv__socket_sockopt(uv_handle_t* handle, int optname, int* value); |
230 | | |
231 | | void uv__fs_scandir_cleanup(uv_fs_t* req); |
232 | | void uv__fs_readdir_cleanup(uv_fs_t* req); |
233 | | uv_dirent_type_t uv__fs_get_dirent_type(uv__dirent_t* dent); |
234 | | |
235 | | int uv__next_timeout(const uv_loop_t* loop); |
236 | | void uv__run_timers(uv_loop_t* loop); |
237 | | void uv__timer_close(uv_timer_t* handle); |
238 | | |
239 | | void uv__process_title_cleanup(void); |
240 | | void uv__signal_cleanup(void); |
241 | | void uv__threadpool_cleanup(void); |
242 | | |
243 | | #define uv__has_active_reqs(loop) \ |
244 | 0 | ((loop)->active_reqs.count > 0) |
245 | | |
246 | | #define uv__req_register(loop) \ |
247 | 0 | do { \ |
248 | 0 | (loop)->active_reqs.count++; \ |
249 | 0 | } \ |
250 | 0 | while (0) |
251 | | |
252 | | #define uv__req_unregister(loop) \ |
253 | 0 | do { \ |
254 | 0 | assert(uv__has_active_reqs(loop)); \ |
255 | 0 | (loop)->active_reqs.count--; \ |
256 | 0 | } \ |
257 | 0 | while (0) |
258 | | |
259 | | #define uv__has_active_handles(loop) \ |
260 | 0 | ((loop)->active_handles > 0) |
261 | | |
262 | | #define uv__active_handle_add(h) \ |
263 | 0 | do { \ |
264 | 0 | (h)->loop->active_handles++; \ |
265 | 0 | } \ |
266 | 0 | while (0) |
267 | | |
268 | | #define uv__active_handle_rm(h) \ |
269 | 0 | do { \ |
270 | 0 | (h)->loop->active_handles--; \ |
271 | 0 | } \ |
272 | 0 | while (0) |
273 | | |
274 | | #define uv__is_active(h) \ |
275 | 0 | (((h)->flags & UV_HANDLE_ACTIVE) != 0) |
276 | | |
277 | | #define uv__is_closing(h) \ |
278 | 0 | (((h)->flags & (UV_HANDLE_CLOSING | UV_HANDLE_CLOSED)) != 0) |
279 | | |
280 | | #if defined(_WIN32) |
281 | | # define uv__is_stream_shutting(h) \ |
282 | | (h->stream.conn.shutdown_req != NULL) |
283 | | #else |
284 | | # define uv__is_stream_shutting(h) \ |
285 | 0 | (h->shutdown_req != NULL) |
286 | | #endif |
287 | | |
288 | | #define uv__handle_start(h) \ |
289 | 0 | do { \ |
290 | 0 | if (((h)->flags & UV_HANDLE_ACTIVE) != 0) break; \ |
291 | 0 | (h)->flags |= UV_HANDLE_ACTIVE; \ |
292 | 0 | if (((h)->flags & UV_HANDLE_REF) != 0) uv__active_handle_add(h); \ |
293 | 0 | } \ |
294 | 0 | while (0) |
295 | | |
296 | | #define uv__handle_stop(h) \ |
297 | 0 | do { \ |
298 | 0 | if (((h)->flags & UV_HANDLE_ACTIVE) == 0) break; \ |
299 | 0 | (h)->flags &= ~UV_HANDLE_ACTIVE; \ |
300 | 0 | if (((h)->flags & UV_HANDLE_REF) != 0) uv__active_handle_rm(h); \ |
301 | 0 | } \ |
302 | 0 | while (0) |
303 | | |
304 | | #define uv__handle_ref(h) \ |
305 | 0 | do { \ |
306 | 0 | if (((h)->flags & UV_HANDLE_REF) != 0) break; \ |
307 | 0 | (h)->flags |= UV_HANDLE_REF; \ |
308 | 0 | if (((h)->flags & UV_HANDLE_CLOSING) != 0) break; \ |
309 | 0 | if (((h)->flags & UV_HANDLE_ACTIVE) != 0) uv__active_handle_add(h); \ |
310 | 0 | } \ |
311 | 0 | while (0) |
312 | | |
313 | | #define uv__handle_unref(h) \ |
314 | 0 | do { \ |
315 | 0 | if (((h)->flags & UV_HANDLE_REF) == 0) break; \ |
316 | 0 | (h)->flags &= ~UV_HANDLE_REF; \ |
317 | 0 | if (((h)->flags & UV_HANDLE_CLOSING) != 0) break; \ |
318 | 0 | if (((h)->flags & UV_HANDLE_ACTIVE) != 0) uv__active_handle_rm(h); \ |
319 | 0 | } \ |
320 | 0 | while (0) |
321 | | |
322 | | #define uv__has_ref(h) \ |
323 | 0 | (((h)->flags & UV_HANDLE_REF) != 0) |
324 | | |
325 | | #if defined(_WIN32) |
326 | | # define uv__handle_platform_init(h) ((h)->u.fd = -1) |
327 | | #else |
328 | 0 | # define uv__handle_platform_init(h) ((h)->next_closing = NULL) |
329 | | #endif |
330 | | |
331 | | #define uv__handle_init(loop_, h, type_) \ |
332 | 0 | do { \ |
333 | 0 | (h)->loop = (loop_); \ |
334 | 0 | (h)->type = (type_); \ |
335 | 0 | (h)->flags = UV_HANDLE_REF; /* Ref the loop when active. */ \ |
336 | 0 | uv__queue_insert_tail(&(loop_)->handle_queue, &(h)->handle_queue); \ |
337 | 0 | uv__handle_platform_init(h); \ |
338 | 0 | } \ |
339 | 0 | while (0) |
340 | | |
341 | | /* Note: uses an open-coded version of SET_REQ_SUCCESS() because of |
342 | | * a circular dependency between src/uv-common.h and src/win/internal.h. |
343 | | */ |
344 | | #if defined(_WIN32) |
345 | | # define UV_REQ_INIT(req, typ) \ |
346 | | do { \ |
347 | | (req)->type = (typ); \ |
348 | | (req)->u.io.overlapped.Internal = 0; /* SET_REQ_SUCCESS() */ \ |
349 | | } \ |
350 | | while (0) |
351 | | #else |
352 | | # define UV_REQ_INIT(req, typ) \ |
353 | 0 | do { \ |
354 | 0 | (req)->type = (typ); \ |
355 | 0 | } \ |
356 | 0 | while (0) |
357 | | #endif |
358 | | |
359 | | #define uv__req_init(loop, req, typ) \ |
360 | 0 | do { \ |
361 | 0 | UV_REQ_INIT(req, typ); \ |
362 | 0 | uv__req_register(loop); \ |
363 | 0 | } \ |
364 | 0 | while (0) |
365 | | |
366 | | #define uv__get_internal_fields(loop) \ |
367 | 0 | ((uv__loop_internal_fields_t*) loop->internal_fields) |
368 | | |
369 | | #define uv__get_loop_metrics(loop) \ |
370 | 0 | (&uv__get_internal_fields(loop)->loop_metrics) |
371 | | |
372 | | #define uv__metrics_inc_loop_count(loop) \ |
373 | 0 | do { \ |
374 | 0 | uv__get_loop_metrics(loop)->metrics.loop_count++; \ |
375 | 0 | } while (0) |
376 | | |
377 | | #define uv__metrics_inc_events(loop, e) \ |
378 | 0 | do { \ |
379 | 0 | uv__get_loop_metrics(loop)->metrics.events += (e); \ |
380 | 0 | } while (0) |
381 | | |
382 | | #define uv__metrics_inc_events_waiting(loop, e) \ |
383 | 0 | do { \ |
384 | 0 | uv__get_loop_metrics(loop)->metrics.events_waiting += (e); \ |
385 | 0 | } while (0) |
386 | | |
387 | | /* Allocator prototypes */ |
388 | | void *uv__calloc(size_t count, size_t size); |
389 | | char *uv__strdup(const char* s); |
390 | | char *uv__strndup(const char* s, size_t n); |
391 | | void* uv__malloc(size_t size); |
392 | | void uv__free(void* ptr); |
393 | | void* uv__realloc(void* ptr, size_t size); |
394 | | void* uv__reallocf(void* ptr, size_t size); |
395 | | |
396 | | typedef struct uv__loop_metrics_s uv__loop_metrics_t; |
397 | | typedef struct uv__loop_internal_fields_s uv__loop_internal_fields_t; |
398 | | |
399 | | struct uv__loop_metrics_s { |
400 | | uv_metrics_t metrics; |
401 | | uint64_t provider_entry_time; |
402 | | uint64_t provider_idle_time; |
403 | | uv_mutex_t lock; |
404 | | }; |
405 | | |
406 | | void uv__metrics_update_idle_time(uv_loop_t* loop); |
407 | | void uv__metrics_set_provider_entry_time(uv_loop_t* loop); |
408 | | |
409 | | #ifdef __linux__ |
410 | | struct uv__iou { |
411 | | uint32_t* sqhead; |
412 | | uint32_t* sqtail; |
413 | | uint32_t sqmask; |
414 | | uint32_t* sqflags; |
415 | | uint32_t* cqhead; |
416 | | uint32_t* cqtail; |
417 | | uint32_t cqmask; |
418 | | void* sq; /* pointer to munmap() on event loop teardown */ |
419 | | void* cqe; /* pointer to array of struct uv__io_uring_cqe */ |
420 | | void* sqe; /* pointer to array of struct uv__io_uring_sqe */ |
421 | | size_t sqlen; |
422 | | size_t cqlen; |
423 | | size_t maxlen; |
424 | | size_t sqelen; |
425 | | int ringfd; |
426 | | uint32_t in_flight; |
427 | | }; |
428 | | #endif /* __linux__ */ |
429 | | |
430 | | struct uv__loop_internal_fields_s { |
431 | | unsigned int flags; |
432 | | uv__loop_metrics_t loop_metrics; |
433 | | int current_timeout; |
434 | | #ifdef __linux__ |
435 | | struct uv__iou ctl; |
436 | | struct uv__iou iou; |
437 | | void* inv; /* used by uv__platform_invalidate_fd() */ |
438 | | #endif /* __linux__ */ |
439 | | }; |
440 | | |
441 | | #if defined(_WIN32) |
442 | | # define UV_PTHREAD_MAX_NAMELEN_NP 32767 |
443 | | #elif defined(__APPLE__) |
444 | | # define UV_PTHREAD_MAX_NAMELEN_NP 64 |
445 | | #elif defined(__NetBSD__) || defined(__illumos__) |
446 | | # define UV_PTHREAD_MAX_NAMELEN_NP PTHREAD_MAX_NAMELEN_NP |
447 | | #elif defined (__linux__) |
448 | | # define UV_PTHREAD_MAX_NAMELEN_NP 16 |
449 | | #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) |
450 | | # define UV_PTHREAD_MAX_NAMELEN_NP (MAXCOMLEN + 1) |
451 | | #else |
452 | | # define UV_PTHREAD_MAX_NAMELEN_NP 16 |
453 | | #endif |
454 | | |
455 | | /* Open-coded so downstream users don't have to link libm. */ |
456 | 0 | static inline int uv__isinf(double d) { |
457 | 0 | uint64_t v; |
458 | |
|
459 | 0 | STATIC_ASSERT(sizeof(v) == sizeof(d)); |
460 | 0 | memcpy(&v, &d, sizeof(v)); |
461 | 0 | return (v << 1 >> 53) == 2047 && !(v << 12); |
462 | 0 | } Unexecuted instantiation: timer.c:uv__isinf Unexecuted instantiation: uv-common.c:uv__isinf Unexecuted instantiation: async.c:uv__isinf Unexecuted instantiation: core.c:uv__isinf Unexecuted instantiation: fs.c:uv__isinf Unexecuted instantiation: loop-watcher.c:uv__isinf Unexecuted instantiation: loop.c:uv__isinf Unexecuted instantiation: pipe.c:uv__isinf Unexecuted instantiation: poll.c:uv__isinf Unexecuted instantiation: process.c:uv__isinf Unexecuted instantiation: signal.c:uv__isinf Unexecuted instantiation: stream.c:uv__isinf Unexecuted instantiation: tcp.c:uv__isinf Unexecuted instantiation: thread.c:uv__isinf Unexecuted instantiation: tty.c:uv__isinf Unexecuted instantiation: udp.c:uv__isinf Unexecuted instantiation: linux.c:uv__isinf Unexecuted instantiation: proctitle.c:uv__isinf Unexecuted instantiation: fs-poll.c:uv__isinf Unexecuted instantiation: inet.c:uv__isinf Unexecuted instantiation: threadpool.c:uv__isinf |
463 | | |
464 | | /* Open-coded so downstream users don't have to link libm. */ |
465 | 0 | static inline int uv__isnan(double d) { |
466 | 0 | uint64_t v; |
467 | |
|
468 | 0 | STATIC_ASSERT(sizeof(v) == sizeof(d)); |
469 | 0 | memcpy(&v, &d, sizeof(v)); |
470 | 0 | return (v << 1 >> 53) == 2047 && !!(v << 12); |
471 | 0 | } Unexecuted instantiation: timer.c:uv__isnan Unexecuted instantiation: uv-common.c:uv__isnan Unexecuted instantiation: async.c:uv__isnan Unexecuted instantiation: core.c:uv__isnan Unexecuted instantiation: fs.c:uv__isnan Unexecuted instantiation: loop-watcher.c:uv__isnan Unexecuted instantiation: loop.c:uv__isnan Unexecuted instantiation: pipe.c:uv__isnan Unexecuted instantiation: poll.c:uv__isnan Unexecuted instantiation: process.c:uv__isnan Unexecuted instantiation: signal.c:uv__isnan Unexecuted instantiation: stream.c:uv__isnan Unexecuted instantiation: tcp.c:uv__isnan Unexecuted instantiation: thread.c:uv__isnan Unexecuted instantiation: tty.c:uv__isnan Unexecuted instantiation: udp.c:uv__isnan Unexecuted instantiation: linux.c:uv__isnan Unexecuted instantiation: proctitle.c:uv__isnan Unexecuted instantiation: fs-poll.c:uv__isnan Unexecuted instantiation: inet.c:uv__isnan Unexecuted instantiation: threadpool.c:uv__isnan |
472 | | |
473 | | #endif /* UV_COMMON_H_ */ |