]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: make linux Dup2 match other systems
authorRuss Cox <rsc@golang.org>
Mon, 13 Feb 2012 05:11:36 +0000 (00:11 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 13 Feb 2012 05:11:36 +0000 (00:11 -0500)
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

src/pkg/syscall/syscall_linux.go
src/pkg/syscall/zsyscall_linux_386.go
src/pkg/syscall/zsyscall_linux_amd64.go
src/pkg/syscall/zsyscall_linux_arm.go

index d0e16271d5d14e7db7d20306fbf1f72e0d6f1be2..10fbc17a02f7a8d975b3d3598a53ddc909b03727 100644 (file)
@@ -802,7 +802,7 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
 //sys  Close(fd int) (err error)
 //sys  Creat(path string, mode uint32) (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        EpollCreate1(flag int) (fd int, err error)
 //sysnb        EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error)
index 8c3a844754d1a9e30986b411d1a18e4298fbcf59..4910b3c5fb4096ad758c8c69c6a909592828ab1c 100644 (file)
@@ -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
 
-func Dup2(oldfd int, newfd int) (fd int, err error) {
-       r0, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
-       fd = int(r0)
+func Dup2(oldfd int, newfd int) (err error) {
+       _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
        if e1 != 0 {
                err = e1
        }
index c53fff7a27c0ad87114c45cc400a499f7d75057d..2260c4ef2d7cc6b636d2f6a5b1f3aa8bf0adb62a 100644 (file)
@@ -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
 
-func Dup2(oldfd int, newfd int) (fd int, err error) {
-       r0, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
-       fd = int(r0)
+func Dup2(oldfd int, newfd int) (err error) {
+       _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
        if e1 != 0 {
                err = e1
        }
index d739139dceec39ad15ac43e55aff748c2995fc3e..56878721d38d0c819b7b016993c94c44c05ac811 100644 (file)
@@ -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
 
-func Dup2(oldfd int, newfd int) (fd int, err error) {
-       r0, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
-       fd = int(r0)
+func Dup2(oldfd int, newfd int) (err error) {
+       _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
        if e1 != 0 {
                err = e1
        }