builtinstdassertSOfd_tgid_tino_tmode_toff_tpid_tpthread_tsockaddrsocklen_ttimespecuid_tIFNAMESIZEpthread_setname_npsysconfmajor_tminor_tid_ttaskid_tprojid_tpoolid_tzoneid_tctid_tGETCONTEXTSETCONTEXTGETUSTACKSETUSTACKPOSIX_FADVpriorityAT_SUNAF_SUNprocfsSFDsignalfd_siginfoPORT_SOURCEPORT_ALERTFILE_EVENTport_notifyfile_objSIOCGLIFINDEXlif_nd_reqlif_ifinfo_reqlifreqIoCtlCommandioImplIOIORIOWIOWRIPIPV6IPTOSTCP
std.c.illumos.AF_SUN
命名空间
ELF 辅助向量标志。
std.c.illumos.AF_SUN.HWCAPVERIFY
常量
可通过 AT_SUN_HWCAP 验证硬件能力
std.c.illumos.AF_SUN.NOPLM
常量
std.c.illumos.AF_SUN.SETUGID
常量
告知 ld.so.1 以“安全”模式运行并忽略环境。
std.c.illumos.assert
别名
别名目标 std.debug.assert
std.c.illumos.AT_SUN
命名空间
ELF 辅助向量的扩展。
std.c.illumos.AT_SUN.AUXFLAGS
常量
内核传入的 AF_SUN_ 标志
std.c.illumos.AT_SUN.BRAND_AUX1
常量
品牌模块的向量。
std.c.illumos.AT_SUN.BRAND_AUX2
常量
std.c.illumos.AT_SUN.BRAND_AUX3
常量
std.c.illumos.AT_SUN.BRAND_AUX4
常量
std.c.illumos.AT_SUN.BRAND_NROOT
常量
std.c.illumos.AT_SUN.BRANDNAME
常量
供链接器使用的品牌库名称
std.c.illumos.AT_SUN.COMMPAGE
常量
通信页的向量。
std.c.illumos.AT_SUN.CPU
常量
cpu 名称
std.c.illumos.AT_SUN.EMULATOR
常量
链接器使用的仿真二进制文件名称
std.c.illumos.AT_SUN.EXECNAME
常量
auxv 中 exec() 的路径名,以空字符终止。
std.c.illumos.AT_SUN.FPSIZE
常量
std.c.illumos.AT_SUN.FPTYPE
常量
有关 x86 FPU 的信息。
std.c.illumos.AT_SUN.GID
常量
有效组标识
std.c.illumos.AT_SUN.HWCAP
常量
有关硬件能力的提示。
std.c.illumos.AT_SUN.HWCAP2
常量
std.c.illumos.AT_SUN.IFLUSH
常量
是否刷新指令缓存?
std.c.illumos.AT_SUN.LDDATA
常量
动态链接器的数据段
std.c.illumos.AT_SUN.LDELF
常量
动态链接器的 ELF 头
std.c.illumos.AT_SUN.LDNAME
常量
动态链接器名称
std.c.illumos.AT_SUN.LDSHDR
常量
动态链接器的节头部
std.c.illumos.AT_SUN.LPAGESZ
常量
大页大小
std.c.illumos.AT_SUN.MMU
常量
MMU 模块名称
std.c.illumos.AT_SUN.PLATFORM
常量
平台名称
std.c.illumos.AT_SUN.RGID
常量
实际组标识
std.c.illumos.AT_SUN.RUID
常量
实际用户标识
std.c.illumos.AT_SUN.UID
常量
有效用户标识
std.c.illumos.builtin
常量
std.c.illumos.ctid_t
别名
别名目标 std.c.illumos.id_t
std.c.illumos.fd_t
别名
别名目标 std.c.fd_t
std.c.illumos.FILE_EVENT
命名空间
用户可监视的文件事件。
std.c.illumos.FILE_EVENT.ACCESS
常量
std.c.illumos.FILE_EVENT.ATTRIB
常量
std.c.illumos.FILE_EVENT.DELETE
常量
std.c.illumos.FILE_EVENT.isException
函数
pub fn isException(event: u32) bool
参数
event: u32
std.c.illumos.FILE_EVENT.MODIFIED
常量
std.c.illumos.FILE_EVENT.MOUNTEDOVER
常量
其他文件/文件系统挂载到了受监视文件/目录之上。
std.c.illumos.FILE_EVENT.NOFOLLOW
常量
std.c.illumos.FILE_EVENT.RENAME_FROM
常量
std.c.illumos.FILE_EVENT.RENAME_TO
常量
std.c.illumos.FILE_EVENT.TRUNC
常量
std.c.illumos.FILE_EVENT.UNMOUNTED
常量
受监视文件所在的文件系统已卸载。
std.c.illumos.file_obj
容器
字段
std.c.illumos.GETCONTEXT
常量
std.c.illumos.GETUSTACK
常量
std.c.illumos.gid_t
别名
别名目标 std.c.gid_t
std.c.illumos.id_t
类型
std.c.illumos.IFNAMESIZE
别名
别名目标 std.c.IFNAMESIZE
std.c.illumos.ino_t
别名
别名目标 std.c.ino_t
std.c.illumos.IO
函数
pub fn IO(io_type: u8, nr: u8) i32
参数
io_type: u8
nr: u8
std.c.illumos.IoCtlCommand
容器
字段
none = 0x20000000
write = 0x40000000
read = 0x80000000
read_write = 0xc0000000
std.c.illumos.ioImpl
函数
fn ioImpl(cmd: IoCtlCommand, io_type: u8, nr: u8, comptime IOT: type) i32
参数
std.c.illumos.IOR
函数
pub fn IOR(io_type: u8, nr: u8, comptime IOT: type) i32
参数
io_type: u8
nr: u8
IOT: type
std.c.illumos.IOW
函数
pub fn IOW(io_type: u8, nr: u8, comptime IOT: type) i32
参数
io_type: u8
nr: u8
IOT: type
std.c.illumos.IOWR
函数
pub fn IOWR(io_type: u8, nr: u8, comptime IOT: type) i32
参数
io_type: u8
nr: u8
IOT: type
std.c.illumos.IP
命名空间
OPTIONSHDRINCLTOSTTLRECVOPTSRECVRETOPTSRECVDSTADDRRETOPTSRECVIFRECVSLLARECVTTLRECVTOSMULTICAST_IFMULTICAST_TTLMULTICAST_LOOPADD_MEMBERSHIPDROP_MEMBERSHIPBLOCK_SOURCEUNBLOCK_SOURCEADD_SOURCE_MEMBERSHIPDROP_SOURCE_MEMBERSHIPNEXTHOPPKTINFORECVPKTINFODONTFRAGMINTTLSEC_OPTBOUND_IFUNSPEC_SRCBROADCAST_TTLDHCPINIT_IFREUSEADDRDONTROUTEBROADCASTDEFAULT_MULTICAST_TTLDEFAULT_MULTICAST_LOOP
std.c.illumos.IP.ADD_MEMBERSHIP
常量
std.c.illumos.IP.ADD_SOURCE_MEMBERSHIP
常量
std.c.illumos.IP.BLOCK_SOURCE
常量
std.c.illumos.IP.BOUND_IF
常量
std.c.illumos.IP.BROADCAST
常量
std.c.illumos.IP.BROADCAST_TTL
常量
std.c.illumos.IP.DEFAULT_MULTICAST_LOOP
常量
std.c.illumos.IP.DEFAULT_MULTICAST_TTL
常量
std.c.illumos.IP.DHCPINIT_IF
常量
std.c.illumos.IP.DONTFRAG
常量
std.c.illumos.IP.DONTROUTE
常量
std.c.illumos.IP.DROP_MEMBERSHIP
常量
std.c.illumos.IP.DROP_SOURCE_MEMBERSHIP
常量
std.c.illumos.IP.HDRINCL
常量
std.c.illumos.IP.MINTTL
常量
std.c.illumos.IP.MULTICAST_IF
常量
std.c.illumos.IP.MULTICAST_LOOP
常量
std.c.illumos.IP.MULTICAST_TTL
常量
std.c.illumos.IP.NEXTHOP
常量
std.c.illumos.IP.OPTIONS
常量
std.c.illumos.IP.PKTINFO
常量
std.c.illumos.IP.RECVDSTADDR
常量
std.c.illumos.IP.RECVIF
常量
std.c.illumos.IP.RECVOPTS
常量
std.c.illumos.IP.RECVPKTINFO
常量
std.c.illumos.IP.RECVRETOPTS
常量
std.c.illumos.IP.RECVSLLA
常量
std.c.illumos.IP.RECVTOS
常量
std.c.illumos.IP.RECVTTL
常量
std.c.illumos.IP.RETOPTS
常量
std.c.illumos.IP.REUSEADDR
常量
std.c.illumos.IP.SEC_OPT
常量
std.c.illumos.IP.TOS
常量
std.c.illumos.IP.TTL
常量
std.c.illumos.IP.UNBLOCK_SOURCE
常量
std.c.illumos.IP.UNSPEC_SRC
常量
std.c.illumos.IPTOS
命名空间
std.c.illumos.IPTOS.CE
常量
std.c.illumos.IPTOS.ECT
常量
std.c.illumos.IPTOS.LOWDELAY
常量
std.c.illumos.IPTOS.PREC_CRITIC_ECP
常量
std.c.illumos.IPTOS.PREC_FLASH
常量
std.c.illumos.IPTOS.PREC_FLASHOVERRIDE
常量
std.c.illumos.IPTOS.PREC_IMMEDIATE
常量
std.c.illumos.IPTOS.PREC_INTERNETCONTROL
常量
std.c.illumos.IPTOS.PREC_NETCONTROL
常量
std.c.illumos.IPTOS.PREC_PRIORITY
常量
std.c.illumos.IPTOS.PREC_ROUTINE
常量
std.c.illumos.IPTOS.RELIABILITY
常量
std.c.illumos.IPTOS.THROUGHPUT
常量
std.c.illumos.IPV6
命名空间
UNICAST_HOPSMULTICAST_IFMULTICAST_HOPSMULTICAST_LOOPJOIN_GROUPLEAVE_GROUPADD_MEMBERSHIPDROP_MEMBERSHIPPKTINFOHOPLIMITNEXTHOPHOPOPTSDSTOPTSRTHDRRTHDRDSTOPTSRECVPKTINFORECVHOPLIMITRECVHOPOPTSOLD_RECVDSTOPTSRECVRTHDRRECVRTHDRDSTOPTSCHECKSUMRECVTCLASSUSE_MIN_MTUDONTFRAGSEC_OPTSRC_PREFERENCESRECVPATHMTUPATHMTUTCLASSV6ONLYRECVDSTOPTSMINHOPCOUNTBOUND_IFUNSPEC_SRCRTHDR_TYPE_0PREFER_SRC_HOMEPREFER_SRC_COAPREFER_SRC_PUBLICPREFER_SRC_TMPPREFER_SRC_NONCGAPREFER_SRC_CGAPREFER_SRC_MIPMASKPREFER_SRC_MIPDEFAULTPREFER_SRC_TMPMASKPREFER_SRC_TMPDEFAULTPREFER_SRC_CGAMASKPREFER_SRC_CGADEFAULTPREFER_SRC_MASKPREFER_SRC_DEFAULT
std.c.illumos.IPV6.ADD_MEMBERSHIP
常量
std.c.illumos.IPV6.BOUND_IF
常量
std.c.illumos.IPV6.CHECKSUM
常量
std.c.illumos.IPV6.DONTFRAG
常量
std.c.illumos.IPV6.DROP_MEMBERSHIP
常量
std.c.illumos.IPV6.DSTOPTS
常量
std.c.illumos.IPV6.HOPLIMIT
常量
std.c.illumos.IPV6.HOPOPTS
常量
std.c.illumos.IPV6.JOIN_GROUP
常量
std.c.illumos.IPV6.LEAVE_GROUP
常量
std.c.illumos.IPV6.MINHOPCOUNT
常量
std.c.illumos.IPV6.MULTICAST_HOPS
常量
std.c.illumos.IPV6.MULTICAST_IF
常量
std.c.illumos.IPV6.MULTICAST_LOOP
常量
std.c.illumos.IPV6.NEXTHOP
常量
std.c.illumos.IPV6.OLD_RECVDSTOPTS
常量
std.c.illumos.IPV6.PATHMTU
常量
std.c.illumos.IPV6.PKTINFO
常量
std.c.illumos.IPV6.PREFER_SRC_CGA
常量
std.c.illumos.IPV6.PREFER_SRC_CGADEFAULT
别名
std.c.illumos.IPV6.PREFER_SRC_CGAMASK
常量
std.c.illumos.IPV6.PREFER_SRC_COA
常量
std.c.illumos.IPV6.PREFER_SRC_DEFAULT
常量
std.c.illumos.IPV6.PREFER_SRC_HOME
常量
std.c.illumos.IPV6.PREFER_SRC_MASK
常量
std.c.illumos.IPV6.PREFER_SRC_MIPDEFAULT
别名
std.c.illumos.IPV6.PREFER_SRC_MIPMASK
常量
std.c.illumos.IPV6.PREFER_SRC_NONCGA
常量
std.c.illumos.IPV6.PREFER_SRC_PUBLIC
常量
std.c.illumos.IPV6.PREFER_SRC_TMP
常量
std.c.illumos.IPV6.PREFER_SRC_TMPDEFAULT
别名
std.c.illumos.IPV6.PREFER_SRC_TMPMASK
常量
std.c.illumos.IPV6.RECVDSTOPTS
常量
std.c.illumos.IPV6.RECVHOPLIMIT
常量
std.c.illumos.IPV6.RECVHOPOPTS
常量
std.c.illumos.IPV6.RECVPATHMTU
常量
std.c.illumos.IPV6.RECVPKTINFO
常量
std.c.illumos.IPV6.RECVRTHDR
常量
std.c.illumos.IPV6.RECVRTHDRDSTOPTS
常量
std.c.illumos.IPV6.RECVTCLASS
常量
std.c.illumos.IPV6.RTHDR
常量
std.c.illumos.IPV6.RTHDR_TYPE_0
常量
std.c.illumos.IPV6.RTHDRDSTOPTS
常量
std.c.illumos.IPV6.SEC_OPT
常量
std.c.illumos.IPV6.SRC_PREFERENCES
常量
std.c.illumos.IPV6.TCLASS
常量
std.c.illumos.IPV6.UNICAST_HOPS
常量
std.c.illumos.IPV6.UNSPEC_SRC
常量
std.c.illumos.IPV6.USE_MIN_MTU
常量
std.c.illumos.IPV6.V6ONLY
常量
std.c.illumos.lif_ifinfo_req
容器
字段
maxhops: u8
reachtime: u32
reachretrans: u32
maxmtu: u32
std.c.illumos.lif_nd_req
容器
字段
std.c.illumos.lifreq
容器
IP 接口请求。详情见 if_tcp(7p)。
字段
ifrn: extern union {
/// 接口名称,例如 "lo0"、"en0"。
name: [IFNAMESIZE]u8,
}
ru1: extern union {
/// 用于子网、令牌等。
addrlen: i32,
/// 驱动程序的 PPA(物理附着点)。
ppa: u32,
}
type: u32IFT 类型之一,例如 IFT_ETHER。
ifru: extern union {
/// 地址。
addr: sockaddr.storage,
/// 点对点链路的另一端。
dstaddr: sockaddr.storage,
/// 广播地址。
broadaddr: sockaddr.storage,
/// 地址令牌。
token: sockaddr.storage,
/// 子网前缀。
subnet: sockaddr.storage,
/// 接口索引。
ivalue: i32,
/// SIOC?LIFFLAGS 的标志。
flags: u64,
/// 跳数度量
metric: i32,
/// 最大传输单元
mtu: u32,
// 严格而言为 [2]i32
muxid: packed struct(u64) { ip: i32, arp: i32 },
/// 邻居可达性判定条目
nd_req: lif_nd_req,
/// 链接信息
ifinfo_req: lif_ifinfo_req,
/// 多路径接口组的名称
groupname: [IFNAMESIZE]u8,
binding: [IFNAMESIZE]u8,
/// 与此接口关联的区域 ID。
zoneid: zoneid_t,
/// 重复地址检测状态,正在进行或已完成。
dadstate: u32,
}
std.c.illumos.major_t
类型
std.c.illumos.minor_t
类型
std.c.illumos.mode_t
别名
别名目标 std.c.mode_t
std.c.illumos.off_t
别名
别名目标 std.c.off_t
std.c.illumos.pid_t
别名
别名目标 std.c.pid_t
std.c.illumos.poolid_t
别名
别名目标 std.c.illumos.id_t
std.c.illumos.PORT_ALERT
命名空间
std.c.illumos.PORT_ALERT.SET
常量
std.c.illumos.PORT_ALERT.UPDATE
常量
std.c.illumos.port_notify
容器
字段
port: u32将请求绑定到端口。
user: ?*void用户定义的变量。
std.c.illumos.PORT_SOURCE
命名空间
std.c.illumos.PORT_SOURCE.AIO
常量
std.c.illumos.PORT_SOURCE.ALERT
常量
std.c.illumos.PORT_SOURCE.FD
常量
std.c.illumos.PORT_SOURCE.FILE
常量
std.c.illumos.PORT_SOURCE.MQ
常量
std.c.illumos.PORT_SOURCE.TIMER
常量
std.c.illumos.PORT_SOURCE.USER
常量
std.c.illumos.POSIX_FADV
命名空间
std.c.illumos.POSIX_FADV.DONTNEED
常量
std.c.illumos.POSIX_FADV.NOREUSE
常量
std.c.illumos.POSIX_FADV.NORMAL
常量
std.c.illumos.POSIX_FADV.RANDOM
常量
std.c.illumos.POSIX_FADV.SEQUENTIAL
常量
std.c.illumos.POSIX_FADV.WILLNEED
常量
std.c.illumos.priority
容器
字段
PROCESS = 0
PGRP = 1
USER = 2
GROUP = 3
SESSION = 4
LWP = 5
TASK = 6
PROJECT = 7
ZONE = 8
CONTRACT = 9
std.c.illumos.procfs
命名空间
std.c.illumos.procfs.fdinfo
容器
字段
fd: fd_t
mode: mode_t
ino: ino_t
size: off_t
offset: off_t
uid: uid_t
gid: gid_t
dev_major: major_t
dev_minor: minor_t
special_major: major_t
special_minor: minor_t
fileflags: i32
fdflags: i32
locktype: i16
lockpid: pid_t
locksysid: i32
peerpid: pid_t
__filler: [25]c_int
peername: [15:0]u8
misc: [1]u8
std.c.illumos.procfs.misc_header
容器
字段
size: u32
type: enum(u32) {
Pathname,
Socketname,
Peersockname,
SockoptsBoolOpts,
SockoptLinger,
SockoptSndbuf,
SockoptRcvbuf,
SockoptIpNexthop,
SockoptIpv6Nexthop,
SockoptType,
SockoptTcpCongestion,
SockfiltersPriv = 14,
}
std.c.illumos.projid_t
别名
别名目标 std.c.illumos.id_t
std.c.illumos.pthread_setname_np
函数
pub extern "c" fn pthread_setname_np(thread: pthread_t, name: [*:0]const u8, arg: ?*anyopaque) c_int
参数
std.c.illumos.pthread_t
别名
别名目标 std.c.pthread_t
std.c.illumos.SETCONTEXT
常量
std.c.illumos.SETUSTACK
常量
std.c.illumos.SFD
命名空间
std.c.illumos.SFD.CLOEXEC
常量
std.c.illumos.SFD.NONBLOCK
常量
std.c.illumos.signalfd_siginfo
容器
字段
signo: u32
errno: i32
code: i32
pid: u32
uid: uid_t
fd: i32
tid: u32
band: u32
overrun: u32
trapno: u32
status: i32
int: i32
ptr: u64
utime: u64
stime: u64
addr: u64
__pad: [48]u8
std.c.illumos.SIOCGLIFINDEX
常量
std.c.illumos.SO
别名
别名目标 std.c.SO
std.c.illumos.sockaddr
别名
别名目标 std.c.sockaddr
std.c.illumos.socklen_t
别名
别名目标 std.c.socklen_t
std.c.illumos.std
别名
别名目标 std
std.c.illumos.sysconf
函数
pub extern "c" fn sysconf(sc: c_int) i64
参数
sc: c_int
std.c.illumos.taskid_t
别名
别名目标 std.c.illumos.id_t
std.c.illumos.TCP
命名空间
std.c.illumos.TCP.ABORT_THRESHOLD
常量
std.c.illumos.TCP.ANONPRIVBIND
常量
std.c.illumos.TCP.CONGESTION
常量
std.c.illumos.TCP.CONN_ABORT_THRESHOLD
常量
std.c.illumos.TCP.CONN_NOTIFY_THRESHOLD
常量
std.c.illumos.TCP.CORK
常量
std.c.illumos.TCP.EXCLBIND
常量
std.c.illumos.TCP.INIT_CWND
常量
std.c.illumos.TCP.KEEPALIVE
常量
std.c.illumos.TCP.KEEPALIVE_ABORT_THRESHOLD
常量
std.c.illumos.TCP.KEEPALIVE_THRESHOLD
常量
std.c.illumos.TCP.KEEPCNT
常量
std.c.illumos.TCP.KEEPIDLE
常量
std.c.illumos.TCP.KEEPINTVL
常量
std.c.illumos.TCP.LINGER2
常量
std.c.illumos.TCP.MAXSEG
常量
std.c.illumos.TCP.MD5SIG
常量
std.c.illumos.TCP.NODELAY
常量
std.c.illumos.TCP.NOTIFY_THRESHOLD
常量
std.c.illumos.TCP.QUICKACK
常量
std.c.illumos.TCP.RECVDSTADDR
常量
std.c.illumos.TCP.RTO_INITIAL
常量
std.c.illumos.TCP.RTO_MAX
常量
std.c.illumos.TCP.RTO_MIN
常量
std.c.illumos.timespec
别名
别名目标 std.c.timespec
std.c.illumos.uid_t
别名
别名目标 std.c.uid_t
std.c.illumos.zoneid_t
别名
别名目标 std.c.illumos.id_t
源码
std/c/illumos.zig
const builtin = @import("builtin");
const std = @import("../std.zig");
const assert = std.debug.assert;
const SO = std.c.SO;
const fd_t = std.c.fd_t;
const gid_t = std.c.gid_t;
const ino_t = std.c.ino_t;
const mode_t = std.c.mode_t;
const off_t = std.c.off_t;
const pid_t = std.c.pid_t;
const pthread_t = std.c.pthread_t;
const sockaddr = std.c.sockaddr;
const socklen_t = std.c.socklen_t;
const timespec = std.c.timespec;
const uid_t = std.c.uid_t;
const IFNAMESIZE = std.c.IFNAMESIZE;
comptime {
assert(builtin.os.tag == .illumos); // 防止在错误的操作系统上访问 std.c 符号。
}
pub extern "c" fn pthread_setname_np(thread: pthread_t, name: [*:0]const u8, arg: ?*anyopaque) c_int;
pub extern "c" fn sysconf(sc: c_int) i64;
pub const major_t = u32;
pub const minor_t = u32;
pub const id_t = i32;
pub const taskid_t = id_t;
pub const projid_t = id_t;
pub const poolid_t = id_t;
pub const zoneid_t = id_t;
pub const ctid_t = id_t;
pub const GETCONTEXT = 0;
pub const SETCONTEXT = 1;
pub const GETUSTACK = 2;
pub const SETUSTACK = 3;
pub const POSIX_FADV = struct {
pub const NORMAL = 0;
pub const RANDOM = 1;
pub const SEQUENTIAL = 2;
pub const WILLNEED = 3;
pub const DONTNEED = 4;
pub const NOREUSE = 5;
};
pub const priority = enum(c_int) {
PROCESS = 0,
PGRP = 1,
USER = 2,
GROUP = 3,
SESSION = 4,
LWP = 5,
TASK = 6,
PROJECT = 7,
ZONE = 8,
CONTRACT = 9,
};
/// ELF 辅助向量的扩展。
pub const AT_SUN = struct {
/// 有效用户标识
pub const UID = 2000;
/// 实际用户标识
pub const RUID = 2001;
/// 有效组标识
pub const GID = 2002;
/// 实际组标识
pub const RGID = 2003;
/// 动态链接器的 ELF 头
pub const LDELF = 2004;
/// 动态链接器的节头部
pub const LDSHDR = 2005;
/// 动态链接器名称
pub const LDNAME = 2006;
/// 大页大小
pub const LPAGESZ = 2007;
/// 平台名称
pub const PLATFORM = 2008;
/// 有关硬件能力的提示。
pub const HWCAP = 2009;
pub const HWCAP2 = 2023;
/// 是否刷新指令缓存?
pub const IFLUSH = 2010;
/// cpu 名称
pub const CPU = 2011;
/// auxv 中 exec() 的路径名,以空字符终止。
pub const EXECNAME = 2014;
/// MMU 模块名称
pub const MMU = 2015;
/// 动态链接器的数据段
pub const LDDATA = 2016;
/// 内核传入的 AF_SUN_ 标志
pub const AUXFLAGS = 2017;
/// 链接器使用的仿真二进制文件名称
pub const EMULATOR = 2018;
/// 供链接器使用的品牌库名称
pub const BRANDNAME = 2019;
/// 品牌模块的向量。
pub const BRAND_AUX1 = 2020;
pub const BRAND_AUX2 = 2021;
pub const BRAND_AUX3 = 2022;
pub const BRAND_AUX4 = 2025;
pub const BRAND_NROOT = 2024;
/// 通信页的向量。
pub const COMMPAGE = 2026;
/// 有关 x86 FPU 的信息。
pub const FPTYPE = 2027;
pub const FPSIZE = 2028;
};
/// ELF 辅助向量标志。
pub const AF_SUN = struct {
/// 告知 ld.so.1 以“安全”模式运行并忽略环境。
pub const SETUGID = 0x00000001;
/// 可通过 AT_SUN_HWCAP 验证硬件能力
pub const HWCAPVERIFY = 0x00000002;
pub const NOPLM = 0x00000004;
};
pub const procfs = struct {
pub const misc_header = extern struct {
size: u32,
type: enum(u32) {
Pathname,
Socketname,
Peersockname,
SockoptsBoolOpts,
SockoptLinger,
SockoptSndbuf,
SockoptRcvbuf,
SockoptIpNexthop,
SockoptIpv6Nexthop,
SockoptType,
SockoptTcpCongestion,
SockfiltersPriv = 14,
},
};
pub const fdinfo = extern struct {
fd: fd_t,
mode: mode_t,
ino: ino_t,
size: off_t,
offset: off_t,
uid: uid_t,
gid: gid_t,
dev_major: major_t,
dev_minor: minor_t,
special_major: major_t,
special_minor: minor_t,
fileflags: i32,
fdflags: i32,
locktype: i16,
lockpid: pid_t,
locksysid: i32,
peerpid: pid_t,
__filler: [25]c_int,
peername: [15:0]u8,
misc: [1]u8,
};
};
pub const SFD = struct {
pub const CLOEXEC = 0o2000000;
pub const NONBLOCK = 0o4000;
};
pub const signalfd_siginfo = extern struct {
signo: u32,
errno: i32,
code: i32,
pid: u32,
uid: uid_t,
fd: i32,
tid: u32, // 未使用
band: u32,
overrun: u32, // 未使用
trapno: u32,
status: i32,
int: i32, // 未使用
ptr: u64, // 未使用
utime: u64,
stime: u64,
addr: u64,
__pad: [48]u8,
};
pub const PORT_SOURCE = struct {
pub const AIO = 1;
pub const TIMER = 2;
pub const USER = 3;
pub const FD = 4;
pub const ALERT = 5;
pub const MQ = 6;
pub const FILE = 7;
};
pub const PORT_ALERT = struct {
pub const SET = 0x01;
pub const UPDATE = 0x02;
};
/// 用户可监视的文件事件。
pub const FILE_EVENT = struct {
pub const ACCESS = 0x00000001;
pub const MODIFIED = 0x00000002;
pub const ATTRIB = 0x00000004;
pub const DELETE = 0x00000010;
pub const RENAME_TO = 0x00000020;
pub const RENAME_FROM = 0x00000040;
pub const TRUNC = 0x00100000;
pub const NOFOLLOW = 0x10000000;
/// 受监视文件所在的文件系统已卸载。
pub const UNMOUNTED = 0x20000000;
/// 其他文件/文件系统挂载到了受监视文件/目录之上。
pub const MOUNTEDOVER = 0x40000000;
pub fn isException(event: u32) bool {
return event & (UNMOUNTED | DELETE | RENAME_TO | RENAME_FROM | MOUNTEDOVER) > 0;
}
};
pub const port_notify = extern struct {
/// 将请求绑定到端口。
port: u32,
/// 用户定义的变量。
user: ?*void,
};
pub const file_obj = extern struct {
/// 访问时间。
atim: timespec,
/// 修改时间
mtim: timespec,
/// 更改时间
ctim: timespec,
__pad: [3]usize,
name: [*:0]u8,
};
// struct ifreq 已标记为过时,接口请求优先使用 struct lifreq。
// 这里将 lifreq 别名为 ifreq,以免修改 os 和 x.os.IPv6 中的现有代码。
pub const SIOCGLIFINDEX = IOWR('i', 133, lifreq);
pub const lif_nd_req = extern struct {
addr: sockaddr.storage,
state_create: u8,
state_same_lla: u8,
state_diff_lla: u8,
hdw_len: i32,
flags: i32,
__pad: i32,
hdw_addr: [64]u8,
};
pub const lif_ifinfo_req = extern struct {
maxhops: u8,
reachtime: u32,
reachretrans: u32,
maxmtu: u32,
};
/// IP 接口请求。详情见 if_tcp(7p)。
pub const lifreq = extern struct {
// 实际上并不位于联合体中,但标准库要求 ifreq 中有一个联合体
ifrn: extern union {
/// 接口名称,例如 "lo0"、"en0"。
name: [IFNAMESIZE]u8,
},
ru1: extern union {
/// 用于子网、令牌等。
addrlen: i32,
/// 驱动程序的 PPA(物理附着点)。
ppa: u32,
},
/// IFT 类型之一,例如 IFT_ETHER。
type: u32,
ifru: extern union {
/// 地址。
addr: sockaddr.storage,
/// 点对点链路的另一端。
dstaddr: sockaddr.storage,
/// 广播地址。
broadaddr: sockaddr.storage,
/// 地址令牌。
token: sockaddr.storage,
/// 子网前缀。
subnet: sockaddr.storage,
/// 接口索引。
ivalue: i32,
/// SIOC?LIFFLAGS 的标志。
flags: u64,
/// 跳数度量
metric: i32,
/// 最大传输单元
mtu: u32,
// 严格而言为 [2]i32
muxid: packed struct(u64) { ip: i32, arp: i32 },
/// 邻居可达性判定条目
nd_req: lif_nd_req,
/// 链接信息
ifinfo_req: lif_ifinfo_req,
/// 多路径接口组的名称
groupname: [IFNAMESIZE]u8,
binding: [IFNAMESIZE]u8,
/// 与此接口关联的区域 ID。
zoneid: zoneid_t,
/// 重复地址检测状态,正在进行或已完成。
dadstate: u32,
},
};
const IoCtlCommand = enum(u32) {
none = 0x20000000, // 无参数
write = 0x40000000, // 复制出参
read = 0x80000000, // 复制输入参数
read_write = 0xc0000000,
};
fn ioImpl(cmd: IoCtlCommand, io_type: u8, nr: u8, comptime IOT: type) i32 {
const size = @as(u32, @intCast(@as(u8, @truncate(@sizeOf(IOT))))) << 16;
const t = @as(u32, @intCast(io_type)) << 8;
return @as(i32, @bitCast(@backingInt(cmd) | size | t | nr));
}
pub fn IO(io_type: u8, nr: u8) i32 {
return ioImpl(.none, io_type, nr, void);
}
pub fn IOR(io_type: u8, nr: u8, comptime IOT: type) i32 {
return ioImpl(.write, io_type, nr, IOT);
}
pub fn IOW(io_type: u8, nr: u8, comptime IOT: type) i32 {
return ioImpl(.read, io_type, nr, IOT);
}
pub fn IOWR(io_type: u8, nr: u8, comptime IOT: type) i32 {
return ioImpl(.read_write, io_type, nr, IOT);
}
// https://github.com/illumos/illumos-gate/blob/608eb926e14f4ba4736b2d59e891335f1cba9e1e/usr/src/uts/common/netinet/in.h#L1141
// (旧版 OpenSolaris 非常相似,只是缺少更多现代项目;现代 Solaris 可能已包含这些项目。)
pub const IP = struct {
pub const OPTIONS = 1;
pub const HDRINCL = 2;
pub const TOS = 3;
pub const TTL = 4;
pub const RECVOPTS = 0x5;
pub const RECVRETOPTS = 0x6;
pub const RECVDSTADDR = 0x7;
pub const RETOPTS = 0x8;
pub const RECVIF = 0x9;
pub const RECVSLLA = 0xa;
pub const RECVTTL = 0xb;
pub const RECVTOS = 0xc;
pub const MULTICAST_IF = 0x10;
pub const MULTICAST_TTL = 0x11;
pub const MULTICAST_LOOP = 0x12;
pub const ADD_MEMBERSHIP = 0x13;
pub const DROP_MEMBERSHIP = 0x14;
pub const BLOCK_SOURCE = 0x15;
pub const UNBLOCK_SOURCE = 0x16;
pub const ADD_SOURCE_MEMBERSHIP = 0x17;
pub const DROP_SOURCE_MEMBERSHIP = 0x18;
pub const NEXTHOP = 0x19;
pub const PKTINFO = 0x1a;
pub const RECVPKTINFO = 0x1a;
pub const DONTFRAG = 0x1b;
pub const MINTTL = 0x1c;
pub const SEC_OPT = 0x22;
pub const BOUND_IF = 0x41;
pub const UNSPEC_SRC = 0x42;
pub const BROADCAST_TTL = 0x43;
pub const DHCPINIT_IF = 0x45;
pub const REUSEADDR = 0x104;
pub const DONTROUTE = 0x105;
pub const BROADCAST = 0x106;
// 命名空间相同,但这些是参数,而不是选项名称
pub const DEFAULT_MULTICAST_TTL = 1;
pub const DEFAULT_MULTICAST_LOOP = 1;
};
// https://github.com/illumos/illumos-gate/blob/608eb926e14f4ba4736b2d59e891335f1cba9e1e/usr/src/uts/common/netinet/in.h#L1192
// 旧 OpenSolaris 非常相似,只是缺少一些较新的定义;现代 Solaris 可能已经包含。
pub const IPV6 = struct {
pub const UNICAST_HOPS = 0x5;
pub const MULTICAST_IF = 0x6;
pub const MULTICAST_HOPS = 0x7;
pub const MULTICAST_LOOP = 0x8;
pub const JOIN_GROUP = 0x9;
pub const LEAVE_GROUP = 0xa;
pub const ADD_MEMBERSHIP = 0x9;
pub const DROP_MEMBERSHIP = 0xa;
pub const PKTINFO = 0xb;
pub const HOPLIMIT = 0xc;
pub const NEXTHOP = 0xd;
pub const HOPOPTS = 0xe;
pub const DSTOPTS = 0xf;
pub const RTHDR = 0x10;
pub const RTHDRDSTOPTS = 0x11;
pub const RECVPKTINFO = 0x12;
pub const RECVHOPLIMIT = 0x13;
pub const RECVHOPOPTS = 0x14;
pub const OLD_RECVDSTOPTS = 0x15;
pub const RECVRTHDR = 0x16;
pub const RECVRTHDRDSTOPTS = 0x17;
pub const CHECKSUM = 0x18;
pub const RECVTCLASS = 0x19;
pub const USE_MIN_MTU = 0x20;
pub const DONTFRAG = 0x21;
pub const SEC_OPT = 0x22;
pub const SRC_PREFERENCES = 0x23;
pub const RECVPATHMTU = 0x24;
pub const PATHMTU = 0x25;
pub const TCLASS = 0x26;
pub const V6ONLY = 0x27;
pub const RECVDSTOPTS = 0x28;
pub const MINHOPCOUNT = 0x2f;
pub const BOUND_IF = 0x41;
pub const UNSPEC_SRC = 0x42;
// 命名空间相同,但这些是参数,而不是选项名称
pub const RTHDR_TYPE_0 = 0;
pub const PREFER_SRC_HOME = 0x01;
pub const PREFER_SRC_COA = 0x02;
pub const PREFER_SRC_PUBLIC = 0x04;
pub const PREFER_SRC_TMP = 0x08;
pub const PREFER_SRC_NONCGA = 0x10;
pub const PREFER_SRC_CGA = 0x20;
pub const PREFER_SRC_MIPMASK = PREFER_SRC_HOME | PREFER_SRC_COA;
pub const PREFER_SRC_MIPDEFAULT = PREFER_SRC_HOME;
pub const PREFER_SRC_TMPMASK = PREFER_SRC_PUBLIC | PREFER_SRC_TMP;
pub const PREFER_SRC_TMPDEFAULT = PREFER_SRC_PUBLIC;
pub const PREFER_SRC_CGAMASK = PREFER_SRC_NONCGA | PREFER_SRC_CGA;
pub const PREFER_SRC_CGADEFAULT = PREFER_SRC_NONCGA;
pub const PREFER_SRC_MASK = PREFER_SRC_MIPMASK | PREFER_SRC_TMPMASK | PREFER_SRC_CGAMASK;
pub const PREFER_SRC_DEFAULT = PREFER_SRC_MIPDEFAULT | PREFER_SRC_TMPDEFAULT | PREFER_SRC_CGADEFAULT;
};
// https://github.com/illumos/illumos-gate/blob/608eb926e14f4ba4736b2d59e891335f1cba9e1e/usr/src/uts/common/netinet/ip.h#L64
pub const IPTOS = struct {
pub const LOWDELAY = 0x10;
pub const THROUGHPUT = 0x08;
pub const RELIABILITY = 0x04;
pub const ECT = 0x02;
pub const CE = 0x01;
pub const PREC_NETCONTROL = 0xe0;
pub const PREC_INTERNETCONTROL = 0xc0;
pub const PREC_CRITIC_ECP = 0xa0;
pub const PREC_FLASHOVERRIDE = 0x80;
pub const PREC_FLASH = 0x60;
pub const PREC_IMMEDIATE = 0x40;
pub const PREC_PRIORITY = 0x20;
pub const PREC_ROUTINE = 0x00;
};
// https://github.com/illumos/illumos-gate/blob/e1e6b944360d951edf36ef4198261818ed2d9b2f/usr/src/uts/common/netinet/tcp.h#L94
pub const TCP = struct {
pub const NODELAY = 0x01;
pub const MAXSEG = 0x02;
pub const KEEPALIVE = 0x8;
pub const NOTIFY_THRESHOLD = 0x10;
pub const ABORT_THRESHOLD = 0x11;
pub const CONN_NOTIFY_THRESHOLD = 0x12;
pub const CONN_ABORT_THRESHOLD = 0x13;
pub const RECVDSTADDR = 0x14;
pub const INIT_CWND = 0x15;
pub const KEEPALIVE_THRESHOLD = 0x16;
pub const KEEPALIVE_ABORT_THRESHOLD = 0x17;
pub const CORK = 0x18;
pub const RTO_INITIAL = 0x19;
pub const RTO_MIN = 0x1A;
pub const RTO_MAX = 0x1B;
pub const LINGER2 = 0x1C;
pub const ANONPRIVBIND = 0x20;
pub const EXCLBIND = 0x21;
pub const KEEPIDLE = 0x22;
pub const KEEPCNT = 0x23;
pub const KEEPINTVL = 0x24;
pub const CONGESTION = 0x25;
pub const QUICKACK = 0x26;
pub const MD5SIG = 0x27;
};