1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:17:45 +00:00

LibCore: Add syscall wrapper for dup()

This commit is contained in:
Andreas Kling 2021-11-28 12:08:28 +01:00
parent cb9cac4e40
commit 83056efc1a
2 changed files with 9 additions and 0 deletions

View file

@ -196,6 +196,14 @@ ErrorOr<void> kill(pid_t pid, int signal)
return {};
}
ErrorOr<int> dup(int source_fd)
{
int fd = ::dup(source_fd);
if (fd < 0)
return Error::from_syscall("dup"sv, -errno);
return fd;
}
ErrorOr<int> dup2(int source_fd, int destination_fd)
{
int fd = ::dup2(source_fd, destination_fd);