Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › Io › Threaded › childKillPosix Private Function childKillPosix Doc Source Private Function std.Io.Threaded.childKillPosix
fn childKillPosix (child : *process .Child ) !void Params File Io/Threaded.zig: 15612
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654 fn childKillPosix (child : *process .Child ) !void {
// Entire function body is intentionally uncancelable.
const pid = child .id .?;
while (true ) switch (posix .errno (posix .system .kill (pid , .TERM ))) {
.SUCCESS => break ,
.INTR => continue ,
.PERM => return error .PermissionDenied ,
.INVAL => |err | return errnoBug (err ),
.SRCH => |err | return errnoBug (err ),
else => |err | return posix .unexpectedErrno (err ),
};
if (have_wait4 ) {
var status : if (builtin .link_libc ) c_int else i32 = undefined ;
while (true ) switch (posix .errno (posix .system .wait4 (pid , &status , 0 , null ))) {
.SUCCESS => return ,
.INTR => continue ,
.CHILD => |err | return errnoBug (err ), // Double-free.
else => |err | return posix .unexpectedErrno (err ),
};
}
if (have_waitid ) {
const linux = std .os .linux ; // Bypass libc which has the wrong signature.
var info : linux .siginfo_t = undefined ;
while (true ) switch (linux .errno (linux .waitid (.PID , pid , &info , linux .W .EXITED , null ))) {
.SUCCESS => return ,
.INTR => continue ,
.CHILD => |err | return errnoBug (err ), // Double-free.
else => |err | return posix .unexpectedErrno (err ),
};
}
var status : if (builtin .link_libc ) c_int else i32 = undefined ;
while (true ) switch (posix .errno (posix .system .waitpid (pid , &status , 0 ))) {
.SUCCESS => return ,
.INTR => continue ,
.CHILD => |err | return errnoBug (err ), // Double-free.
else => |err | return posix .unexpectedErrno (err ),
};
}