aboutsummaryrefslogtreecommitdiff
path: root/src/DarwinPosixSpawn.zig
diff options
context:
space:
mode:
authorJustus Klausecker <justus@klausecker.de>2025-08-20 15:56:49 +0200
committerJustus Klausecker <justus@klausecker.de>2025-08-20 18:21:32 +0200
commit590d264bdf340fa1e6549ce1988f9ccb7418f4d7 (patch)
treeb9ef97ae19c737d2b883b51fd82919c6a10cd0ea /src/DarwinPosixSpawn.zig
parentd748cc9c12ba852ac02edf55eb418b06086d211c (diff)
downloadzig-590d264bdf340fa1e6549ce1988f9ccb7418f4d7.tar.gz
zig-590d264bdf340fa1e6549ce1988f9ccb7418f4d7.zip
std.c.darwin: cleanup, expose everything in std.c
This mainly just moves stuff around. Justifications for other changes: * `KEVENT.FLAGS` is backed by `c_uint` because that's what the `kevent64` flags param takes (according to the 'latest' manpage from 2008) * `MACH_RCV_NOTIFY` is a legacy name and `MACH_RCV_OVERWRITE` is deprecated (xnu/osfmk/mach/message.h), so I removed them. They were 0 anyway and thus couldn't be represented as a packed struct field. * `MACH.RCV` and `MACH.SEND` are technically the same 'type' because they can both be supplied at the same time to `mach_msg`. I decided to still keep them separate because naming works out better that way and all flags except for `MACH_MSG_STRICT_REPLY` aren't shared anyway. Both are part of a packed union `mach_msg_option_t` which supplies a helper function to combine the two types. * `PT` is backed by `c_int` because that's what `ptrace` takes as a request arg (according to the latest manpage from 2015)
Diffstat (limited to 'src/DarwinPosixSpawn.zig')
-rw-r--r--src/DarwinPosixSpawn.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/DarwinPosixSpawn.zig b/src/DarwinPosixSpawn.zig
index 0743eb0c66..9819711984 100644
--- a/src/DarwinPosixSpawn.zig
+++ b/src/DarwinPosixSpawn.zig
@@ -41,17 +41,17 @@ pub const Attr = struct {
}
}
- pub fn get(self: Attr) Error!u16 {
- var flags: c_short = undefined;
+ pub fn get(self: Attr) Error!std.c.POSIX_SPAWN {
+ var flags: std.c.POSIX_SPAWN = undefined;
switch (errno(std.c.posix_spawnattr_getflags(&self.attr, &flags))) {
- .SUCCESS => return @as(u16, @bitCast(flags)),
+ .SUCCESS => return flags,
.INVAL => unreachable,
else => |err| return unexpectedErrno(err),
}
}
- pub fn set(self: *Attr, flags: u16) Error!void {
- switch (errno(std.c.posix_spawnattr_setflags(&self.attr, @as(c_short, @bitCast(flags))))) {
+ pub fn set(self: *Attr, flags: std.c.POSIX_SPAWN) Error!void {
+ switch (errno(std.c.posix_spawnattr_setflags(&self.attr, flags))) {
.SUCCESS => return,
.INVAL => unreachable,
else => |err| return unexpectedErrno(err),