authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-08-31 18:24:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-09-01 17:54:07-07:00
logf8dd4b13d6fe428265229fc1e31c2f8b0cd373b1
treeee97556c506b09e566b8d0db2329e9556fb5a768
parent057f0fec33c4e54e87383d1181e946d3cddbc4c0

std.os reorg: more fixes caught by CI


11 files changed, 244 insertions(+), 222 deletions(-)

lib/std/Thread.zig+1-1
...@@ -558,7 +558,7 @@ const PosixThreadImpl = struct {...@@ -558,7 +558,7 @@ const PosixThreadImpl = struct {
558 .openbsd => {558 .openbsd => {
559 var count: c_int = undefined;559 var count: c_int = undefined;
560 var count_size: usize = @sizeOf(c_int);560 var count_size: usize = @sizeOf(c_int);
561 const mib = [_]c_int{ os.CTL_HW, os.HW_NCPUONLINE };561 const mib = [_]c_int{ os.CTL.HW, os.HW_NCPUONLINE };
562 os.sysctl(&mib, &count, &count_size, null, 0) catch |err| switch (err) {562 os.sysctl(&mib, &count, &count_size, null, 0) catch |err| switch (err) {
563 error.NameTooLong, error.UnknownName => unreachable,563 error.NameTooLong, error.UnknownName => unreachable,
564 else => |e| return e,564 else => |e| return e,
lib/std/c/dragonfly.zig+68-64
...@@ -221,7 +221,7 @@ pub const SA = struct {...@@ -221,7 +221,7 @@ pub const SA = struct {
221};221};
222222
223pub const PATH_MAX = 1024;223pub const PATH_MAX = 1024;
224pub const IOV_MAX = KERN_IOV_MAX;224pub const IOV_MAX = KERN.IOV_MAX;
225225
226pub const ino_t = c_ulong;226pub const ino_t = c_ulong;
227227
...@@ -270,69 +270,73 @@ pub const timeval = extern struct {...@@ -270,69 +270,73 @@ pub const timeval = extern struct {
270 tv_usec: suseconds_t,270 tv_usec: suseconds_t,
271};271};
272272
273pub const CTL_UNSPEC = 0;273pub const CTL = struct {
274pub const CTL_KERN = 1;274 pub const UNSPEC = 0;
275pub const CTL_VM = 2;275 pub const KERN = 1;
276pub const CTL_VFS = 3;276 pub const VM = 2;
277pub const CTL_NET = 4;277 pub const VFS = 3;
278pub const CTL_DEBUG = 5;278 pub const NET = 4;
279pub const CTL_HW = 6;279 pub const DEBUG = 5;
280pub const CTL_MACHDEP = 7;280 pub const HW = 6;
281pub const CTL_USER = 8;281 pub const MACHDEP = 7;
282pub const CTL_LWKT = 10;282 pub const USER = 8;
283pub const CTL_MAXID = 11;283 pub const LWKT = 10;
284pub const CTL_MAXNAME = 12;284 pub const MAXID = 11;
285285 pub const MAXNAME = 12;
286pub const KERN_PROC_ALL = 0;286};
287pub const KERN_OSTYPE = 1;287
288pub const KERN_PROC_PID = 1;288pub const KERN = struct {
289pub const KERN_OSRELEASE = 2;289 pub const PROC_ALL = 0;
290pub const KERN_PROC_PGRP = 2;290 pub const OSTYPE = 1;
291pub const KERN_OSREV = 3;291 pub const PROC_PID = 1;
292pub const KERN_PROC_SESSION = 3;292 pub const OSRELEASE = 2;
293pub const KERN_VERSION = 4;293 pub const PROC_PGRP = 2;
294pub const KERN_PROC_TTY = 4;294 pub const OSREV = 3;
295pub const KERN_MAXVNODES = 5;295 pub const PROC_SESSION = 3;
296pub const KERN_PROC_UID = 5;296 pub const VERSION = 4;
297pub const KERN_MAXPROC = 6;297 pub const PROC_TTY = 4;
298pub const KERN_PROC_RUID = 6;298 pub const MAXVNODES = 5;
299pub const KERN_MAXFILES = 7;299 pub const PROC_UID = 5;
300pub const KERN_PROC_ARGS = 7;300 pub const MAXPROC = 6;
301pub const KERN_ARGMAX = 8;301 pub const PROC_RUID = 6;
302pub const KERN_PROC_CWD = 8;302 pub const MAXFILES = 7;
303pub const KERN_PROC_PATHNAME = 9;303 pub const PROC_ARGS = 7;
304pub const KERN_SECURELVL = 9;304 pub const ARGMAX = 8;
305pub const KERN_PROC_SIGTRAMP = 10;305 pub const PROC_CWD = 8;
306pub const KERN_HOSTNAME = 10;306 pub const PROC_PATHNAME = 9;
307pub const KERN_HOSTID = 11;307 pub const SECURELVL = 9;
308pub const KERN_CLOCKRATE = 12;308 pub const PROC_SIGTRAMP = 10;
309pub const KERN_VNODE = 13;309 pub const HOSTNAME = 10;
310pub const KERN_PROC = 14;310 pub const HOSTID = 11;
311pub const KERN_FILE = 15;311 pub const CLOCKRATE = 12;
312pub const KERN_PROC_FLAGMASK = 16;312 pub const VNODE = 13;
313pub const KERN_PROF = 16;313 pub const PROC = 14;
314pub const KERN_PROC_FLAG_LWP = 16;314 pub const FILE = 15;
315pub const KERN_POSIX1 = 17;315 pub const PROC_FLAGMASK = 16;
316pub const KERN_NGROUPS = 18;316 pub const PROF = 16;
317pub const KERN_JOB_CONTROL = 19;317 pub const PROC_FLAG_LWP = 16;
318pub const KERN_SAVED_IDS = 20;318 pub const POSIX1 = 17;
319pub const KERN_BOOTTIME = 21;319 pub const NGROUPS = 18;
320pub const KERN_NISDOMAINNAME = 22;320 pub const JOB_CONTROL = 19;
321pub const KERN_UPDATEINTERVAL = 23;321 pub const SAVED_IDS = 20;
322pub const KERN_OSRELDATE = 24;322 pub const BOOTTIME = 21;
323pub const KERN_NTP_PLL = 25;323 pub const NISDOMAINNAME = 22;
324pub const KERN_BOOTFILE = 26;324 pub const UPDATEINTERVAL = 23;
325pub const KERN_MAXFILESPERPROC = 27;325 pub const OSRELDATE = 24;
326pub const KERN_MAXPROCPERUID = 28;326 pub const NTP_PLL = 25;
327pub const KERN_DUMPDEV = 29;327 pub const BOOTFILE = 26;
328pub const KERN_IPC = 30;328 pub const MAXFILESPERPROC = 27;
329pub const KERN_DUMMY = 31;329 pub const MAXPROCPERUID = 28;
330pub const KERN_PS_STRINGS = 32;330 pub const DUMPDEV = 29;
331pub const KERN_USRSTACK = 33;331 pub const IPC = 30;
332pub const KERN_LOGSIGEXIT = 34;332 pub const DUMMY = 31;
333pub const KERN_IOV_MAX = 35;333 pub const PS_STRINGS = 32;
334pub const KERN_MAXPOSIXLOCKSPERUID = 36;334 pub const USRSTACK = 33;
335pub const KERN_MAXID = 37;335 pub const LOGSIGEXIT = 34;
336 pub const IOV_MAX = 35;
337 pub const MAXPOSIXLOCKSPERUID = 36;
338 pub const MAXID = 37;
339};
336340
337pub const HOST_NAME_MAX = 255;341pub const HOST_NAME_MAX = 255;
338342
lib/std/c/freebsd.zig+29-25
...@@ -349,15 +349,19 @@ pub const sockaddr = extern struct {...@@ -349,15 +349,19 @@ pub const sockaddr = extern struct {
349 };349 };
350};350};
351351
352pub const CTL_KERN = 1;352pub const CTL = struct {
353pub const CTL_DEBUG = 5;353 pub const KERN = 1;
354 pub const DEBUG = 5;
355};
354356
355pub const KERN_PROC = 14; // struct: process entries357pub const KERN = struct {
356pub const KERN_PROC_PATHNAME = 12; // path to executable358 pub const PROC = 14; // struct: process entries
357pub const KERN_IOV_MAX = 35;359 pub const PROC_PATHNAME = 12; // path to executable
360 pub const IOV_MAX = 35;
361};
358362
359pub const PATH_MAX = 1024;363pub const PATH_MAX = 1024;
360pub const IOV_MAX = KERN_IOV_MAX;364pub const IOV_MAX = KERN.IOV_MAX;
361365
362pub const STDIN_FILENO = 0;366pub const STDIN_FILENO = 0;
363pub const STDOUT_FILENO = 1;367pub const STDOUT_FILENO = 1;
...@@ -413,6 +417,25 @@ pub const W = struct {...@@ -413,6 +417,25 @@ pub const W = struct {
413 pub const NOWAIT = 8;417 pub const NOWAIT = 8;
414 pub const EXITED = 16;418 pub const EXITED = 16;
415 pub const TRAPPED = 32;419 pub const TRAPPED = 32;
420
421 pub fn EXITSTATUS(s: u32) u8 {
422 return @intCast(u8, (s & 0xff00) >> 8);
423 }
424 pub fn TERMSIG(s: u32) u32 {
425 return s & 0x7f;
426 }
427 pub fn STOPSIG(s: u32) u32 {
428 return EXITSTATUS(s);
429 }
430 pub fn IFEXITED(s: u32) bool {
431 return TERMSIG(s) == 0;
432 }
433 pub fn IFSTOPPED(s: u32) bool {
434 return @intCast(u16, (((s & 0xffff) *% 0x10001) >> 8)) > 0x7f00;
435 }
436 pub fn IFSIGNALED(s: u32) bool {
437 return (s & 0xffff) -% 1 < 0xff;
438 }
416};439};
417440
418pub const SA = struct {441pub const SA = struct {
...@@ -913,25 +936,6 @@ pub const T = struct {...@@ -913,25 +936,6 @@ pub const T = struct {
913 pub const IOCSIG = 0x2004745f;936 pub const IOCSIG = 0x2004745f;
914};937};
915938
916pub fn WEXITSTATUS(s: u32) u8 {
917 return @intCast(u8, (s & 0xff00) >> 8);
918}
919pub fn WTERMSIG(s: u32) u32 {
920 return s & 0x7f;
921}
922pub fn WSTOPSIG(s: u32) u32 {
923 return WEXITSTATUS(s);
924}
925pub fn WIFEXITED(s: u32) bool {
926 return WTERMSIG(s) == 0;
927}
928pub fn WIFSTOPPED(s: u32) bool {
929 return @intCast(u16, (((s & 0xffff) *% 0x10001) >> 8)) > 0x7f00;
930}
931pub fn WIFSIGNALED(s: u32) bool {
932 return (s & 0xffff) -% 1 < 0xff;
933}
934
935pub const winsize = extern struct {939pub const winsize = extern struct {
936 ws_row: u16,940 ws_row: u16,
937 ws_col: u16,941 ws_col: u16,
lib/std/c/haiku.zig+8-4
...@@ -365,11 +365,15 @@ pub const sockaddr = extern struct {...@@ -365,11 +365,15 @@ pub const sockaddr = extern struct {
365 };365 };
366};366};
367367
368pub const CTL_KERN = 1;368pub const CTL = struct {
369pub const CTL_DEBUG = 5;369 pub const KERN = 1;
370 pub const DEBUG = 5;
371};
370372
371pub const KERN_PROC = 14; // struct: process entries373pub const KERN = struct {
372pub const KERN_PROC_PATHNAME = 12; // path to executable374 pub const PROC = 14; // struct: process entries
375 pub const PROC_PATHNAME = 12; // path to executable
376};
373377
374pub const PATH_MAX = 1024;378pub const PATH_MAX = 1024;
375379
lib/std/c/netbsd.zig+10-6
...@@ -520,15 +520,19 @@ pub const AI = struct {...@@ -520,15 +520,19 @@ pub const AI = struct {
520 pub const ADDRCONFIG = 0x00000400;520 pub const ADDRCONFIG = 0x00000400;
521};521};
522522
523pub const CTL_KERN = 1;523pub const CTL = struct {
524pub const CTL_DEBUG = 5;524 pub const KERN = 1;
525 pub const DEBUG = 5;
526};
525527
526pub const KERN_PROC_ARGS = 48; // struct: process argv/env528pub const KERN = struct {
527pub const KERN_PROC_PATHNAME = 5; // path to executable529 pub const PROC_ARGS = 48; // struct: process argv/env
528pub const KERN_IOV_MAX = 38;530 pub const PROC_PATHNAME = 5; // path to executable
531 pub const IOV_MAX = 38;
532};
529533
530pub const PATH_MAX = 1024;534pub const PATH_MAX = 1024;
531pub const IOV_MAX = KERN_IOV_MAX;535pub const IOV_MAX = KERN.IOV_MAX;
532536
533pub const STDIN_FILENO = 0;537pub const STDIN_FILENO = 0;
534pub const STDOUT_FILENO = 1;538pub const STDOUT_FILENO = 1;
lib/std/c/openbsd.zig+117-114
...@@ -1215,105 +1215,123 @@ pub const POLL = struct {...@@ -1215,105 +1215,123 @@ pub const POLL = struct {
1215 pub const WRBAND = 0x0100;1215 pub const WRBAND = 0x0100;
1216};1216};
12171217
1218// sysctl mib1218pub const CTL = struct {
1219pub const CTL_UNSPEC = 0;1219 pub const UNSPEC = 0;
1220pub const CTL_KERN = 1;1220 pub const KERN = 1;
1221pub const CTL_VM = 2;1221 pub const VM = 2;
1222pub const CTL_FS = 3;1222 pub const FS = 3;
1223pub const CTL_NET = 4;1223 pub const NET = 4;
1224pub const CTL_DEBUG = 5;1224 pub const DEBUG = 5;
1225pub const CTL_HW = 6;1225 pub const HW = 6;
1226pub const CTL_MACHDEP = 7;1226 pub const MACHDEP = 7;
12271227
1228pub const CTL_DDB = 9;1228 pub const DDB = 9;
1229pub const CTL_VFS = 10;1229 pub const VFS = 10;
12301230};
1231pub const KERN_OSTYPE = 1;1231
1232pub const KERN_OSRELEASE = 2;1232pub const KERN = struct {
1233pub const KERN_OSREV = 3;1233 pub const OSTYPE = 1;
1234pub const KERN_VERSION = 4;1234 pub const OSRELEASE = 2;
1235pub const KERN_MAXVNODES = 5;1235 pub const OSREV = 3;
1236pub const KERN_MAXPROC = 6;1236 pub const VERSION = 4;
1237pub const KERN_MAXFILES = 7;1237 pub const MAXVNODES = 5;
1238pub const KERN_ARGMAX = 8;1238 pub const MAXPROC = 6;
1239pub const KERN_SECURELVL = 9;1239 pub const MAXFILES = 7;
1240pub const KERN_HOSTNAME = 10;1240 pub const ARGMAX = 8;
1241pub const KERN_HOSTID = 11;1241 pub const SECURELVL = 9;
1242pub const KERN_CLOCKRATE = 12;1242 pub const HOSTNAME = 10;
12431243 pub const HOSTID = 11;
1244pub const KERN_PROF = 16;1244 pub const CLOCKRATE = 12;
1245pub const KERN_POSIX1 = 17;1245
1246pub const KERN_NGROUPS = 18;1246 pub const PROF = 16;
1247pub const KERN_JOB_CONTROL = 19;1247 pub const POSIX1 = 17;
1248pub const KERN_SAVED_IDS = 20;1248 pub const NGROUPS = 18;
1249pub const KERN_BOOTTIME = 21;1249 pub const JOB_CONTROL = 19;
1250pub const KERN_DOMAINNAME = 22;1250 pub const SAVED_IDS = 20;
1251pub const KERN_MAXPARTITIONS = 23;1251 pub const BOOTTIME = 21;
1252pub const KERN_RAWPARTITION = 24;1252 pub const DOMAINNAME = 22;
1253pub const KERN_MAXTHREAD = 25;1253 pub const MAXPARTITIONS = 23;
1254pub const KERN_NTHREADS = 26;1254 pub const RAWPARTITION = 24;
1255pub const KERN_OSVERSION = 27;1255 pub const MAXTHREAD = 25;
1256pub const KERN_SOMAXCONN = 28;1256 pub const NTHREADS = 26;
1257pub const KERN_SOMINCONN = 29;1257 pub const OSVERSION = 27;
12581258 pub const SOMAXCONN = 28;
1259pub const KERN_NOSUIDCOREDUMP = 32;1259 pub const SOMINCONN = 29;
1260pub const KERN_FSYNC = 33;1260
1261pub const KERN_SYSVMSG = 34;1261 pub const NOSUIDCOREDUMP = 32;
1262pub const KERN_SYSVSEM = 35;1262 pub const FSYNC = 33;
1263pub const KERN_SYSVSHM = 36;1263 pub const SYSVMSG = 34;
12641264 pub const SYSVSEM = 35;
1265pub const KERN_MSGBUFSIZE = 38;1265 pub const SYSVSHM = 36;
1266pub const KERN_MALLOCSTATS = 39;1266
1267pub const KERN_CPTIME = 40;1267 pub const MSGBUFSIZE = 38;
1268pub const KERN_NCHSTATS = 41;1268 pub const MALLOCSTATS = 39;
1269pub const KERN_FORKSTAT = 42;1269 pub const CPTIME = 40;
1270pub const KERN_NSELCOLL = 43;1270 pub const NCHSTATS = 41;
1271pub const KERN_TTY = 44;1271 pub const FORKSTAT = 42;
1272pub const KERN_CCPU = 45;1272 pub const NSELCOLL = 43;
1273pub const KERN_FSCALE = 46;1273 pub const TTY = 44;
1274pub const KERN_NPROCS = 47;1274 pub const CCPU = 45;
1275pub const KERN_MSGBUF = 48;1275 pub const FSCALE = 46;
1276pub const KERN_POOL = 49;1276 pub const NPROCS = 47;
1277pub const KERN_STACKGAPRANDOM = 50;1277 pub const MSGBUF = 48;
1278pub const KERN_SYSVIPC_INFO = 51;1278 pub const POOL = 49;
1279pub const KERN_ALLOWKMEM = 52;1279 pub const STACKGAPRANDOM = 50;
1280pub const KERN_WITNESSWATCH = 53;1280 pub const SYSVIPC_INFO = 51;
1281pub const KERN_SPLASSERT = 54;1281 pub const ALLOWKMEM = 52;
1282pub const KERN_PROC_ARGS = 55;1282 pub const WITNESSWATCH = 53;
1283pub const KERN_NFILES = 56;1283 pub const SPLASSERT = 54;
1284pub const KERN_TTYCOUNT = 57;1284 pub const PROC_ARGS = 55;
1285pub const KERN_NUMVNODES = 58;1285 pub const NFILES = 56;
1286pub const KERN_MBSTAT = 59;1286 pub const TTYCOUNT = 57;
1287pub const KERN_WITNESS = 60;1287 pub const NUMVNODES = 58;
1288pub const KERN_SEMINFO = 61;1288 pub const MBSTAT = 59;
1289pub const KERN_SHMINFO = 62;1289 pub const WITNESS = 60;
1290pub const KERN_INTRCNT = 63;1290 pub const SEMINFO = 61;
1291pub const KERN_WATCHDOG = 64;1291 pub const SHMINFO = 62;
1292pub const KERN_ALLOWDT = 65;1292 pub const INTRCNT = 63;
1293pub const KERN_PROC = 66;1293 pub const WATCHDOG = 64;
1294pub const KERN_MAXCLUSTERS = 67;1294 pub const ALLOWDT = 65;
1295pub const KERN_EVCOUNT = 68;1295 pub const PROC = 66;
1296pub const KERN_TIMECOUNTER = 69;1296 pub const MAXCLUSTERS = 67;
1297pub const KERN_MAXLOCKSPERUID = 70;1297 pub const EVCOUNT = 68;
1298pub const KERN_CPTIME2 = 71;1298 pub const TIMECOUNTER = 69;
1299pub const KERN_CACHEPCT = 72;1299 pub const MAXLOCKSPERUID = 70;
1300pub const KERN_FILE = 73;1300 pub const CPTIME2 = 71;
1301pub const KERN_WXABORT = 74;1301 pub const CACHEPCT = 72;
1302pub const KERN_CONSDEV = 75;1302 pub const FILE = 73;
1303pub const KERN_NETLIVELOCKS = 76;1303 pub const WXABORT = 74;
1304pub const KERN_POOL_DEBUG = 77;1304 pub const CONSDEV = 75;
1305pub const KERN_PROC_CWD = 78;1305 pub const NETLIVELOCKS = 76;
1306pub const KERN_PROC_NOBROADCASTKILL = 79;1306 pub const POOL_DEBUG = 77;
1307pub const KERN_PROC_VMMAP = 80;1307 pub const PROC_CWD = 78;
1308pub const KERN_GLOBAL_PTRACE = 81;1308 pub const PROC_NOBROADCASTKILL = 79;
1309pub const KERN_CONSBUFSIZE = 82;1309 pub const PROC_VMMAP = 80;
1310pub const KERN_CONSBUF = 83;1310 pub const GLOBAL_PTRACE = 81;
1311pub const KERN_AUDIO = 84;1311 pub const CONSBUFSIZE = 82;
1312pub const KERN_CPUSTATS = 85;1312 pub const CONSBUF = 83;
1313pub const KERN_PFSTATUS = 86;1313 pub const AUDIO = 84;
1314pub const KERN_TIMEOUT_STATS = 87;1314 pub const CPUSTATS = 85;
1315pub const KERN_UTC_OFFSET = 88;1315 pub const PFSTATUS = 86;
1316pub const KERN_VIDEO = 89;1316 pub const TIMEOUT_STATS = 87;
1317 pub const UTC_OFFSET = 88;
1318 pub const VIDEO = 89;
1319
1320 pub const PROC_ALL = 0;
1321 pub const PROC_PID = 1;
1322 pub const PROC_PGRP = 2;
1323 pub const PROC_SESSION = 3;
1324 pub const PROC_TTY = 4;
1325 pub const PROC_UID = 5;
1326 pub const PROC_RUID = 6;
1327 pub const PROC_KTHREAD = 7;
1328 pub const PROC_SHOW_THREADS = 0x40000000;
1329
1330 pub const PROC_ARGV = 1;
1331 pub const PROC_NARGV = 2;
1332 pub const PROC_ENV = 3;
1333 pub const PROC_NENV = 4;
1334};
13171335
1318pub const HW_MACHINE = 1;1336pub const HW_MACHINE = 1;
1319pub const HW_MODEL = 2;1337pub const HW_MODEL = 2;
...@@ -1340,18 +1358,3 @@ pub const HW_ALLOWPOWERDOWN = 22;...@@ -1340,18 +1358,3 @@ pub const HW_ALLOWPOWERDOWN = 22;
1340pub const HW_PERFPOLICY = 23;1358pub const HW_PERFPOLICY = 23;
1341pub const HW_SMT = 24;1359pub const HW_SMT = 24;
1342pub const HW_NCPUONLINE = 25;1360pub const HW_NCPUONLINE = 25;
1343
1344pub const KERN_PROC_ALL = 0;
1345pub const KERN_PROC_PID = 1;
1346pub const KERN_PROC_PGRP = 2;
1347pub const KERN_PROC_SESSION = 3;
1348pub const KERN_PROC_TTY = 4;
1349pub const KERN_PROC_UID = 5;
1350pub const KERN_PROC_RUID = 6;
1351pub const KERN_PROC_KTHREAD = 7;
1352pub const KERN_PROC_SHOW_THREADS = 0x40000000;
1353
1354pub const KERN_PROC_ARGV = 1;
1355pub const KERN_PROC_NARGV = 2;
1356pub const KERN_PROC_ENV = 3;
1357pub const KERN_PROC_NENV = 4;
lib/std/fs.zig+3-3
...@@ -344,7 +344,7 @@ pub const Dir = struct {...@@ -344,7 +344,7 @@ pub const Dir = struct {
344 self.index = 0;344 self.index = 0;
345 self.end_index = @intCast(usize, rc);345 self.end_index = @intCast(usize, rc);
346 }346 }
347 const darwin_entry = @ptrCast(*align(1) os.darwin.dirent, &self.buf[self.index]);347 const darwin_entry = @ptrCast(*align(1) os.dirent, &self.buf[self.index]);
348 const next_index = self.index + darwin_entry.reclen();348 const next_index = self.index + darwin_entry.reclen();
349 self.index = next_index;349 self.index = next_index;
350350
...@@ -2442,14 +2442,14 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {...@@ -2442,14 +2442,14 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
2442 switch (builtin.os.tag) {2442 switch (builtin.os.tag) {
2443 .linux => return os.readlinkZ("/proc/self/exe", out_buffer),2443 .linux => return os.readlinkZ("/proc/self/exe", out_buffer),
2444 .freebsd, .dragonfly => {2444 .freebsd, .dragonfly => {
2445 var mib = [4]c_int{ os.CTL_KERN, os.KERN_PROC, os.KERN_PROC_PATHNAME, -1 };2445 var mib = [4]c_int{ os.CTL.KERN, os.KERN.PROC, os.KERN.PROC_PATHNAME, -1 };
2446 var out_len: usize = out_buffer.len;2446 var out_len: usize = out_buffer.len;
2447 try os.sysctl(&mib, out_buffer.ptr, &out_len, null, 0);2447 try os.sysctl(&mib, out_buffer.ptr, &out_len, null, 0);
2448 // TODO could this slice from 0 to out_len instead?2448 // TODO could this slice from 0 to out_len instead?
2449 return mem.spanZ(std.meta.assumeSentinel(out_buffer.ptr, 0));2449 return mem.spanZ(std.meta.assumeSentinel(out_buffer.ptr, 0));
2450 },2450 },
2451 .netbsd => {2451 .netbsd => {
2452 var mib = [4]c_int{ os.CTL_KERN, os.KERN_PROC_ARGS, -1, os.KERN_PROC_PATHNAME };2452 var mib = [4]c_int{ os.CTL.KERN, os.KERN.PROC_ARGS, -1, os.KERN.PROC_PATHNAME };
2453 var out_len: usize = out_buffer.len;2453 var out_len: usize = out_buffer.len;
2454 try os.sysctl(&mib, out_buffer.ptr, &out_len, null, 0);2454 try os.sysctl(&mib, out_buffer.ptr, &out_len, null, 0);
2455 // TODO could this slice from 0 to out_len instead?2455 // TODO could this slice from 0 to out_len instead?
lib/std/os.zig+3
...@@ -68,6 +68,7 @@ pub const ARCH = system.ARCH;...@@ -68,6 +68,7 @@ pub const ARCH = system.ARCH;
68pub const AT = system.AT;68pub const AT = system.AT;
69pub const CLOCK = system.CLOCK;69pub const CLOCK = system.CLOCK;
70pub const CPU_COUNT = system.CPU_COUNT;70pub const CPU_COUNT = system.CPU_COUNT;
71pub const CTL = system.CTL;
71pub const DT = system.DT;72pub const DT = system.DT;
72pub const E = system.E;73pub const E = system.E;
73pub const Elf_Symndx = system.Elf_Symndx;74pub const Elf_Symndx = system.Elf_Symndx;
...@@ -78,6 +79,7 @@ pub const HOST_NAME_MAX = system.HOST_NAME_MAX;...@@ -78,6 +79,7 @@ pub const HOST_NAME_MAX = system.HOST_NAME_MAX;
78pub const IFNAMESIZE = system.IFNAMESIZE;79pub const IFNAMESIZE = system.IFNAMESIZE;
79pub const IOV_MAX = system.IOV_MAX;80pub const IOV_MAX = system.IOV_MAX;
80pub const IPPROTO = system.IPPROTO;81pub const IPPROTO = system.IPPROTO;
82pub const KERN = system.KERN;
81pub const Kevent = system.Kevent;83pub const Kevent = system.Kevent;
82pub const LOCK = system.LOCK;84pub const LOCK = system.LOCK;
83pub const MADV = system.MADV;85pub const MADV = system.MADV;
...@@ -121,6 +123,7 @@ pub const blksize_t = system.blksize_t;...@@ -121,6 +123,7 @@ pub const blksize_t = system.blksize_t;
121pub const clock_t = system.clock_t;123pub const clock_t = system.clock_t;
122pub const cpu_set_t = system.cpu_set_t;124pub const cpu_set_t = system.cpu_set_t;
123pub const dev_t = system.dev_t;125pub const dev_t = system.dev_t;
126pub const dirent = system.dirent;
124pub const dl_phdr_info = system.dl_phdr_info;127pub const dl_phdr_info = system.dl_phdr_info;
125pub const empty_sigset = system.empty_sigset;128pub const empty_sigset = system.empty_sigset;
126pub const fd_t = system.fd_t;129pub const fd_t = system.fd_t;
lib/std/zig/system.zig+2-2
...@@ -309,8 +309,8 @@ pub const NativeTargetInfo = struct {...@@ -309,8 +309,8 @@ pub const NativeTargetInfo = struct {
309 },309 },
310 .openbsd => {310 .openbsd => {
311 const mib: [2]c_int = [_]c_int{311 const mib: [2]c_int = [_]c_int{
312 std.os.CTL_KERN,312 std.os.CTL.KERN,
313 std.os.KERN_OSRELEASE,313 std.os.KERN.OSRELEASE,
314 };314 };
315 var buf: [64]u8 = undefined;315 var buf: [64]u8 = undefined;
316 var len: usize = buf.len;316 var len: usize = buf.len;
lib/std/zig/system/darwin/macos.zig+2-2
...@@ -404,8 +404,8 @@ fn testVersionEquality(expected: std.builtin.Version, got: std.builtin.Version)...@@ -404,8 +404,8 @@ fn testVersionEquality(expected: std.builtin.Version, got: std.builtin.Version)
404}404}
405405
406pub fn detectNativeCpuAndFeatures() ?Target.Cpu {406pub fn detectNativeCpuAndFeatures() ?Target.Cpu {
407 var cpu_family: os.CPUFAMILY = undefined;407 var cpu_family: std.c.CPUFAMILY = undefined;
408 var len: usize = @sizeOf(os.CPUFAMILY);408 var len: usize = @sizeOf(std.c.CPUFAMILY);
409 os.sysctlbynameZ("hw.cpufamily", &cpu_family, &len, null, 0) catch |err| switch (err) {409 os.sysctlbynameZ("hw.cpufamily", &cpu_family, &len, null, 0) catch |err| switch (err) {
410 error.NameTooLong => unreachable, // constant, known good value410 error.NameTooLong => unreachable, // constant, known good value
411 error.PermissionDenied => unreachable, // only when setting values,411 error.PermissionDenied => unreachable, // only when setting values,
src/main.zig+1-1
...@@ -3828,7 +3828,7 @@ fn parseCodeModel(arg: []const u8) std.builtin.CodeModel {...@@ -3828,7 +3828,7 @@ fn parseCodeModel(arg: []const u8) std.builtin.CodeModel {
3828/// garbage collector to run concurrently to zig processes, and to allow multiple3828/// garbage collector to run concurrently to zig processes, and to allow multiple
3829/// zig processes to run concurrently with each other, without clobbering each other.3829/// zig processes to run concurrently with each other, without clobbering each other.
3830fn gimmeMoreOfThoseSweetSweetFileDescriptors() void {3830fn gimmeMoreOfThoseSweetSweetFileDescriptors() void {
3831 if (!@hasDecl(std.os, "rlimit")) return;3831 if (!@hasDecl(std.os.system, "rlimit")) return;
3832 const posix = std.os;3832 const posix = std.os;
38333833
3834 var lim = posix.getrlimit(.NOFILE) catch return; // Oh well; we tried.3834 var lim = posix.getrlimit(.NOFILE) catch return; // Oh well; we tried.