authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-09-06 09:46:23+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-09-06 09:50:49+02:00
log0e3010e54d44f208eaa0bd3ca011b674738fc1e2
treebbd19b5d079a51e348d580ca9790efffb8ff0134
parent7ca0bf0f36a8af70635a902546d6e9032b6e6551
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.c: add HW constants for freebsd


2 files changed, 45 insertions(+), 30 deletions(-)

lib/std/c.zig+45-1
...@@ -1395,6 +1395,51 @@ pub const CPU = switch (native_os) {...@@ -1395,6 +1395,51 @@ pub const CPU = switch (native_os) {
1395 },1395 },
1396 else => void,1396 else => void,
1397};1397};
1398pub const HW = switch (native_os) {
1399 .freebsd => struct {
1400 pub const MACHINE = 1;
1401 pub const MODEL = 2;
1402 pub const NCPU = 3;
1403 pub const BYTEORDER = 4;
1404 pub const PHYSMEM = 5;
1405 pub const USERMEM = 6;
1406 pub const PAGESIZE = 7;
1407 pub const DISKNAMES = 8;
1408 pub const DISKSTATS = 9;
1409 pub const FLOATINGPT = 10;
1410 pub const MACHINE_ARCH = 11;
1411 pub const REALMEM = 12;
1412 },
1413 .openbsd => struct {
1414 pub const MACHINE = 1;
1415 pub const MODEL = 2;
1416 pub const NCPU = 3;
1417 pub const BYTEORDER = 4;
1418 pub const PHYSMEM = 5;
1419 pub const USERMEM = 6;
1420 pub const PAGESIZE = 7;
1421 pub const DISKNAMES = 8;
1422 pub const DISKSTATS = 9;
1423 pub const DISKCOUNT = 10;
1424 pub const SENSORS = 11;
1425 pub const CPUSPEED = 12;
1426 pub const SETPERF = 13;
1427 pub const VENDOR = 14;
1428 pub const PRODUCT = 15;
1429 pub const VERSION = 16;
1430 pub const SERIALNO = 17;
1431 pub const UUID = 18;
1432 pub const PHYSMEM64 = 19;
1433 pub const USERMEM64 = 20;
1434 pub const NCPUFOUND = 21;
1435 pub const ALLOWPOWERDOWN = 22;
1436 pub const PERFPOLICY = 23;
1437 pub const SMT = 24;
1438 pub const NCPUONLINE = 25;
1439 pub const POWER = 26;
1440 },
1441 else => void,
1442};
1398pub const KERN = switch (native_os) {1443pub const KERN = switch (native_os) {
1399 .freebsd => struct {1444 .freebsd => struct {
1400 /// struct: process entries1445 /// struct: process entries
...@@ -11333,7 +11378,6 @@ pub const writev_pos = haiku.writev_pos;...@@ -11333,7 +11378,6 @@ pub const writev_pos = haiku.writev_pos;
1133311378
11334pub const AUTH = openbsd.AUTH;11379pub const AUTH = openbsd.AUTH;
11335pub const BI = openbsd.BI;11380pub const BI = openbsd.BI;
11336pub const HW = openbsd.HW;
11337pub const PTHREAD_STACK_MIN = openbsd.PTHREAD_STACK_MIN;11381pub const PTHREAD_STACK_MIN = openbsd.PTHREAD_STACK_MIN;
11338pub const TCFLUSH = openbsd.TCFLUSH;11382pub const TCFLUSH = openbsd.TCFLUSH;
11339pub const TCIO = openbsd.TCIO;11383pub const TCIO = openbsd.TCIO;
lib/std/c/openbsd.zig-29
...@@ -273,35 +273,6 @@ pub const MAX_PAGE_SHIFT = switch (builtin.cpu.arch) {...@@ -273,35 +273,6 @@ pub const MAX_PAGE_SHIFT = switch (builtin.cpu.arch) {
273 .sparc64 => 13,273 .sparc64 => 13,
274};274};
275275
276pub const HW = struct {
277 pub const MACHINE = 1;
278 pub const MODEL = 2;
279 pub const NCPU = 3;
280 pub const BYTEORDER = 4;
281 pub const PHYSMEM = 5;
282 pub const USERMEM = 6;
283 pub const PAGESIZE = 7;
284 pub const DISKNAMES = 8;
285 pub const DISKSTATS = 9;
286 pub const DISKCOUNT = 10;
287 pub const SENSORS = 11;
288 pub const CPUSPEED = 12;
289 pub const SETPERF = 13;
290 pub const VENDOR = 14;
291 pub const PRODUCT = 15;
292 pub const VERSION = 16;
293 pub const SERIALNO = 17;
294 pub const UUID = 18;
295 pub const PHYSMEM64 = 19;
296 pub const USERMEM64 = 20;
297 pub const NCPUFOUND = 21;
298 pub const ALLOWPOWERDOWN = 22;
299 pub const PERFPOLICY = 23;
300 pub const SMT = 24;
301 pub const NCPUONLINE = 25;
302 pub const POWER = 26;
303};
304
305pub const PTHREAD_STACK_MIN = switch (builtin.cpu.arch) {276pub const PTHREAD_STACK_MIN = switch (builtin.cpu.arch) {
306 .sparc64 => 1 << 13,277 .sparc64 => 1 << 13,
307 .mips64 => 1 << 14,278 .mips64 => 1 << 14,