Commit 65ba8ee0 authored by Russ Cox's avatar Russ Cox

syscall: make linux Dup2 match other systems

You could argue for changing all the others, but
Linux is outvoted, and the only time it matters
is when newfd==-1, in which case you can call Dup.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5650073
parent 87815368
...@@ -802,7 +802,7 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri ...@@ -802,7 +802,7 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
//sys Close(fd int) (err error) //sys Close(fd int) (err error)
//sys Creat(path string, mode uint32) (fd int, err error) //sys Creat(path string, mode uint32) (fd int, err error)
//sysnb Dup(oldfd int) (fd int, err error) //sysnb Dup(oldfd int) (fd int, err error)
//sysnb Dup2(oldfd int, newfd int) (fd int, err error) //sysnb Dup2(oldfd int, newfd int) (err error)
//sysnb EpollCreate(size int) (fd int, err error) //sysnb EpollCreate(size int) (fd int, err error)
//sysnb EpollCreate1(flag int) (fd int, err error) //sysnb EpollCreate1(flag int) (fd int, err error)
//sysnb EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) //sysnb EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error)
......
...@@ -210,9 +210,8 @@ func Dup(oldfd int) (fd int, err error) { ...@@ -210,9 +210,8 @@ func Dup(oldfd int) (fd int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(oldfd int, newfd int) (fd int, err error) { func Dup2(oldfd int, newfd int) (err error) {
r0, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
fd = int(r0)
if e1 != 0 { if e1 != 0 {
err = e1 err = e1
} }
......
...@@ -210,9 +210,8 @@ func Dup(oldfd int) (fd int, err error) { ...@@ -210,9 +210,8 @@ func Dup(oldfd int) (fd int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(oldfd int, newfd int) (fd int, err error) { func Dup2(oldfd int, newfd int) (err error) {
r0, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
fd = int(r0)
if e1 != 0 { if e1 != 0 {
err = e1 err = e1
} }
......
...@@ -210,9 +210,8 @@ func Dup(oldfd int) (fd int, err error) { ...@@ -210,9 +210,8 @@ func Dup(oldfd int) (fd int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(oldfd int, newfd int) (fd int, err error) { func Dup2(oldfd int, newfd int) (err error) {
r0, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
fd = int(r0)
if e1 != 0 { if e1 != 0 {
err = e1 err = e1
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment