22 #ifndef UV_UNIX_INTERNAL_H_
23 #define UV_UNIX_INTERNAL_H_
34 #include <sys/socket.h>
36 #if defined(__STRICT_ANSI__)
37 # define inline __inline
40 #if defined(__linux__)
49 # include <sys/port.h>
54 # define reqevents events
55 # define rtnevents revents
56 # include <sys/poll.h>
61 #if defined(__APPLE__) && !TARGET_OS_IPHONE
62 # include <AvailabilityMacros.h>
66 # define UV__PATH_MAX PATH_MAX
68 # define UV__PATH_MAX 8192
71 #if defined(__ANDROID__)
73 # ifdef pthread_sigmask
74 # undef pthread_sigmask
76 # define pthread_sigmask(how, set, oldset) uv__pthread_sigmask(how, set, oldset)
79 #define ACCESS_ONCE(type, var) \
80 (*(volatile type*) &(var))
82 #define ROUND_UP(a, b) \
83 ((a) % (b) ? ((a) + (b)) - ((a) % (b)) : (a))
85 #define UNREACHABLE() \
87 assert(0 && "unreachable code"); \
92 #define SAVE_ERRNO(block) \
94 int _saved_errno = errno; \
95 do { block; } while (0); \
96 errno = _saved_errno; \
104 #if defined(__clang__) || \
105 defined(__GNUC__) || \
106 defined(__INTEL_COMPILER)
107 # define UV_UNUSED(declaration) __attribute__((unused)) declaration
109 # define UV_UNUSED(declaration) declaration
114 # define UV__POLLRDHUP POLLRDHUP
116 # define UV__POLLRDHUP 0x2000
120 # define UV__POLLPRI POLLPRI
122 # define UV__POLLPRI 0
125 #if !defined(O_CLOEXEC) && defined(__FreeBSD__)
130 # define O_CLOEXEC 0x00100000
158 #if defined(_AIX) || \
159 defined(__APPLE__) || \
160 defined(__DragonFly__) || \
161 defined(__FreeBSD__) || \
162 defined(__FreeBSD_kernel__) || \
163 defined(__linux__) || \
164 defined(__OpenBSD__) || \
166 #define uv__cloexec uv__cloexec_ioctl
167 #define uv__nonblock uv__nonblock_ioctl
169 #define uv__cloexec uv__cloexec_fcntl
170 #define uv__nonblock uv__nonblock_fcntl
180 #if defined(__linux__) && O_NDELAY != O_NONBLOCK
182 #define uv__nonblock uv__nonblock_fcntl
224 #if defined(__APPLE__)
278 #if defined(__APPLE__)
280 #define uv__stream_fd(handle) (uv___stream_fd((const uv_stream_t*) (handle)))
282 #define uv__stream_fd(handle) ((handle)->io_watcher.fd)
286 # define UV__F_NONBLOCK O_NONBLOCK
288 # define UV__F_NONBLOCK 1
293 #if defined(__APPLE__)
310 s = strrchr(
path,
'/');
317 #if defined(__linux__)
328 #if defined(__linux__) || \
329 defined(__FreeBSD__) || \
330 defined(__FreeBSD_kernel__)
334 unsigned int msg_len;
337 int uv__recvmmsg(
int fd,
struct uv__mmsghdr* mmsg,
unsigned int vlen);
338 int uv__sendmmsg(
int fd,
struct uv__mmsghdr* mmsg,
unsigned int vlen);
static mcore_handle handle
static static fork const void static count static fd const char const char static newpath const char static path const char path
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd domain
int uv__sendmmsg(int fd, struct uv__mmsghdr *mmsg, unsigned int vlen)
int uv__recvmmsg(int fd, struct uv__mmsghdr *mmsg, unsigned int vlen)
int uv__fsevents_init(uv_fs_event_t *handle)
int uv__fsevents_close(uv_fs_event_t *handle)
void uv__fsevents_loop_delete(uv_loop_t *loop)
int uv__inotify_fork(uv_loop_t *loop, void *old_watchers)
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause const char static mode static sync const char const char static newpath const char static pathname unsigned long static filedes void static end_data_segment static handler static getegid char static len static pgid const char static path oldfd
int uv__pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
static struct sockaddr static addrlen static backlog const void static flags void flags
static struct sockaddr static addrlen static backlog const void msg
#define UV_UNUSED(declaration)
int uv__tcp_keepalive(int fd, int on, unsigned int delay)
void uv__io_stop(uv_loop_t *loop, uv__io_t *w, unsigned int events)
void uv__prepare_close(uv_prepare_t *handle)
void uv__udp_close(uv_udp_t *handle)
int uv__open_cloexec(const char *path, int flags)
void uv__signal_loop_cleanup(uv_loop_t *loop)
uv_handle_type uv__handle_type(int fd)
int uv__async_fork(uv_loop_t *loop)
int uv__signal_loop_fork(uv_loop_t *loop)
void uv__poll_close(uv_poll_t *handle)
int uv__random_getrandom(void *buf, size_t buflen)
int uv__close_nocheckstdio(int fd)
void uv__fs_event_close(uv_fs_event_t *handle)
void uv__async_stop(uv_loop_t *loop)
void uv__idle_close(uv_idle_t *handle)
int uv__stream_open(uv_stream_t *, int fd, int flags)
int uv__nonblock_ioctl(int fd, int set)
void uv__server_io(uv_loop_t *loop, uv__io_t *w, unsigned int events)
int uv_pipe_listen(uv_pipe_t *handle, int backlog, uv_connection_cb cb)
void uv__platform_invalidate_fd(uv_loop_t *loop, int fd)
int uv__random_readpath(const char *path, void *buf, size_t buflen)
void uv__io_start(uv_loop_t *loop, uv__io_t *w, unsigned int events)
int uv__fd_exists(uv_loop_t *loop, int fd)
void uv__signal_global_once_init(void)
void uv__io_poll(uv_loop_t *loop, int timeout)
uint64_t uv__hrtime(uv_clocktype_t type)
void uv__io_close(uv_loop_t *loop, uv__io_t *w)
int uv__io_check_fd(uv_loop_t *loop, int fd)
int uv__getsockpeername(const uv_handle_t *handle, uv__peersockfunc func, struct sockaddr *name, int *namelen)
void uv__run_prepare(uv_loop_t *loop)
int uv__io_active(const uv__io_t *w, unsigned int events)
int uv_tcp_listen(uv_tcp_t *tcp, int backlog, uv_connection_cb cb)
int uv__getpwuid_r(uv_passwd_t *pwd)
int uv__random_sysctl(void *buf, size_t buflen)
void uv__signal_close(uv_signal_t *handle)
int uv__accept(int sockfd)
int uv__search_path(const char *prog, char *buf, size_t *buflen)
void uv__check_close(uv_check_t *handle)
int uv__platform_loop_init(uv_loop_t *loop)
int uv__socket(int domain, int type, int protocol)
ssize_t uv__recvmsg(int fd, struct msghdr *msg, int flags)
void uv__io_init(uv__io_t *w, uv__io_cb cb, int fd)
int uv__close_nocancel(int fd)
int uv__io_fork(uv_loop_t *loop)
void uv__pipe_close(uv_pipe_t *handle)
int uv__dup2_cloexec(int oldfd, int newfd)
int uv__random_getentropy(void *buf, size_t buflen)
int uv__nonblock_fcntl(int fd, int set)
void uv__udp_finish_close(uv_udp_t *handle)
void uv__platform_loop_delete(uv_loop_t *loop)
void uv__run_check(uv_loop_t *loop)
int uv__cloexec_ioctl(int fd, int set)
int(* uv__peersockfunc)(int, struct sockaddr *, socklen_t *)
void uv__stream_destroy(uv_stream_t *stream)
void uv__make_close_pending(uv_handle_t *handle)
int uv__make_pipe(int fds[2], int flags)
void uv__async_close(uv_async_t *handle)
void uv__process_close(uv_process_t *handle)
void uv__stream_close(uv_stream_t *handle)
int uv__kqueue_init(uv_loop_t *loop)
int uv__cloexec_fcntl(int fd, int set)
void uv__io_feed(uv_loop_t *loop, uv__io_t *w)
void uv__run_idle(uv_loop_t *loop)
FILE * uv__open_file(const char *path)
void uv__tcp_close(uv_tcp_t *handle)
int uv__random_devurandom(void *buf, size_t buflen)
int uv__tcp_nodelay(int fd, int on)
void uv__stream_init(uv_loop_t *loop, uv_stream_t *stream, uv_handle_type type)
void(* uv__io_cb)(struct uv_loop_s *loop, struct uv__io_s *w, unsigned int events)
void(* uv_connection_cb)(uv_stream_t *server, int status)
static const z80_opcode fd[]