commit 431a3d1a5038ba6d3f93e5e6951189ed51266442
parent bf9678fa3d7e30201ce1ced4a1cc0507cb72f1a8
Author: Drew DeVault <sir@cmpwn.com>
Date: Thu, 4 Nov 2021 15:02:55 +0100
rt+linux: use dup3 for dup2 implementation
dup2 is not available on ARM et al.
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha
@@ -160,7 +160,12 @@ export fn dup(fd: int) (int | errno) = {
};
export fn dup2(oldfd: int, newfd: int) (int | errno) = {
- return wrap_return(syscall2(SYS_dup2, oldfd: u64, newfd: u64))?: int;
+ return dup3(oldfd, newfd, 0);
+};
+
+export fn dup3(oldfd: int, newfd: int, flags: int) (int | errno) = {
+ return wrap_return(syscall3(SYS_dup3,
+ oldfd: u64, newfd: u64, flags: u64))?: int;
};
export fn close(fd: int) (void | errno) = {