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. Public Constant
pubconstAT = switch (native_os) {
.linux => linux.AT,
.windows => struct {
/// Remove directory instead of unlinking filepubconstREMOVEDIR = 0x200;
},
.driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct {
pubconstFDCWD = -2;
/// Use effective ids in access checkpubconstEACCESS = 0x0010;
/// Act on the symlink itself not the targetpubconstSYMLINK_NOFOLLOW = 0x0020;
/// Act on target of symlinkpubconstSYMLINK_FOLLOW = 0x0040;
/// Path refers to directorypubconstREMOVEDIR = 0x0080;
},
.freebsd => struct {
/// Magic value that specify the use of the current working directory/// to determine the target of relative file paths in the openat() and/// similar syscalls.pubconstFDCWD = -100;
/// Check access using effective user and group IDpubconstEACCESS = 0x0100;
/// Do not follow symbolic linkspubconstSYMLINK_NOFOLLOW = 0x0200;
/// Follow symbolic linkpubconstSYMLINK_FOLLOW = 0x0400;
/// Remove directory instead of filepubconstREMOVEDIR = 0x0800;
/// Fail if not under dirfdpubconstBENEATH = 0x1000;
},
.netbsd => struct {
/// Magic value that specify the use of the current working directory/// to determine the target of relative file paths in the openat() and/// similar syscalls.pubconstFDCWD = -100;
/// Check access using effective user and group IDpubconstEACCESS = 0x0100;
/// Do not follow symbolic linkspubconstSYMLINK_NOFOLLOW = 0x0200;
/// Follow symbolic linkpubconstSYMLINK_FOLLOW = 0x0400;
/// Remove directory instead of filepubconstREMOVEDIR = 0x0800;
},
.dragonfly => struct {
pubconstFDCWD = -328243;
pubconstSYMLINK_NOFOLLOW = 1;
pubconstREMOVEDIR = 2;
pubconstEACCESS = 4;
pubconstSYMLINK_FOLLOW = 8;
},
.openbsd => struct {
/// Magic value that specify the use of the current working directory/// to determine the target of relative file paths in the openat() and/// similar syscalls.pubconstFDCWD = -100;
/// Check access using effective user and group IDpubconstEACCESS = 0x01;
/// Do not follow symbolic linkspubconstSYMLINK_NOFOLLOW = 0x02;
/// Follow symbolic linkpubconstSYMLINK_FOLLOW = 0x04;
/// Remove directory instead of filepubconstREMOVEDIR = 0x08;
},
.haiku => struct {
pubconstFDCWD = -1;
pubconstSYMLINK_NOFOLLOW = 0x01;
pubconstSYMLINK_FOLLOW = 0x02;
pubconstREMOVEDIR = 0x04;
pubconstEACCESS = 0x08;
},
.illumos => struct {
/// Magic value that specify the use of the current working directory/// to determine the target of relative file paths in the openat() and/// similar syscalls.pubconstFDCWD: fd_t = @bitCast(@as(u32, 0xffd19553));
/// Do not follow symbolic linkspubconstSYMLINK_NOFOLLOW = 0x1000;
/// Follow symbolic linkpubconstSYMLINK_FOLLOW = 0x2000;
/// Remove directory instead of filepubconstREMOVEDIR = 0x1;
pubconstTRIGGER = 0x2;
/// Check access using effective user and group IDpubconstEACCESS = 0x4;
},
.emscripten => struct {
pubconstFDCWD = -100;
pubconstSYMLINK_NOFOLLOW = 0x100;
pubconstREMOVEDIR = 0x200;
pubconstSYMLINK_FOLLOW = 0x400;
pubconstNO_AUTOMOUNT = 0x800;
pubconstEMPTY_PATH = 0x1000;
pubconstSTATX_SYNC_TYPE = 0x6000;
pubconstSTATX_SYNC_AS_STAT = 0x0000;
pubconstSTATX_FORCE_SYNC = 0x2000;
pubconstSTATX_DONT_SYNC = 0x4000;
pubconstRECURSIVE = 0x8000;
},
.wasi => struct {
// Match `AT_*` constants in lib/libc/include/wasm-wasi-musl/__header_fcntl.hpubconstEACCESS = 0x0;
pubconstSYMLINK_NOFOLLOW = 0x1;
pubconstSYMLINK_FOLLOW = 0x2;
pubconstREMOVEDIR = 0x4;
/// When linking libc, we follow their convention and use -2 for current working directory./// However, without libc, Zig does a different convention: it assumes the/// current working directory is the first preopen. This behavior can be/// overridden with a public function called `wasi_cwd` in the root source/// file.pubconstFDCWD: fd_t = if (builtin.link_libc) -2else3;
},
// https://github.com/SerenityOS/serenity/blob/2808b0376406a40e31293bb3bcb9170374e90506/Kernel/API/POSIX/fcntl.h#L49-L52
.serenity => struct {
pubconstFDCWD = -100;
pubconstSYMLINK_NOFOLLOW = 0x100;
pubconstREMOVEDIR = 0x200;
pubconstEACCESS = 0x400;
},
else => void,
}