mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
parent
6af0eeb58d
commit
fb366f3cd4
@ -80,11 +80,11 @@ pub extern "c" fn posix_memalign(memptr: *?*anyopaque, alignment: usize, size: u
|
||||
pub const posix_spawnattr_t = *opaque {};
|
||||
pub const posix_spawn_file_actions_t = *opaque {};
|
||||
pub extern "c" fn posix_spawnattr_init(attr: *posix_spawnattr_t) c_int;
|
||||
pub extern "c" fn posix_spawnattr_destroy(attr: *posix_spawnattr_t) void;
|
||||
pub extern "c" fn posix_spawnattr_destroy(attr: *posix_spawnattr_t) c_int;
|
||||
pub extern "c" fn posix_spawnattr_setflags(attr: *posix_spawnattr_t, flags: c_short) c_int;
|
||||
pub extern "c" fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *c_short) c_int;
|
||||
pub extern "c" fn posix_spawn_file_actions_init(actions: *posix_spawn_file_actions_t) c_int;
|
||||
pub extern "c" fn posix_spawn_file_actions_destroy(actions: *posix_spawn_file_actions_t) void;
|
||||
pub extern "c" fn posix_spawn_file_actions_destroy(actions: *posix_spawn_file_actions_t) c_int;
|
||||
pub extern "c" fn posix_spawn_file_actions_addclose(actions: *posix_spawn_file_actions_t, filedes: fd_t) c_int;
|
||||
pub extern "c" fn posix_spawn_file_actions_addopen(
|
||||
actions: *posix_spawn_file_actions_t,
|
||||
|
@ -47,8 +47,12 @@ const posix_spawn = if (builtin.target.isDarwin()) struct {
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Attr) void {
|
||||
system.posix_spawnattr_destroy(&self.attr);
|
||||
self.* = undefined;
|
||||
defer self.* = undefined;
|
||||
switch (errno(system.posix_spawnattr_destroy(&self.attr))) {
|
||||
.SUCCESS => return,
|
||||
.INVAL => unreachable, // Invalid parameters.
|
||||
else => unreachable,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get(self: Attr) Error!u16 {
|
||||
@ -83,8 +87,12 @@ const posix_spawn = if (builtin.target.isDarwin()) struct {
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Actions) void {
|
||||
system.posix_spawn_file_actions_destroy(&self.actions);
|
||||
self.* = undefined;
|
||||
defer self.* = undefined;
|
||||
switch (errno(system.posix_spawn_file_actions_destroy(&self.actions))) {
|
||||
.SUCCESS => return,
|
||||
.INVAL => unreachable, // Invalid parameters.
|
||||
else => unreachable,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn open(self: *Actions, fd: fd_t, path: []const u8, flags: u32, mode: mode_t) Error!void {
|
||||
|
Loading…
Reference in New Issue
Block a user