1
0
mirror of https://github.com/golang/go synced 2024-11-18 07:14:44 -07:00

syscall: avoid dup2 in forkAndExecInChild1 on Android

Android O and newer blocks the dup2 syscall.

Change-Id: Ibca01fc72ef114deeef6c0450a8b81a556ed0530
Reviewed-on: https://go-review.googlesource.com/c/go/+/235537
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Elias Naur 2020-05-28 13:58:45 +02:00
parent 6bf2eea62a
commit 2711127974
11 changed files with 28 additions and 36 deletions

View File

@ -0,0 +1,10 @@
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !android
// +build 386 amd64 arm mips mipsle mips64 mips64le ppc64 ppc64le s390x
package syscall
const _SYS_dup = SYS_DUP2

View File

@ -0,0 +1,9 @@
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build android arm64 riscv64
package syscall
const _SYS_dup = SYS_DUP3

View File

@ -9,10 +9,7 @@ package syscall
import "unsafe" import "unsafe"
const ( const _SYS_setgroups = SYS_SETGROUPS32
_SYS_dup = SYS_DUP2
_SYS_setgroups = SYS_SETGROUPS32
)
func setTimespec(sec, nsec int64) Timespec { func setTimespec(sec, nsec int64) Timespec {
return Timespec{Sec: int32(sec), Nsec: int32(nsec)} return Timespec{Sec: int32(sec), Nsec: int32(nsec)}

View File

@ -4,10 +4,7 @@
package syscall package syscall
const ( const _SYS_setgroups = SYS_SETGROUPS
_SYS_dup = SYS_DUP2
_SYS_setgroups = SYS_SETGROUPS
)
//sys Dup2(oldfd int, newfd int) (err error) //sys Dup2(oldfd int, newfd int) (err error)
//sysnb EpollCreate(size int) (fd int, err error) //sysnb EpollCreate(size int) (fd int, err error)

View File

@ -6,10 +6,7 @@ package syscall
import "unsafe" import "unsafe"
const ( const _SYS_setgroups = SYS_SETGROUPS32
_SYS_dup = SYS_DUP2
_SYS_setgroups = SYS_SETGROUPS32
)
func setTimespec(sec, nsec int64) Timespec { func setTimespec(sec, nsec int64) Timespec {
return Timespec{Sec: int32(sec), Nsec: int32(nsec)} return Timespec{Sec: int32(sec), Nsec: int32(nsec)}

View File

@ -6,10 +6,7 @@ package syscall
import "unsafe" import "unsafe"
const ( const _SYS_setgroups = SYS_SETGROUPS
_SYS_dup = SYS_DUP3
_SYS_setgroups = SYS_SETGROUPS
)
func EpollCreate(size int) (fd int, err error) { func EpollCreate(size int) (fd int, err error) {
if size <= 0 { if size <= 0 {

View File

@ -7,10 +7,7 @@
package syscall package syscall
const ( const _SYS_setgroups = SYS_SETGROUPS
_SYS_dup = SYS_DUP2
_SYS_setgroups = SYS_SETGROUPS
)
//sys Dup2(oldfd int, newfd int) (err error) //sys Dup2(oldfd int, newfd int) (err error)
//sysnb EpollCreate(size int) (fd int, err error) //sysnb EpollCreate(size int) (fd int, err error)

View File

@ -9,10 +9,7 @@ package syscall
import "unsafe" import "unsafe"
const ( const _SYS_setgroups = SYS_SETGROUPS
_SYS_dup = SYS_DUP2
_SYS_setgroups = SYS_SETGROUPS
)
func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno)

View File

@ -7,10 +7,7 @@
package syscall package syscall
const ( const _SYS_setgroups = SYS_SETGROUPS
_SYS_dup = SYS_DUP2
_SYS_setgroups = SYS_SETGROUPS
)
//sys Dup2(oldfd int, newfd int) (err error) //sys Dup2(oldfd int, newfd int) (err error)
//sysnb EpollCreate(size int) (fd int, err error) //sysnb EpollCreate(size int) (fd int, err error)

View File

@ -6,10 +6,7 @@ package syscall
import "unsafe" import "unsafe"
const ( const _SYS_setgroups = SYS_SETGROUPS
_SYS_dup = SYS_DUP3
_SYS_setgroups = SYS_SETGROUPS
)
func EpollCreate(size int) (fd int, err error) { func EpollCreate(size int) (fd int, err error) {
if size <= 0 { if size <= 0 {

View File

@ -6,10 +6,7 @@ package syscall
import "unsafe" import "unsafe"
const ( const _SYS_setgroups = SYS_SETGROUPS
_SYS_dup = SYS_DUP2
_SYS_setgroups = SYS_SETGROUPS
)
//sys Dup2(oldfd int, newfd int) (err error) //sys Dup2(oldfd int, newfd int) (err error)
//sysnb EpollCreate(size int) (fd int, err error) //sysnb EpollCreate(size int) (fd int, err error)