ref: ea6a106b2f1ed6748ea55f6f9730b4138ff0dbf8
parent: 0060152b535f0376265f0fe46bba45964fe1a8b0
author: Ori Bernstein <ori@eigenstate.org>
date: Sun May 8 14:30:39 EDT 2016
Use a correct implementation of pipe()
--- a/lib/sys/sys+openbsd-x64.myr
+++ b/lib/sys/sys+openbsd-x64.myr
@@ -669,7 +669,7 @@
const getdents = {fd, buf; -> syscall(Sysgetdents, a(buf), a(buf.len)) castto(int64)}
/* file stuff */
-const pipe = {fds; -> __freebsd_pipe(fds)}
+const pipe = {fds; -> syscall(Syspipe, fds)}
const dup = {fd; -> syscall(Sysdup, a(fd)) castto(fd)}
const dup2 = {src, dst; -> syscall(Sysdup2, a(src), a(dst)) castto(fd)}
const fcntl = {fd, cmd, args; -> syscall(Sysfcntl, a(fd), a(cmd), a(args))}
--- a/lib/sys/syscall+freebsd-x64.s
+++ b/lib/sys/syscall+freebsd-x64.s
@@ -22,22 +22,3 @@
.success:
ret
-
-/*
- * pipe() syscall returns the pipes created in eax:edx, and
- * needs to copy them to the destination locations manually.
- */
-.globl sys$__freebsd_pipe
-sys$__freebsd_pipe:
- movq $0x2a,%rax
- syscall
-
- jae .pipesuccess
- negq %rax
-
-.pipesuccess:
- movl %eax,(%rdi)
- movl %edx,4(%rdi)
- xorq %rax,%rax
- ret
-