一、概述
Libuv 定义了若干枚举,本文集中列出方便查询( 针对 Windows 平台的枚举未完全列出)。这些枚举主要定义在如下文件:
include/uv.h
include/uv-common.h
src/unix/internal.h
src/unix/fsevents.c ( Darwin )
src/win/tty.c ( Windows )
src/win/winapi.h ( Windows )
二、用于声明枚举的映射( Map )的宏
主要目的是方便维护、减少出错几率和减少代码量。UV_ERRNO_MAP :映射错误号和错误消息。用在 uv_strerror 和 uv_err_name 函数。UV_HANDLE_TYPE_MAP :映射 Handles 类型。UV_REQ_TYPE_MAP :映射 Requests 类型。
注:映射宏一般配合命名为 “XX” 的临时宏使用。
三、include/uv.h
1、uv_errno_t :错误号
1 | typedef enum { |
2、uv_handle_type :Handle 类型
1 | typedef enum { |
3、uv_req_type :Request 类型
1 | typedef enum { |
4、uv_loop_option :Loop 选项
1 | typedef enum { |
5、uv_run_mode :Loop 运行模式
1 | typedef enum { |
6、uv_membership :UDP socket 组播选项
1 | typedef enum { |
7、uv_tcp_flags :TCP socket 标记
1 | enum uv_tcp_flags { |
8、uv_udp_flags :UDP socket 标记
1 | enum uv_udp_flags { |
9、uv_tty_mode_t :tty 模式
1 | typedef enum { |
10、poll 事件
1 | enum uv_poll_event { |
11、uv_stdio_flags :标准 IO 标记
1 | /* uv_spawn() options. */ |
12、uv_process_flags :进程标记
1 | /* |
13、uv_dirent_type_t :dirent 结构中的文件类型字段映射
1 | typedef enum { |
14、uv_fs_type :文件系统操作类型
1 | typedef enum { |
15、uv_fs_event :文件系统事件
1 | enum uv_fs_event { |
16、uv_fs_event_flags :文件系统事件处理标记
1 | /* |
目前仅在 macOS 和 Windows 使用了 UV_FS_EVENT_RECURSIVE 标记。
四、include/uv-common.h
1、Handle 标记
1 |
|
五、src/unix/internal.h
1、Handle 标记
1 | /* handle flags */ |
2、Loop 标记
1 | /* loop flags */ |
3、uv_clocktype_t :时钟类型
1 | typedef enum { |
六、include/fsevents.c ( Darwin )
1、uv__cf_loop_signal_type_t :Core Foundation 事件循环信号类型
1 | enum uv__cf_loop_signal_type_e { |
七、Windows
1、_FS_INFORMATION_CLASS
1 | typedef enum _FS_INFORMATION_CLASS { |
2、uv__read_console_status_e
1 | enum uv__read_console_status_e { |