17777dab0Sopenharmony_ci/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. 27777dab0Sopenharmony_ci * 37777dab0Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a copy 47777dab0Sopenharmony_ci * of this software and associated documentation files (the "Software"), to 57777dab0Sopenharmony_ci * deal in the Software without restriction, including without limitation the 67777dab0Sopenharmony_ci * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 77777dab0Sopenharmony_ci * sell copies of the Software, and to permit persons to whom the Software is 87777dab0Sopenharmony_ci * furnished to do so, subject to the following conditions: 97777dab0Sopenharmony_ci * 107777dab0Sopenharmony_ci * The above copyright notice and this permission notice shall be included in 117777dab0Sopenharmony_ci * all copies or substantial portions of the Software. 127777dab0Sopenharmony_ci * 137777dab0Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 147777dab0Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 157777dab0Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 167777dab0Sopenharmony_ci * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 177777dab0Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 187777dab0Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 197777dab0Sopenharmony_ci * IN THE SOFTWARE. 207777dab0Sopenharmony_ci */ 217777dab0Sopenharmony_ci 227777dab0Sopenharmony_ci#ifndef UV_UNIX_H 237777dab0Sopenharmony_ci#define UV_UNIX_H 247777dab0Sopenharmony_ci 257777dab0Sopenharmony_ci#include <sys/types.h> 267777dab0Sopenharmony_ci#include <sys/stat.h> 277777dab0Sopenharmony_ci#include <fcntl.h> 287777dab0Sopenharmony_ci#include <dirent.h> 297777dab0Sopenharmony_ci 307777dab0Sopenharmony_ci#include <sys/socket.h> 317777dab0Sopenharmony_ci#include <netinet/in.h> 327777dab0Sopenharmony_ci#include <netinet/tcp.h> 337777dab0Sopenharmony_ci#include <arpa/inet.h> 347777dab0Sopenharmony_ci#include <netdb.h> /* MAXHOSTNAMELEN on Solaris */ 357777dab0Sopenharmony_ci 367777dab0Sopenharmony_ci#include <termios.h> 377777dab0Sopenharmony_ci#include <pwd.h> 387777dab0Sopenharmony_ci 397777dab0Sopenharmony_ci#if !defined(__MVS__) 407777dab0Sopenharmony_ci#include <semaphore.h> 417777dab0Sopenharmony_ci#include <sys/param.h> /* MAXHOSTNAMELEN on Linux and the BSDs */ 427777dab0Sopenharmony_ci#endif 437777dab0Sopenharmony_ci#include <pthread.h> 447777dab0Sopenharmony_ci#include <signal.h> 457777dab0Sopenharmony_ci 467777dab0Sopenharmony_ci#include "uv/threadpool.h" 477777dab0Sopenharmony_ci 487777dab0Sopenharmony_ci#if defined(__linux__) 497777dab0Sopenharmony_ci# include "uv/linux.h" 507777dab0Sopenharmony_ci#elif defined (__MVS__) 517777dab0Sopenharmony_ci# include "uv/os390.h" 527777dab0Sopenharmony_ci#elif defined(__PASE__) /* __PASE__ and _AIX are both defined on IBM i */ 537777dab0Sopenharmony_ci# include "uv/posix.h" /* IBM i needs uv/posix.h, not uv/aix.h */ 547777dab0Sopenharmony_ci#elif defined(_AIX) 557777dab0Sopenharmony_ci# include "uv/aix.h" 567777dab0Sopenharmony_ci#elif defined(__sun) 577777dab0Sopenharmony_ci# include "uv/sunos.h" 587777dab0Sopenharmony_ci#elif defined(__APPLE__) 597777dab0Sopenharmony_ci# include "uv/darwin.h" 607777dab0Sopenharmony_ci#elif defined(__DragonFly__) || \ 617777dab0Sopenharmony_ci defined(__FreeBSD__) || \ 627777dab0Sopenharmony_ci defined(__FreeBSD_kernel__) || \ 637777dab0Sopenharmony_ci defined(__OpenBSD__) || \ 647777dab0Sopenharmony_ci defined(__NetBSD__) 657777dab0Sopenharmony_ci# include "uv/bsd.h" 667777dab0Sopenharmony_ci#elif defined(__CYGWIN__) || \ 677777dab0Sopenharmony_ci defined(__MSYS__) || \ 687777dab0Sopenharmony_ci defined(__HAIKU__) || \ 697777dab0Sopenharmony_ci defined(__QNX__) || \ 707777dab0Sopenharmony_ci defined(__GNU__) 717777dab0Sopenharmony_ci# include "uv/posix.h" 727777dab0Sopenharmony_ci#endif 737777dab0Sopenharmony_ci 747777dab0Sopenharmony_ci#ifndef NI_MAXHOST 757777dab0Sopenharmony_ci# define NI_MAXHOST 1025 767777dab0Sopenharmony_ci#endif 777777dab0Sopenharmony_ci 787777dab0Sopenharmony_ci#ifndef NI_MAXSERV 797777dab0Sopenharmony_ci# define NI_MAXSERV 32 807777dab0Sopenharmony_ci#endif 817777dab0Sopenharmony_ci 827777dab0Sopenharmony_ci#ifndef UV_IO_PRIVATE_PLATFORM_FIELDS 837777dab0Sopenharmony_ci# define UV_IO_PRIVATE_PLATFORM_FIELDS /* empty */ 847777dab0Sopenharmony_ci#endif 857777dab0Sopenharmony_ci 867777dab0Sopenharmony_cistruct uv__io_s; 877777dab0Sopenharmony_cistruct uv_loop_s; 887777dab0Sopenharmony_ci 897777dab0Sopenharmony_citypedef void (*uv__io_cb)(struct uv_loop_s* loop, 907777dab0Sopenharmony_ci struct uv__io_s* w, 917777dab0Sopenharmony_ci unsigned int events); 927777dab0Sopenharmony_citypedef struct uv__io_s uv__io_t; 937777dab0Sopenharmony_ci 947777dab0Sopenharmony_cistruct uv__io_s { 957777dab0Sopenharmony_ci uv__io_cb cb; 967777dab0Sopenharmony_ci void* pending_queue[2]; 977777dab0Sopenharmony_ci void* watcher_queue[2]; 987777dab0Sopenharmony_ci unsigned int pevents; /* Pending event mask i.e. mask at next tick. */ 997777dab0Sopenharmony_ci unsigned int events; /* Current event mask. */ 1007777dab0Sopenharmony_ci int fd; 1017777dab0Sopenharmony_ci UV_IO_PRIVATE_PLATFORM_FIELDS 1027777dab0Sopenharmony_ci}; 1037777dab0Sopenharmony_ci 1047777dab0Sopenharmony_ci#ifndef UV_PLATFORM_SEM_T 1057777dab0Sopenharmony_ci# define UV_PLATFORM_SEM_T sem_t 1067777dab0Sopenharmony_ci#endif 1077777dab0Sopenharmony_ci 1087777dab0Sopenharmony_ci#ifndef UV_PLATFORM_LOOP_FIELDS 1097777dab0Sopenharmony_ci# define UV_PLATFORM_LOOP_FIELDS /* empty */ 1107777dab0Sopenharmony_ci#endif 1117777dab0Sopenharmony_ci 1127777dab0Sopenharmony_ci#ifndef UV_PLATFORM_FS_EVENT_FIELDS 1137777dab0Sopenharmony_ci# define UV_PLATFORM_FS_EVENT_FIELDS /* empty */ 1147777dab0Sopenharmony_ci#endif 1157777dab0Sopenharmony_ci 1167777dab0Sopenharmony_ci#ifndef UV_STREAM_PRIVATE_PLATFORM_FIELDS 1177777dab0Sopenharmony_ci# define UV_STREAM_PRIVATE_PLATFORM_FIELDS /* empty */ 1187777dab0Sopenharmony_ci#endif 1197777dab0Sopenharmony_ci 1207777dab0Sopenharmony_ci/* Note: May be cast to struct iovec. See writev(2). */ 1217777dab0Sopenharmony_citypedef struct uv_buf_t { 1227777dab0Sopenharmony_ci char* base; 1237777dab0Sopenharmony_ci size_t len; 1247777dab0Sopenharmony_ci} uv_buf_t; 1257777dab0Sopenharmony_ci 1267777dab0Sopenharmony_citypedef int uv_file; 1277777dab0Sopenharmony_citypedef int uv_os_sock_t; 1287777dab0Sopenharmony_citypedef int uv_os_fd_t; 1297777dab0Sopenharmony_citypedef pid_t uv_pid_t; 1307777dab0Sopenharmony_ci 1317777dab0Sopenharmony_ci#define UV_ONCE_INIT PTHREAD_ONCE_INIT 1327777dab0Sopenharmony_ci 1337777dab0Sopenharmony_citypedef pthread_once_t uv_once_t; 1347777dab0Sopenharmony_citypedef pthread_t uv_thread_t; 1357777dab0Sopenharmony_citypedef pthread_mutex_t uv_mutex_t; 1367777dab0Sopenharmony_citypedef pthread_rwlock_t uv_rwlock_t; 1377777dab0Sopenharmony_citypedef UV_PLATFORM_SEM_T uv_sem_t; 1387777dab0Sopenharmony_citypedef pthread_cond_t uv_cond_t; 1397777dab0Sopenharmony_citypedef pthread_key_t uv_key_t; 1407777dab0Sopenharmony_ci 1417777dab0Sopenharmony_ci/* Note: guard clauses should match uv_barrier_init's in src/unix/thread.c. */ 1427777dab0Sopenharmony_ci#if defined(_AIX) || \ 1437777dab0Sopenharmony_ci defined(__OpenBSD__) || \ 1447777dab0Sopenharmony_ci !defined(PTHREAD_BARRIER_SERIAL_THREAD) 1457777dab0Sopenharmony_ci/* TODO(bnoordhuis) Merge into uv_barrier_t in v2. */ 1467777dab0Sopenharmony_cistruct _uv_barrier { 1477777dab0Sopenharmony_ci uv_mutex_t mutex; 1487777dab0Sopenharmony_ci uv_cond_t cond; 1497777dab0Sopenharmony_ci unsigned threshold; 1507777dab0Sopenharmony_ci unsigned in; 1517777dab0Sopenharmony_ci unsigned out; 1527777dab0Sopenharmony_ci}; 1537777dab0Sopenharmony_ci 1547777dab0Sopenharmony_citypedef struct { 1557777dab0Sopenharmony_ci struct _uv_barrier* b; 1567777dab0Sopenharmony_ci# if defined(PTHREAD_BARRIER_SERIAL_THREAD) 1577777dab0Sopenharmony_ci /* TODO(bnoordhuis) Remove padding in v2. */ 1587777dab0Sopenharmony_ci char pad[sizeof(pthread_barrier_t) - sizeof(struct _uv_barrier*)]; 1597777dab0Sopenharmony_ci# endif 1607777dab0Sopenharmony_ci} uv_barrier_t; 1617777dab0Sopenharmony_ci#else 1627777dab0Sopenharmony_citypedef pthread_barrier_t uv_barrier_t; 1637777dab0Sopenharmony_ci#endif 1647777dab0Sopenharmony_ci 1657777dab0Sopenharmony_ci/* Platform-specific definitions for uv_spawn support. */ 1667777dab0Sopenharmony_citypedef gid_t uv_gid_t; 1677777dab0Sopenharmony_citypedef uid_t uv_uid_t; 1687777dab0Sopenharmony_ci 1697777dab0Sopenharmony_citypedef struct dirent uv__dirent_t; 1707777dab0Sopenharmony_ci 1717777dab0Sopenharmony_ci#define UV_DIR_PRIVATE_FIELDS \ 1727777dab0Sopenharmony_ci DIR* dir; 1737777dab0Sopenharmony_ci 1747777dab0Sopenharmony_ci#if defined(DT_UNKNOWN) 1757777dab0Sopenharmony_ci# define HAVE_DIRENT_TYPES 1767777dab0Sopenharmony_ci# if defined(DT_REG) 1777777dab0Sopenharmony_ci# define UV__DT_FILE DT_REG 1787777dab0Sopenharmony_ci# else 1797777dab0Sopenharmony_ci# define UV__DT_FILE -1 1807777dab0Sopenharmony_ci# endif 1817777dab0Sopenharmony_ci# if defined(DT_DIR) 1827777dab0Sopenharmony_ci# define UV__DT_DIR DT_DIR 1837777dab0Sopenharmony_ci# else 1847777dab0Sopenharmony_ci# define UV__DT_DIR -2 1857777dab0Sopenharmony_ci# endif 1867777dab0Sopenharmony_ci# if defined(DT_LNK) 1877777dab0Sopenharmony_ci# define UV__DT_LINK DT_LNK 1887777dab0Sopenharmony_ci# else 1897777dab0Sopenharmony_ci# define UV__DT_LINK -3 1907777dab0Sopenharmony_ci# endif 1917777dab0Sopenharmony_ci# if defined(DT_FIFO) 1927777dab0Sopenharmony_ci# define UV__DT_FIFO DT_FIFO 1937777dab0Sopenharmony_ci# else 1947777dab0Sopenharmony_ci# define UV__DT_FIFO -4 1957777dab0Sopenharmony_ci# endif 1967777dab0Sopenharmony_ci# if defined(DT_SOCK) 1977777dab0Sopenharmony_ci# define UV__DT_SOCKET DT_SOCK 1987777dab0Sopenharmony_ci# else 1997777dab0Sopenharmony_ci# define UV__DT_SOCKET -5 2007777dab0Sopenharmony_ci# endif 2017777dab0Sopenharmony_ci# if defined(DT_CHR) 2027777dab0Sopenharmony_ci# define UV__DT_CHAR DT_CHR 2037777dab0Sopenharmony_ci# else 2047777dab0Sopenharmony_ci# define UV__DT_CHAR -6 2057777dab0Sopenharmony_ci# endif 2067777dab0Sopenharmony_ci# if defined(DT_BLK) 2077777dab0Sopenharmony_ci# define UV__DT_BLOCK DT_BLK 2087777dab0Sopenharmony_ci# else 2097777dab0Sopenharmony_ci# define UV__DT_BLOCK -7 2107777dab0Sopenharmony_ci# endif 2117777dab0Sopenharmony_ci#endif 2127777dab0Sopenharmony_ci 2137777dab0Sopenharmony_ci/* Platform-specific definitions for uv_dlopen support. */ 2147777dab0Sopenharmony_ci#define UV_DYNAMIC /* empty */ 2157777dab0Sopenharmony_ci 2167777dab0Sopenharmony_citypedef struct { 2177777dab0Sopenharmony_ci void* handle; 2187777dab0Sopenharmony_ci char* errmsg; 2197777dab0Sopenharmony_ci} uv_lib_t; 2207777dab0Sopenharmony_ci 2217777dab0Sopenharmony_ci#define UV_LOOP_PRIVATE_FIELDS \ 2227777dab0Sopenharmony_ci unsigned long flags; \ 2237777dab0Sopenharmony_ci int backend_fd; \ 2247777dab0Sopenharmony_ci void* pending_queue[2]; \ 2257777dab0Sopenharmony_ci void* watcher_queue[2]; \ 2267777dab0Sopenharmony_ci uv__io_t** watchers; \ 2277777dab0Sopenharmony_ci unsigned int nwatchers; \ 2287777dab0Sopenharmony_ci unsigned int nfds; \ 2297777dab0Sopenharmony_ci void* wq[2]; \ 2307777dab0Sopenharmony_ci uv_mutex_t wq_mutex; \ 2317777dab0Sopenharmony_ci uv_async_t wq_async; \ 2327777dab0Sopenharmony_ci uv_rwlock_t cloexec_lock; \ 2337777dab0Sopenharmony_ci uv_handle_t* closing_handles; \ 2347777dab0Sopenharmony_ci void* process_handles[2]; \ 2357777dab0Sopenharmony_ci void* prepare_handles[2]; \ 2367777dab0Sopenharmony_ci void* check_handles[2]; \ 2377777dab0Sopenharmony_ci void* idle_handles[2]; \ 2387777dab0Sopenharmony_ci void* async_handles[2]; \ 2397777dab0Sopenharmony_ci void (*async_unused)(void); /* TODO(bnoordhuis) Remove in libuv v2. */ \ 2407777dab0Sopenharmony_ci uv__io_t async_io_watcher; \ 2417777dab0Sopenharmony_ci int async_wfd; \ 2427777dab0Sopenharmony_ci struct { \ 2437777dab0Sopenharmony_ci void* min; \ 2447777dab0Sopenharmony_ci unsigned int nelts; \ 2457777dab0Sopenharmony_ci } timer_heap; \ 2467777dab0Sopenharmony_ci uint64_t timer_counter; \ 2477777dab0Sopenharmony_ci uint64_t time; \ 2487777dab0Sopenharmony_ci int signal_pipefd[2]; \ 2497777dab0Sopenharmony_ci uv__io_t signal_io_watcher; \ 2507777dab0Sopenharmony_ci uv_signal_t child_watcher; \ 2517777dab0Sopenharmony_ci int emfile_fd; \ 2527777dab0Sopenharmony_ci UV_PLATFORM_LOOP_FIELDS \ 2537777dab0Sopenharmony_ci 2547777dab0Sopenharmony_ci#define UV_REQ_TYPE_PRIVATE /* empty */ 2557777dab0Sopenharmony_ci 2567777dab0Sopenharmony_ci#define UV_REQ_PRIVATE_FIELDS /* empty */ 2577777dab0Sopenharmony_ci 2587777dab0Sopenharmony_ci#define UV_PRIVATE_REQ_TYPES /* empty */ 2597777dab0Sopenharmony_ci 2607777dab0Sopenharmony_ci#define UV_WRITE_PRIVATE_FIELDS \ 2617777dab0Sopenharmony_ci void* queue[2]; \ 2627777dab0Sopenharmony_ci unsigned int write_index; \ 2637777dab0Sopenharmony_ci uv_buf_t* bufs; \ 2647777dab0Sopenharmony_ci unsigned int nbufs; \ 2657777dab0Sopenharmony_ci int error; \ 2667777dab0Sopenharmony_ci uv_buf_t bufsml[4]; \ 2677777dab0Sopenharmony_ci 2687777dab0Sopenharmony_ci#define UV_CONNECT_PRIVATE_FIELDS \ 2697777dab0Sopenharmony_ci void* queue[2]; \ 2707777dab0Sopenharmony_ci 2717777dab0Sopenharmony_ci#define UV_SHUTDOWN_PRIVATE_FIELDS /* empty */ 2727777dab0Sopenharmony_ci 2737777dab0Sopenharmony_ci#define UV_UDP_SEND_PRIVATE_FIELDS \ 2747777dab0Sopenharmony_ci void* queue[2]; \ 2757777dab0Sopenharmony_ci struct sockaddr_storage addr; \ 2767777dab0Sopenharmony_ci unsigned int nbufs; \ 2777777dab0Sopenharmony_ci uv_buf_t* bufs; \ 2787777dab0Sopenharmony_ci ssize_t status; \ 2797777dab0Sopenharmony_ci uv_udp_send_cb send_cb; \ 2807777dab0Sopenharmony_ci uv_buf_t bufsml[4]; \ 2817777dab0Sopenharmony_ci 2827777dab0Sopenharmony_ci#define UV_HANDLE_PRIVATE_FIELDS \ 2837777dab0Sopenharmony_ci uv_handle_t* next_closing; \ 2847777dab0Sopenharmony_ci unsigned int flags; \ 2857777dab0Sopenharmony_ci 2867777dab0Sopenharmony_ci#define UV_STREAM_PRIVATE_FIELDS \ 2877777dab0Sopenharmony_ci uv_connect_t *connect_req; \ 2887777dab0Sopenharmony_ci uv_shutdown_t *shutdown_req; \ 2897777dab0Sopenharmony_ci uv__io_t io_watcher; \ 2907777dab0Sopenharmony_ci void* write_queue[2]; \ 2917777dab0Sopenharmony_ci void* write_completed_queue[2]; \ 2927777dab0Sopenharmony_ci uv_connection_cb connection_cb; \ 2937777dab0Sopenharmony_ci int delayed_error; \ 2947777dab0Sopenharmony_ci int accepted_fd; \ 2957777dab0Sopenharmony_ci void* queued_fds; \ 2967777dab0Sopenharmony_ci UV_STREAM_PRIVATE_PLATFORM_FIELDS \ 2977777dab0Sopenharmony_ci 2987777dab0Sopenharmony_ci#define UV_TCP_PRIVATE_FIELDS /* empty */ 2997777dab0Sopenharmony_ci 3007777dab0Sopenharmony_ci#define UV_UDP_PRIVATE_FIELDS \ 3017777dab0Sopenharmony_ci uv_alloc_cb alloc_cb; \ 3027777dab0Sopenharmony_ci uv_udp_recv_cb recv_cb; \ 3037777dab0Sopenharmony_ci uv__io_t io_watcher; \ 3047777dab0Sopenharmony_ci void* write_queue[2]; \ 3057777dab0Sopenharmony_ci void* write_completed_queue[2]; \ 3067777dab0Sopenharmony_ci 3077777dab0Sopenharmony_ci#define UV_PIPE_PRIVATE_FIELDS \ 3087777dab0Sopenharmony_ci const char* pipe_fname; /* strdup'ed */ 3097777dab0Sopenharmony_ci 3107777dab0Sopenharmony_ci#define UV_POLL_PRIVATE_FIELDS \ 3117777dab0Sopenharmony_ci uv__io_t io_watcher; 3127777dab0Sopenharmony_ci 3137777dab0Sopenharmony_ci#define UV_PREPARE_PRIVATE_FIELDS \ 3147777dab0Sopenharmony_ci uv_prepare_cb prepare_cb; \ 3157777dab0Sopenharmony_ci void* queue[2]; \ 3167777dab0Sopenharmony_ci 3177777dab0Sopenharmony_ci#define UV_CHECK_PRIVATE_FIELDS \ 3187777dab0Sopenharmony_ci uv_check_cb check_cb; \ 3197777dab0Sopenharmony_ci void* queue[2]; \ 3207777dab0Sopenharmony_ci 3217777dab0Sopenharmony_ci#define UV_IDLE_PRIVATE_FIELDS \ 3227777dab0Sopenharmony_ci uv_idle_cb idle_cb; \ 3237777dab0Sopenharmony_ci void* queue[2]; \ 3247777dab0Sopenharmony_ci 3257777dab0Sopenharmony_ci#define UV_ASYNC_PRIVATE_FIELDS \ 3267777dab0Sopenharmony_ci uv_async_cb async_cb; \ 3277777dab0Sopenharmony_ci void* queue[2]; \ 3287777dab0Sopenharmony_ci int pending; \ 3297777dab0Sopenharmony_ci 3307777dab0Sopenharmony_ci#define UV_TIMER_PRIVATE_FIELDS \ 3317777dab0Sopenharmony_ci uv_timer_cb timer_cb; \ 3327777dab0Sopenharmony_ci void* heap_node[3]; \ 3337777dab0Sopenharmony_ci uint64_t timeout; \ 3347777dab0Sopenharmony_ci uint64_t repeat; \ 3357777dab0Sopenharmony_ci uint64_t start_id; 3367777dab0Sopenharmony_ci 3377777dab0Sopenharmony_ci#define UV_GETADDRINFO_PRIVATE_FIELDS \ 3387777dab0Sopenharmony_ci struct uv__work work_req; \ 3397777dab0Sopenharmony_ci uv_getaddrinfo_cb cb; \ 3407777dab0Sopenharmony_ci struct addrinfo* hints; \ 3417777dab0Sopenharmony_ci char* hostname; \ 3427777dab0Sopenharmony_ci char* service; \ 3437777dab0Sopenharmony_ci struct addrinfo* addrinfo; \ 3447777dab0Sopenharmony_ci int retcode; 3457777dab0Sopenharmony_ci 3467777dab0Sopenharmony_ci#define UV_GETNAMEINFO_PRIVATE_FIELDS \ 3477777dab0Sopenharmony_ci struct uv__work work_req; \ 3487777dab0Sopenharmony_ci uv_getnameinfo_cb getnameinfo_cb; \ 3497777dab0Sopenharmony_ci struct sockaddr_storage storage; \ 3507777dab0Sopenharmony_ci int flags; \ 3517777dab0Sopenharmony_ci char host[NI_MAXHOST]; \ 3527777dab0Sopenharmony_ci char service[NI_MAXSERV]; \ 3537777dab0Sopenharmony_ci int retcode; 3547777dab0Sopenharmony_ci 3557777dab0Sopenharmony_ci#define UV_PROCESS_PRIVATE_FIELDS \ 3567777dab0Sopenharmony_ci void* queue[2]; \ 3577777dab0Sopenharmony_ci int status; \ 3587777dab0Sopenharmony_ci 3597777dab0Sopenharmony_ci#define UV_FS_PRIVATE_FIELDS \ 3607777dab0Sopenharmony_ci const char *new_path; \ 3617777dab0Sopenharmony_ci uv_file file; \ 3627777dab0Sopenharmony_ci int flags; \ 3637777dab0Sopenharmony_ci mode_t mode; \ 3647777dab0Sopenharmony_ci unsigned int nbufs; \ 3657777dab0Sopenharmony_ci uv_buf_t* bufs; \ 3667777dab0Sopenharmony_ci off_t off; \ 3677777dab0Sopenharmony_ci uv_uid_t uid; \ 3687777dab0Sopenharmony_ci uv_gid_t gid; \ 3697777dab0Sopenharmony_ci double atime; \ 3707777dab0Sopenharmony_ci double mtime; \ 3717777dab0Sopenharmony_ci struct uv__work work_req; \ 3727777dab0Sopenharmony_ci uv_buf_t bufsml[4]; \ 3737777dab0Sopenharmony_ci 3747777dab0Sopenharmony_ci#define UV_WORK_PRIVATE_FIELDS \ 3757777dab0Sopenharmony_ci struct uv__work work_req; 3767777dab0Sopenharmony_ci 3777777dab0Sopenharmony_ci#define UV_TTY_PRIVATE_FIELDS \ 3787777dab0Sopenharmony_ci struct termios orig_termios; \ 3797777dab0Sopenharmony_ci int mode; 3807777dab0Sopenharmony_ci 3817777dab0Sopenharmony_ci#define UV_SIGNAL_PRIVATE_FIELDS \ 3827777dab0Sopenharmony_ci /* RB_ENTRY(uv_signal_s) tree_entry; */ \ 3837777dab0Sopenharmony_ci struct { \ 3847777dab0Sopenharmony_ci struct uv_signal_s* rbe_left; \ 3857777dab0Sopenharmony_ci struct uv_signal_s* rbe_right; \ 3867777dab0Sopenharmony_ci struct uv_signal_s* rbe_parent; \ 3877777dab0Sopenharmony_ci int rbe_color; \ 3887777dab0Sopenharmony_ci } tree_entry; \ 3897777dab0Sopenharmony_ci /* Use two counters here so we don have to fiddle with atomics. */ \ 3907777dab0Sopenharmony_ci unsigned int caught_signals; \ 3917777dab0Sopenharmony_ci unsigned int dispatched_signals; 3927777dab0Sopenharmony_ci 3937777dab0Sopenharmony_ci#define UV_FS_EVENT_PRIVATE_FIELDS \ 3947777dab0Sopenharmony_ci uv_fs_event_cb cb; \ 3957777dab0Sopenharmony_ci UV_PLATFORM_FS_EVENT_FIELDS \ 3967777dab0Sopenharmony_ci 3977777dab0Sopenharmony_ci/* fs open() flags supported on this platform: */ 3987777dab0Sopenharmony_ci#if defined(O_APPEND) 3997777dab0Sopenharmony_ci# define UV_FS_O_APPEND O_APPEND 4007777dab0Sopenharmony_ci#else 4017777dab0Sopenharmony_ci# define UV_FS_O_APPEND 0 4027777dab0Sopenharmony_ci#endif 4037777dab0Sopenharmony_ci#if defined(O_CREAT) 4047777dab0Sopenharmony_ci# define UV_FS_O_CREAT O_CREAT 4057777dab0Sopenharmony_ci#else 4067777dab0Sopenharmony_ci# define UV_FS_O_CREAT 0 4077777dab0Sopenharmony_ci#endif 4087777dab0Sopenharmony_ci 4097777dab0Sopenharmony_ci#if defined(__linux__) && defined(__arm__) 4107777dab0Sopenharmony_ci# define UV_FS_O_DIRECT 0x10000 4117777dab0Sopenharmony_ci#elif defined(__linux__) && defined(__m68k__) 4127777dab0Sopenharmony_ci# define UV_FS_O_DIRECT 0x10000 4137777dab0Sopenharmony_ci#elif defined(__linux__) && defined(__mips__) 4147777dab0Sopenharmony_ci# define UV_FS_O_DIRECT 0x08000 4157777dab0Sopenharmony_ci#elif defined(__linux__) && defined(__powerpc__) 4167777dab0Sopenharmony_ci# define UV_FS_O_DIRECT 0x20000 4177777dab0Sopenharmony_ci#elif defined(__linux__) && defined(__s390x__) 4187777dab0Sopenharmony_ci# define UV_FS_O_DIRECT 0x04000 4197777dab0Sopenharmony_ci#elif defined(__linux__) && defined(__x86_64__) 4207777dab0Sopenharmony_ci# define UV_FS_O_DIRECT 0x04000 4217777dab0Sopenharmony_ci#elif defined(O_DIRECT) 4227777dab0Sopenharmony_ci# define UV_FS_O_DIRECT O_DIRECT 4237777dab0Sopenharmony_ci#else 4247777dab0Sopenharmony_ci# define UV_FS_O_DIRECT 0 4257777dab0Sopenharmony_ci#endif 4267777dab0Sopenharmony_ci 4277777dab0Sopenharmony_ci#if defined(O_DIRECTORY) 4287777dab0Sopenharmony_ci# define UV_FS_O_DIRECTORY O_DIRECTORY 4297777dab0Sopenharmony_ci#else 4307777dab0Sopenharmony_ci# define UV_FS_O_DIRECTORY 0 4317777dab0Sopenharmony_ci#endif 4327777dab0Sopenharmony_ci#if defined(O_DSYNC) 4337777dab0Sopenharmony_ci# define UV_FS_O_DSYNC O_DSYNC 4347777dab0Sopenharmony_ci#else 4357777dab0Sopenharmony_ci# define UV_FS_O_DSYNC 0 4367777dab0Sopenharmony_ci#endif 4377777dab0Sopenharmony_ci#if defined(O_EXCL) 4387777dab0Sopenharmony_ci# define UV_FS_O_EXCL O_EXCL 4397777dab0Sopenharmony_ci#else 4407777dab0Sopenharmony_ci# define UV_FS_O_EXCL 0 4417777dab0Sopenharmony_ci#endif 4427777dab0Sopenharmony_ci#if defined(O_EXLOCK) 4437777dab0Sopenharmony_ci# define UV_FS_O_EXLOCK O_EXLOCK 4447777dab0Sopenharmony_ci#else 4457777dab0Sopenharmony_ci# define UV_FS_O_EXLOCK 0 4467777dab0Sopenharmony_ci#endif 4477777dab0Sopenharmony_ci#if defined(O_NOATIME) 4487777dab0Sopenharmony_ci# define UV_FS_O_NOATIME O_NOATIME 4497777dab0Sopenharmony_ci#else 4507777dab0Sopenharmony_ci# define UV_FS_O_NOATIME 0 4517777dab0Sopenharmony_ci#endif 4527777dab0Sopenharmony_ci#if defined(O_NOCTTY) 4537777dab0Sopenharmony_ci# define UV_FS_O_NOCTTY O_NOCTTY 4547777dab0Sopenharmony_ci#else 4557777dab0Sopenharmony_ci# define UV_FS_O_NOCTTY 0 4567777dab0Sopenharmony_ci#endif 4577777dab0Sopenharmony_ci#if defined(O_NOFOLLOW) 4587777dab0Sopenharmony_ci# define UV_FS_O_NOFOLLOW O_NOFOLLOW 4597777dab0Sopenharmony_ci#else 4607777dab0Sopenharmony_ci# define UV_FS_O_NOFOLLOW 0 4617777dab0Sopenharmony_ci#endif 4627777dab0Sopenharmony_ci#if defined(O_NONBLOCK) 4637777dab0Sopenharmony_ci# define UV_FS_O_NONBLOCK O_NONBLOCK 4647777dab0Sopenharmony_ci#else 4657777dab0Sopenharmony_ci# define UV_FS_O_NONBLOCK 0 4667777dab0Sopenharmony_ci#endif 4677777dab0Sopenharmony_ci#if defined(O_RDONLY) 4687777dab0Sopenharmony_ci# define UV_FS_O_RDONLY O_RDONLY 4697777dab0Sopenharmony_ci#else 4707777dab0Sopenharmony_ci# define UV_FS_O_RDONLY 0 4717777dab0Sopenharmony_ci#endif 4727777dab0Sopenharmony_ci#if defined(O_RDWR) 4737777dab0Sopenharmony_ci# define UV_FS_O_RDWR O_RDWR 4747777dab0Sopenharmony_ci#else 4757777dab0Sopenharmony_ci# define UV_FS_O_RDWR 0 4767777dab0Sopenharmony_ci#endif 4777777dab0Sopenharmony_ci#if defined(O_SYMLINK) 4787777dab0Sopenharmony_ci# define UV_FS_O_SYMLINK O_SYMLINK 4797777dab0Sopenharmony_ci#else 4807777dab0Sopenharmony_ci# define UV_FS_O_SYMLINK 0 4817777dab0Sopenharmony_ci#endif 4827777dab0Sopenharmony_ci#if defined(O_SYNC) 4837777dab0Sopenharmony_ci# define UV_FS_O_SYNC O_SYNC 4847777dab0Sopenharmony_ci#else 4857777dab0Sopenharmony_ci# define UV_FS_O_SYNC 0 4867777dab0Sopenharmony_ci#endif 4877777dab0Sopenharmony_ci#if defined(O_TRUNC) 4887777dab0Sopenharmony_ci# define UV_FS_O_TRUNC O_TRUNC 4897777dab0Sopenharmony_ci#else 4907777dab0Sopenharmony_ci# define UV_FS_O_TRUNC 0 4917777dab0Sopenharmony_ci#endif 4927777dab0Sopenharmony_ci#if defined(O_WRONLY) 4937777dab0Sopenharmony_ci# define UV_FS_O_WRONLY O_WRONLY 4947777dab0Sopenharmony_ci#else 4957777dab0Sopenharmony_ci# define UV_FS_O_WRONLY 0 4967777dab0Sopenharmony_ci#endif 4977777dab0Sopenharmony_ci 4987777dab0Sopenharmony_ci/* fs open() flags supported on other platforms: */ 4997777dab0Sopenharmony_ci#define UV_FS_O_FILEMAP 0 5007777dab0Sopenharmony_ci#define UV_FS_O_RANDOM 0 5017777dab0Sopenharmony_ci#define UV_FS_O_SHORT_LIVED 0 5027777dab0Sopenharmony_ci#define UV_FS_O_SEQUENTIAL 0 5037777dab0Sopenharmony_ci#define UV_FS_O_TEMPORARY 0 5047777dab0Sopenharmony_ci 5057777dab0Sopenharmony_ci#endif /* UV_UNIX_H */ 506