mirror of
https://github.com/golang/go
synced 2024-11-18 04:14:49 -07:00
internal/syscall/unix: eliminate non-trivial randomTrap initializer
While here, enable getrandom on arm64 too (using the value found in include/uapi/asm-generic/unistd.h, which seems to match up with other GOARCH=arm64 syscall numbers). Updates #10848. Change-Id: I5ab36ccf6ee8d5cc6f0e1a61d09f0da7410288b9 Reviewed-on: https://go-review.googlesource.com/16662 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
dcd9e5bc0f
commit
b16c699195
@ -5,20 +5,11 @@
|
||||
package unix
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var randomTrap = map[string]uintptr{
|
||||
"386": 355,
|
||||
"amd64": 318,
|
||||
"arm": 384,
|
||||
"ppc64": 359,
|
||||
"ppc64le": 359,
|
||||
}[runtime.GOARCH]
|
||||
|
||||
var randomUnsupported int32 // atomic
|
||||
|
||||
// GetRandomFlag is a flag supported by the getrandom system call.
|
||||
|
7
src/internal/syscall/unix/getrandom_linux_386.go
Normal file
7
src/internal/syscall/unix/getrandom_linux_386.go
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
package unix
|
||||
|
||||
const randomTrap uintptr = 355
|
7
src/internal/syscall/unix/getrandom_linux_amd64.go
Normal file
7
src/internal/syscall/unix/getrandom_linux_amd64.go
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
package unix
|
||||
|
||||
const randomTrap uintptr = 318
|
7
src/internal/syscall/unix/getrandom_linux_arm.go
Normal file
7
src/internal/syscall/unix/getrandom_linux_arm.go
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
package unix
|
||||
|
||||
const randomTrap uintptr = 384
|
9
src/internal/syscall/unix/getrandom_linux_generic.go
Normal file
9
src/internal/syscall/unix/getrandom_linux_generic.go
Normal file
@ -0,0 +1,9 @@
|
||||
// Copyright 2014 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 arm64
|
||||
|
||||
package unix
|
||||
|
||||
const randomTrap uintptr = 278
|
9
src/internal/syscall/unix/getrandom_linux_ppc64x.go
Normal file
9
src/internal/syscall/unix/getrandom_linux_ppc64x.go
Normal file
@ -0,0 +1,9 @@
|
||||
// Copyright 2014 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 ppc64 ppc64le
|
||||
|
||||
package unix
|
||||
|
||||
const randomTrap uintptr = 359
|
Loading…
Reference in New Issue
Block a user