diff options
author | Joel Sing <jsing@google.com> | 2011-07-29 13:47:20 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-07-29 13:47:20 -0400 |
commit | eb2b3f5dc74181b66848bef194bfd0ec1401345c (patch) | |
tree | 76ab3957c60559285c624bb332bef13da7823428 | |
parent | e0b6f4721fac04fbaaa669e3a52818ef6c2d5df1 (diff) | |
download | go-eb2b3f5dc74181b66848bef194bfd0ec1401345c.tar.gz go-eb2b3f5dc74181b66848bef194bfd0ec1401345c.zip |
syscall: move bsd pipe syscall
Not all BSDs have the same pipe() syscall implementation - move the Darwin/FreeBSD specific implementation into their respective OS syscall files. This will be needed to add OpenBSD syscall support.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4823057
-rw-r--r-- | src/pkg/syscall/syscall_bsd.go | 10 | ||||
-rw-r--r-- | src/pkg/syscall/syscall_darwin.go | 10 | ||||
-rw-r--r-- | src/pkg/syscall/syscall_freebsd.go | 10 |
3 files changed, 20 insertions, 10 deletions
diff --git a/src/pkg/syscall/syscall_bsd.go b/src/pkg/syscall/syscall_bsd.go index 2df75917b4..7fd85a3203 100644 --- a/src/pkg/syscall/syscall_bsd.go +++ b/src/pkg/syscall/syscall_bsd.go @@ -135,16 +135,6 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, return } -//sysnb pipe() (r int, w int, errno int) - -func Pipe(p []int) (errno int) { - if len(p) != 2 { - return EINVAL - } - p[0], p[1], errno = pipe() - return -} - func Sleep(ns int64) (errno int) { tv := NsecToTimeval(ns) return Select(0, nil, nil, nil, &tv) diff --git a/src/pkg/syscall/syscall_darwin.go b/src/pkg/syscall/syscall_darwin.go index d43d486d5a..11dc8aae22 100644 --- a/src/pkg/syscall/syscall_darwin.go +++ b/src/pkg/syscall/syscall_darwin.go @@ -60,6 +60,16 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, func PtraceAttach(pid int) (errno int) { return ptrace(PT_ATTACH, pid, 0, 0) } func PtraceDetach(pid int) (errno int) { return ptrace(PT_DETACH, pid, 0, 0) } +//sysnb pipe() (r int, w int, errno int) + +func Pipe(p []int) (errno int) { + if len(p) != 2 { + return EINVAL + } + p[0], p[1], errno = pipe() + return +} + // TODO func Sendfile(outfd int, infd int, offset *int64, count int) (written int, errno int) { return -1, ENOSYS diff --git a/src/pkg/syscall/syscall_freebsd.go b/src/pkg/syscall/syscall_freebsd.go index ac2f505d10..c2bddd99d5 100644 --- a/src/pkg/syscall/syscall_freebsd.go +++ b/src/pkg/syscall/syscall_freebsd.go @@ -56,6 +56,16 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, return origlen - len(buf), count, names } +//sysnb pipe() (r int, w int, errno int) + +func Pipe(p []int) (errno int) { + if len(p) != 2 { + return EINVAL + } + p[0], p[1], errno = pipe() + return +} + // TODO func Sendfile(outfd int, infd int, offset *int64, count int) (written int, errno int) { return -1, ENOSYS |