mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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
This commit is contained in:
parent
e0b6f4721f
commit
eb2b3f5dc7
3 changed files with 20 additions and 10 deletions
|
|
@ -135,16 +135,6 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int,
|
||||||
return
|
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) {
|
func Sleep(ns int64) (errno int) {
|
||||||
tv := NsecToTimeval(ns)
|
tv := NsecToTimeval(ns)
|
||||||
return Select(0, nil, nil, nil, &tv)
|
return Select(0, nil, nil, nil, &tv)
|
||||||
|
|
|
||||||
|
|
@ -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 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) }
|
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
|
// TODO
|
||||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, errno int) {
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, errno int) {
|
||||||
return -1, ENOSYS
|
return -1, ENOSYS
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,16 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int,
|
||||||
return origlen - len(buf), count, names
|
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
|
// TODO
|
||||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, errno int) {
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, errno int) {
|
||||||
return -1, ENOSYS
|
return -1, ENOSYS
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue