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 › debug › MachOFile › mapDebugInfoFile Private Function mapDebugInfoFile Doc Source Private Function std.debug.MachOFile.mapDebugInfoFile
fn mapDebugInfoFile (io : Io , path : []const u8 ) ![]align (std .heap .page_size_min ) const u8 Params File debug/MachOFile.zig: 671
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691 fn mapDebugInfoFile (io : Io , path : []const u8 ) ![]align (std .heap .page_size_min ) const u8 {
const file = Io .Dir .cwd ().openFile (io , path , .{}) catch |err | switch (err ) {
error .FileNotFound => return error .MissingDebugInfo ,
else => return error .ReadFailed ,
};
defer file .close (io );
const file_len = std .math .cast (
usize ,
file .length (io ) catch return error .ReadFailed ,
) orelse return error .ReadFailed ;
return posix .mmap (
null ,
file_len ,
.{ .READ = true },
.{ .TYPE = .SHARED },
file .handle ,
0 ,
) catch return error .ReadFailed ;
}
Uses
mmapto map the file atpathinto memory.