From be91b68e66b537e76c0301c413da553c62175edc Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Mon, 7 Oct 2024 13:19:33 -0400 Subject: [PATCH] dragonfly std: more std.c support --- lib/std/c.zig | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/lib/std/c.zig b/lib/std/c.zig index ab4f7e84e7..d28f5b0ac4 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -134,7 +134,7 @@ pub const mode_t = switch (native_os) { .linux => linux.mode_t, .emscripten => emscripten.mode_t, .openbsd, .haiku, .netbsd, .solaris, .illumos, .wasi => u32, - .freebsd, .macos, .ios, .tvos, .watchos, .visionos => u16, + .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .dragonfly => u16, else => u0, }; @@ -3150,6 +3150,72 @@ pub const T = switch (native_os) { pub const IOCUCNTL = 0x80047466; pub const IOCXMTFRAME = 0x80087444; }, + .dragonfly => struct { + pub const IOCMODG = 0x40047403; + pub const IOCMODS = 0x80047404; + pub const IOCM_LE = 0x00000001; + pub const IOCM_DTR = 0x00000002; + pub const IOCM_RTS = 0x00000004; + pub const IOCM_ST = 0x00000008; + pub const IOCM_SR = 0x00000010; + pub const IOCM_CTS = 0x00000020; + pub const IOCM_CAR = 0x00000040; + pub const IOCM_CD = 0x00000040; + pub const IOCM_RNG = 0x00000080; + pub const IOCM_RI = 0x00000080; + pub const IOCM_DSR = 0x00000100; + pub const IOCEXCL = 0x2000740d; + pub const IOCNXCL = 0x2000740e; + pub const IOCFLUSH = 0x80047410; + pub const IOCGETA = 0x402c7413; + pub const IOCSETA = 0x802c7414; + pub const IOCSETAW = 0x802c7415; + pub const IOCSETAF = 0x802c7416; + pub const IOCGETD = 0x4004741a; + pub const IOCSETD = 0x8004741b; + pub const IOCSBRK = 0x2000747b; + pub const IOCCBRK = 0x2000747a; + pub const IOCSDTR = 0x20007479; + pub const IOCCDTR = 0x20007478; + pub const IOCGPGRP = 0x40047477; + pub const IOCSPGRP = 0x80047476; + pub const IOCOUTQ = 0x40047473; + pub const IOCSTI = 0x80017472; + pub const IOCNOTTY = 0x20007471; + pub const IOCPKT = 0x80047470; + pub const IOCPKT_DATA = 0x00000000; + pub const IOCPKT_FLUSHREAD = 0x00000001; + pub const IOCPKT_FLUSHWRITE = 0x00000002; + pub const IOCPKT_STOP = 0x00000004; + pub const IOCPKT_START = 0x00000008; + pub const IOCPKT_NOSTOP = 0x00000010; + pub const IOCPKT_DOSTOP = 0x00000020; + pub const IOCPKT_IOCTL = 0x00000040; + pub const IOCSTOP = 0x2000746f; + pub const IOCSTART = 0x2000746e; + pub const IOCMSET = 0x8004746d; + pub const IOCMBIS = 0x8004746c; + pub const IOCMBIC = 0x8004746b; + pub const IOCMGET = 0x4004746a; + pub const IOCREMOTE = 0x80047469; + pub const IOCGWINSZ = 0x40087468; + pub const IOCSWINSZ = 0x80087467; + pub const IOCUCNTL = 0x80047466; + pub const IOCSTAT = 0x20007465; + pub const IOCGSID = 0x40047463; + pub const IOCCONS = 0x80047462; + pub const IOCSCTTY = 0x20007461; + pub const IOCEXT = 0x80047460; + pub const IOCSIG = 0x2000745f; + pub const IOCDRAIN = 0x2000745e; + pub const IOCMSDTRWAIT = 0x8004745b; + pub const IOCMGDTRWAIT = 0x4004745a; + pub const IOCTIMESTAMP = 0x40107459; + pub const IOCDCDTIMESTAMP = 0x40107458; + pub const IOCSDRAINWAIT = 0x80047457; + pub const IOCGDRAINWAIT = 0x40047456; + pub const IOCISPTMASTER = 0x20007455; + }, else => void, }; pub const IOCPARM_MASK = switch (native_os) { @@ -9809,6 +9875,10 @@ pub const _ksiginfo = netbsd._ksiginfo; pub const _lwp_self = netbsd._lwp_self; pub const lwpid_t = netbsd.lwpid_t; +pub const lwp_gettid = dragonfly.lwp_gettid; +pub const umtx_sleep = dragonfly.umtx_sleep; +pub const umtx_wakeup = dragonfly.umtx_wakeup; + /// External definitions shared by two or more operating systems. const private = struct { extern "c" fn close(fd: fd_t) c_int;