]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: split implementation of Dup2 per linux GOOS
authorDave Cheney <dave@cheney.net>
Wed, 25 Feb 2015 00:23:04 +0000 (11:23 +1100)
committerDave Cheney <dave@cheney.net>
Wed, 25 Feb 2015 00:52:03 +0000 (00:52 +0000)
Updates #9974

This proposal moves the definition of Dup2 from the generic syscall_linux.go
to the GOOS specific variants. This is in preparation for the arm64 port.

For all existing platforms Dup2 is not affected. When arm64 is added we'll use
either a forwarding method to Dup3 or

//sysnb        Dup2(oldfd int, newfd int) (err error) = SYS_DUP3

Because mksycall.pl does not sort symbols before generating the output file
the diff includes some unavoidable code moves as Dup2 is processed latter in
the run.

Discussion: https://groups.google.com/forum/#!topic/golang-dev/zpeFtN2z5Fc

Change-Id: Icdedf55bb29e749c4230e1ee371bf9d0bd0cfb38
Reviewed-on: https://go-review.googlesource.com/5835
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>

src/syscall/syscall_linux.go
src/syscall/syscall_linux_386.go
src/syscall/syscall_linux_amd64.go
src/syscall/syscall_linux_arm.go
src/syscall/syscall_linux_ppc64x.go
src/syscall/zsyscall_linux_386.go
src/syscall/zsyscall_linux_amd64.go
src/syscall/zsyscall_linux_arm.go
src/syscall/zsyscall_linux_ppc64.go
src/syscall/zsyscall_linux_ppc64le.go

index 409ebbfddee2decba3f551518e5090246d864760..8841cc5f7d6db8886694f1b39437c2eaebc61534 100644 (file)
@@ -766,7 +766,6 @@ 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) (err error)
 //sysnb        Dup3(oldfd int, newfd int, flags int) (err error)
 //sysnb        EpollCreate(size int) (fd int, err error)
 //sysnb        EpollCreate1(flag int) (fd int, err error)
