mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 16:45:27 +00:00
std.os fixes to get the test suite passing again
This commit is contained in:
parent
feec4b0614
commit
057f0fec33
@ -57,6 +57,8 @@ pub usingnamespace switch (builtin.os.tag) {
|
||||
else => struct {},
|
||||
};
|
||||
|
||||
pub const whence_t = if (builtin.os.tag == .wasi) std.os.wasi.whence_t else c_int;
|
||||
|
||||
pub usingnamespace switch (builtin.os.tag) {
|
||||
.netbsd, .macos, .ios, .watchos, .tvos, .windows => struct {},
|
||||
else => struct {
|
||||
@ -106,7 +108,7 @@ pub extern "c" fn exit(code: c_int) noreturn;
|
||||
pub extern "c" fn _exit(code: c_int) noreturn;
|
||||
pub extern "c" fn isatty(fd: c.fd_t) c_int;
|
||||
pub extern "c" fn close(fd: c.fd_t) c_int;
|
||||
pub extern "c" fn lseek(fd: c.fd_t, offset: c.off_t, whence: c_int) c.off_t;
|
||||
pub extern "c" fn lseek(fd: c.fd_t, offset: c.off_t, whence: whence_t) c.off_t;
|
||||
pub extern "c" fn open(path: [*:0]const u8, oflag: c_uint, ...) c_int;
|
||||
pub extern "c" fn openat(fd: c_int, path: [*:0]const u8, oflag: c_uint, ...) c_int;
|
||||
pub extern "c" fn ftruncate(fd: c_int, length: c.off_t) c_int;
|
||||
|
@ -613,38 +613,26 @@ pub const MAP = struct {
|
||||
pub const FAILED = @intToPtr(*c_void, maxInt(usize));
|
||||
};
|
||||
|
||||
/// [XSI] no hang in wait/no child to reap
|
||||
pub const WNOHANG = 0x00000001;
|
||||
|
||||
/// [XSI] notify on stop, untraced child
|
||||
pub const WUNTRACED = 0x00000002;
|
||||
|
||||
/// take signal on signal stack
|
||||
pub const SA_ONSTACK = 0x0001;
|
||||
|
||||
/// restart system on signal return
|
||||
pub const SA_RESTART = 0x0002;
|
||||
|
||||
/// reset to SIG.DFL when taking signal
|
||||
pub const SA_RESETHAND = 0x0004;
|
||||
|
||||
/// do not generate SIG.CHLD on child stop
|
||||
pub const SA_NOCLDSTOP = 0x0008;
|
||||
|
||||
/// don't mask the signal we're delivering
|
||||
pub const SA_NODEFER = 0x0010;
|
||||
|
||||
/// don't keep zombies around
|
||||
pub const SA_NOCLDWAIT = 0x0020;
|
||||
|
||||
/// signal handler with SA_SIGINFO args
|
||||
pub const SA_SIGINFO = 0x0040;
|
||||
|
||||
/// do not bounce off kernel's sigtramp
|
||||
pub const SA_USERTRAMP = 0x0100;
|
||||
|
||||
/// signal handler with SA_SIGINFO args with 64bit regs information
|
||||
pub const SA_64REGSET = 0x0200;
|
||||
pub const SA = struct {
|
||||
/// take signal on signal stack
|
||||
pub const ONSTACK = 0x0001;
|
||||
/// restart system on signal return
|
||||
pub const RESTART = 0x0002;
|
||||
/// reset to SIG.DFL when taking signal
|
||||
pub const RESETHAND = 0x0004;
|
||||
/// do not generate SIG.CHLD on child stop
|
||||
pub const NOCLDSTOP = 0x0008;
|
||||
/// don't mask the signal we're delivering
|
||||
pub const NODEFER = 0x0010;
|
||||
/// don't keep zombies around
|
||||
pub const NOCLDWAIT = 0x0020;
|
||||
/// signal handler with SIGINFO args
|
||||
pub const SIGINFO = 0x0040;
|
||||
/// do not bounce off kernel's sigtramp
|
||||
pub const USERTRAMP = 0x0100;
|
||||
/// signal handler with SIGINFO args with 64bit regs information
|
||||
pub const @"64REGSET" = 0x0200;
|
||||
};
|
||||
|
||||
pub const F_OK = 0;
|
||||
pub const X_OK = 1;
|
||||
@ -694,19 +682,23 @@ pub const O = struct {
|
||||
pub const SYNC = 128;
|
||||
};
|
||||
|
||||
pub const SEEK_SET = 0x0;
|
||||
pub const SEEK_CUR = 0x1;
|
||||
pub const SEEK_END = 0x2;
|
||||
pub const SEEK = struct {
|
||||
pub const SET = 0x0;
|
||||
pub const CUR = 0x1;
|
||||
pub const END = 0x2;
|
||||
};
|
||||
|
||||
pub const DT_UNKNOWN = 0;
|
||||
pub const DT_FIFO = 1;
|
||||
pub const DT_CHR = 2;
|
||||
pub const DT_DIR = 4;
|
||||
pub const DT_BLK = 6;
|
||||
pub const DT_REG = 8;
|
||||
pub const DT_LNK = 10;
|
||||
pub const DT_SOCK = 12;
|
||||
pub const DT_WHT = 14;
|
||||
pub const DT = struct {
|
||||
pub const UNKNOWN = 0;
|
||||
pub const FIFO = 1;
|
||||
pub const CHR = 2;
|
||||
pub const DIR = 4;
|
||||
pub const BLK = 6;
|
||||
pub const REG = 8;
|
||||
pub const LNK = 10;
|
||||
pub const SOCK = 12;
|
||||
pub const WHT = 14;
|
||||
};
|
||||
|
||||
/// no flag value
|
||||
pub const KEVENT_FLAG_NONE = 0x000;
|
||||
@ -1070,6 +1062,11 @@ pub const SO = struct {
|
||||
};
|
||||
|
||||
pub const W = struct {
|
||||
/// [XSI] no hang in wait/no child to reap
|
||||
pub const NOHANG = 0x00000001;
|
||||
/// [XSI] notify on stop, untraced child
|
||||
pub const UNTRACED = 0x00000002;
|
||||
|
||||
pub fn EXITSTATUS(x: u32) u8 {
|
||||
return @intCast(u8, x >> 8);
|
||||
}
|
||||
@ -1759,9 +1756,11 @@ pub const rlimit = extern struct {
|
||||
max: rlim_t,
|
||||
};
|
||||
|
||||
pub const SHUT_RD = 0;
|
||||
pub const SHUT_WR = 1;
|
||||
pub const SHUT_RDWR = 2;
|
||||
pub const SHUT = struct {
|
||||
pub const RD = 0;
|
||||
pub const WR = 1;
|
||||
pub const RDWR = 2;
|
||||
};
|
||||
|
||||
// Term
|
||||
pub const VEOF = 0;
|
||||
|
@ -182,20 +182,43 @@ pub const MAP = struct {
|
||||
pub const SIZEALIGN = 262144;
|
||||
};
|
||||
|
||||
pub const WNOHANG = 0x0001;
|
||||
pub const WUNTRACED = 0x0002;
|
||||
pub const WCONTINUED = 0x0004;
|
||||
pub const WSTOPPED = WUNTRACED;
|
||||
pub const WNOWAIT = 0x0008;
|
||||
pub const WEXITED = 0x0010;
|
||||
pub const WTRAPPED = 0x0020;
|
||||
pub const W = struct {
|
||||
pub const NOHANG = 0x0001;
|
||||
pub const UNTRACED = 0x0002;
|
||||
pub const CONTINUED = 0x0004;
|
||||
pub const STOPPED = UNTRACED;
|
||||
pub const NOWAIT = 0x0008;
|
||||
pub const EXITED = 0x0010;
|
||||
pub const TRAPPED = 0x0020;
|
||||
|
||||
pub const SA_ONSTACK = 0x0001;
|
||||
pub const SA_RESTART = 0x0002;
|
||||
pub const SA_RESETHAND = 0x0004;
|
||||
pub const SA_NODEFER = 0x0010;
|
||||
pub const SA_NOCLDWAIT = 0x0020;
|
||||
pub const SA_SIGINFO = 0x0040;
|
||||
pub fn EXITSTATUS(s: u32) u8 {
|
||||
return @intCast(u8, (s & 0xff00) >> 8);
|
||||
}
|
||||
pub fn TERMSIG(s: u32) u32 {
|
||||
return s & 0x7f;
|
||||
}
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return EXITSTATUS(s);
|
||||
}
|
||||
pub fn IFEXITED(s: u32) bool {
|
||||
return TERMSIG(s) == 0;
|
||||
}
|
||||
pub fn IFSTOPPED(s: u32) bool {
|
||||
return @intCast(u16, (((s & 0xffff) *% 0x10001) >> 8)) > 0x7f00;
|
||||
}
|
||||
pub fn IFSIGNALED(s: u32) bool {
|
||||
return (s & 0xffff) -% 1 < 0xff;
|
||||
}
|
||||
};
|
||||
|
||||
pub const SA = struct {
|
||||
pub const ONSTACK = 0x0001;
|
||||
pub const RESTART = 0x0002;
|
||||
pub const RESETHAND = 0x0004;
|
||||
pub const NODEFER = 0x0010;
|
||||
pub const NOCLDWAIT = 0x0020;
|
||||
pub const SIGINFO = 0x0040;
|
||||
};
|
||||
|
||||
pub const PATH_MAX = 1024;
|
||||
pub const IOV_MAX = KERN_IOV_MAX;
|
||||
@ -348,11 +371,13 @@ pub const O = struct {
|
||||
pub const DIRECTORY = 134217728;
|
||||
};
|
||||
|
||||
pub const SEEK_SET = 0;
|
||||
pub const SEEK_CUR = 1;
|
||||
pub const SEEK_END = 2;
|
||||
pub const SEEK_DATA = 3;
|
||||
pub const SEEK_HOLE = 4;
|
||||
pub const SEEK = struct {
|
||||
pub const SET = 0;
|
||||
pub const CUR = 1;
|
||||
pub const END = 2;
|
||||
pub const DATA = 3;
|
||||
pub const HOLE = 4;
|
||||
};
|
||||
|
||||
pub const F = struct {
|
||||
pub const ULOCK = 0;
|
||||
@ -388,25 +413,6 @@ pub const AT = struct {
|
||||
pub const SYMLINK_FOLLOW = 8;
|
||||
};
|
||||
|
||||
pub fn WEXITSTATUS(s: u32) u8 {
|
||||
return @intCast(u8, (s & 0xff00) >> 8);
|
||||
}
|
||||
pub fn WTERMSIG(s: u32) u32 {
|
||||
return s & 0x7f;
|
||||
}
|
||||
pub fn WSTOPSIG(s: u32) u32 {
|
||||
return WEXITSTATUS(s);
|
||||
}
|
||||
pub fn WIFEXITED(s: u32) bool {
|
||||
return WTERMSIG(s) == 0;
|
||||
}
|
||||
pub fn WIFSTOPPED(s: u32) bool {
|
||||
return @intCast(u16, (((s & 0xffff) *% 0x10001) >> 8)) > 0x7f00;
|
||||
}
|
||||
pub fn WIFSIGNALED(s: u32) bool {
|
||||
return (s & 0xffff) -% 1 < 0xff;
|
||||
}
|
||||
|
||||
pub const dirent = extern struct {
|
||||
d_fileno: c_ulong,
|
||||
d_namlen: u16,
|
||||
@ -420,16 +426,18 @@ pub const dirent = extern struct {
|
||||
}
|
||||
};
|
||||
|
||||
pub const DT_UNKNOWN = 0;
|
||||
pub const DT_FIFO = 1;
|
||||
pub const DT_CHR = 2;
|
||||
pub const DT_DIR = 4;
|
||||
pub const DT_BLK = 6;
|
||||
pub const DT_REG = 8;
|
||||
pub const DT_LNK = 10;
|
||||
pub const DT_SOCK = 12;
|
||||
pub const DT_WHT = 14;
|
||||
pub const DT_DBF = 15;
|
||||
pub const DT = struct {
|
||||
pub const UNKNOWN = 0;
|
||||
pub const FIFO = 1;
|
||||
pub const CHR = 2;
|
||||
pub const DIR = 4;
|
||||
pub const BLK = 6;
|
||||
pub const REG = 8;
|
||||
pub const LNK = 10;
|
||||
pub const SOCK = 12;
|
||||
pub const WHT = 14;
|
||||
pub const DBF = 15;
|
||||
};
|
||||
|
||||
pub const CLOCK = struct {
|
||||
pub const REALTIME = 0;
|
||||
@ -1075,9 +1083,11 @@ pub const rlimit = extern struct {
|
||||
max: rlim_t,
|
||||
};
|
||||
|
||||
pub const SHUT_RD = 0;
|
||||
pub const SHUT_WR = 1;
|
||||
pub const SHUT_RDWR = 2;
|
||||
pub const SHUT = struct {
|
||||
pub const RD = 0;
|
||||
pub const WR = 1;
|
||||
pub const RDWR = 2;
|
||||
};
|
||||
|
||||
pub const nfds_t = u32;
|
||||
|
||||
|
@ -569,9 +569,11 @@ pub const LOCK = struct {
|
||||
|
||||
pub const FD_CLOEXEC = 1;
|
||||
|
||||
pub const SEEK_SET = 0;
|
||||
pub const SEEK_CUR = 1;
|
||||
pub const SEEK_END = 2;
|
||||
pub const SEEK = struct {
|
||||
pub const SET = 0;
|
||||
pub const CUR = 1;
|
||||
pub const END = 2;
|
||||
};
|
||||
|
||||
pub const SOCK = struct {
|
||||
pub const STREAM = 1;
|
||||
@ -721,15 +723,17 @@ pub const AF = struct {
|
||||
pub const MAX = 42;
|
||||
};
|
||||
|
||||
pub const DT_UNKNOWN = 0;
|
||||
pub const DT_FIFO = 1;
|
||||
pub const DT_CHR = 2;
|
||||
pub const DT_DIR = 4;
|
||||
pub const DT_BLK = 6;
|
||||
pub const DT_REG = 8;
|
||||
pub const DT_LNK = 10;
|
||||
pub const DT_SOCK = 12;
|
||||
pub const DT_WHT = 14;
|
||||
pub const DT = struct {
|
||||
pub const UNKNOWN = 0;
|
||||
pub const FIFO = 1;
|
||||
pub const CHR = 2;
|
||||
pub const DIR = 4;
|
||||
pub const BLK = 6;
|
||||
pub const REG = 8;
|
||||
pub const LNK = 10;
|
||||
pub const SOCK = 12;
|
||||
pub const WHT = 14;
|
||||
};
|
||||
|
||||
/// add event to kq (implies enable)
|
||||
pub const EV_ADD = 0x0001;
|
||||
@ -1541,9 +1545,11 @@ pub const rlimit = extern struct {
|
||||
max: rlim_t,
|
||||
};
|
||||
|
||||
pub const SHUT_RD = 0;
|
||||
pub const SHUT_WR = 1;
|
||||
pub const SHUT_RDWR = 2;
|
||||
pub const SHUT = struct {
|
||||
pub const RD = 0;
|
||||
pub const WR = 1;
|
||||
pub const RDWR = 2;
|
||||
};
|
||||
|
||||
pub const nfds_t = u32;
|
||||
|
||||
|
@ -408,23 +408,52 @@ pub const MAP = struct {
|
||||
pub const PREFAULT_READ = 0x00040000;
|
||||
pub const @"32BIT" = 0x00080000;
|
||||
};
|
||||
pub const WNOHANG = 0x1;
|
||||
pub const WUNTRACED = 0x2;
|
||||
pub const WSTOPPED = 0x10;
|
||||
pub const WCONTINUED = 0x4;
|
||||
pub const WNOWAIT = 0x20;
|
||||
pub const WEXITED = 0x08;
|
||||
|
||||
pub const SA_ONSTACK = 0x20;
|
||||
pub const SA_RESTART = 0x10;
|
||||
pub const SA_RESETHAND = 0x04;
|
||||
pub const SA_NOCLDSTOP = 0x01;
|
||||
pub const SA_NODEFER = 0x08;
|
||||
pub const SA_NOCLDWAIT = 0x02;
|
||||
pub const SA_SIGINFO = 0x40;
|
||||
pub const SA_NOMASK = SA_NODEFER;
|
||||
pub const SA_STACK = SA_ONSTACK;
|
||||
pub const SA_ONESHOT = SA_RESETHAND;
|
||||
pub const W = struct {
|
||||
pub const NOHANG = 0x1;
|
||||
pub const UNTRACED = 0x2;
|
||||
pub const STOPPED = 0x10;
|
||||
pub const CONTINUED = 0x4;
|
||||
pub const NOWAIT = 0x20;
|
||||
pub const EXITED = 0x08;
|
||||
|
||||
pub fn EXITSTATUS(s: u32) u8 {
|
||||
return @intCast(u8, s & 0xff);
|
||||
}
|
||||
|
||||
pub fn TERMSIG(s: u32) u32 {
|
||||
return (s >> 8) & 0xff;
|
||||
}
|
||||
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return EXITSTATUS(s);
|
||||
}
|
||||
|
||||
pub fn IFEXITED(s: u32) bool {
|
||||
return TERMSIG(s) == 0;
|
||||
}
|
||||
|
||||
pub fn IFSTOPPED(s: u32) bool {
|
||||
return ((s >> 16) & 0xff) != 0;
|
||||
}
|
||||
|
||||
pub fn IFSIGNALED(s: u32) bool {
|
||||
return ((s >> 8) & 0xff) != 0;
|
||||
}
|
||||
};
|
||||
|
||||
pub const SA = struct {
|
||||
pub const ONSTACK = 0x20;
|
||||
pub const RESTART = 0x10;
|
||||
pub const RESETHAND = 0x04;
|
||||
pub const NOCLDSTOP = 0x01;
|
||||
pub const NODEFER = 0x08;
|
||||
pub const NOCLDWAIT = 0x02;
|
||||
pub const SIGINFO = 0x40;
|
||||
pub const NOMASK = NODEFER;
|
||||
pub const STACK = ONSTACK;
|
||||
pub const ONESHOT = RESETHAND;
|
||||
};
|
||||
|
||||
pub const SIG = struct {
|
||||
pub const ERR = @intToPtr(fn (i32) callconv(.C) void, maxInt(usize));
|
||||
@ -558,9 +587,11 @@ pub const LOCK = struct {
|
||||
|
||||
pub const FD_CLOEXEC = 1;
|
||||
|
||||
pub const SEEK_SET = 0;
|
||||
pub const SEEK_CUR = 1;
|
||||
pub const SEEK_END = 2;
|
||||
pub const SEEK = struct {
|
||||
pub const SET = 0;
|
||||
pub const CUR = 1;
|
||||
pub const END = 2;
|
||||
};
|
||||
|
||||
pub const SOCK = struct {
|
||||
pub const STREAM = 1;
|
||||
@ -710,15 +741,17 @@ pub const AF = struct {
|
||||
pub const MAX = 42;
|
||||
};
|
||||
|
||||
pub const DT_UNKNOWN = 0;
|
||||
pub const DT_FIFO = 1;
|
||||
pub const DT_CHR = 2;
|
||||
pub const DT_DIR = 4;
|
||||
pub const DT_BLK = 6;
|
||||
pub const DT_REG = 8;
|
||||
pub const DT_LNK = 10;
|
||||
pub const DT_SOCK = 12;
|
||||
pub const DT_WHT = 14;
|
||||
pub const DT = struct {
|
||||
pub const UNKNOWN = 0;
|
||||
pub const FIFO = 1;
|
||||
pub const CHR = 2;
|
||||
pub const DIR = 4;
|
||||
pub const BLK = 6;
|
||||
pub const REG = 8;
|
||||
pub const LNK = 10;
|
||||
pub const SOCK = 12;
|
||||
pub const WHT = 14;
|
||||
};
|
||||
|
||||
/// add event to kq (implies enable)
|
||||
pub const EV_ADD = 0x0001;
|
||||
@ -806,32 +839,6 @@ pub const T = struct {
|
||||
pub const IOCGSID = 0x8024;
|
||||
};
|
||||
|
||||
pub const W = struct {
|
||||
pub fn EXITSTATUS(s: u32) u8 {
|
||||
return @intCast(u8, s & 0xff);
|
||||
}
|
||||
|
||||
pub fn TERMSIG(s: u32) u32 {
|
||||
return (s >> 8) & 0xff;
|
||||
}
|
||||
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return EXITSTATUS(s);
|
||||
}
|
||||
|
||||
pub fn IFEXITED(s: u32) bool {
|
||||
return TERMSIG(s) == 0;
|
||||
}
|
||||
|
||||
pub fn IFSTOPPED(s: u32) bool {
|
||||
return ((s >> 16) & 0xff) != 0;
|
||||
}
|
||||
|
||||
pub fn IFSIGNALED(s: u32) bool {
|
||||
return ((s >> 8) & 0xff) != 0;
|
||||
}
|
||||
};
|
||||
|
||||
pub const winsize = extern struct {
|
||||
ws_row: u16,
|
||||
ws_col: u16,
|
||||
@ -1364,9 +1371,11 @@ pub const rlimit = extern struct {
|
||||
max: rlim_t,
|
||||
};
|
||||
|
||||
pub const SHUT_RD = 0;
|
||||
pub const SHUT_WR = 1;
|
||||
pub const SHUT_RDWR = 2;
|
||||
pub const SHUT = struct {
|
||||
pub const RD = 0;
|
||||
pub const WR = 1;
|
||||
pub const RDWR = 2;
|
||||
};
|
||||
|
||||
// TODO fill out if needed
|
||||
pub const directory_which = enum(c_int) {
|
||||
|
@ -96,6 +96,7 @@ pub const ucontext_t = linux.ucontext_t;
|
||||
pub const uid_t = linux.uid_t;
|
||||
pub const user_desc = linux.user_desc;
|
||||
pub const utsname = linux.utsname;
|
||||
pub const PR = linux.PR;
|
||||
|
||||
pub const _errno = switch (native_abi) {
|
||||
.android => struct {
|
||||
|
@ -569,21 +569,51 @@ pub const MAP = struct {
|
||||
pub const ANONYMOUS = ANON;
|
||||
pub const STACK = 0x2000;
|
||||
};
|
||||
pub const WNOHANG = 0x00000001;
|
||||
pub const WUNTRACED = 0x00000002;
|
||||
pub const WSTOPPED = WUNTRACED;
|
||||
pub const WCONTINUED = 0x00000010;
|
||||
pub const WNOWAIT = 0x00010000;
|
||||
pub const WEXITED = 0x00000020;
|
||||
pub const WTRAPPED = 0x00000040;
|
||||
|
||||
pub const SA_ONSTACK = 0x0001;
|
||||
pub const SA_RESTART = 0x0002;
|
||||
pub const SA_RESETHAND = 0x0004;
|
||||
pub const SA_NOCLDSTOP = 0x0008;
|
||||
pub const SA_NODEFER = 0x0010;
|
||||
pub const SA_NOCLDWAIT = 0x0020;
|
||||
pub const SA_SIGINFO = 0x0040;
|
||||
pub const W = struct {
|
||||
pub const NOHANG = 0x00000001;
|
||||
pub const UNTRACED = 0x00000002;
|
||||
pub const STOPPED = UNTRACED;
|
||||
pub const CONTINUED = 0x00000010;
|
||||
pub const NOWAIT = 0x00010000;
|
||||
pub const EXITED = 0x00000020;
|
||||
pub const TRAPPED = 0x00000040;
|
||||
|
||||
pub fn EXITSTATUS(s: u32) u8 {
|
||||
return @intCast(u8, (s >> 8) & 0xff);
|
||||
}
|
||||
pub fn TERMSIG(s: u32) u32 {
|
||||
return s & 0x7f;
|
||||
}
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return EXITSTATUS(s);
|
||||
}
|
||||
pub fn IFEXITED(s: u32) bool {
|
||||
return TERMSIG(s) == 0;
|
||||
}
|
||||
|
||||
pub fn IFCONTINUED(s: u32) bool {
|
||||
return ((s & 0x7f) == 0xffff);
|
||||
}
|
||||
|
||||
pub fn IFSTOPPED(s: u32) bool {
|
||||
return ((s & 0x7f != 0x7f) and !IFCONTINUED(s));
|
||||
}
|
||||
|
||||
pub fn IFSIGNALED(s: u32) bool {
|
||||
return !IFSTOPPED(s) and !IFCONTINUED(s) and !IFEXITED(s);
|
||||
}
|
||||
};
|
||||
|
||||
pub const SA = struct {
|
||||
pub const ONSTACK = 0x0001;
|
||||
pub const RESTART = 0x0002;
|
||||
pub const RESETHAND = 0x0004;
|
||||
pub const NOCLDSTOP = 0x0008;
|
||||
pub const NODEFER = 0x0010;
|
||||
pub const NOCLDWAIT = 0x0020;
|
||||
pub const SIGINFO = 0x0040;
|
||||
};
|
||||
|
||||
// access function
|
||||
pub const F_OK = 0; // test for existence of file
|
||||
@ -666,19 +696,23 @@ pub const LOCK = struct {
|
||||
|
||||
pub const FD_CLOEXEC = 1;
|
||||
|
||||
pub const SEEK_SET = 0;
|
||||
pub const SEEK_CUR = 1;
|
||||
pub const SEEK_END = 2;
|
||||
pub const SEEK = struct {
|
||||
pub const SET = 0;
|
||||
pub const CUR = 1;
|
||||
pub const END = 2;
|
||||
};
|
||||
|
||||
pub const DT_UNKNOWN = 0;
|
||||
pub const DT_FIFO = 1;
|
||||
pub const DT_CHR = 2;
|
||||
pub const DT_DIR = 4;
|
||||
pub const DT_BLK = 6;
|
||||
pub const DT_REG = 8;
|
||||
pub const DT_LNK = 10;
|
||||
pub const DT_SOCK = 12;
|
||||
pub const DT_WHT = 14;
|
||||
pub const DT = struct {
|
||||
pub const UNKNOWN = 0;
|
||||
pub const FIFO = 1;
|
||||
pub const CHR = 2;
|
||||
pub const DIR = 4;
|
||||
pub const BLK = 6;
|
||||
pub const REG = 8;
|
||||
pub const LNK = 10;
|
||||
pub const SOCK = 12;
|
||||
pub const WHT = 14;
|
||||
};
|
||||
|
||||
/// add event to kq (implies enable)
|
||||
pub const EV_ADD = 0x0001;
|
||||
@ -845,31 +879,6 @@ pub const T = struct {
|
||||
pub const IOCXMTFRAME = 0x80087444;
|
||||
};
|
||||
|
||||
pub fn WEXITSTATUS(s: u32) u8 {
|
||||
return @intCast(u8, (s >> 8) & 0xff);
|
||||
}
|
||||
pub fn WTERMSIG(s: u32) u32 {
|
||||
return s & 0x7f;
|
||||
}
|
||||
pub fn WSTOPSIG(s: u32) u32 {
|
||||
return WEXITSTATUS(s);
|
||||
}
|
||||
pub fn WIFEXITED(s: u32) bool {
|
||||
return WTERMSIG(s) == 0;
|
||||
}
|
||||
|
||||
pub fn WIFCONTINUED(s: u32) bool {
|
||||
return ((s & 0x7f) == 0xffff);
|
||||
}
|
||||
|
||||
pub fn WIFSTOPPED(s: u32) bool {
|
||||
return ((s & 0x7f != 0x7f) and !WIFCONTINUED(s));
|
||||
}
|
||||
|
||||
pub fn WIFSIGNALED(s: u32) bool {
|
||||
return !WIFSTOPPED(s) and !WIFCONTINUED(s) and !WIFEXITED(s);
|
||||
}
|
||||
|
||||
pub const winsize = extern struct {
|
||||
ws_row: u16,
|
||||
ws_col: u16,
|
||||
@ -1388,9 +1397,11 @@ pub const rlimit = extern struct {
|
||||
max: rlim_t,
|
||||
};
|
||||
|
||||
pub const SHUT_RD = 0;
|
||||
pub const SHUT_WR = 1;
|
||||
pub const SHUT_RDWR = 2;
|
||||
pub const SHUT = struct {
|
||||
pub const RD = 0;
|
||||
pub const WR = 1;
|
||||
pub const RDWR = 2;
|
||||
};
|
||||
|
||||
pub const nfds_t = u32;
|
||||
|
||||
|
@ -361,17 +361,47 @@ pub const MAP = struct {
|
||||
pub const STACK = 0x4000;
|
||||
pub const CONCEAL = 0x8000;
|
||||
};
|
||||
pub const WNOHANG = 1;
|
||||
pub const WUNTRACED = 2;
|
||||
pub const WCONTINUED = 8;
|
||||
|
||||
pub const SA_ONSTACK = 0x0001;
|
||||
pub const SA_RESTART = 0x0002;
|
||||
pub const SA_RESETHAND = 0x0004;
|
||||
pub const SA_NOCLDSTOP = 0x0008;
|
||||
pub const SA_NODEFER = 0x0010;
|
||||
pub const SA_NOCLDWAIT = 0x0020;
|
||||
pub const SA_SIGINFO = 0x0040;
|
||||
pub const W = struct {
|
||||
pub const NOHANG = 1;
|
||||
pub const UNTRACED = 2;
|
||||
pub const CONTINUED = 8;
|
||||
|
||||
pub fn EXITSTATUS(s: u32) u8 {
|
||||
return @intCast(u8, (s >> 8) & 0xff);
|
||||
}
|
||||
pub fn TERMSIG(s: u32) u32 {
|
||||
return (s & 0x7f);
|
||||
}
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return EXITSTATUS(s);
|
||||
}
|
||||
pub fn IFEXITED(s: u32) bool {
|
||||
return TERMSIG(s) == 0;
|
||||
}
|
||||
|
||||
pub fn IFCONTINUED(s: u32) bool {
|
||||
return ((s & 0o177777) == 0o177777);
|
||||
}
|
||||
|
||||
pub fn IFSTOPPED(s: u32) bool {
|
||||
return (s & 0xff == 0o177);
|
||||
}
|
||||
|
||||
pub fn IFSIGNALED(s: u32) bool {
|
||||
return (((s) & 0o177) != 0o177) and (((s) & 0o177) != 0);
|
||||
}
|
||||
};
|
||||
|
||||
pub const SA = struct {
|
||||
pub const ONSTACK = 0x0001;
|
||||
pub const RESTART = 0x0002;
|
||||
pub const RESETHAND = 0x0004;
|
||||
pub const NOCLDSTOP = 0x0008;
|
||||
pub const NODEFER = 0x0010;
|
||||
pub const NOCLDWAIT = 0x0020;
|
||||
pub const SIGINFO = 0x0040;
|
||||
};
|
||||
|
||||
// access function
|
||||
pub const F_OK = 0; // test for existence of file
|
||||
@ -448,9 +478,11 @@ pub const LOCK = struct {
|
||||
|
||||
pub const FD_CLOEXEC = 1;
|
||||
|
||||
pub const SEEK_SET = 0;
|
||||
pub const SEEK_CUR = 1;
|
||||
pub const SEEK_END = 2;
|
||||
pub const SEEK = struct {
|
||||
pub const SET = 0;
|
||||
pub const CUR = 1;
|
||||
pub const END = 2;
|
||||
};
|
||||
|
||||
pub const SOCK = struct {
|
||||
pub const STREAM = 1;
|
||||
@ -530,15 +562,17 @@ pub const AF = struct {
|
||||
pub const MAX = 36;
|
||||
};
|
||||
|
||||
pub const DT_UNKNOWN = 0;
|
||||
pub const DT_FIFO = 1;
|
||||
pub const DT_CHR = 2;
|
||||
pub const DT_DIR = 4;
|
||||
pub const DT_BLK = 6;
|
||||
pub const DT_REG = 8;
|
||||
pub const DT_LNK = 10;
|
||||
pub const DT_SOCK = 12;
|
||||
pub const DT_WHT = 14; // XXX
|
||||
pub const DT = struct {
|
||||
pub const UNKNOWN = 0;
|
||||
pub const FIFO = 1;
|
||||
pub const CHR = 2;
|
||||
pub const DIR = 4;
|
||||
pub const BLK = 6;
|
||||
pub const REG = 8;
|
||||
pub const LNK = 10;
|
||||
pub const SOCK = 12;
|
||||
pub const WHT = 14; // XXX
|
||||
};
|
||||
|
||||
pub const EV_ADD = 0x0001;
|
||||
pub const EV_DELETE = 0x0002;
|
||||
@ -668,31 +702,6 @@ pub const T = struct {
|
||||
pub const IOCXMTFRAME = 0x80087444;
|
||||
};
|
||||
|
||||
pub fn WEXITSTATUS(s: u32) u8 {
|
||||
return @intCast(u8, (s >> 8) & 0xff);
|
||||
}
|
||||
pub fn WTERMSIG(s: u32) u32 {
|
||||
return (s & 0x7f);
|
||||
}
|
||||
pub fn WSTOPSIG(s: u32) u32 {
|
||||
return WEXITSTATUS(s);
|
||||
}
|
||||
pub fn WIFEXITED(s: u32) bool {
|
||||
return WTERMSIG(s) == 0;
|
||||
}
|
||||
|
||||
pub fn WIFCONTINUED(s: u32) bool {
|
||||
return ((s & 0o177777) == 0o177777);
|
||||
}
|
||||
|
||||
pub fn WIFSTOPPED(s: u32) bool {
|
||||
return (s & 0xff == 0o177);
|
||||
}
|
||||
|
||||
pub fn WIFSIGNALED(s: u32) bool {
|
||||
return (((s) & 0o177) != 0o177) and (((s) & 0o177) != 0);
|
||||
}
|
||||
|
||||
pub const winsize = extern struct {
|
||||
ws_row: c_ushort,
|
||||
ws_col: c_ushort,
|
||||
@ -1178,9 +1187,11 @@ pub const rlimit = extern struct {
|
||||
max: rlim_t,
|
||||
};
|
||||
|
||||
pub const SHUT_RD = 0;
|
||||
pub const SHUT_WR = 1;
|
||||
pub const SHUT_RDWR = 2;
|
||||
pub const SHUT = struct {
|
||||
pub const RD = 0;
|
||||
pub const WR = 1;
|
||||
pub const RDWR = 2;
|
||||
};
|
||||
|
||||
pub const nfds_t = c_uint;
|
||||
|
||||
|
@ -8,7 +8,7 @@ pub fn _errno() *c_int {
|
||||
return &errno;
|
||||
}
|
||||
|
||||
pub const fd_t = c_int;
|
||||
pub const fd_t = wasi.fd_t;
|
||||
pub const pid_t = c_int;
|
||||
pub const uid_t = u32;
|
||||
pub const gid_t = u32;
|
||||
@ -22,6 +22,9 @@ pub const STDIN_FILENO = wasi.STDIN_FILENO;
|
||||
pub const STDOUT_FILENO = wasi.STDOUT_FILENO;
|
||||
pub const E = wasi.E;
|
||||
pub const CLOCK = wasi.CLOCK;
|
||||
pub const S = wasi.S;
|
||||
pub const IOV_MAX = wasi.IOV_MAX;
|
||||
pub const AT = wasi.AT;
|
||||
|
||||
pub const Stat = extern struct {
|
||||
dev: i32,
|
||||
|
@ -88,9 +88,11 @@ pub const SIG = struct {
|
||||
pub const ERR = -1;
|
||||
};
|
||||
|
||||
pub const SEEK_SET = 0;
|
||||
pub const SEEK_CUR = 1;
|
||||
pub const SEEK_END = 2;
|
||||
pub const SEEK = struct {
|
||||
pub const SET = 0;
|
||||
pub const CUR = 1;
|
||||
pub const END = 2;
|
||||
};
|
||||
|
||||
pub const E = enum(u16) {
|
||||
/// No error occurred.
|
||||
|
@ -344,7 +344,7 @@ pub const Dir = struct {
|
||||
self.index = 0;
|
||||
self.end_index = @intCast(usize, rc);
|
||||
}
|
||||
const darwin_entry = @ptrCast(*align(1) os.dirent, &self.buf[self.index]);
|
||||
const darwin_entry = @ptrCast(*align(1) os.darwin.dirent, &self.buf[self.index]);
|
||||
const next_index = self.index + darwin_entry.reclen();
|
||||
self.index = next_index;
|
||||
|
||||
@ -355,14 +355,14 @@ pub const Dir = struct {
|
||||
}
|
||||
|
||||
const entry_kind = switch (darwin_entry.d_type) {
|
||||
os.DT_BLK => Entry.Kind.BlockDevice,
|
||||
os.DT_CHR => Entry.Kind.CharacterDevice,
|
||||
os.DT_DIR => Entry.Kind.Directory,
|
||||
os.DT_FIFO => Entry.Kind.NamedPipe,
|
||||
os.DT_LNK => Entry.Kind.SymLink,
|
||||
os.DT_REG => Entry.Kind.File,
|
||||
os.DT_SOCK => Entry.Kind.UnixDomainSocket,
|
||||
os.DT_WHT => Entry.Kind.Whiteout,
|
||||
os.DT.BLK => Entry.Kind.BlockDevice,
|
||||
os.DT.CHR => Entry.Kind.CharacterDevice,
|
||||
os.DT.DIR => Entry.Kind.Directory,
|
||||
os.DT.FIFO => Entry.Kind.NamedPipe,
|
||||
os.DT.LNK => Entry.Kind.SymLink,
|
||||
os.DT.REG => Entry.Kind.File,
|
||||
os.DT.SOCK => Entry.Kind.UnixDomainSocket,
|
||||
os.DT.WHT => Entry.Kind.Whiteout,
|
||||
else => Entry.Kind.Unknown,
|
||||
};
|
||||
return Entry{
|
||||
@ -409,14 +409,14 @@ pub const Dir = struct {
|
||||
}
|
||||
|
||||
const entry_kind = switch (bsd_entry.d_type) {
|
||||
os.DT_BLK => Entry.Kind.BlockDevice,
|
||||
os.DT_CHR => Entry.Kind.CharacterDevice,
|
||||
os.DT_DIR => Entry.Kind.Directory,
|
||||
os.DT_FIFO => Entry.Kind.NamedPipe,
|
||||
os.DT_LNK => Entry.Kind.SymLink,
|
||||
os.DT_REG => Entry.Kind.File,
|
||||
os.DT_SOCK => Entry.Kind.UnixDomainSocket,
|
||||
os.DT_WHT => Entry.Kind.Whiteout,
|
||||
os.DT.BLK => Entry.Kind.BlockDevice,
|
||||
os.DT.CHR => Entry.Kind.CharacterDevice,
|
||||
os.DT.DIR => Entry.Kind.Directory,
|
||||
os.DT.FIFO => Entry.Kind.NamedPipe,
|
||||
os.DT.LNK => Entry.Kind.SymLink,
|
||||
os.DT.REG => Entry.Kind.File,
|
||||
os.DT.SOCK => Entry.Kind.UnixDomainSocket,
|
||||
os.DT.WHT => Entry.Kind.Whiteout,
|
||||
else => Entry.Kind.Unknown,
|
||||
};
|
||||
return Entry{
|
||||
|
@ -175,5 +175,5 @@ test "extracting WASI preopens" {
|
||||
try std.testing.expectEqual(@as(usize, 1), preopens.asSlice().len);
|
||||
const preopen = preopens.find(PreopenType{ .Dir = "." }) orelse unreachable;
|
||||
try std.testing.expect(preopen.@"type".eql(PreopenType{ .Dir = "." }));
|
||||
try std.testing.expectEqual(@as(usize, 3), preopen.fd);
|
||||
try std.testing.expectEqual(@as(i32, 3), preopen.fd);
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ pub const ARCH = system.ARCH;
|
||||
pub const AT = system.AT;
|
||||
pub const CLOCK = system.CLOCK;
|
||||
pub const CPU_COUNT = system.CPU_COUNT;
|
||||
pub const DT = system.DT;
|
||||
pub const E = system.E;
|
||||
pub const Elf_Symndx = system.Elf_Symndx;
|
||||
pub const F = system.F;
|
||||
|
@ -105,18 +105,19 @@ pub const MAP = struct {
|
||||
/// Interpret addr exactly
|
||||
pub const FIXED = 0x10;
|
||||
/// don't use a file
|
||||
pub const ANONYMOUS = 0x20;
|
||||
pub const ANONYMOUS = if (is_mips) 0x800 else 0x20;
|
||||
// MAP_ 0x0100 - 0x4000 flags are per architecture
|
||||
/// populate (prefault) pagetables
|
||||
pub const POPULATE = 0x8000;
|
||||
pub const POPULATE = if (is_mips) 0x10000 else 0x8000;
|
||||
/// do not block on IO
|
||||
pub const NONBLOCK = 0x10000;
|
||||
pub const NONBLOCK = if (is_mips) 0x20000 else 0x10000;
|
||||
/// give out an address that is best suited for process/thread stacks
|
||||
pub const STACK = 0x20000;
|
||||
pub const STACK = if (is_mips) 0x40000 else 0x20000;
|
||||
/// create a huge page mapping
|
||||
pub const HUGETLB = 0x40000;
|
||||
pub const HUGETLB = if (is_mips) 0x80000 else 0x40000;
|
||||
/// perform synchronous page faults for the mapping
|
||||
pub const SYNC = 0x80000;
|
||||
/// FIXED which doesn't unmap underlying mapping
|
||||
/// MAP_FIXED which doesn't unmap underlying mapping
|
||||
pub const FIXED_NOREPLACE = 0x100000;
|
||||
/// For anonymous mmap, memory could be uninitialized
|
||||
pub const UNINITIALIZED = 0x4000000;
|
||||
@ -2111,154 +2112,92 @@ pub const AF = struct {
|
||||
pub const MAX = PF.MAX;
|
||||
};
|
||||
|
||||
pub const SO = if (is_mips) struct {
|
||||
pub const SECURITY_AUTHENTICATION = 22;
|
||||
pub const SECURITY_ENCRYPTION_TRANSPORT = 23;
|
||||
pub const SECURITY_ENCRYPTION_NETWORK = 24;
|
||||
|
||||
pub const BINDTODEVICE = 25;
|
||||
|
||||
pub const ATTACH_FILTER = 26;
|
||||
pub const DETACH_FILTER = 27;
|
||||
pub const GET_FILTER = ATTACH_FILTER;
|
||||
|
||||
pub const PEERNAME = 28;
|
||||
pub const TIMESTAMP_OLD = 29;
|
||||
pub const PASSSEC = 34;
|
||||
pub const TIMESTAMPNS_OLD = 35;
|
||||
pub const MARK = 36;
|
||||
pub const TIMESTAMPING_OLD = 37;
|
||||
|
||||
pub const RXQ_OVFL = 40;
|
||||
pub const WIFI_STATUS = 41;
|
||||
pub const PEEK_OFF = 42;
|
||||
pub const NOFCS = 43;
|
||||
pub const LOCK_FILTER = 44;
|
||||
pub const SELECT_ERR_QUEUE = 45;
|
||||
pub const BUSY_POLL = 46;
|
||||
pub const MAX_PACING_RATE = 47;
|
||||
pub const BPF_EXTENSIONS = 48;
|
||||
pub const INCOMING_CPU = 49;
|
||||
pub const ATTACH_BPF = 50;
|
||||
pub const DETACH_BPF = DETACH_FILTER;
|
||||
pub const ATTACH_REUSEPORT_CBPF = 51;
|
||||
pub const ATTACH_REUSEPORT_EBPF = 52;
|
||||
pub const CNX_ADVICE = 53;
|
||||
pub const MEMINFO = 55;
|
||||
pub const INCOMING_NAPI_ID = 56;
|
||||
pub const COOKIE = 57;
|
||||
pub const PEERGROUPS = 59;
|
||||
pub const ZEROCOPY = 60;
|
||||
pub const TXTIME = 61;
|
||||
pub const BINDTOIFINDEX = 62;
|
||||
pub const TIMESTAMP_NEW = 63;
|
||||
pub const TIMESTAMPNS_NEW = 64;
|
||||
pub const TIMESTAMPING_NEW = 65;
|
||||
pub const RCVTIMEO_NEW = 66;
|
||||
pub const SNDTIMEO_NEW = 67;
|
||||
pub const DETACH_REUSEPORT_BPF = 68;
|
||||
} else if (is_ppc or is_ppc64) struct {
|
||||
pub const DEBUG = 1;
|
||||
pub const REUSEADDR = 2;
|
||||
pub const TYPE = 3;
|
||||
pub const ERROR = 4;
|
||||
pub const DONTROUTE = 5;
|
||||
pub const BROADCAST = 6;
|
||||
pub const SNDBUF = 7;
|
||||
pub const RCVBUF = 8;
|
||||
pub const KEEPALIVE = 9;
|
||||
pub const OOBINLINE = 10;
|
||||
pub const NO_CHECK = 11;
|
||||
pub const PRIORITY = 12;
|
||||
pub const LINGER = 13;
|
||||
pub const BSDCOMPAT = 14;
|
||||
pub const REUSEPORT = 15;
|
||||
pub const RCVLOWAT = 16;
|
||||
pub const SNDLOWAT = 17;
|
||||
pub const RCVTIMEO = 18;
|
||||
pub const SNDTIMEO = 19;
|
||||
pub const PASSCRED = 20;
|
||||
pub const PEERCRED = 21;
|
||||
pub const ACCEPTCONN = 30;
|
||||
pub const PEERSEC = 31;
|
||||
pub const SNDBUFFORCE = 32;
|
||||
pub const RCVBUFFORCE = 33;
|
||||
pub const PROTOCOL = 38;
|
||||
pub const DOMAIN = 39;
|
||||
|
||||
pub const SECURITY_AUTHENTICATION = 22;
|
||||
pub const SECURITY_ENCRYPTION_TRANSPORT = 23;
|
||||
pub const SECURITY_ENCRYPTION_NETWORK = 24;
|
||||
|
||||
pub const BINDTODEVICE = 25;
|
||||
|
||||
pub const ATTACH_FILTER = 26;
|
||||
pub const DETACH_FILTER = 27;
|
||||
pub const GET_FILTER = ATTACH_FILTER;
|
||||
|
||||
pub const PEERNAME = 28;
|
||||
pub const TIMESTAMP_OLD = 29;
|
||||
pub const PASSSEC = 34;
|
||||
pub const TIMESTAMPNS_OLD = 35;
|
||||
pub const MARK = 36;
|
||||
pub const TIMESTAMPING_OLD = 37;
|
||||
|
||||
pub const RXQ_OVFL = 40;
|
||||
pub const WIFI_STATUS = 41;
|
||||
pub const PEEK_OFF = 42;
|
||||
pub const NOFCS = 43;
|
||||
pub const LOCK_FILTER = 44;
|
||||
pub const SELECT_ERR_QUEUE = 45;
|
||||
pub const BUSY_POLL = 46;
|
||||
pub const MAX_PACING_RATE = 47;
|
||||
pub const BPF_EXTENSIONS = 48;
|
||||
pub const INCOMING_CPU = 49;
|
||||
pub const ATTACH_BPF = 50;
|
||||
pub const DETACH_BPF = DETACH_FILTER;
|
||||
pub const ATTACH_REUSEPORT_CBPF = 51;
|
||||
pub const ATTACH_REUSEPORT_EBPF = 52;
|
||||
pub const CNX_ADVICE = 53;
|
||||
pub const MEMINFO = 55;
|
||||
pub const INCOMING_NAPI_ID = 56;
|
||||
pub const COOKIE = 57;
|
||||
pub const PEERGROUPS = 59;
|
||||
pub const ZEROCOPY = 60;
|
||||
pub const TXTIME = 61;
|
||||
pub const BINDTOIFINDEX = 62;
|
||||
pub const TIMESTAMP_NEW = 63;
|
||||
pub const TIMESTAMPNS_NEW = 64;
|
||||
pub const TIMESTAMPING_NEW = 65;
|
||||
pub const RCVTIMEO_NEW = 66;
|
||||
pub const SNDTIMEO_NEW = 67;
|
||||
pub const DETACH_REUSEPORT_BPF = 68;
|
||||
} else struct {
|
||||
pub const DEBUG = 1;
|
||||
pub const REUSEADDR = 2;
|
||||
pub const TYPE = 3;
|
||||
pub const ERROR = 4;
|
||||
pub const DONTROUTE = 5;
|
||||
pub const BROADCAST = 6;
|
||||
pub const SNDBUF = 7;
|
||||
pub const RCVBUF = 8;
|
||||
pub const KEEPALIVE = 9;
|
||||
pub const OOBINLINE = 10;
|
||||
pub const NO_CHECK = 11;
|
||||
pub const PRIORITY = 12;
|
||||
pub const LINGER = 13;
|
||||
pub const BSDCOMPAT = 14;
|
||||
pub const REUSEPORT = 15;
|
||||
pub const PASSCRED = 16;
|
||||
pub const PEERCRED = 17;
|
||||
pub const RCVLOWAT = 18;
|
||||
pub const SNDLOWAT = 19;
|
||||
pub const RCVTIMEO = 20;
|
||||
pub const SNDTIMEO = 21;
|
||||
pub const ACCEPTCONN = 30;
|
||||
pub const PEERSEC = 31;
|
||||
pub const SNDBUFFORCE = 32;
|
||||
pub const RCVBUFFORCE = 33;
|
||||
pub const PROTOCOL = 38;
|
||||
pub const DOMAIN = 39;
|
||||
pub const SO = struct {
|
||||
pub usingnamespace if (is_mips) struct {
|
||||
pub const DEBUG = 1;
|
||||
pub const REUSEADDR = 0x0004;
|
||||
pub const KEEPALIVE = 0x0008;
|
||||
pub const DONTROUTE = 0x0010;
|
||||
pub const BROADCAST = 0x0020;
|
||||
pub const LINGER = 0x0080;
|
||||
pub const OOBINLINE = 0x0100;
|
||||
pub const REUSEPORT = 0x0200;
|
||||
pub const SNDBUF = 0x1001;
|
||||
pub const RCVBUF = 0x1002;
|
||||
pub const SNDLOWAT = 0x1003;
|
||||
pub const RCVLOWAT = 0x1004;
|
||||
pub const RCVTIMEO = 0x1006;
|
||||
pub const SNDTIMEO = 0x1005;
|
||||
pub const ERROR = 0x1007;
|
||||
pub const TYPE = 0x1008;
|
||||
pub const ACCEPTCONN = 0x1009;
|
||||
pub const PROTOCOL = 0x1028;
|
||||
pub const DOMAIN = 0x1029;
|
||||
pub const NO_CHECK = 11;
|
||||
pub const PRIORITY = 12;
|
||||
pub const BSDCOMPAT = 14;
|
||||
pub const PASSCRED = 17;
|
||||
pub const PEERCRED = 18;
|
||||
pub const PEERSEC = 30;
|
||||
pub const SNDBUFFORCE = 31;
|
||||
pub const RCVBUFFORCE = 33;
|
||||
} else if (is_ppc or is_ppc64) struct {
|
||||
pub const DEBUG = 1;
|
||||
pub const REUSEADDR = 2;
|
||||
pub const TYPE = 3;
|
||||
pub const ERROR = 4;
|
||||
pub const DONTROUTE = 5;
|
||||
pub const BROADCAST = 6;
|
||||
pub const SNDBUF = 7;
|
||||
pub const RCVBUF = 8;
|
||||
pub const KEEPALIVE = 9;
|
||||
pub const OOBINLINE = 10;
|
||||
pub const NO_CHECK = 11;
|
||||
pub const PRIORITY = 12;
|
||||
pub const LINGER = 13;
|
||||
pub const BSDCOMPAT = 14;
|
||||
pub const REUSEPORT = 15;
|
||||
pub const RCVLOWAT = 16;
|
||||
pub const SNDLOWAT = 17;
|
||||
pub const RCVTIMEO = 18;
|
||||
pub const SNDTIMEO = 19;
|
||||
pub const PASSCRED = 20;
|
||||
pub const PEERCRED = 21;
|
||||
pub const ACCEPTCONN = 30;
|
||||
pub const PEERSEC = 31;
|
||||
pub const SNDBUFFORCE = 32;
|
||||
pub const RCVBUFFORCE = 33;
|
||||
pub const PROTOCOL = 38;
|
||||
pub const DOMAIN = 39;
|
||||
} else struct {
|
||||
pub const DEBUG = 1;
|
||||
pub const REUSEADDR = 2;
|
||||
pub const TYPE = 3;
|
||||
pub const ERROR = 4;
|
||||
pub const DONTROUTE = 5;
|
||||
pub const BROADCAST = 6;
|
||||
pub const SNDBUF = 7;
|
||||
pub const RCVBUF = 8;
|
||||
pub const KEEPALIVE = 9;
|
||||
pub const OOBINLINE = 10;
|
||||
pub const NO_CHECK = 11;
|
||||
pub const PRIORITY = 12;
|
||||
pub const LINGER = 13;
|
||||
pub const BSDCOMPAT = 14;
|
||||
pub const REUSEPORT = 15;
|
||||
pub const PASSCRED = 16;
|
||||
pub const PEERCRED = 17;
|
||||
pub const RCVLOWAT = 18;
|
||||
pub const SNDLOWAT = 19;
|
||||
pub const RCVTIMEO = 20;
|
||||
pub const SNDTIMEO = 21;
|
||||
pub const ACCEPTCONN = 30;
|
||||
pub const PEERSEC = 31;
|
||||
pub const SNDBUFFORCE = 32;
|
||||
pub const RCVBUFFORCE = 33;
|
||||
pub const PROTOCOL = 38;
|
||||
pub const DOMAIN = 39;
|
||||
};
|
||||
|
||||
pub const SECURITY_AUTHENTICATION = 22;
|
||||
pub const SECURITY_ENCRYPTION_TRANSPORT = 23;
|
||||
|
@ -696,36 +696,6 @@ pub const MAP = struct {
|
||||
pub const @"32BIT" = 0x40;
|
||||
};
|
||||
|
||||
pub const SO = struct {
|
||||
pub const DEBUG = 1;
|
||||
pub const REUSEADDR = 0x0004;
|
||||
pub const KEEPALIVE = 0x0008;
|
||||
pub const DONTROUTE = 0x0010;
|
||||
pub const BROADCAST = 0x0020;
|
||||
pub const LINGER = 0x0080;
|
||||
pub const OOBINLINE = 0x0100;
|
||||
pub const REUSEPORT = 0x0200;
|
||||
pub const SNDBUF = 0x1001;
|
||||
pub const RCVBUF = 0x1002;
|
||||
pub const SNDLOWAT = 0x1003;
|
||||
pub const RCVLOWAT = 0x1004;
|
||||
pub const RCVTIMEO = 0x1006;
|
||||
pub const SNDTIMEO = 0x1005;
|
||||
pub const ERROR = 0x1007;
|
||||
pub const TYPE = 0x1008;
|
||||
pub const ACCEPTCONN = 0x1009;
|
||||
pub const PROTOCOL = 0x1028;
|
||||
pub const DOMAIN = 0x1029;
|
||||
pub const NO_CHECK = 11;
|
||||
pub const PRIORITY = 12;
|
||||
pub const BSDCOMPAT = 14;
|
||||
pub const PASSCRED = 17;
|
||||
pub const PEERCRED = 18;
|
||||
pub const PEERSEC = 30;
|
||||
pub const SNDBUFFORCE = 31;
|
||||
pub const RCVBUFFORCE = 33;
|
||||
};
|
||||
|
||||
pub const VDSO = struct {
|
||||
pub const CGT_SYM = "__kernel_clock_gettime";
|
||||
pub const CGT_VER = "LINUX_2.6.39";
|
||||
|
@ -292,7 +292,7 @@ pub const EVENTTYPE_FD_WRITE: eventtype_t = 2;
|
||||
|
||||
pub const exitcode_t = u32;
|
||||
|
||||
pub const fd_t = u32;
|
||||
pub const fd_t = i32;
|
||||
|
||||
pub const fdflags_t = u16;
|
||||
pub const FDFLAG = struct {
|
||||
@ -461,8 +461,10 @@ pub const RIGHT = struct {
|
||||
};
|
||||
|
||||
pub const sdflags_t = u8;
|
||||
pub const SHUT_RD: sdflags_t = 0x01;
|
||||
pub const SHUT_WR: sdflags_t = 0x02;
|
||||
pub const SHUT = struct {
|
||||
pub const RD: sdflags_t = 0x01;
|
||||
pub const WR: sdflags_t = 0x02;
|
||||
};
|
||||
|
||||
pub const siflags_t = u16;
|
||||
|
||||
|
@ -243,9 +243,9 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
|
||||
ctx.objErrStage1("array in c exported function",
|
||||
\\export fn zig_array(x: [10]u8) void {
|
||||
\\try expect(std.mem.eql(u8, &x, "1234567890"));
|
||||
\\ try std.testing.expect(std.mem.eql(u8, &x, "1234567890"));
|
||||
\\}
|
||||
\\
|
||||
\\const std = @import("std");
|
||||
\\export fn zig_return_array() [10]u8 {
|
||||
\\ return "1234567890".*;
|
||||
\\}
|
||||
@ -2787,6 +2787,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
\\ _ = msg; _ = error_return_trace;
|
||||
\\ while (true) {}
|
||||
\\}
|
||||
\\const builtin = @import("std").builtin;
|
||||
, &[_][]const u8{
|
||||
"error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn([]const u8,anytype) anytype'",
|
||||
"note: only one of the functions is generic",
|
||||
@ -2832,6 +2833,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
\\ var s: Foo = Foo.E;
|
||||
\\ _ = s;
|
||||
\\}
|
||||
\\const D = 1;
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:1:17: error: enum 'Foo' depends on itself",
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user