Function dup [src]

Prototype

pub fn dup(old_fd: fd_t) !fd_t

Parameters

old_fd: fd_t

Source

pub fn dup(old_fd: fd_t) !fd_t { const rc = system.dup(old_fd); return switch (errno(rc)) { .SUCCESS => return @intCast(rc), .MFILE => error.ProcessFdQuotaExceeded, .BADF => unreachable, // invalid file descriptor else => |err| return unexpectedErrno(err), }; }