mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.os reorg: more fixes caught by CI
This commit is contained in:
parent
057f0fec33
commit
f8dd4b13d6
@ -558,7 +558,7 @@ const PosixThreadImpl = struct {
|
||||
.openbsd => {
|
||||
var count: c_int = undefined;
|
||||
var count_size: usize = @sizeOf(c_int);
|
||||
const mib = [_]c_int{ os.CTL_HW, os.HW_NCPUONLINE };
|
||||
const mib = [_]c_int{ os.CTL.HW, os.HW_NCPUONLINE };
|
||||
os.sysctl(&mib, &count, &count_size, null, 0) catch |err| switch (err) {
|
||||
error.NameTooLong, error.UnknownName => unreachable,
|
||||
else => |e| return e,
|
||||
|
||||
@ -221,7 +221,7 @@ pub const SA = struct {
|
||||
};
|
||||
|
||||
pub const PATH_MAX = 1024;
|
||||
pub const IOV_MAX = KERN_IOV_MAX;
|
||||
pub const IOV_MAX = KERN.IOV_MAX;
|
||||
|
||||
pub const ino_t = c_ulong;
|
||||
|
||||
@ -270,69 +270,73 @@ pub const timeval = extern struct {
|
||||
tv_usec: suseconds_t,
|
||||
};
|
||||
|
||||
pub const CTL_UNSPEC = 0;
|
||||
pub const CTL_KERN = 1;
|
||||
pub const CTL_VM = 2;
|
||||
pub const CTL_VFS = 3;
|
||||
pub const CTL_NET = 4;
|
||||
pub const CTL_DEBUG = 5;
|
||||
pub const CTL_HW = 6;
|
||||
pub const CTL_MACHDEP = 7;
|
||||
pub const CTL_USER = 8;
|
||||
pub const CTL_LWKT = 10;
|
||||
pub const CTL_MAXID = 11;
|
||||
pub const CTL_MAXNAME = 12;
|
||||
pub const CTL = struct {
|
||||
pub const UNSPEC = 0;
|
||||
pub const KERN = 1;
|
||||
pub const VM = 2;
|
||||
pub const VFS = 3;
|
||||
pub const NET = 4;
|
||||
pub const DEBUG = 5;
|
||||
pub const HW = 6;
|
||||
pub const MACHDEP = 7;
|
||||
pub const USER = 8;
|
||||
pub const LWKT = 10;
|
||||
pub const MAXID = 11;
|
||||
pub const MAXNAME = 12;
|
||||
};
|
||||
|
||||
pub const KERN_PROC_ALL = 0;
|
||||
pub const KERN_OSTYPE = 1;
|
||||
pub const KERN_PROC_PID = 1;
|
||||
pub const KERN_OSRELEASE = 2;
|
||||
pub const KERN_PROC_PGRP = 2;
|
||||
pub const KERN_OSREV = 3;
|
||||
pub const KERN_PROC_SESSION = 3;
|
||||
pub const KERN_VERSION = 4;
|
||||
pub const KERN_PROC_TTY = 4;
|
||||
pub const KERN_MAXVNODES = 5;
|
||||
pub const KERN_PROC_UID = 5;
|
||||
pub const KERN_MAXPROC = 6;
|
||||
pub const KERN_PROC_RUID = 6;
|
||||
pub const KERN_MAXFILES = 7;
|
||||
pub const KERN_PROC_ARGS = 7;
|
||||
pub const KERN_ARGMAX = 8;
|
||||
pub const KERN_PROC_CWD = 8;
|
||||
pub const KERN_PROC_PATHNAME = 9;
|
||||
pub const KERN_SECURELVL = 9;
|
||||
pub const KERN_PROC_SIGTRAMP = 10;
|
||||
pub const KERN_HOSTNAME = 10;
|
||||
pub const KERN_HOSTID = 11;
|
||||
pub const KERN_CLOCKRATE = 12;
|
||||
pub const KERN_VNODE = 13;
|
||||
pub const KERN_PROC = 14;
|
||||
pub const KERN_FILE = 15;
|
||||
pub const KERN_PROC_FLAGMASK = 16;
|
||||
pub const KERN_PROF = 16;
|
||||
pub const KERN_PROC_FLAG_LWP = 16;
|
||||
pub const KERN_POSIX1 = 17;
|
||||
pub const KERN_NGROUPS = 18;
|
||||
pub const KERN_JOB_CONTROL = 19;
|
||||
pub const KERN_SAVED_IDS = 20;
|
||||
pub const KERN_BOOTTIME = 21;
|
||||
pub const KERN_NISDOMAINNAME = 22;
|
||||
pub const KERN_UPDATEINTERVAL = 23;
|
||||
pub const KERN_OSRELDATE = 24;
|
||||
pub const KERN_NTP_PLL = 25;
|
||||
pub const KERN_BOOTFILE = 26;
|
||||
pub const KERN_MAXFILESPERPROC = 27;
|
||||
pub const KERN_MAXPROCPERUID = 28;
|
||||
pub const KERN_DUMPDEV = 29;
|
||||
pub const KERN_IPC = 30;
|
||||
pub const KERN_DUMMY = 31;
|
||||
pub const KERN_PS_STRINGS = 32;
|
||||
pub const KERN_USRSTACK = 33;
|
||||
pub const KERN_LOGSIGEXIT = 34;
|
||||
pub const KERN_IOV_MAX = 35;
|
||||
pub const KERN_MAXPOSIXLOCKSPERUID = 36;
|
||||
pub const KERN_MAXID = 37;
|
||||
pub const KERN = struct {
|
||||
pub const PROC_ALL = 0;
|
||||
pub const OSTYPE = 1;
|
||||
pub const PROC_PID = 1;
|
||||
pub const OSRELEASE = 2;
|
||||
pub const PROC_PGRP = 2;
|
||||
pub const OSREV = 3;
|
||||
pub const PROC_SESSION = 3;
|
||||
pub const VERSION = 4;
|
||||
pub const PROC_TTY = 4;
|
||||
pub const MAXVNODES = 5;
|
||||
pub const PROC_UID = 5;
|
||||
pub const MAXPROC = 6;
|
||||
pub const PROC_RUID = 6;
|
||||
pub const MAXFILES = 7;
|
||||
pub const PROC_ARGS = 7;
|
||||
pub const ARGMAX = 8;
|
||||
pub const PROC_CWD = 8;
|
||||
pub const PROC_PATHNAME = 9;
|
||||
pub const SECURELVL = 9;
|
||||
pub const PROC_SIGTRAMP = 10;
|
||||
pub const HOSTNAME = 10;
|
||||
pub const HOSTID = 11;
|
||||
pub const CLOCKRATE = 12;
|
||||
pub const VNODE = 13;
|
||||
pub const PROC = 14;
|
||||
pub const FILE = 15;
|
||||
pub const PROC_FLAGMASK = 16;
|
||||
pub const PROF = 16;
|
||||
pub const PROC_FLAG_LWP = 16;
|
||||
pub const POSIX1 = 17;
|
||||
pub const NGROUPS = 18;
|
||||
pub const JOB_CONTROL = 19;
|
||||
pub const SAVED_IDS = 20;
|
||||
pub const BOOTTIME = 21;
|
||||
pub const NISDOMAINNAME = 22;
|
||||
pub const UPDATEINTERVAL = 23;
|
||||
pub const OSRELDATE = 24;
|
||||
pub const NTP_PLL = 25;
|
||||
pub const BOOTFILE = 26;
|
||||
pub const MAXFILESPERPROC = 27;
|
||||
pub const MAXPROCPERUID = 28;
|
||||
pub const DUMPDEV = 29;
|
||||
pub const IPC = 30;
|
||||
pub const DUMMY = 31;
|
||||
pub const PS_STRINGS = 32;
|
||||
pub const USRSTACK = 33;
|
||||
pub const LOGSIGEXIT = 34;
|
||||
pub const IOV_MAX = 35;
|
||||
pub const MAXPOSIXLOCKSPERUID = 36;
|
||||
pub const MAXID = 37;
|
||||
};
|
||||
|
||||
pub const HOST_NAME_MAX = 255;
|
||||
|
||||
|
||||
@ -349,15 +349,19 @@ pub const sockaddr = extern struct {
|
||||
};
|
||||
};
|
||||
|
||||
pub const CTL_KERN = 1;
|
||||
pub const CTL_DEBUG = 5;
|
||||
pub const CTL = struct {
|
||||
pub const KERN = 1;
|
||||
pub const DEBUG = 5;
|
||||
};
|
||||
|
||||
pub const KERN_PROC = 14; // struct: process entries
|
||||
pub const KERN_PROC_PATHNAME = 12; // path to executable
|
||||
pub const KERN_IOV_MAX = 35;
|
||||
pub const KERN = struct {
|
||||
pub const PROC = 14; // struct: process entries
|
||||
pub const PROC_PATHNAME = 12; // path to executable
|
||||
pub const IOV_MAX = 35;
|
||||
};
|
||||
|
||||
pub const PATH_MAX = 1024;
|
||||
pub const IOV_MAX = KERN_IOV_MAX;
|
||||
pub const IOV_MAX = KERN.IOV_MAX;
|
||||
|
||||
pub const STDIN_FILENO = 0;
|
||||
pub const STDOUT_FILENO = 1;
|
||||
@ -413,6 +417,25 @@ pub const W = struct {
|
||||
pub const NOWAIT = 8;
|
||||
pub const EXITED = 16;
|
||||
pub const TRAPPED = 32;
|
||||
|
||||
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 {
|
||||
@ -913,25 +936,6 @@ pub const T = struct {
|
||||
pub const IOCSIG = 0x2004745f;
|
||||
};
|
||||
|
||||
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 winsize = extern struct {
|
||||
ws_row: u16,
|
||||
ws_col: u16,
|
||||
|
||||
@ -365,11 +365,15 @@ pub const sockaddr = extern struct {
|
||||
};
|
||||
};
|
||||
|
||||
pub const CTL_KERN = 1;
|
||||
pub const CTL_DEBUG = 5;
|
||||
pub const CTL = struct {
|
||||
pub const KERN = 1;
|
||||
pub const DEBUG = 5;
|
||||
};
|
||||
|
||||
pub const KERN_PROC = 14; // struct: process entries
|
||||
pub const KERN_PROC_PATHNAME = 12; // path to executable
|
||||
pub const KERN = struct {
|
||||
pub const PROC = 14; // struct: process entries
|
||||
pub const PROC_PATHNAME = 12; // path to executable
|
||||
};
|
||||
|
||||
pub const PATH_MAX = 1024;
|
||||
|
||||
|
||||
@ -520,15 +520,19 @@ pub const AI = struct {
|
||||
pub const ADDRCONFIG = 0x00000400;
|
||||
};
|
||||
|
||||
pub const CTL_KERN = 1;
|
||||
pub const CTL_DEBUG = 5;
|
||||
pub const CTL = struct {
|
||||
pub const KERN = 1;
|
||||
pub const DEBUG = 5;
|
||||
};
|
||||
|
||||
pub const KERN_PROC_ARGS = 48; // struct: process argv/env
|
||||
pub const KERN_PROC_PATHNAME = 5; // path to executable
|
||||
pub const KERN_IOV_MAX = 38;
|
||||
pub const KERN = struct {
|
||||
pub const PROC_ARGS = 48; // struct: process argv/env
|
||||
pub const PROC_PATHNAME = 5; // path to executable
|
||||
pub const IOV_MAX = 38;
|
||||
};
|
||||
|
||||
pub const PATH_MAX = 1024;
|
||||
pub const IOV_MAX = KERN_IOV_MAX;
|
||||
pub const IOV_MAX = KERN.IOV_MAX;
|
||||
|
||||
pub const STDIN_FILENO = 0;
|
||||
pub const STDOUT_FILENO = 1;
|
||||
|
||||
@ -1215,105 +1215,123 @@ pub const POLL = struct {
|
||||
pub const WRBAND = 0x0100;
|
||||
};
|
||||
|
||||
// sysctl mib
|
||||
pub const CTL_UNSPEC = 0;
|
||||
pub const CTL_KERN = 1;
|
||||
pub const CTL_VM = 2;
|
||||
pub const CTL_FS = 3;
|
||||
pub const CTL_NET = 4;
|
||||
pub const CTL_DEBUG = 5;
|
||||
pub const CTL_HW = 6;
|
||||
pub const CTL_MACHDEP = 7;
|
||||
pub const CTL = struct {
|
||||
pub const UNSPEC = 0;
|
||||
pub const KERN = 1;
|
||||
pub const VM = 2;
|
||||
pub const FS = 3;
|
||||
pub const NET = 4;
|
||||
pub const DEBUG = 5;
|
||||
pub const HW = 6;
|
||||
pub const MACHDEP = 7;
|
||||
|
||||
pub const CTL_DDB = 9;
|
||||
pub const CTL_VFS = 10;
|
||||
pub const DDB = 9;
|
||||
pub const VFS = 10;
|
||||
};
|
||||
|
||||
pub const KERN_OSTYPE = 1;
|
||||
pub const KERN_OSRELEASE = 2;
|
||||
pub const KERN_OSREV = 3;
|
||||
pub const KERN_VERSION = 4;
|
||||
pub const KERN_MAXVNODES = 5;
|
||||
pub const KERN_MAXPROC = 6;
|
||||
pub const KERN_MAXFILES = 7;
|
||||
pub const KERN_ARGMAX = 8;
|
||||
pub const KERN_SECURELVL = 9;
|
||||
pub const KERN_HOSTNAME = 10;
|
||||
pub const KERN_HOSTID = 11;
|
||||
pub const KERN_CLOCKRATE = 12;
|
||||
pub const KERN = struct {
|
||||
pub const OSTYPE = 1;
|
||||
pub const OSRELEASE = 2;
|
||||
pub const OSREV = 3;
|
||||
pub const VERSION = 4;
|
||||
pub const MAXVNODES = 5;
|
||||
pub const MAXPROC = 6;
|
||||
pub const MAXFILES = 7;
|
||||
pub const ARGMAX = 8;
|
||||
pub const SECURELVL = 9;
|
||||
pub const HOSTNAME = 10;
|
||||
pub const HOSTID = 11;
|
||||
pub const CLOCKRATE = 12;
|
||||
|
||||
pub const KERN_PROF = 16;
|
||||
pub const KERN_POSIX1 = 17;
|
||||
pub const KERN_NGROUPS = 18;
|
||||
pub const KERN_JOB_CONTROL = 19;
|
||||
pub const KERN_SAVED_IDS = 20;
|
||||
pub const KERN_BOOTTIME = 21;
|
||||
pub const KERN_DOMAINNAME = 22;
|
||||
pub const KERN_MAXPARTITIONS = 23;
|
||||
pub const KERN_RAWPARTITION = 24;
|
||||
pub const KERN_MAXTHREAD = 25;
|
||||
pub const KERN_NTHREADS = 26;
|
||||
pub const KERN_OSVERSION = 27;
|
||||
pub const KERN_SOMAXCONN = 28;
|
||||
pub const KERN_SOMINCONN = 29;
|
||||
pub const PROF = 16;
|
||||
pub const POSIX1 = 17;
|
||||
pub const NGROUPS = 18;
|
||||
pub const JOB_CONTROL = 19;
|
||||
pub const SAVED_IDS = 20;
|
||||
pub const BOOTTIME = 21;
|
||||
pub const DOMAINNAME = 22;
|
||||
pub const MAXPARTITIONS = 23;
|
||||
pub const RAWPARTITION = 24;
|
||||
pub const MAXTHREAD = 25;
|
||||
pub const NTHREADS = 26;
|
||||
pub const OSVERSION = 27;
|
||||
pub const SOMAXCONN = 28;
|
||||
pub const SOMINCONN = 29;
|
||||
|
||||
pub const KERN_NOSUIDCOREDUMP = 32;
|
||||
pub const KERN_FSYNC = 33;
|
||||
pub const KERN_SYSVMSG = 34;
|
||||
pub const KERN_SYSVSEM = 35;
|
||||
pub const KERN_SYSVSHM = 36;
|
||||
pub const NOSUIDCOREDUMP = 32;
|
||||
pub const FSYNC = 33;
|
||||
pub const SYSVMSG = 34;
|
||||
pub const SYSVSEM = 35;
|
||||
pub const SYSVSHM = 36;
|
||||
|
||||
pub const KERN_MSGBUFSIZE = 38;
|
||||
pub const KERN_MALLOCSTATS = 39;
|
||||
pub const KERN_CPTIME = 40;
|
||||
pub const KERN_NCHSTATS = 41;
|
||||
pub const KERN_FORKSTAT = 42;
|
||||
pub const KERN_NSELCOLL = 43;
|
||||
pub const KERN_TTY = 44;
|
||||
pub const KERN_CCPU = 45;
|
||||
pub const KERN_FSCALE = 46;
|
||||
pub const KERN_NPROCS = 47;
|
||||
pub const KERN_MSGBUF = 48;
|
||||
pub const KERN_POOL = 49;
|
||||
pub const KERN_STACKGAPRANDOM = 50;
|
||||
pub const KERN_SYSVIPC_INFO = 51;
|
||||
pub const KERN_ALLOWKMEM = 52;
|
||||
pub const KERN_WITNESSWATCH = 53;
|
||||
pub const KERN_SPLASSERT = 54;
|
||||
pub const KERN_PROC_ARGS = 55;
|
||||
pub const KERN_NFILES = 56;
|
||||
pub const KERN_TTYCOUNT = 57;
|
||||
pub const KERN_NUMVNODES = 58;
|
||||
pub const KERN_MBSTAT = 59;
|
||||
pub const KERN_WITNESS = 60;
|
||||
pub const KERN_SEMINFO = 61;
|
||||
pub const KERN_SHMINFO = 62;
|
||||
pub const KERN_INTRCNT = 63;
|
||||
pub const KERN_WATCHDOG = 64;
|
||||
pub const KERN_ALLOWDT = 65;
|
||||
pub const KERN_PROC = 66;
|
||||
pub const KERN_MAXCLUSTERS = 67;
|
||||
pub const KERN_EVCOUNT = 68;
|
||||
pub const KERN_TIMECOUNTER = 69;
|
||||
pub const KERN_MAXLOCKSPERUID = 70;
|
||||
pub const KERN_CPTIME2 = 71;
|
||||
pub const KERN_CACHEPCT = 72;
|
||||
pub const KERN_FILE = 73;
|
||||
pub const KERN_WXABORT = 74;
|
||||
pub const KERN_CONSDEV = 75;
|
||||
pub const KERN_NETLIVELOCKS = 76;
|
||||
pub const KERN_POOL_DEBUG = 77;
|
||||
pub const KERN_PROC_CWD = 78;
|
||||
pub const KERN_PROC_NOBROADCASTKILL = 79;
|
||||
pub const KERN_PROC_VMMAP = 80;
|
||||
pub const KERN_GLOBAL_PTRACE = 81;
|
||||
pub const KERN_CONSBUFSIZE = 82;
|
||||
pub const KERN_CONSBUF = 83;
|
||||
pub const KERN_AUDIO = 84;
|
||||
pub const KERN_CPUSTATS = 85;
|
||||
pub const KERN_PFSTATUS = 86;
|
||||
pub const KERN_TIMEOUT_STATS = 87;
|
||||
pub const KERN_UTC_OFFSET = 88;
|
||||
pub const KERN_VIDEO = 89;
|
||||
pub const MSGBUFSIZE = 38;
|
||||
pub const MALLOCSTATS = 39;
|
||||
pub const CPTIME = 40;
|
||||
pub const NCHSTATS = 41;
|
||||
pub const FORKSTAT = 42;
|
||||
pub const NSELCOLL = 43;
|
||||
pub const TTY = 44;
|
||||
pub const CCPU = 45;
|
||||
pub const FSCALE = 46;
|
||||
pub const NPROCS = 47;
|
||||
pub const MSGBUF = 48;
|
||||
pub const POOL = 49;
|
||||
pub const STACKGAPRANDOM = 50;
|
||||
pub const SYSVIPC_INFO = 51;
|
||||
pub const ALLOWKMEM = 52;
|
||||
pub const WITNESSWATCH = 53;
|
||||
pub const SPLASSERT = 54;
|
||||
pub const PROC_ARGS = 55;
|
||||
pub const NFILES = 56;
|
||||
pub const TTYCOUNT = 57;
|
||||
pub const NUMVNODES = 58;
|
||||
pub const MBSTAT = 59;
|
||||
pub const WITNESS = 60;
|
||||
pub const SEMINFO = 61;
|
||||
pub const SHMINFO = 62;
|
||||
pub const INTRCNT = 63;
|
||||
pub const WATCHDOG = 64;
|
||||
pub const ALLOWDT = 65;
|
||||
pub const PROC = 66;
|
||||
pub const MAXCLUSTERS = 67;
|
||||
pub const EVCOUNT = 68;
|
||||
pub const TIMECOUNTER = 69;
|
||||
pub const MAXLOCKSPERUID = 70;
|
||||
pub const CPTIME2 = 71;
|
||||
pub const CACHEPCT = 72;
|
||||
pub const FILE = 73;
|
||||
pub const WXABORT = 74;
|
||||
pub const CONSDEV = 75;
|
||||
pub const NETLIVELOCKS = 76;
|
||||
pub const POOL_DEBUG = 77;
|
||||
pub const PROC_CWD = 78;
|
||||
pub const PROC_NOBROADCASTKILL = 79;
|
||||
pub const PROC_VMMAP = 80;
|
||||
pub const GLOBAL_PTRACE = 81;
|
||||
pub const CONSBUFSIZE = 82;
|
||||
pub const CONSBUF = 83;
|
||||
pub const AUDIO = 84;
|
||||
pub const CPUSTATS = 85;
|
||||
pub const PFSTATUS = 86;
|
||||
pub const TIMEOUT_STATS = 87;
|
||||
pub const UTC_OFFSET = 88;
|
||||
pub const VIDEO = 89;
|
||||
|
||||
pub const PROC_ALL = 0;
|
||||
pub const PROC_PID = 1;
|
||||
pub const PROC_PGRP = 2;
|
||||
pub const PROC_SESSION = 3;
|
||||
pub const PROC_TTY = 4;
|
||||
pub const PROC_UID = 5;
|
||||
pub const PROC_RUID = 6;
|
||||
pub const PROC_KTHREAD = 7;
|
||||
pub const PROC_SHOW_THREADS = 0x40000000;
|
||||
|
||||
pub const PROC_ARGV = 1;
|
||||
pub const PROC_NARGV = 2;
|
||||
pub const PROC_ENV = 3;
|
||||
pub const PROC_NENV = 4;
|
||||
};
|
||||
|
||||
pub const HW_MACHINE = 1;
|
||||
pub const HW_MODEL = 2;
|
||||
@ -1340,18 +1358,3 @@ pub const HW_ALLOWPOWERDOWN = 22;
|
||||
pub const HW_PERFPOLICY = 23;
|
||||
pub const HW_SMT = 24;
|
||||
pub const HW_NCPUONLINE = 25;
|
||||
|
||||
pub const KERN_PROC_ALL = 0;
|
||||
pub const KERN_PROC_PID = 1;
|
||||
pub const KERN_PROC_PGRP = 2;
|
||||
pub const KERN_PROC_SESSION = 3;
|
||||
pub const KERN_PROC_TTY = 4;
|
||||
pub const KERN_PROC_UID = 5;
|
||||
pub const KERN_PROC_RUID = 6;
|
||||
pub const KERN_PROC_KTHREAD = 7;
|
||||
pub const KERN_PROC_SHOW_THREADS = 0x40000000;
|
||||
|
||||
pub const KERN_PROC_ARGV = 1;
|
||||
pub const KERN_PROC_NARGV = 2;
|
||||
pub const KERN_PROC_ENV = 3;
|
||||
pub const KERN_PROC_NENV = 4;
|
||||
|
||||
@ -344,7 +344,7 @@ pub const Dir = struct {
|
||||
self.index = 0;
|
||||
self.end_index = @intCast(usize, rc);
|
||||
}
|
||||
const darwin_entry = @ptrCast(*align(1) os.darwin.dirent, &self.buf[self.index]);
|
||||
const darwin_entry = @ptrCast(*align(1) os.dirent, &self.buf[self.index]);
|
||||
const next_index = self.index + darwin_entry.reclen();
|
||||
self.index = next_index;
|
||||
|
||||
@ -2442,14 +2442,14 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
|
||||
switch (builtin.os.tag) {
|
||||
.linux => return os.readlinkZ("/proc/self/exe", out_buffer),
|
||||
.freebsd, .dragonfly => {
|
||||
var mib = [4]c_int{ os.CTL_KERN, os.KERN_PROC, os.KERN_PROC_PATHNAME, -1 };
|
||||
var mib = [4]c_int{ os.CTL.KERN, os.KERN.PROC, os.KERN.PROC_PATHNAME, -1 };
|
||||
var out_len: usize = out_buffer.len;
|
||||
try os.sysctl(&mib, out_buffer.ptr, &out_len, null, 0);
|
||||
// TODO could this slice from 0 to out_len instead?
|
||||
return mem.spanZ(std.meta.assumeSentinel(out_buffer.ptr, 0));
|
||||
},
|
||||
.netbsd => {
|
||||
var mib = [4]c_int{ os.CTL_KERN, os.KERN_PROC_ARGS, -1, os.KERN_PROC_PATHNAME };
|
||||
var mib = [4]c_int{ os.CTL.KERN, os.KERN.PROC_ARGS, -1, os.KERN.PROC_PATHNAME };
|
||||
var out_len: usize = out_buffer.len;
|
||||
try os.sysctl(&mib, out_buffer.ptr, &out_len, null, 0);
|
||||
// TODO could this slice from 0 to out_len instead?
|
||||
|
||||
@ -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 CTL = system.CTL;
|
||||
pub const DT = system.DT;
|
||||
pub const E = system.E;
|
||||
pub const Elf_Symndx = system.Elf_Symndx;
|
||||
@ -78,6 +79,7 @@ pub const HOST_NAME_MAX = system.HOST_NAME_MAX;
|
||||
pub const IFNAMESIZE = system.IFNAMESIZE;
|
||||
pub const IOV_MAX = system.IOV_MAX;
|
||||
pub const IPPROTO = system.IPPROTO;
|
||||
pub const KERN = system.KERN;
|
||||
pub const Kevent = system.Kevent;
|
||||
pub const LOCK = system.LOCK;
|
||||
pub const MADV = system.MADV;
|
||||
@ -121,6 +123,7 @@ pub const blksize_t = system.blksize_t;
|
||||
pub const clock_t = system.clock_t;
|
||||
pub const cpu_set_t = system.cpu_set_t;
|
||||
pub const dev_t = system.dev_t;
|
||||
pub const dirent = system.dirent;
|
||||
pub const dl_phdr_info = system.dl_phdr_info;
|
||||
pub const empty_sigset = system.empty_sigset;
|
||||
pub const fd_t = system.fd_t;
|
||||
|
||||
@ -309,8 +309,8 @@ pub const NativeTargetInfo = struct {
|
||||
},
|
||||
.openbsd => {
|
||||
const mib: [2]c_int = [_]c_int{
|
||||
std.os.CTL_KERN,
|
||||
std.os.KERN_OSRELEASE,
|
||||
std.os.CTL.KERN,
|
||||
std.os.KERN.OSRELEASE,
|
||||
};
|
||||
var buf: [64]u8 = undefined;
|
||||
var len: usize = buf.len;
|
||||
|
||||
@ -404,8 +404,8 @@ fn testVersionEquality(expected: std.builtin.Version, got: std.builtin.Version)
|
||||
}
|
||||
|
||||
pub fn detectNativeCpuAndFeatures() ?Target.Cpu {
|
||||
var cpu_family: os.CPUFAMILY = undefined;
|
||||
var len: usize = @sizeOf(os.CPUFAMILY);
|
||||
var cpu_family: std.c.CPUFAMILY = undefined;
|
||||
var len: usize = @sizeOf(std.c.CPUFAMILY);
|
||||
os.sysctlbynameZ("hw.cpufamily", &cpu_family, &len, null, 0) catch |err| switch (err) {
|
||||
error.NameTooLong => unreachable, // constant, known good value
|
||||
error.PermissionDenied => unreachable, // only when setting values,
|
||||
|
||||
@ -3828,7 +3828,7 @@ fn parseCodeModel(arg: []const u8) std.builtin.CodeModel {
|
||||
/// garbage collector to run concurrently to zig processes, and to allow multiple
|
||||
/// zig processes to run concurrently with each other, without clobbering each other.
|
||||
fn gimmeMoreOfThoseSweetSweetFileDescriptors() void {
|
||||
if (!@hasDecl(std.os, "rlimit")) return;
|
||||
if (!@hasDecl(std.os.system, "rlimit")) return;
|
||||
const posix = std.os;
|
||||
|
||||
var lim = posix.getrlimit(.NOFILE) catch return; // Oh well; we tried.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user