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 › posix › mremap Public Function mremap Doc Source 703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727 pub fn mremap (
old_address : ?[*]align (page_size_min ) u8 ,
old_len : usize ,
new_len : usize ,
flags : system .MREMAP ,
new_address : ?[*]align (page_size_min ) u8 ,
) MRemapError ![]align (page_size_min ) u8 {
const rc = system .mremap (old_address , old_len , new_len , flags , new_address );
const err : E = if (builtin .link_libc ) blk : {
if (rc != std .c .MAP_FAILED ) return @as ([*]align (page_size_min ) u8 , @ptrCast (@alignCast (rc )))[0 ..new_len ];
break :blk @fromBackingInt (@intCast (system ._errno ().*));
} else blk : {
const err = errno (rc );
if (err == .SUCCESS ) return @as ([*]align (page_size_min ) u8 , @ptrFromInt (rc ))[0 ..new_len ];
break :blk err ;
};
switch (err ) {
.SUCCESS => unreachable ,
.AGAIN => return error .LockedMemoryLimitExceeded ,
.INVAL => return error .InvalidSyscallParameters ,
.NOMEM => return error .OutOfMemory ,
.FAULT => unreachable ,
else => return unexpectedErrno (err ),
}
}