aboutsummaryrefslogtreecommitdiff
path: root/src/syscall/syscall_linux_amd64.go
diff options
context:
space:
mode:
authorDave Cheney <dave@cheney.net>2015-02-25 10:20:13 +1100
committerDave Cheney <dave@cheney.net>2015-02-25 00:19:40 +0000
commit9b3ccc082f6bda01727fc98096f7d197bba830db (patch)
treed5befc595e1b97997e067a472df71d8a19414b70 /src/syscall/syscall_linux_amd64.go
parent7ce02613870a67f26055836ded66591be148b82b (diff)
downloadgo-9b3ccc082f6bda01727fc98096f7d197bba830db.tar.xz
syscall: split implementation of Pipe/Pipe2 per GOOS
Updates #9974 This proposal moves the definition of Pipe an Pipe2 from the generic syscall_linux.go to the GOOS specific variants. This is in preparation for the arm64 port. For platforms where pipe2(2) is not supported in the minimum 2.6.23 kernel, amd64 and 386, we retain pipe(2). For all other platforms pipe(2) is removed and Pipe forwards to pipe2(2). Because mksycall.pl does not sort symbols before generating the output file the diff includes some unavoidable code moves as Pipe and Pipe2 are processed latter in the run. Discussion: https://groups.google.com/forum/#!topic/golang-dev/zpeFtN2z5Fc Change-Id: Ie26d6761eeb9760dbaff974ee8bc0d57a9ceaee4 Reviewed-on: https://go-review.googlesource.com/5833 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/syscall/syscall_linux_amd64.go')
-rw-r--r--src/syscall/syscall_linux_amd64.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/syscall/syscall_linux_amd64.go b/src/syscall/syscall_linux_amd64.go
index 74a89fb671..1ab356bf07 100644
--- a/src/syscall/syscall_linux_amd64.go
+++ b/src/syscall/syscall_linux_amd64.go
@@ -97,6 +97,32 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
return
}
+//sysnb pipe(p *[2]_C_int) (err error)
+
+func Pipe(p []int) (err error) {
+ if len(p) != 2 {
+ return EINVAL
+ }
+ var pp [2]_C_int
+ err = pipe(&pp)
+ p[0] = int(pp[0])
+ p[1] = int(pp[1])
+ return
+}
+
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+
+func Pipe2(p []int, flags int) (err error) {
+ if len(p) != 2 {
+ return EINVAL
+ }
+ var pp [2]_C_int
+ err = pipe2(&pp, flags)
+ p[0] = int(pp[0])
+ p[1] = int(pp[1])
+ return
+}
+
func (r *PtraceRegs) PC() uint64 { return r.Rip }
func (r *PtraceRegs) SetPC(pc uint64) { r.Rip = pc }