Skip to content

Commit b00cbec

Browse files
authored
Merge pull request #21622 from mikdusan/bsd
bsd: revive freebsd and dragonfly
2 parents ea527f7 + e535e65 commit b00cbec

File tree

2 files changed

+72
-1
lines changed

2 files changed

+72
-1
lines changed

lib/std/c.zig

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pub const mode_t = switch (native_os) {
134134
.linux => linux.mode_t,
135135
.emscripten => emscripten.mode_t,
136136
.openbsd, .haiku, .netbsd, .solaris, .illumos, .wasi => u32,
137-
.freebsd, .macos, .ios, .tvos, .watchos, .visionos => u16,
137+
.freebsd, .macos, .ios, .tvos, .watchos, .visionos, .dragonfly => u16,
138138
else => u0,
139139
};
140140

@@ -3150,6 +3150,72 @@ pub const T = switch (native_os) {
31503150
pub const IOCUCNTL = 0x80047466;
31513151
pub const IOCXMTFRAME = 0x80087444;
31523152
},
3153+
.dragonfly => struct {
3154+
pub const IOCMODG = 0x40047403;
3155+
pub const IOCMODS = 0x80047404;
3156+
pub const IOCM_LE = 0x00000001;
3157+
pub const IOCM_DTR = 0x00000002;
3158+
pub const IOCM_RTS = 0x00000004;
3159+
pub const IOCM_ST = 0x00000008;
3160+
pub const IOCM_SR = 0x00000010;
3161+
pub const IOCM_CTS = 0x00000020;
3162+
pub const IOCM_CAR = 0x00000040;
3163+
pub const IOCM_CD = 0x00000040;
3164+
pub const IOCM_RNG = 0x00000080;
3165+
pub const IOCM_RI = 0x00000080;
3166+
pub const IOCM_DSR = 0x00000100;
3167+
pub const IOCEXCL = 0x2000740d;
3168+
pub const IOCNXCL = 0x2000740e;
3169+
pub const IOCFLUSH = 0x80047410;
3170+
pub const IOCGETA = 0x402c7413;
3171+
pub const IOCSETA = 0x802c7414;
3172+
pub const IOCSETAW = 0x802c7415;
3173+
pub const IOCSETAF = 0x802c7416;
3174+
pub const IOCGETD = 0x4004741a;
3175+
pub const IOCSETD = 0x8004741b;
3176+
pub const IOCSBRK = 0x2000747b;
3177+
pub const IOCCBRK = 0x2000747a;
3178+
pub const IOCSDTR = 0x20007479;
3179+
pub const IOCCDTR = 0x20007478;
3180+
pub const IOCGPGRP = 0x40047477;
3181+
pub const IOCSPGRP = 0x80047476;
3182+
pub const IOCOUTQ = 0x40047473;
3183+
pub const IOCSTI = 0x80017472;
3184+
pub const IOCNOTTY = 0x20007471;
3185+
pub const IOCPKT = 0x80047470;
3186+
pub const IOCPKT_DATA = 0x00000000;
3187+
pub const IOCPKT_FLUSHREAD = 0x00000001;
3188+
pub const IOCPKT_FLUSHWRITE = 0x00000002;
3189+
pub const IOCPKT_STOP = 0x00000004;
3190+
pub const IOCPKT_START = 0x00000008;
3191+
pub const IOCPKT_NOSTOP = 0x00000010;
3192+
pub const IOCPKT_DOSTOP = 0x00000020;
3193+
pub const IOCPKT_IOCTL = 0x00000040;
3194+
pub const IOCSTOP = 0x2000746f;
3195+
pub const IOCSTART = 0x2000746e;
3196+
pub const IOCMSET = 0x8004746d;
3197+
pub const IOCMBIS = 0x8004746c;
3198+
pub const IOCMBIC = 0x8004746b;
3199+
pub const IOCMGET = 0x4004746a;
3200+
pub const IOCREMOTE = 0x80047469;
3201+
pub const IOCGWINSZ = 0x40087468;
3202+
pub const IOCSWINSZ = 0x80087467;
3203+
pub const IOCUCNTL = 0x80047466;
3204+
pub const IOCSTAT = 0x20007465;
3205+
pub const IOCGSID = 0x40047463;
3206+
pub const IOCCONS = 0x80047462;
3207+
pub const IOCSCTTY = 0x20007461;
3208+
pub const IOCEXT = 0x80047460;
3209+
pub const IOCSIG = 0x2000745f;
3210+
pub const IOCDRAIN = 0x2000745e;
3211+
pub const IOCMSDTRWAIT = 0x8004745b;
3212+
pub const IOCMGDTRWAIT = 0x4004745a;
3213+
pub const IOCTIMESTAMP = 0x40107459;
3214+
pub const IOCDCDTIMESTAMP = 0x40107458;
3215+
pub const IOCSDRAINWAIT = 0x80047457;
3216+
pub const IOCGDRAINWAIT = 0x40047456;
3217+
pub const IOCISPTMASTER = 0x20007455;
3218+
},
31533219
else => void,
31543220
};
31553221
pub const IOCPARM_MASK = switch (native_os) {
@@ -9809,6 +9875,10 @@ pub const _ksiginfo = netbsd._ksiginfo;
98099875
pub const _lwp_self = netbsd._lwp_self;
98109876
pub const lwpid_t = netbsd.lwpid_t;
98119877

9878+
pub const lwp_gettid = dragonfly.lwp_gettid;
9879+
pub const umtx_sleep = dragonfly.umtx_sleep;
9880+
pub const umtx_wakeup = dragonfly.umtx_wakeup;
9881+
98129882
/// External definitions shared by two or more operating systems.
98139883
const private = struct {
98149884
extern "c" fn close(fd: fd_t) c_int;

lib/std/posix.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6785,6 +6785,7 @@ pub const MemFdCreateError = error{
67856785
OutOfMemory,
67866786
/// Either the name provided exceeded `NAME_MAX`, or invalid flags were passed.
67876787
NameTooLong,
6788+
SystemOutdated,
67886789
} || UnexpectedError;
67896790

67906791
pub fn memfd_createZ(name: [*:0]const u8, flags: u32) MemFdCreateError!fd_t {

0 commit comments

Comments
 (0)