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 › Dispatch › childKill Private Function childKill Doc Source Private Function std.Io.Dispatch.childKill
fn childKill (userdata : ?*anyopaque , child : *process .Child ) void Params userdata : ?*anyopaque child : *process .Child File Io/Dispatch.zig: 4596
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615 fn childKill (userdata : ?*anyopaque , child : *process .Child ) void {
const ev : *Evented = @ptrCast (@alignCast (userdata ));
defer ev .childCleanup (child );
const pid = child .id .?;
while (true ) switch (c .errno (c .kill (pid , .TERM ))) {
.SUCCESS => break ,
.INTR => {},
.PERM => return ,
.INVAL => |err | errnoBug (err ) catch return ,
.SRCH => |err | errnoBug (err ) catch return ,
else => |err | unexpectedErrno (err ) catch return ,
};
var status : c_int = undefined ;
while (true ) switch (c .errno (c .wait4 (pid , &status , 0 , null ))) {
.SUCCESS => return ,
.INTR => {},
.CHILD => |err | errnoBug (err ) catch return , // Double-free.
else => |err | unexpectedErrno (err ) catch return ,
};
}