Merge pull request #21622 from mikdusan/bsd

bsd: revive freebsd and dragonfly
This commit is contained in:
Alex Rønne Petersen 2024-10-08 18:32:02 +02:00 committed by GitHub
commit b00cbecfd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 72 additions and 1 deletions

View File

@ -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;

View File

@ -6785,6 +6785,7 @@ pub const MemFdCreateError = error{
OutOfMemory,
/// Either the name provided exceeded `NAME_MAX`, or invalid flags were passed.
NameTooLong,
SystemOutdated,
} || UnexpectedError;
pub fn memfd_createZ(name: [*:0]const u8, flags: u32) MemFdCreateError!fd_t {