index 52527d88485f682f21ec5e386cb1c029bf876579..8f94ff402a15df10a268bc0d52a627347341e45c 100644 (file)
@@ -57,6 +57,7 @@ func Pipe2(p []int, flags int) (err error) {
 // 64-bit file system and 32-bit uid calls
 // (386 default is 32-bit file system and 16-bit uid).
 //sys  Chown(path string, uid int, gid int) (err error) = SYS_CHOWN32
+//sysnb        Dup2(oldfd int, newfd int) (err error)
 //sys  Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
 //sys  Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
 //sys  Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
index 1ab356bf07b1345f4142c43f862f01be8fbe356a..ecc41ed21ee93985420c6aaf1e068c43b149e9ad 100644 (file)
@@ -5,6 +5,7 @@
 package syscall
 
 //sys  Chown(path string, uid int, gid int) (err error)
+//sysnb        Dup2(oldfd int, newfd int) (err error)
 //sys  Fchown(fd int, uid int, gid int) (err error)
 //sys  Fstat(fd int, stat *Stat_t) (err error)
 //sys  Fstatfs(fd int, buf *Statfs_t) (err error)
index c0ae748575df86000d986781c0be0dc2eef7b679..bd8cbd8bb2e72c2e4337fb54c3ee09e6a4f0a7de 100644 (file)
@@ -79,6 +79,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
 // 64-bit file system and 32-bit uid calls
 // (16-bit uid calls are not always supported in newer kernels)
 //sys  Chown(path string, uid int, gid int) (err error) = SYS_CHOWN32
+//sysnb        Dup2(oldfd int, newfd int) (err error)
 //sys  Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
 //sys  Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
 //sysnb        Getegid() (egid int) = SYS_GETEGID32
index ca101067becb368daac5ed24384a572db4648c79..6d9431798765729a517464e141d848f28ec7d182 100644 (file)
@@ -8,6 +8,7 @@
 package syscall
 
 //sys  Chown(path string, uid int, gid int) (err error)
+//sysnb        Dup2(oldfd int, newfd int) (err error)
 //sys  Fchown(fd int, uid int, gid int) (err error)
 //sys  Fstat(fd int, stat *Stat_t) (err error)
 //sys  Fstatfs(fd int, buf *Statfs_t) (err error)
index 5d6728df29498d69c939e79ee123209c48386833..5c1f49042a6b50d6ae5dca0b12dfec6a42e7ef2b 100644 (file)
@@ -294,16 +294,6 @@ 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) (err error) {
-       _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
-       if e1 != 0 {
-               err = e1
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Dup3(oldfd int, newfd int, flags int) (err error) {
        _, _, e1 := RawSyscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags))
        if e1 != 0 {
@@ -1412,6 +1402,16 @@ func Chown(path string, uid int, gid int) (err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
+func Dup2(oldfd int, newfd int) (err error) {
+       _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
+       if e1 != 0 {
+               err = e1
+       }
+       return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Fchown(fd int, uid int, gid int) (err error) {
        _, _, e1 := Syscall(SYS_FCHOWN32, uintptr(fd), uintptr(uid), uintptr(gid))
        if e1 != 0 {
index 573a2fd9089a9fe666d69c1c0d3fd9b280300552..6b00fed1858f909391d25028a9fc03386738faa4 100644 (file)
@@ -294,16 +294,6 @@ 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) (err error) {
-       _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
-       if e1 != 0 {
-               err = e1
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Dup3(oldfd int, newfd int, flags int) (err error) {
        _, _, e1 := RawSyscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags))
        if e1 != 0 {
@@ -1392,6 +1382,16 @@ func Chown(path string, uid int, gid int) (err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
+func Dup2(oldfd int, newfd int) (err error) {
+       _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
+       if e1 != 0 {
+               err = e1
+       }
+       return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Fchown(fd int, uid int, gid int) (err error) {
        _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
        if e1 != 0 {
index 22ecde0ea2a2a3b0be85aea8d0a884627049ac9a..599e5f4f51e3718a8e144742b79a2dffa1683d54 100644 (file)
@@ -294,16 +294,6 @@ 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) (err error) {
-       _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
-       if e1 != 0 {
-               err = e1
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Dup3(oldfd int, newfd int, flags int) (err error) {
        _, _, e1 := RawSyscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags))
        if e1 != 0 {
@@ -1581,6 +1571,16 @@ func Chown(path string, uid int, gid int) (err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
+func Dup2(oldfd int, newfd int) (err error) {
+       _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
+       if e1 != 0 {
+               err = e1
+       }
+       return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Fchown(fd int, uid int, gid int) (err error) {
        _, _, e1 := Syscall(SYS_FCHOWN32, uintptr(fd), uintptr(uid), uintptr(gid))
        if e1 != 0 {
index d0835c6fcaefb8639e19870cfe196692dad92e3c..3f94cdceaf7c10aaf92840fa53a104d9c61c7e3d 100644 (file)
@@ -294,16 +294,6 @@ 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) (err error) {
-       _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
-       if e1 != 0 {
-               err = e1
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Dup3(oldfd int, newfd int, flags int) (err error) {
        _, _, e1 := RawSyscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags))
        if e1 != 0 {
@@ -1392,6 +1382,16 @@ func Chown(path string, uid int, gid int) (err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
+func Dup2(oldfd int, newfd int) (err error) {
+       _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
+       if e1 != 0 {
+               err = e1
+       }
+       return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Fchown(fd int, uid int, gid int) (err error) {
        _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
        if e1 != 0 {
index d0835c6fcaefb8639e19870cfe196692dad92e3c..3f94cdceaf7c10aaf92840fa53a104d9c61c7e3d 100644 (file)
@@ -294,16 +294,6 @@ 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) (err error) {
-       _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
-       if e1 != 0 {
-               err = e1
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Dup3(oldfd int, newfd int, flags int) (err error) {
        _, _, e1 := RawSyscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags))
        if e1 != 0 {
@@ -1392,6 +1382,16 @@ func Chown(path string, uid int, gid int) (err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
+func Dup2(oldfd int, newfd int) (err error) {
+       _, _, e1 := RawSyscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
+       if e1 != 0 {
+               err = e1
+       }
+       return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Fchown(fd int, uid int, gid int) (err error) {
        _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
        if e1 != 0 {