pub fn fchdir(fd: posix.fd_t) FchdirError!void fd: posix.fd_t18310
18311
18312
18313
18314
18315
18316
18317
18318
18319
18320
18321
18322
18323
18324
18325pub fn fchdir(fd: posix.fd_t) FchdirError!void {
if (fd == posix.AT.FDCWD) return;
const syscall: Syscall = try .start();
while (true) switch (posix.errno(posix.system.fchdir(fd))) {
.SUCCESS => return syscall.finish(),
.INTR => {
try syscall.checkCancel();
continue;
},
.ACCES => return syscall.fail(error.AccessDenied),
.NOTDIR => return syscall.fail(error.NotDir),
.IO => return syscall.fail(error.FileSystem),
.BADF => |err| return syscall.errnoBug(err),
else => |err| return syscall.unexpectedErrno(err),
};
}