mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-14 11:09:56 -06:00
libuv 2020-04-06 (d21f5aea)
Code extracted from:
https://github.com/libuv/libuv.git
at commit d21f5aeab0a4b6193f13640471cde405579f9c69 (v1.x).
This commit is contained in:
committed by
Brad King
parent
b4069b04ff
commit
394b07af40
114
include/uv.h
114
include/uv.h
@@ -27,6 +27,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(BUILDING_UV_SHARED) && defined(USING_UV_SHARED)
|
||||
#error "Define either BUILDING_UV_SHARED or USING_UV_SHARED, not both."
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
/* Windows - set up dll import/export decorators. */
|
||||
# if defined(BUILDING_UV_SHARED)
|
||||
@@ -143,6 +147,7 @@ extern "C" {
|
||||
XX(EREMOTEIO, "remote I/O error") \
|
||||
XX(ENOTTY, "inappropriate ioctl for device") \
|
||||
XX(EFTYPE, "inappropriate file type or format") \
|
||||
XX(EILSEQ, "illegal byte sequence") \
|
||||
|
||||
#define UV_HANDLE_TYPE_MAP(XX) \
|
||||
XX(ASYNC, async) \
|
||||
@@ -172,6 +177,7 @@ extern "C" {
|
||||
XX(WORK, work) \
|
||||
XX(GETADDRINFO, getaddrinfo) \
|
||||
XX(GETNAMEINFO, getnameinfo) \
|
||||
XX(RANDOM, random) \
|
||||
|
||||
typedef enum {
|
||||
#define XX(code, _) UV_ ## code = UV__ ## code,
|
||||
@@ -229,13 +235,16 @@ typedef struct uv_connect_s uv_connect_t;
|
||||
typedef struct uv_udp_send_s uv_udp_send_t;
|
||||
typedef struct uv_fs_s uv_fs_t;
|
||||
typedef struct uv_work_s uv_work_t;
|
||||
typedef struct uv_random_s uv_random_t;
|
||||
|
||||
/* None of the above. */
|
||||
typedef struct uv_env_item_s uv_env_item_t;
|
||||
typedef struct uv_cpu_info_s uv_cpu_info_t;
|
||||
typedef struct uv_interface_address_s uv_interface_address_t;
|
||||
typedef struct uv_dirent_s uv_dirent_t;
|
||||
typedef struct uv_passwd_s uv_passwd_t;
|
||||
typedef struct uv_utsname_s uv_utsname_t;
|
||||
typedef struct uv_statfs_s uv_statfs_t;
|
||||
|
||||
typedef enum {
|
||||
UV_LOOP_BLOCK_SIGNAL
|
||||
@@ -323,6 +332,10 @@ typedef void (*uv_getnameinfo_cb)(uv_getnameinfo_t* req,
|
||||
int status,
|
||||
const char* hostname,
|
||||
const char* service);
|
||||
typedef void (*uv_random_cb)(uv_random_t* req,
|
||||
int status,
|
||||
void* buf,
|
||||
size_t buflen);
|
||||
|
||||
typedef struct {
|
||||
long tv_sec;
|
||||
@@ -557,6 +570,7 @@ UV_EXTERN int uv_tcp_getsockname(const uv_tcp_t* handle,
|
||||
UV_EXTERN int uv_tcp_getpeername(const uv_tcp_t* handle,
|
||||
struct sockaddr* name,
|
||||
int* namelen);
|
||||
UV_EXTERN int uv_tcp_close_reset(uv_tcp_t* handle, uv_close_cb close_cb);
|
||||
UV_EXTERN int uv_tcp_connect(uv_connect_t* req,
|
||||
uv_tcp_t* handle,
|
||||
const struct sockaddr* addr,
|
||||
@@ -591,7 +605,12 @@ enum uv_udp_flags {
|
||||
* (provided they all set the flag) but only the last one to bind will receive
|
||||
* any traffic, in effect "stealing" the port from the previous listener.
|
||||
*/
|
||||
UV_UDP_REUSEADDR = 4
|
||||
UV_UDP_REUSEADDR = 4,
|
||||
/*
|
||||
* Indicates that the message was received by recvmmsg, so the buffer provided
|
||||
* must not be freed by the recv_cb callback.
|
||||
*/
|
||||
UV_UDP_MMSG_CHUNK = 8
|
||||
};
|
||||
|
||||
typedef void (*uv_udp_send_cb)(uv_udp_send_t* req, int status);
|
||||
@@ -643,6 +662,11 @@ UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle,
|
||||
const char* multicast_addr,
|
||||
const char* interface_addr,
|
||||
uv_membership membership);
|
||||
UV_EXTERN int uv_udp_set_source_membership(uv_udp_t* handle,
|
||||
const char* multicast_addr,
|
||||
const char* interface_addr,
|
||||
const char* source_addr,
|
||||
uv_membership membership);
|
||||
UV_EXTERN int uv_udp_set_multicast_loop(uv_udp_t* handle, int on);
|
||||
UV_EXTERN int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl);
|
||||
UV_EXTERN int uv_udp_set_multicast_interface(uv_udp_t* handle,
|
||||
@@ -687,10 +711,25 @@ typedef enum {
|
||||
UV_TTY_MODE_IO
|
||||
} uv_tty_mode_t;
|
||||
|
||||
typedef enum {
|
||||
/*
|
||||
* The console supports handling of virtual terminal sequences
|
||||
* (Windows10 new console, ConEmu)
|
||||
*/
|
||||
UV_TTY_SUPPORTED,
|
||||
/* The console cannot process the virtual terminal sequence. (Legacy
|
||||
* console)
|
||||
*/
|
||||
UV_TTY_UNSUPPORTED
|
||||
} uv_tty_vtermstate_t;
|
||||
|
||||
|
||||
UV_EXTERN int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int readable);
|
||||
UV_EXTERN int uv_tty_set_mode(uv_tty_t*, uv_tty_mode_t mode);
|
||||
UV_EXTERN int uv_tty_reset_mode(void);
|
||||
UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height);
|
||||
UV_EXTERN void uv_tty_set_vterm_state(uv_tty_vtermstate_t state);
|
||||
UV_EXTERN int uv_tty_get_vterm_state(uv_tty_vtermstate_t* state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C++" {
|
||||
@@ -1070,6 +1109,17 @@ struct uv_utsname_s {
|
||||
to as meaningless in the docs. */
|
||||
};
|
||||
|
||||
struct uv_statfs_s {
|
||||
uint64_t f_type;
|
||||
uint64_t f_bsize;
|
||||
uint64_t f_blocks;
|
||||
uint64_t f_bfree;
|
||||
uint64_t f_bavail;
|
||||
uint64_t f_files;
|
||||
uint64_t f_ffree;
|
||||
uint64_t f_spare[4];
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
UV_DIRENT_UNKNOWN,
|
||||
UV_DIRENT_FILE,
|
||||
@@ -1132,12 +1182,22 @@ UV_EXTERN void uv_os_free_passwd(uv_passwd_t* pwd);
|
||||
UV_EXTERN uv_pid_t uv_os_getpid(void);
|
||||
UV_EXTERN uv_pid_t uv_os_getppid(void);
|
||||
|
||||
#define UV_PRIORITY_LOW 19
|
||||
#define UV_PRIORITY_BELOW_NORMAL 10
|
||||
#define UV_PRIORITY_NORMAL 0
|
||||
#define UV_PRIORITY_ABOVE_NORMAL -7
|
||||
#define UV_PRIORITY_HIGH -14
|
||||
#define UV_PRIORITY_HIGHEST -20
|
||||
#if defined(__PASE__)
|
||||
/* On IBM i PASE, the highest process priority is -10 */
|
||||
# define UV_PRIORITY_LOW 39 // RUNPTY(99)
|
||||
# define UV_PRIORITY_BELOW_NORMAL 15 // RUNPTY(50)
|
||||
# define UV_PRIORITY_NORMAL 0 // RUNPTY(20)
|
||||
# define UV_PRIORITY_ABOVE_NORMAL -4 // RUNTY(12)
|
||||
# define UV_PRIORITY_HIGH -7 // RUNPTY(6)
|
||||
# define UV_PRIORITY_HIGHEST -10 // RUNPTY(1)
|
||||
#else
|
||||
# define UV_PRIORITY_LOW 19
|
||||
# define UV_PRIORITY_BELOW_NORMAL 10
|
||||
# define UV_PRIORITY_NORMAL 0
|
||||
# define UV_PRIORITY_ABOVE_NORMAL -7
|
||||
# define UV_PRIORITY_HIGH -14
|
||||
# define UV_PRIORITY_HIGHEST -20
|
||||
#endif
|
||||
|
||||
UV_EXTERN int uv_os_getpriority(uv_pid_t pid, int* priority);
|
||||
UV_EXTERN int uv_os_setpriority(uv_pid_t pid, int priority);
|
||||
@@ -1150,6 +1210,13 @@ UV_EXTERN int uv_interface_addresses(uv_interface_address_t** addresses,
|
||||
UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses,
|
||||
int count);
|
||||
|
||||
struct uv_env_item_s {
|
||||
char* name;
|
||||
char* value;
|
||||
};
|
||||
|
||||
UV_EXTERN int uv_os_environ(uv_env_item_t** envitems, int* count);
|
||||
UV_EXTERN void uv_os_free_environ(uv_env_item_t* envitems, int count);
|
||||
UV_EXTERN int uv_os_getenv(const char* name, char* buffer, size_t* size);
|
||||
UV_EXTERN int uv_os_setenv(const char* name, const char* value);
|
||||
UV_EXTERN int uv_os_unsetenv(const char* name);
|
||||
@@ -1205,7 +1272,9 @@ typedef enum {
|
||||
UV_FS_LCHOWN,
|
||||
UV_FS_OPENDIR,
|
||||
UV_FS_READDIR,
|
||||
UV_FS_CLOSEDIR
|
||||
UV_FS_CLOSEDIR,
|
||||
UV_FS_STATFS,
|
||||
UV_FS_MKSTEMP
|
||||
} uv_fs_type;
|
||||
|
||||
struct uv_dir_s {
|
||||
@@ -1296,6 +1365,10 @@ UV_EXTERN int uv_fs_mkdtemp(uv_loop_t* loop,
|
||||
uv_fs_t* req,
|
||||
const char* tpl,
|
||||
uv_fs_cb cb);
|
||||
UV_EXTERN int uv_fs_mkstemp(uv_loop_t* loop,
|
||||
uv_fs_t* req,
|
||||
const char* tpl,
|
||||
uv_fs_cb cb);
|
||||
UV_EXTERN int uv_fs_rmdir(uv_loop_t* loop,
|
||||
uv_fs_t* req,
|
||||
const char* path,
|
||||
@@ -1433,6 +1506,10 @@ UV_EXTERN int uv_fs_lchown(uv_loop_t* loop,
|
||||
uv_uid_t uid,
|
||||
uv_gid_t gid,
|
||||
uv_fs_cb cb);
|
||||
UV_EXTERN int uv_fs_statfs(uv_loop_t* loop,
|
||||
uv_fs_t* req,
|
||||
const char* path,
|
||||
uv_fs_cb cb);
|
||||
|
||||
|
||||
enum uv_fs_event {
|
||||
@@ -1538,6 +1615,26 @@ UV_EXTERN int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size
|
||||
UV_EXTERN int uv_inet_ntop(int af, const void* src, char* dst, size_t size);
|
||||
UV_EXTERN int uv_inet_pton(int af, const char* src, void* dst);
|
||||
|
||||
|
||||
struct uv_random_s {
|
||||
UV_REQ_FIELDS
|
||||
/* read-only */
|
||||
uv_loop_t* loop;
|
||||
/* private */
|
||||
int status;
|
||||
void* buf;
|
||||
size_t buflen;
|
||||
uv_random_cb cb;
|
||||
struct uv__work work_req;
|
||||
};
|
||||
|
||||
UV_EXTERN int uv_random(uv_loop_t* loop,
|
||||
uv_random_t* req,
|
||||
void *buf,
|
||||
size_t buflen,
|
||||
unsigned flags, /* For future extension; must be 0. */
|
||||
uv_random_cb cb);
|
||||
|
||||
#if defined(IF_NAMESIZE)
|
||||
# define UV_IF_NAMESIZE (IF_NAMESIZE + 1)
|
||||
#elif defined(IFNAMSIZ)
|
||||
@@ -1564,6 +1661,7 @@ UV_EXTERN uint64_t uv_get_total_memory(void);
|
||||
UV_EXTERN uint64_t uv_get_constrained_memory(void);
|
||||
|
||||
UV_EXTERN uint64_t uv_hrtime(void);
|
||||
UV_EXTERN void uv_sleep(unsigned int msec);
|
||||
|
||||
UV_EXTERN void uv_disable_stdio_inheritance(void);
|
||||
|
||||
|
||||
@@ -439,5 +439,10 @@
|
||||
# define UV__EFTYPE (-4028)
|
||||
#endif
|
||||
|
||||
#if defined(EILSEQ) && !defined(_WIN32)
|
||||
# define UV__EILSEQ UV__ERR(EILSEQ)
|
||||
#else
|
||||
# define UV__EILSEQ (-4027)
|
||||
#endif
|
||||
|
||||
#endif /* UV_ERRNO_H_ */
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
# include "uv/linux.h"
|
||||
#elif defined (__MVS__)
|
||||
# include "uv/os390.h"
|
||||
#elif defined(__PASE__) /* __PASE__ and _AIX are both defined on IBM i */
|
||||
# include "uv/posix.h" /* IBM i needs uv/posix.h, not uv/aix.h */
|
||||
#elif defined(_AIX)
|
||||
# include "uv/aix.h"
|
||||
#elif defined(__sun)
|
||||
@@ -61,8 +63,7 @@
|
||||
defined(__OpenBSD__) || \
|
||||
defined(__NetBSD__)
|
||||
# include "uv/bsd.h"
|
||||
#elif defined(__PASE__) || \
|
||||
defined(__CYGWIN__) || \
|
||||
#elif defined(__CYGWIN__) || \
|
||||
defined(__MSYS__) || \
|
||||
defined(__GNU__)
|
||||
# include "uv/posix.h"
|
||||
@@ -404,11 +405,25 @@ typedef struct {
|
||||
#else
|
||||
# define UV_FS_O_CREAT 0
|
||||
#endif
|
||||
#if defined(O_DIRECT)
|
||||
|
||||
#if defined(__linux__) && defined(__arm__)
|
||||
# define UV_FS_O_DIRECT 0x10000
|
||||
#elif defined(__linux__) && defined(__m68k__)
|
||||
# define UV_FS_O_DIRECT 0x10000
|
||||
#elif defined(__linux__) && defined(__mips__)
|
||||
# define UV_FS_O_DIRECT 0x08000
|
||||
#elif defined(__linux__) && defined(__powerpc__)
|
||||
# define UV_FS_O_DIRECT 0x20000
|
||||
#elif defined(__linux__) && defined(__s390x__)
|
||||
# define UV_FS_O_DIRECT 0x04000
|
||||
#elif defined(__linux__) && defined(__x86_64__)
|
||||
# define UV_FS_O_DIRECT 0x04000
|
||||
#elif defined(O_DIRECT)
|
||||
# define UV_FS_O_DIRECT O_DIRECT
|
||||
#else
|
||||
# define UV_FS_O_DIRECT 0
|
||||
#endif
|
||||
|
||||
#if defined(O_DIRECTORY)
|
||||
# define UV_FS_O_DIRECTORY O_DIRECTORY
|
||||
#else
|
||||
@@ -481,6 +496,7 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
/* fs open() flags supported on other platforms: */
|
||||
#define UV_FS_O_FILEMAP 0
|
||||
#define UV_FS_O_RANDOM 0
|
||||
#define UV_FS_O_SHORT_LIVED 0
|
||||
#define UV_FS_O_SEQUENTIAL 0
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
*/
|
||||
|
||||
#define UV_VERSION_MAJOR 1
|
||||
#define UV_VERSION_MINOR 29
|
||||
#define UV_VERSION_PATCH 2
|
||||
#define UV_VERSION_MINOR 35
|
||||
#define UV_VERSION_PATCH 1
|
||||
#define UV_VERSION_IS_RELEASE 0
|
||||
#define UV_VERSION_SUFFIX "dev"
|
||||
|
||||
|
||||
@@ -517,7 +517,7 @@ typedef struct {
|
||||
/* eol conversion state */ \
|
||||
unsigned char previous_eol; \
|
||||
/* ansi parser state */ \
|
||||
unsigned char ansi_parser_state; \
|
||||
unsigned short ansi_parser_state; \
|
||||
unsigned char ansi_csi_argc; \
|
||||
unsigned short ansi_csi_argv[4]; \
|
||||
COORD saved_position; \
|
||||
@@ -668,6 +668,7 @@ typedef struct {
|
||||
#define UV_FS_O_APPEND _O_APPEND
|
||||
#define UV_FS_O_CREAT _O_CREAT
|
||||
#define UV_FS_O_EXCL _O_EXCL
|
||||
#define UV_FS_O_FILEMAP 0x20000000
|
||||
#define UV_FS_O_RANDOM _O_RANDOM
|
||||
#define UV_FS_O_RDONLY _O_RDONLY
|
||||
#define UV_FS_O_RDWR _O_RDWR
|
||||
|
||||
Reference in New Issue
Block a user