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:
parent
cb9cac4e40
commit
83056efc1a
2 changed files with 9 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue