Function fchdir [src]

Prototype

pub fn fchdir(dirfd: fd_t) FchdirError!void

Parameters

dirfd: fd_t

Possible Errors

AccessDenied
FileSystem
NotDir
Unexpected UnexpectedError

The Operating System returned an undocumented error code.

This error is in theory not possible, but it would be better to handle this error than to invoke undefined behavior.

When this error code is observed, it usually means the Zig Standard Library needs a small patch to add the error code to the error set for the respective function.

Source

pub fn fchdir(dirfd: fd_t) FchdirError!void { if (dirfd == AT.FDCWD) return; while (true) { switch (errno(system.fchdir(dirfd))) { .SUCCESS => return, .ACCES => return error.AccessDenied, .BADF => unreachable, .NOTDIR => return error.NotDir, .INTR => continue, .IO => return error.FileSystem, else => |err| return unexpectedErrno(err), } } }