25 #include <sys/types.h> 30 #include <sys/socket.h> 31 #include <netinet/in.h> 32 #include <netinet/tcp.h> 33 #include <arpa/inet.h> 40 #include <semaphore.h> 45 #include "uv/threadpool.h" 47 #if defined(__linux__) 48 # include "uv/linux.h" 49 #elif defined(__PASE__) 50 # include "uv/posix.h" 51 #elif defined(__APPLE__) 52 # include "uv/darwin.h" 53 #elif defined(__DragonFly__) || \ 54 defined(__FreeBSD__) || \ 55 defined(__FreeBSD_kernel__) || \ 56 defined(__OpenBSD__) || \ 59 #elif defined(__CYGWIN__) || defined(__MSYS__) 60 # include "uv/posix.h" 63 #ifndef PTHREAD_BARRIER_SERIAL_THREAD 64 # include "uv/pthread-barrier.h" 68 # define NI_MAXHOST 1025 72 # define NI_MAXSERV 32 75 #ifndef UV_IO_PRIVATE_PLATFORM_FIELDS 76 # define UV_IO_PRIVATE_PLATFORM_FIELDS 82 typedef void (*uv__io_cb)(
struct uv_loop_s* loop,
89 void* pending_queue[2];
90 void* watcher_queue[2];
94 UV_IO_PRIVATE_PLATFORM_FIELDS
97 #ifndef UV_PLATFORM_SEM_T 98 # define UV_PLATFORM_SEM_T sem_t 101 #ifndef UV_PLATFORM_LOOP_FIELDS 102 # define UV_PLATFORM_LOOP_FIELDS 105 #ifndef UV_PLATFORM_FS_EVENT_FIELDS 106 # define UV_PLATFORM_FS_EVENT_FIELDS 109 #ifndef UV_STREAM_PRIVATE_PLATFORM_FIELDS 110 # define UV_STREAM_PRIVATE_PLATFORM_FIELDS 120 typedef int uv_os_sock_t;
121 typedef int uv_os_fd_t;
122 typedef pid_t uv_pid_t;
124 #define UV_ONCE_INIT PTHREAD_ONCE_INIT 127 typedef pthread_t uv_thread_t;
128 typedef pthread_mutex_t uv_mutex_t;
130 typedef UV_PLATFORM_SEM_T uv_sem_t;
137 typedef gid_t uv_gid_t;
138 typedef uid_t uv_uid_t;
142 #if defined(DT_UNKNOWN) 143 # define HAVE_DIRENT_TYPES 145 # define UV__DT_FILE DT_REG 147 # define UV__DT_FILE -1 150 # define UV__DT_DIR DT_DIR 152 # define UV__DT_DIR -2 155 # define UV__DT_LINK DT_LNK 157 # define UV__DT_LINK -3 159 # if defined(DT_FIFO) 160 # define UV__DT_FIFO DT_FIFO 162 # define UV__DT_FIFO -4 164 # if defined(DT_SOCK) 165 # define UV__DT_SOCKET DT_SOCK 167 # define UV__DT_SOCKET -5 170 # define UV__DT_CHAR DT_CHR 172 # define UV__DT_CHAR -6 175 # define UV__DT_BLOCK DT_BLK 177 # define UV__DT_BLOCK -7 189 #define UV_LOOP_PRIVATE_FIELDS \ 190 unsigned long flags; \ 192 void* pending_queue[2]; \ 193 void* watcher_queue[2]; \ 194 uv__io_t** watchers; \ 195 unsigned int nwatchers; \ 198 uv_mutex_t wq_mutex; \ 199 uv_async_t wq_async; \ 200 uv_rwlock_t cloexec_lock; \ 201 uv_handle_t* closing_handles; \ 202 void* process_handles[2]; \ 203 void* prepare_handles[2]; \ 204 void* check_handles[2]; \ 205 void* idle_handles[2]; \ 206 void* async_handles[2]; \ 207 void (*async_unused)(void); \ 208 uv__io_t async_io_watcher; \ 212 unsigned int nelts; \ 214 uint64_t timer_counter; \ 216 int signal_pipefd[2]; \ 217 uv__io_t signal_io_watcher; \ 218 uv_signal_t child_watcher; \ 220 UV_PLATFORM_LOOP_FIELDS \ 222 #define UV_REQ_TYPE_PRIVATE 224 #define UV_REQ_PRIVATE_FIELDS 226 #define UV_PRIVATE_REQ_TYPES 228 #define UV_WRITE_PRIVATE_FIELDS \ 230 unsigned int write_index; \ 232 unsigned int nbufs; \ 234 uv_buf_t bufsml[4]; \ 236 #define UV_CONNECT_PRIVATE_FIELDS \ 239 #define UV_SHUTDOWN_PRIVATE_FIELDS 241 #define UV_UDP_SEND_PRIVATE_FIELDS \ 243 struct sockaddr_storage addr; \ 244 unsigned int nbufs; \ 247 uv_udp_send_cb send_cb; \ 248 uv_buf_t bufsml[4]; \ 250 #define UV_HANDLE_PRIVATE_FIELDS \ 251 uv_handle_t* next_closing; \ 252 unsigned int flags; \ 254 #define UV_STREAM_PRIVATE_FIELDS \ 255 uv_connect_t *connect_req; \ 256 uv_shutdown_t *shutdown_req; \ 257 uv__io_t io_watcher; \ 258 void* write_queue[2]; \ 259 void* write_completed_queue[2]; \ 260 uv_connection_cb connection_cb; \ 264 UV_STREAM_PRIVATE_PLATFORM_FIELDS \ 266 #define UV_TCP_PRIVATE_FIELDS 268 #define UV_UDP_PRIVATE_FIELDS \ 269 uv_alloc_cb alloc_cb; \ 270 uv_udp_recv_cb recv_cb; \ 271 uv__io_t io_watcher; \ 272 void* write_queue[2]; \ 273 void* write_completed_queue[2]; \ 275 #define UV_PIPE_PRIVATE_FIELDS \ 276 const char* pipe_fname; 278 #define UV_POLL_PRIVATE_FIELDS \ 281 #define UV_PREPARE_PRIVATE_FIELDS \ 282 uv_prepare_cb prepare_cb; \ 285 #define UV_CHECK_PRIVATE_FIELDS \ 286 uv_check_cb check_cb; \ 289 #define UV_IDLE_PRIVATE_FIELDS \ 290 uv_idle_cb idle_cb; \ 293 #define UV_ASYNC_PRIVATE_FIELDS \ 294 uv_async_cb async_cb; \ 298 #define UV_TIMER_PRIVATE_FIELDS \ 299 uv_timer_cb timer_cb; \ 300 void* heap_node[3]; \ 305 #define UV_GETADDRINFO_PRIVATE_FIELDS \ 306 struct uv__work work_req; \ 307 uv_getaddrinfo_cb cb; \ 308 struct addrinfo* hints; \ 311 struct addrinfo* addrinfo; \ 314 #define UV_GETNAMEINFO_PRIVATE_FIELDS \ 315 struct uv__work work_req; \ 316 uv_getnameinfo_cb getnameinfo_cb; \ 317 struct sockaddr_storage storage; \ 319 char host[NI_MAXHOST]; \ 320 char service[NI_MAXSERV]; \ 323 #define UV_PROCESS_PRIVATE_FIELDS \ 327 #define UV_FS_PRIVATE_FIELDS \ 328 const char *new_path; \ 332 unsigned int nbufs; \ 339 struct uv__work work_req; \ 340 uv_buf_t bufsml[4]; \ 342 #define UV_WORK_PRIVATE_FIELDS \ 343 struct uv__work work_req; 345 #define UV_TTY_PRIVATE_FIELDS \ 346 struct termios orig_termios; \ 349 #define UV_SIGNAL_PRIVATE_FIELDS \ 352 struct uv_signal_s* rbe_left; \ 353 struct uv_signal_s* rbe_right; \ 354 struct uv_signal_s* rbe_parent; \ 358 unsigned int caught_signals; \ 359 unsigned int dispatched_signals; 361 #define UV_FS_EVENT_PRIVATE_FIELDS \ 363 UV_PLATFORM_FS_EVENT_FIELDS \ 366 #if defined(O_APPEND) 367 # define UV_FS_O_APPEND O_APPEND 369 # define UV_FS_O_APPEND 0 372 # define UV_FS_O_CREAT O_CREAT 374 # define UV_FS_O_CREAT 0 376 #if defined(O_DIRECT) 377 # define UV_FS_O_DIRECT O_DIRECT 379 # define UV_FS_O_DIRECT 0 381 #if defined(O_DIRECTORY) 382 # define UV_FS_O_DIRECTORY O_DIRECTORY 384 # define UV_FS_O_DIRECTORY 0 387 # define UV_FS_O_DSYNC O_DSYNC 389 # define UV_FS_O_DSYNC 0 392 # define UV_FS_O_EXCL O_EXCL 394 # define UV_FS_O_EXCL 0 396 #if defined(O_EXLOCK) 397 # define UV_FS_O_EXLOCK O_EXLOCK 399 # define UV_FS_O_EXLOCK 0 401 #if defined(O_NOATIME) 402 # define UV_FS_O_NOATIME O_NOATIME 404 # define UV_FS_O_NOATIME 0 406 #if defined(O_NOCTTY) 407 # define UV_FS_O_NOCTTY O_NOCTTY 409 # define UV_FS_O_NOCTTY 0 411 #if defined(O_NOFOLLOW) 412 # define UV_FS_O_NOFOLLOW O_NOFOLLOW 414 # define UV_FS_O_NOFOLLOW 0 416 #if defined(O_NONBLOCK) 417 # define UV_FS_O_NONBLOCK O_NONBLOCK 419 # define UV_FS_O_NONBLOCK 0 421 #if defined(O_RDONLY) 422 # define UV_FS_O_RDONLY O_RDONLY 424 # define UV_FS_O_RDONLY 0 427 # define UV_FS_O_RDWR O_RDWR 429 # define UV_FS_O_RDWR 0 431 #if defined(O_SYMLINK) 432 # define UV_FS_O_SYMLINK O_SYMLINK 434 # define UV_FS_O_SYMLINK 0 437 # define UV_FS_O_SYNC O_SYNC 439 # define UV_FS_O_SYNC 0 442 # define UV_FS_O_TRUNC O_TRUNC 444 # define UV_FS_O_TRUNC 0 446 #if defined(O_WRONLY) 447 # define UV_FS_O_WRONLY O_WRONLY 449 # define UV_FS_O_WRONLY 0 453 #define UV_FS_O_RANDOM 0 454 #define UV_FS_O_SHORT_LIVED 0 455 #define UV_FS_O_SEQUENTIAL 0 456 #define UV_FS_O_TEMPORARY 0
It should be possible to cast uv_buf_t[] to WSABUF[] see http://msdn.microsoft.com/en-us/library/ms74...
Definition: win.h:213
Definition: pthread-barrier.h:57