libgo: change build procedure to use build tags
Previously the libgo Makefile explicitly listed the set of files to compile for each package. For packages that use build tags, this required a lot of awkward automake conditionals in the Makefile. This CL changes the build to look at the build tags in the files. The new shell script libgo/match.sh does the matching. This required adjusting a lot of build tags, and removing some files that are never used. I verified that the exact same sets of files are compiled on amd64 GNU/Linux. I also tested the build on i386 Solaris. Writing match.sh revealed some bugs in the build tag handling that already exists, in a slightly different form, in the gotest shell script. This CL fixes those problems as well. The old code used automake conditionals to handle systems that were missing strerror_r and wait4. Rather than deal with those in Go, those functions are now implemented in runtime/go-nosys.c when necessary, so the Go code can simply assume that they exist. The os testsuite looked for dir_unix.go, which was never built for gccgo and has now been removed. I changed the testsuite to look for dir.go instead. Reviewed-on: https://go-review.googlesource.com/25546 From-SVN: r239189
This commit is contained in:
parent
d712e9a7e2
commit
e0f69f36ea
@ -1,4 +1,4 @@
|
|||||||
ae44ca35b0b1c2ab925cadbcd7d47b334be5a318
|
8473b709ebd46c03c0e36e140656bd8c5d32d883
|
||||||
|
|
||||||
The first line of this file holds the git revision number of the last
|
The first line of this file holds the git revision number of the last
|
||||||
merge done from the gofrontend repository.
|
merge done from the gofrontend repository.
|
||||||
|
2295
libgo/Makefile.am
2295
libgo/Makefile.am
File diff suppressed because it is too large
Load Diff
2059
libgo/Makefile.in
2059
libgo/Makefile.in
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build amd64
|
// +build ignore
|
||||||
|
// -build amd64
|
||||||
|
|
||||||
package aes
|
package aes
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
package aes
|
package aes
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !amd64,!s390x
|
// -build !amd64,!s390x
|
||||||
|
|
||||||
package aes
|
package aes
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
package aes
|
package aes
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !amd64
|
// -build !amd64
|
||||||
|
|
||||||
package elliptic
|
package elliptic
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
// http://link.springer.com/article/10.1007%2Fs13389-014-0090-x
|
// http://link.springer.com/article/10.1007%2Fs13389-014-0090-x
|
||||||
// https://eprint.iacr.org/2013/816.pdf
|
// https://eprint.iacr.org/2013/816.pdf
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
// +build amd64
|
// +build amd64
|
||||||
|
|
||||||
package elliptic
|
package elliptic
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build amd64 amd64p32 386 arm ppc64le s390x
|
// +build ignore
|
||||||
|
// -build amd64 amd64p32 386 arm ppc64le s390x
|
||||||
|
|
||||||
package md5
|
package md5
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !amd64,!amd64p32,!386,!arm,!ppc64le,!s390x
|
// -build !amd64,!amd64p32,!386,!arm,!ppc64le,!s390x
|
||||||
|
|
||||||
package md5
|
package md5
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
// +build amd64 amd64p32 arm,!nacl 386
|
// +build amd64 amd64p32 arm,!nacl 386
|
||||||
|
|
||||||
package rc4
|
package rc4
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !amd64,!amd64p32,!arm,!386 arm,nacl
|
// -build !amd64,!amd64p32,!arm,!386 arm,nacl
|
||||||
|
|
||||||
package rc4
|
package rc4
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
// +build s390x
|
// +build s390x
|
||||||
|
|
||||||
package sha1
|
package sha1
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
package sha1
|
package sha1
|
||||||
|
|
||||||
//go:noescape
|
//go:noescape
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
// +build amd64p32 arm 386 s390x
|
// +build amd64p32 arm 386 s390x
|
||||||
|
|
||||||
package sha1
|
package sha1
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !amd64,!amd64p32,!386,!arm,!s390x
|
// -build !amd64,!amd64p32,!386,!arm,!s390x
|
||||||
|
|
||||||
package sha1
|
package sha1
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
package sha1
|
package sha1
|
||||||
|
|
||||||
// featureCheck reports whether the CPU supports the
|
// featureCheck reports whether the CPU supports the
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
// +build 386 amd64 s390x
|
// +build 386 amd64 s390x
|
||||||
|
|
||||||
package sha256
|
package sha256
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !amd64,!386,!s390x
|
// -build !amd64,!386,!s390x
|
||||||
|
|
||||||
package sha256
|
package sha256
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
package sha256
|
package sha256
|
||||||
|
|
||||||
// featureCheck reports whether the CPU supports the
|
// featureCheck reports whether the CPU supports the
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
// +build s390x
|
// +build s390x
|
||||||
|
|
||||||
package sha512
|
package sha512
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build amd64 s390x
|
// +build ignore
|
||||||
|
// -build amd64 s390x
|
||||||
|
|
||||||
package sha512
|
package sha512
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !amd64,!s390x
|
// -build !amd64,!s390x
|
||||||
|
|
||||||
package sha512
|
package sha512
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
package sha512
|
package sha512
|
||||||
|
|
||||||
// featureCheck reports whether the CPU supports the
|
// featureCheck reports whether the CPU supports the
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
package crc32
|
package crc32
|
||||||
|
|
||||||
// This file contains the code to call the SSE 4.2 version of the Castagnoli
|
// This file contains the code to call the SSE 4.2 version of the Castagnoli
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !amd64,!amd64p32,!s390x
|
// -build !amd64,!amd64p32,!s390x
|
||||||
|
|
||||||
package crc32
|
package crc32
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build solaris irix
|
||||||
|
|
||||||
// gccgo specific implementation of syslog for Solaris. Solaris uses
|
// gccgo specific implementation of syslog for Solaris. Solaris uses
|
||||||
// STREAMS to communicate with syslogd. That is enough of a pain that
|
// STREAMS to communicate with syslogd. That is enough of a pain that
|
||||||
// we just call the libc function.
|
// we just call the libc function.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !windows,!nacl,!plan9
|
// +build !windows,!nacl,!plan9,!solaris,!irix
|
||||||
|
|
||||||
package syslog
|
package syslog
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
// +build !math_big_pure_go
|
// +build !math_big_pure_go
|
||||||
|
|
||||||
package big
|
package big
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build math_big_pure_go
|
// -build math_big_pure_go
|
||||||
|
|
||||||
package big
|
package big
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build amd64 amd64p32
|
// +build ignore
|
||||||
|
// -build amd64 amd64p32
|
||||||
|
|
||||||
package math
|
package math
|
||||||
|
|
||||||
|
@ -1,182 +0,0 @@
|
|||||||
// Copyright 2010 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.
|
|
||||||
|
|
||||||
// Waiting for FDs via select(2).
|
|
||||||
|
|
||||||
package net
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"os"
|
|
||||||
"syscall"
|
|
||||||
)
|
|
||||||
|
|
||||||
type pollster struct {
|
|
||||||
readFds, writeFds, repeatFds *syscall.FdSet
|
|
||||||
maxFd int
|
|
||||||
readyReadFds, readyWriteFds *syscall.FdSet
|
|
||||||
nReady int
|
|
||||||
lastFd int
|
|
||||||
closed bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func newpollster() (p *pollster, err error) {
|
|
||||||
p = new(pollster)
|
|
||||||
p.readFds = new(syscall.FdSet)
|
|
||||||
p.writeFds = new(syscall.FdSet)
|
|
||||||
p.repeatFds = new(syscall.FdSet)
|
|
||||||
p.readyReadFds = new(syscall.FdSet)
|
|
||||||
p.readyWriteFds = new(syscall.FdSet)
|
|
||||||
p.maxFd = -1
|
|
||||||
p.nReady = 0
|
|
||||||
p.lastFd = 0
|
|
||||||
return p, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *pollster) AddFD(fd int, mode int, repeat bool) (bool, error) {
|
|
||||||
// pollServer is locked.
|
|
||||||
|
|
||||||
if p.closed {
|
|
||||||
return false, errors.New("pollster closed")
|
|
||||||
}
|
|
||||||
|
|
||||||
if mode == 'r' {
|
|
||||||
syscall.FDSet(fd, p.readFds)
|
|
||||||
} else {
|
|
||||||
syscall.FDSet(fd, p.writeFds)
|
|
||||||
}
|
|
||||||
|
|
||||||
if repeat {
|
|
||||||
syscall.FDSet(fd, p.repeatFds)
|
|
||||||
}
|
|
||||||
|
|
||||||
if fd > p.maxFd {
|
|
||||||
p.maxFd = fd
|
|
||||||
}
|
|
||||||
|
|
||||||
return true, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *pollster) DelFD(fd int, mode int) bool {
|
|
||||||
// pollServer is locked.
|
|
||||||
|
|
||||||
if p.closed {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if mode == 'r' {
|
|
||||||
if !syscall.FDIsSet(fd, p.readFds) {
|
|
||||||
print("Select unexpected fd=", fd, " for read\n")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
syscall.FDClr(fd, p.readFds)
|
|
||||||
} else {
|
|
||||||
if !syscall.FDIsSet(fd, p.writeFds) {
|
|
||||||
print("Select unexpected fd=", fd, " for write\n")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
syscall.FDClr(fd, p.writeFds)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Doesn't matter if not already present.
|
|
||||||
syscall.FDClr(fd, p.repeatFds)
|
|
||||||
|
|
||||||
// We don't worry about maxFd here.
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *pollster) WaitFD(s *pollServer, nsec int64) (fd int, mode int, err error) {
|
|
||||||
if p.nReady == 0 {
|
|
||||||
var timeout *syscall.Timeval
|
|
||||||
var tv syscall.Timeval
|
|
||||||
timeout = nil
|
|
||||||
if nsec > 0 {
|
|
||||||
tv = syscall.NsecToTimeval(nsec)
|
|
||||||
timeout = &tv
|
|
||||||
}
|
|
||||||
|
|
||||||
var n int
|
|
||||||
var e error
|
|
||||||
var tmpReadFds, tmpWriteFds syscall.FdSet
|
|
||||||
for {
|
|
||||||
if p.closed {
|
|
||||||
return -1, 0, errors.New("pollster closed")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Temporary syscall.FdSet's into which the values are copied
|
|
||||||
// because select mutates the values.
|
|
||||||
tmpReadFds = *p.readFds
|
|
||||||
tmpWriteFds = *p.writeFds
|
|
||||||
|
|
||||||
s.Unlock()
|
|
||||||
n, e = syscall.Select(p.maxFd+1, &tmpReadFds, &tmpWriteFds, nil, timeout)
|
|
||||||
s.Lock()
|
|
||||||
|
|
||||||
if e != syscall.EINTR {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if e == syscall.EBADF {
|
|
||||||
// Some file descriptor has been closed.
|
|
||||||
tmpReadFds = syscall.FdSet{}
|
|
||||||
tmpWriteFds = syscall.FdSet{}
|
|
||||||
n = 0
|
|
||||||
for i := 0; i < p.maxFd+1; i++ {
|
|
||||||
if syscall.FDIsSet(i, p.readFds) {
|
|
||||||
var s syscall.Stat_t
|
|
||||||
if syscall.Fstat(i, &s) == syscall.EBADF {
|
|
||||||
syscall.FDSet(i, &tmpReadFds)
|
|
||||||
n++
|
|
||||||
}
|
|
||||||
} else if syscall.FDIsSet(i, p.writeFds) {
|
|
||||||
var s syscall.Stat_t
|
|
||||||
if syscall.Fstat(i, &s) == syscall.EBADF {
|
|
||||||
syscall.FDSet(i, &tmpWriteFds)
|
|
||||||
n++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if e != nil {
|
|
||||||
return -1, 0, os.NewSyscallError("select", e)
|
|
||||||
}
|
|
||||||
if n == 0 {
|
|
||||||
return -1, 0, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
p.nReady = n
|
|
||||||
*p.readyReadFds = tmpReadFds
|
|
||||||
*p.readyWriteFds = tmpWriteFds
|
|
||||||
p.lastFd = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
flag := false
|
|
||||||
for i := p.lastFd; i < p.maxFd+1; i++ {
|
|
||||||
if syscall.FDIsSet(i, p.readyReadFds) {
|
|
||||||
flag = true
|
|
||||||
mode = 'r'
|
|
||||||
syscall.FDClr(i, p.readyReadFds)
|
|
||||||
} else if syscall.FDIsSet(i, p.readyWriteFds) {
|
|
||||||
flag = true
|
|
||||||
mode = 'w'
|
|
||||||
syscall.FDClr(i, p.readyWriteFds)
|
|
||||||
}
|
|
||||||
if flag {
|
|
||||||
if !syscall.FDIsSet(i, p.repeatFds) {
|
|
||||||
p.DelFD(i, mode)
|
|
||||||
}
|
|
||||||
p.nReady--
|
|
||||||
p.lastFd = i
|
|
||||||
return i, mode, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Will not reach here. Just to shut up the compiler.
|
|
||||||
return -1, 0, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *pollster) Close() error {
|
|
||||||
p.closed = true
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build rtems
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build linux solaris,386 solaris,sparc
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
import "syscall"
|
import "syscall"
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !linux
|
||||||
|
// +build !solaris,386
|
||||||
|
// +build !solaris,sparc
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
import "syscall"
|
import "syscall"
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
// Copyright 2009 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 darwin dragonfly freebsd linux nacl netbsd openbsd solaris
|
|
||||||
|
|
||||||
package os
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
"syscall"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
blockSize = 4096
|
|
||||||
)
|
|
||||||
|
|
||||||
func (f *File) readdirnames(n int) (names []string, err error) {
|
|
||||||
// If this file has no dirinfo, create one.
|
|
||||||
if f.dirinfo == nil {
|
|
||||||
f.dirinfo = new(dirInfo)
|
|
||||||
// The buffer must be at least a block long.
|
|
||||||
f.dirinfo.buf = make([]byte, blockSize)
|
|
||||||
}
|
|
||||||
d := f.dirinfo
|
|
||||||
|
|
||||||
size := n
|
|
||||||
if size <= 0 {
|
|
||||||
size = 100
|
|
||||||
n = -1
|
|
||||||
}
|
|
||||||
|
|
||||||
names = make([]string, 0, size) // Empty with room to grow.
|
|
||||||
for n != 0 {
|
|
||||||
// Refill the buffer if necessary
|
|
||||||
if d.bufp >= d.nbuf {
|
|
||||||
d.bufp = 0
|
|
||||||
var errno error
|
|
||||||
d.nbuf, errno = fixCount(syscall.ReadDirent(f.fd, d.buf))
|
|
||||||
if errno != nil {
|
|
||||||
return names, NewSyscallError("readdirent", errno)
|
|
||||||
}
|
|
||||||
if d.nbuf <= 0 {
|
|
||||||
break // EOF
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drain the buffer
|
|
||||||
var nb, nc int
|
|
||||||
nb, nc, names = syscall.ParseDirent(d.buf[d.bufp:d.nbuf], n, names)
|
|
||||||
d.bufp += nb
|
|
||||||
n -= nc
|
|
||||||
}
|
|
||||||
if n >= 0 && len(names) == 0 {
|
|
||||||
return names, io.EOF
|
|
||||||
}
|
|
||||||
return names, nil
|
|
||||||
}
|
|
@ -28,7 +28,7 @@ import (
|
|||||||
var supportsSymlinks = true
|
var supportsSymlinks = true
|
||||||
|
|
||||||
var dot = []string{
|
var dot = []string{
|
||||||
"dir_unix.go",
|
"dir.go",
|
||||||
"env.go",
|
"env.go",
|
||||||
"error.go",
|
"error.go",
|
||||||
"file.go",
|
"file.go",
|
||||||
|
@ -2,6 +2,13 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !darwin
|
||||||
|
// +build !freebsd
|
||||||
|
// +build !linux
|
||||||
|
// +build !netbsd
|
||||||
|
// +build !openbsd
|
||||||
|
// +build !solaris
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build linux openbsd solaristag
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin freebsd netbsd
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !solaristag
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
// For systems which only store the hostname in uname (Solaris).
|
// For systems which only store the hostname in uname (Solaris).
|
||||||
|
|
||||||
|
// +build solaris irix rtems
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
import "syscall"
|
import "syscall"
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
// Copyright 2016 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 mips64 mips64le
|
|
||||||
|
|
||||||
package runtime
|
|
||||||
|
|
||||||
// crosscall1 calls into the runtime to set up the registers the
|
|
||||||
// Go runtime expects and so the symbol it calls needs to be exported
|
|
||||||
// for external linking to work.
|
|
||||||
//go:cgo_export_static _cgo_reginit
|
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
// Support for memory sanitizer. See runtime/cgo/mmap.go.
|
// Support for memory sanitizer. See runtime/cgo/mmap.go.
|
||||||
|
|
||||||
// +build linux,amd64
|
// +build linux,amd64
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
// Copyright 2015 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 runtime
|
|
||||||
|
|
||||||
// crosscall_ppc64 calls into the runtime to set up the registers the
|
|
||||||
// Go runtime expects and so the symbol it calls needs to be exported
|
|
||||||
// for external linking to work.
|
|
||||||
//go:cgo_export_static _cgo_reginit
|
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
// Code to check that pointer writes follow the cgo rules.
|
// Code to check that pointer writes follow the cgo rules.
|
||||||
// These functions are invoked via the write barrier when debug.cgocheck > 1.
|
// These functions are invoked via the write barrier when debug.cgocheck > 1.
|
||||||
|
|
||||||
|
@ -1,183 +0,0 @@
|
|||||||
// +build mips64 mips64le
|
|
||||||
// +build linux
|
|
||||||
|
|
||||||
package runtime
|
|
||||||
|
|
||||||
const (
|
|
||||||
_EINTR = 0x4
|
|
||||||
_EAGAIN = 0xb
|
|
||||||
_ENOMEM = 0xc
|
|
||||||
|
|
||||||
_PROT_NONE = 0x0
|
|
||||||
_PROT_READ = 0x1
|
|
||||||
_PROT_WRITE = 0x2
|
|
||||||
_PROT_EXEC = 0x4
|
|
||||||
|
|
||||||
_MAP_ANON = 0x800
|
|
||||||
_MAP_PRIVATE = 0x2
|
|
||||||
_MAP_FIXED = 0x10
|
|
||||||
|
|
||||||
_MADV_DONTNEED = 0x4
|
|
||||||
_MADV_HUGEPAGE = 0xe
|
|
||||||
_MADV_NOHUGEPAGE = 0xf
|
|
||||||
|
|
||||||
_SA_RESTART = 0x10000000
|
|
||||||
_SA_ONSTACK = 0x8000000
|
|
||||||
_SA_SIGINFO = 0x8
|
|
||||||
|
|
||||||
_SIGHUP = 0x1
|
|
||||||
_SIGINT = 0x2
|
|
||||||
_SIGQUIT = 0x3
|
|
||||||
_SIGILL = 0x4
|
|
||||||
_SIGTRAP = 0x5
|
|
||||||
_SIGABRT = 0x6
|
|
||||||
_SIGEMT = 0x7
|
|
||||||
_SIGFPE = 0x8
|
|
||||||
_SIGKILL = 0x9
|
|
||||||
_SIGBUS = 0xa
|
|
||||||
_SIGSEGV = 0xb
|
|
||||||
_SIGSYS = 0xc
|
|
||||||
_SIGPIPE = 0xd
|
|
||||||
_SIGALRM = 0xe
|
|
||||||
_SIGUSR1 = 0x10
|
|
||||||
_SIGUSR2 = 0x11
|
|
||||||
_SIGCHLD = 0x12
|
|
||||||
_SIGPWR = 0x13
|
|
||||||
_SIGWINCH = 0x14
|
|
||||||
_SIGURG = 0x15
|
|
||||||
_SIGIO = 0x16
|
|
||||||
_SIGSTOP = 0x17
|
|
||||||
_SIGTSTP = 0x18
|
|
||||||
_SIGCONT = 0x19
|
|
||||||
_SIGTTIN = 0x1a
|
|
||||||
_SIGTTOU = 0x1b
|
|
||||||
_SIGVTALRM = 0x1c
|
|
||||||
_SIGPROF = 0x1d
|
|
||||||
_SIGXCPU = 0x1e
|
|
||||||
_SIGXFSZ = 0x1f
|
|
||||||
|
|
||||||
_FPE_INTDIV = 0x1
|
|
||||||
_FPE_INTOVF = 0x2
|
|
||||||
_FPE_FLTDIV = 0x3
|
|
||||||
_FPE_FLTOVF = 0x4
|
|
||||||
_FPE_FLTUND = 0x5
|
|
||||||
_FPE_FLTRES = 0x6
|
|
||||||
_FPE_FLTINV = 0x7
|
|
||||||
_FPE_FLTSUB = 0x8
|
|
||||||
|
|
||||||
_BUS_ADRALN = 0x1
|
|
||||||
_BUS_ADRERR = 0x2
|
|
||||||
_BUS_OBJERR = 0x3
|
|
||||||
|
|
||||||
_SEGV_MAPERR = 0x1
|
|
||||||
_SEGV_ACCERR = 0x2
|
|
||||||
|
|
||||||
_ITIMER_REAL = 0x0
|
|
||||||
_ITIMER_VIRTUAL = 0x1
|
|
||||||
_ITIMER_PROF = 0x2
|
|
||||||
|
|
||||||
_EPOLLIN = 0x1
|
|
||||||
_EPOLLOUT = 0x4
|
|
||||||
_EPOLLERR = 0x8
|
|
||||||
_EPOLLHUP = 0x10
|
|
||||||
_EPOLLRDHUP = 0x2000
|
|
||||||
_EPOLLET = 0x80000000
|
|
||||||
_EPOLL_CLOEXEC = 0x80000
|
|
||||||
_EPOLL_CTL_ADD = 0x1
|
|
||||||
_EPOLL_CTL_DEL = 0x2
|
|
||||||
_EPOLL_CTL_MOD = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
//struct Sigset {
|
|
||||||
// uint64 sig[1];
|
|
||||||
//};
|
|
||||||
//typedef uint64 Sigset;
|
|
||||||
|
|
||||||
type timespec struct {
|
|
||||||
tv_sec int64
|
|
||||||
tv_nsec int64
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ts *timespec) set_sec(x int64) {
|
|
||||||
ts.tv_sec = x
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ts *timespec) set_nsec(x int32) {
|
|
||||||
ts.tv_nsec = int64(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
type timeval struct {
|
|
||||||
tv_sec int64
|
|
||||||
tv_usec int64
|
|
||||||
}
|
|
||||||
|
|
||||||
func (tv *timeval) set_usec(x int32) {
|
|
||||||
tv.tv_usec = int64(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
type sigactiont struct {
|
|
||||||
sa_flags uint32
|
|
||||||
sa_handler uintptr
|
|
||||||
sa_mask [2]uint64
|
|
||||||
// linux header does not have sa_restorer field,
|
|
||||||
// but it is used in setsig(). it is no harm to put it here
|
|
||||||
sa_restorer uintptr
|
|
||||||
}
|
|
||||||
|
|
||||||
type siginfo struct {
|
|
||||||
si_signo int32
|
|
||||||
si_code int32
|
|
||||||
si_errno int32
|
|
||||||
__pad0 [1]int32
|
|
||||||
// below here is a union; si_addr is the only field we use
|
|
||||||
si_addr uint64
|
|
||||||
}
|
|
||||||
|
|
||||||
type itimerval struct {
|
|
||||||
it_interval timeval
|
|
||||||
it_value timeval
|
|
||||||
}
|
|
||||||
|
|
||||||
type epollevent struct {
|
|
||||||
events uint32
|
|
||||||
pad_cgo_0 [4]byte
|
|
||||||
data [8]byte // unaligned uintptr
|
|
||||||
}
|
|
||||||
|
|
||||||
const (
|
|
||||||
_O_RDONLY = 0x0
|
|
||||||
_O_CLOEXEC = 0x80000
|
|
||||||
_SA_RESTORER = 0
|
|
||||||
)
|
|
||||||
|
|
||||||
type sigaltstackt struct {
|
|
||||||
ss_sp *byte
|
|
||||||
ss_size uintptr
|
|
||||||
ss_flags int32
|
|
||||||
}
|
|
||||||
|
|
||||||
type sigcontext struct {
|
|
||||||
sc_regs [32]uint64
|
|
||||||
sc_fpregs [32]uint64
|
|
||||||
sc_mdhi uint64
|
|
||||||
sc_hi1 uint64
|
|
||||||
sc_hi2 uint64
|
|
||||||
sc_hi3 uint64
|
|
||||||
sc_mdlo uint64
|
|
||||||
sc_lo1 uint64
|
|
||||||
sc_lo2 uint64
|
|
||||||
sc_lo3 uint64
|
|
||||||
sc_pc uint64
|
|
||||||
sc_fpc_csr uint32
|
|
||||||
sc_used_math uint32
|
|
||||||
sc_dsp uint32
|
|
||||||
sc_reserved uint32
|
|
||||||
}
|
|
||||||
|
|
||||||
type ucontext struct {
|
|
||||||
uc_flags uint64
|
|
||||||
uc_link *ucontext
|
|
||||||
uc_stack sigaltstackt
|
|
||||||
uc_mcontext sigcontext
|
|
||||||
uc_sigmask uint64
|
|
||||||
}
|
|
@ -1,167 +0,0 @@
|
|||||||
// Copyright 2016 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 runtime
|
|
||||||
|
|
||||||
const (
|
|
||||||
_EINTR = 0x4
|
|
||||||
_EAGAIN = 0xb
|
|
||||||
_ENOMEM = 0xc
|
|
||||||
|
|
||||||
_PROT_NONE = 0x0
|
|
||||||
_PROT_READ = 0x1
|
|
||||||
_PROT_WRITE = 0x2
|
|
||||||
_PROT_EXEC = 0x4
|
|
||||||
|
|
||||||
_MAP_ANON = 0x20
|
|
||||||
_MAP_PRIVATE = 0x2
|
|
||||||
_MAP_FIXED = 0x10
|
|
||||||
|
|
||||||
_MADV_DONTNEED = 0x4
|
|
||||||
_MADV_HUGEPAGE = 0xe
|
|
||||||
_MADV_NOHUGEPAGE = 0xf
|
|
||||||
|
|
||||||
_SA_RESTART = 0x10000000
|
|
||||||
_SA_ONSTACK = 0x8000000
|
|
||||||
_SA_SIGINFO = 0x4
|
|
||||||
|
|
||||||
_SIGHUP = 0x1
|
|
||||||
_SIGINT = 0x2
|
|
||||||
_SIGQUIT = 0x3
|
|
||||||
_SIGILL = 0x4
|
|
||||||
_SIGTRAP = 0x5
|
|
||||||
_SIGABRT = 0x6
|
|
||||||
_SIGBUS = 0x7
|
|
||||||
_SIGFPE = 0x8
|
|
||||||
_SIGKILL = 0x9
|
|
||||||
_SIGUSR1 = 0xa
|
|
||||||
_SIGSEGV = 0xb
|
|
||||||
_SIGUSR2 = 0xc
|
|
||||||
_SIGPIPE = 0xd
|
|
||||||
_SIGALRM = 0xe
|
|
||||||
_SIGSTKFLT = 0x10
|
|
||||||
_SIGCHLD = 0x11
|
|
||||||
_SIGCONT = 0x12
|
|
||||||
_SIGSTOP = 0x13
|
|
||||||
_SIGTSTP = 0x14
|
|
||||||
_SIGTTIN = 0x15
|
|
||||||
_SIGTTOU = 0x16
|
|
||||||
_SIGURG = 0x17
|
|
||||||
_SIGXCPU = 0x18
|
|
||||||
_SIGXFSZ = 0x19
|
|
||||||
_SIGVTALRM = 0x1a
|
|
||||||
_SIGPROF = 0x1b
|
|
||||||
_SIGWINCH = 0x1c
|
|
||||||
_SIGIO = 0x1d
|
|
||||||
_SIGPWR = 0x1e
|
|
||||||
_SIGSYS = 0x1f
|
|
||||||
|
|
||||||
_FPE_INTDIV = 0x1
|
|
||||||
_FPE_INTOVF = 0x2
|
|
||||||
_FPE_FLTDIV = 0x3
|
|
||||||
_FPE_FLTOVF = 0x4
|
|
||||||
_FPE_FLTUND = 0x5
|
|
||||||
_FPE_FLTRES = 0x6
|
|
||||||
_FPE_FLTINV = 0x7
|
|
||||||
_FPE_FLTSUB = 0x8
|
|
||||||
|
|
||||||
_BUS_ADRALN = 0x1
|
|
||||||
_BUS_ADRERR = 0x2
|
|
||||||
_BUS_OBJERR = 0x3
|
|
||||||
|
|
||||||
_SEGV_MAPERR = 0x1
|
|
||||||
_SEGV_ACCERR = 0x2
|
|
||||||
|
|
||||||
_ITIMER_REAL = 0x0
|
|
||||||
_ITIMER_VIRTUAL = 0x1
|
|
||||||
_ITIMER_PROF = 0x2
|
|
||||||
|
|
||||||
_EPOLLIN = 0x1
|
|
||||||
_EPOLLOUT = 0x4
|
|
||||||
_EPOLLERR = 0x8
|
|
||||||
_EPOLLHUP = 0x10
|
|
||||||
_EPOLLRDHUP = 0x2000
|
|
||||||
_EPOLLET = 0x80000000
|
|
||||||
_EPOLL_CLOEXEC = 0x80000
|
|
||||||
_EPOLL_CTL_ADD = 0x1
|
|
||||||
_EPOLL_CTL_DEL = 0x2
|
|
||||||
_EPOLL_CTL_MOD = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type timespec struct {
|
|
||||||
tv_sec int64
|
|
||||||
tv_nsec int64
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ts *timespec) set_sec(x int64) {
|
|
||||||
ts.tv_sec = x
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ts *timespec) set_nsec(x int32) {
|
|
||||||
ts.tv_nsec = int64(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
type timeval struct {
|
|
||||||
tv_sec int64
|
|
||||||
tv_usec int64
|
|
||||||
}
|
|
||||||
|
|
||||||
func (tv *timeval) set_usec(x int32) {
|
|
||||||
tv.tv_usec = int64(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
type sigactiont struct {
|
|
||||||
sa_handler uintptr
|
|
||||||
sa_flags uint64
|
|
||||||
sa_restorer uintptr
|
|
||||||
sa_mask uint64
|
|
||||||
}
|
|
||||||
|
|
||||||
type siginfo struct {
|
|
||||||
si_signo int32
|
|
||||||
si_errno int32
|
|
||||||
si_code int32
|
|
||||||
// below here is a union; si_addr is the only field we use
|
|
||||||
si_addr uint64
|
|
||||||
}
|
|
||||||
|
|
||||||
type itimerval struct {
|
|
||||||
it_interval timeval
|
|
||||||
it_value timeval
|
|
||||||
}
|
|
||||||
|
|
||||||
type epollevent struct {
|
|
||||||
events uint32
|
|
||||||
pad_cgo_0 [4]byte
|
|
||||||
data [8]byte // unaligned uintptr
|
|
||||||
}
|
|
||||||
|
|
||||||
const (
|
|
||||||
_O_RDONLY = 0x0
|
|
||||||
_O_CLOEXEC = 0x80000
|
|
||||||
_SA_RESTORER = 0
|
|
||||||
)
|
|
||||||
|
|
||||||
type sigaltstackt struct {
|
|
||||||
ss_sp *byte
|
|
||||||
ss_flags int32
|
|
||||||
ss_size uintptr
|
|
||||||
}
|
|
||||||
|
|
||||||
type sigcontext struct {
|
|
||||||
psw_mask uint64
|
|
||||||
psw_addr uint64
|
|
||||||
gregs [16]uint64
|
|
||||||
aregs [16]uint32
|
|
||||||
fpc uint32
|
|
||||||
fpregs [16]uint64
|
|
||||||
}
|
|
||||||
|
|
||||||
type ucontext struct {
|
|
||||||
uc_flags uint64
|
|
||||||
uc_link *ucontext
|
|
||||||
uc_stack sigaltstackt
|
|
||||||
uc_mcontext sigcontext
|
|
||||||
uc_sigmask uint64
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
// Copyright 2015 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 runtime
|
|
||||||
|
|
||||||
const _PAGESIZE = 0x1000
|
|
||||||
|
|
||||||
type ureg struct {
|
|
||||||
r0 uint32 /* general registers */
|
|
||||||
r1 uint32 /* ... */
|
|
||||||
r2 uint32 /* ... */
|
|
||||||
r3 uint32 /* ... */
|
|
||||||
r4 uint32 /* ... */
|
|
||||||
r5 uint32 /* ... */
|
|
||||||
r6 uint32 /* ... */
|
|
||||||
r7 uint32 /* ... */
|
|
||||||
r8 uint32 /* ... */
|
|
||||||
r9 uint32 /* ... */
|
|
||||||
r10 uint32 /* ... */
|
|
||||||
r11 uint32 /* ... */
|
|
||||||
r12 uint32 /* ... */
|
|
||||||
sp uint32
|
|
||||||
link uint32 /* ... */
|
|
||||||
trap uint32 /* trap type */
|
|
||||||
psr uint32
|
|
||||||
pc uint32 /* interrupted addr */
|
|
||||||
}
|
|
||||||
|
|
||||||
type sigctxt struct {
|
|
||||||
u *ureg
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *sigctxt) pc() uintptr { return uintptr(c.u.pc) }
|
|
||||||
func (c *sigctxt) sp() uintptr { return uintptr(c.u.sp) }
|
|
||||||
func (c *sigctxt) lr() uintptr { return uintptr(c.u.link) }
|
|
||||||
|
|
||||||
func (c *sigctxt) setpc(x uintptr) { c.u.pc = uint32(x) }
|
|
||||||
func (c *sigctxt) setsp(x uintptr) { c.u.sp = uint32(x) }
|
|
||||||
func (c *sigctxt) setlr(x uintptr) { c.u.link = uint32(x) }
|
|
||||||
func (c *sigctxt) savelr(x uintptr) { c.u.r0 = uint32(x) }
|
|
||||||
|
|
||||||
func dumpregs(u *ureg) {
|
|
||||||
print("r0 ", hex(u.r0), "\n")
|
|
||||||
print("r1 ", hex(u.r1), "\n")
|
|
||||||
print("r2 ", hex(u.r2), "\n")
|
|
||||||
print("r3 ", hex(u.r3), "\n")
|
|
||||||
print("r4 ", hex(u.r4), "\n")
|
|
||||||
print("r5 ", hex(u.r5), "\n")
|
|
||||||
print("r6 ", hex(u.r6), "\n")
|
|
||||||
print("r7 ", hex(u.r7), "\n")
|
|
||||||
print("r8 ", hex(u.r8), "\n")
|
|
||||||
print("r9 ", hex(u.r9), "\n")
|
|
||||||
print("r10 ", hex(u.r10), "\n")
|
|
||||||
print("r11 ", hex(u.r11), "\n")
|
|
||||||
print("r12 ", hex(u.r12), "\n")
|
|
||||||
print("sp ", hex(u.sp), "\n")
|
|
||||||
print("link ", hex(u.link), "\n")
|
|
||||||
print("pc ", hex(u.pc), "\n")
|
|
||||||
print("psr ", hex(u.psr), "\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
func sigpanictramp()
|
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Run go generate from src/runtime to update.
|
// Run go generate from src/runtime to update.
|
||||||
// See mkfastlog2table.go for comments.
|
// See mkfastlog2table.go for comments.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
const fastlogNumBits = 5
|
const fastlogNumBits = 5
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
// +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x
|
// +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x
|
||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
// +build !plan9
|
// +build !plan9
|
||||||
// +build !solaris
|
// +build !solaris
|
||||||
// +build !windows
|
// +build !windows
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
// Copyright 2015 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 msan
|
|
||||||
|
|
||||||
package runtime
|
|
||||||
|
|
||||||
import (
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Public memory sanitizer API.
|
|
||||||
|
|
||||||
func MSanRead(addr unsafe.Pointer, len int) {
|
|
||||||
msanread(addr, uintptr(len))
|
|
||||||
}
|
|
||||||
|
|
||||||
func MSanWrite(addr unsafe.Pointer, len int) {
|
|
||||||
msanwrite(addr, uintptr(len))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Private interface for the runtime.
|
|
||||||
const msanenabled = true
|
|
||||||
|
|
||||||
// If we are running on the system stack, the C program may have
|
|
||||||
// marked part of that stack as uninitialized. We don't instrument
|
|
||||||
// the runtime, but operations like a slice copy can call msanread
|
|
||||||
// anyhow for values on the stack. Just ignore msanread when running
|
|
||||||
// on the system stack. The other msan functions are fine.
|
|
||||||
func msanread(addr unsafe.Pointer, sz uintptr) {
|
|
||||||
g := getg()
|
|
||||||
if g == g.m.g0 || g == g.m.gsignal {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
domsanread(addr, sz)
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:noescape
|
|
||||||
func domsanread(addr unsafe.Pointer, sz uintptr)
|
|
||||||
|
|
||||||
//go:noescape
|
|
||||||
func msanwrite(addr unsafe.Pointer, sz uintptr)
|
|
||||||
|
|
||||||
//go:noescape
|
|
||||||
func msanmalloc(addr unsafe.Pointer, sz uintptr)
|
|
||||||
|
|
||||||
//go:noescape
|
|
||||||
func msanfree(addr unsafe.Pointer, sz uintptr)
|
|
||||||
|
|
||||||
// These are called from msan_amd64.s
|
|
||||||
//go:cgo_import_static __msan_read_go
|
|
||||||
//go:cgo_import_static __msan_write_go
|
|
||||||
//go:cgo_import_static __msan_malloc_go
|
|
||||||
//go:cgo_import_static __msan_free_go
|
|
@ -2,6 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
// +build !msan
|
// +build !msan
|
||||||
|
|
||||||
// Dummy MSan support API, used when not built with -msan.
|
// Dummy MSan support API, used when not built with -msan.
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
// Garbage collector: stack barriers
|
// Garbage collector: stack barriers
|
||||||
//
|
//
|
||||||
// Stack barriers enable the garbage collector to determine how much
|
// Stack barriers enable the garbage collector to determine how much
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
// 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 runtime
|
|
||||||
|
|
||||||
import _ "unsafe" // for go:cgo_export_static and go:cgo_export_dynamic
|
|
||||||
|
|
||||||
// Export the main function.
|
|
||||||
//
|
|
||||||
// Used by the app package to start all-Go Android apps that are
|
|
||||||
// loaded via JNI. See golang.org/x/mobile/app.
|
|
||||||
|
|
||||||
//go:cgo_export_static main.main
|
|
||||||
//go:cgo_export_dynamic main.main
|
|
@ -1,48 +0,0 @@
|
|||||||
// Copyright 2009 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 !mips64
|
|
||||||
// +build !mips64le
|
|
||||||
// +build !s390x
|
|
||||||
// +build linux
|
|
||||||
|
|
||||||
package runtime
|
|
||||||
|
|
||||||
const (
|
|
||||||
_SS_DISABLE = 2
|
|
||||||
_NSIG = 65
|
|
||||||
_SI_USER = 0
|
|
||||||
_SIG_BLOCK = 0
|
|
||||||
_SIG_UNBLOCK = 1
|
|
||||||
_SIG_SETMASK = 2
|
|
||||||
_RLIMIT_AS = 9
|
|
||||||
)
|
|
||||||
|
|
||||||
// It's hard to tease out exactly how big a Sigset is, but
|
|
||||||
// rt_sigprocmask crashes if we get it wrong, so if binaries
|
|
||||||
// are running, this is right.
|
|
||||||
type sigset [2]uint32
|
|
||||||
|
|
||||||
type rlimit struct {
|
|
||||||
rlim_cur uintptr
|
|
||||||
rlim_max uintptr
|
|
||||||
}
|
|
||||||
|
|
||||||
var sigset_all = sigset{^uint32(0), ^uint32(0)}
|
|
||||||
|
|
||||||
func sigaddset(mask *sigset, i int) {
|
|
||||||
(*mask)[(i-1)/32] |= 1 << ((uint32(i) - 1) & 31)
|
|
||||||
}
|
|
||||||
|
|
||||||
func sigdelset(mask *sigset, i int) {
|
|
||||||
(*mask)[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
|
|
||||||
}
|
|
||||||
|
|
||||||
func sigfillset(mask *uint64) {
|
|
||||||
*mask = ^uint64(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
func sigcopyset(mask *sigset, m sigmask) {
|
|
||||||
copy((*mask)[:], m[:])
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
// Copyright 2015 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 linux
|
|
||||||
// +build mips64 mips64le
|
|
||||||
|
|
||||||
package runtime
|
|
||||||
|
|
||||||
var randomNumber uint32
|
|
||||||
|
|
||||||
func archauxv(tag, val uintptr) {
|
|
||||||
switch tag {
|
|
||||||
case _AT_RANDOM:
|
|
||||||
// sysargs filled in startupRandomData, but that
|
|
||||||
// pointer may not be word aligned, so we must treat
|
|
||||||
// it as a byte array.
|
|
||||||
randomNumber = uint32(startupRandomData[4]) | uint32(startupRandomData[5])<<8 |
|
|
||||||
uint32(startupRandomData[6])<<16 | uint32(startupRandomData[7])<<24
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:nosplit
|
|
||||||
func cputicks() int64 {
|
|
||||||
// Currently cputicks() is used in blocking profiler and to seed fastrand1().
|
|
||||||
// nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
|
|
||||||
// randomNumber provides better seeding of fastrand1.
|
|
||||||
return nanotime() + int64(randomNumber)
|
|
||||||
}
|
|
||||||
|
|
||||||
const (
|
|
||||||
_SS_DISABLE = 2
|
|
||||||
_NSIG = 65
|
|
||||||
_SI_USER = 0
|
|
||||||
_SIG_BLOCK = 1
|
|
||||||
_SIG_UNBLOCK = 2
|
|
||||||
_SIG_SETMASK = 3
|
|
||||||
_RLIMIT_AS = 6
|
|
||||||
)
|
|
||||||
|
|
||||||
type sigset [2]uint64
|
|
||||||
|
|
||||||
type rlimit struct {
|
|
||||||
rlim_cur uintptr
|
|
||||||
rlim_max uintptr
|
|
||||||
}
|
|
||||||
|
|
||||||
var sigset_all = sigset{^uint64(0), ^uint64(0)}
|
|
||||||
|
|
||||||
func sigaddset(mask *sigset, i int) {
|
|
||||||
(*mask)[(i-1)/64] |= 1 << ((uint32(i) - 1) & 63)
|
|
||||||
}
|
|
||||||
|
|
||||||
func sigdelset(mask *sigset, i int) {
|
|
||||||
(*mask)[(i-1)/64] &^= 1 << ((uint32(i) - 1) & 63)
|
|
||||||
}
|
|
||||||
|
|
||||||
func sigfillset(mask *[2]uint64) {
|
|
||||||
(*mask)[0], (*mask)[1] = ^uint64(0), ^uint64(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
func sigcopyset(mask *sigset, m sigmask) {
|
|
||||||
(*mask)[0] = uint64(m[0]) | uint64(m[1])<<32
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
// 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 !amd64,!arm,!arm64,!mips64,!mips64le
|
|
||||||
|
|
||||||
package runtime
|
|
||||||
|
|
||||||
func archauxv(tag, val uintptr) {
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
// Copyright 2016 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 runtime
|
|
||||||
|
|
||||||
const (
|
|
||||||
_SS_DISABLE = 2
|
|
||||||
_NSIG = 65
|
|
||||||
_SI_USER = 0
|
|
||||||
_SIG_BLOCK = 0
|
|
||||||
_SIG_UNBLOCK = 1
|
|
||||||
_SIG_SETMASK = 2
|
|
||||||
_RLIMIT_AS = 9
|
|
||||||
)
|
|
||||||
|
|
||||||
type sigset uint64
|
|
||||||
|
|
||||||
type rlimit struct {
|
|
||||||
rlim_cur uintptr
|
|
||||||
rlim_max uintptr
|
|
||||||
}
|
|
||||||
|
|
||||||
var sigset_all = sigset(^uint64(0))
|
|
||||||
|
|
||||||
func sigaddset(mask *sigset, i int) {
|
|
||||||
if i > 64 {
|
|
||||||
throw("unexpected signal greater than 64")
|
|
||||||
}
|
|
||||||
*mask |= 1 << (uint(i) - 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
func sigdelset(mask *sigset, i int) {
|
|
||||||
if i > 64 {
|
|
||||||
throw("unexpected signal greater than 64")
|
|
||||||
}
|
|
||||||
*mask &^= 1 << (uint(i) - 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
func sigfillset(mask *uint64) {
|
|
||||||
*mask = ^uint64(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
func sigcopyset(mask *sigset, m sigmask) {
|
|
||||||
*mask = sigset(uint64(m[0]) | uint64(m[1])<<32)
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
// Copyright 2009 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 runtime
|
|
||||||
|
|
||||||
import "unsafe"
|
|
||||||
|
|
||||||
func lwp_mcontext_init(mc *mcontextt, stk unsafe.Pointer, mp *m, gp *g, fn uintptr) {
|
|
||||||
// Machine dependent mcontext initialisation for LWP.
|
|
||||||
mc.__gregs[_REG_EIP] = uint32(funcPC(lwp_tramp))
|
|
||||||
mc.__gregs[_REG_UESP] = uint32(uintptr(stk))
|
|
||||||
mc.__gregs[_REG_EBX] = uint32(uintptr(unsafe.Pointer(mp)))
|
|
||||||
mc.__gregs[_REG_EDX] = uint32(uintptr(unsafe.Pointer(gp)))
|
|
||||||
mc.__gregs[_REG_ESI] = uint32(fn)
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
// Copyright 2009 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 runtime
|
|
||||||
|
|
||||||
import "unsafe"
|
|
||||||
|
|
||||||
func lwp_mcontext_init(mc *mcontextt, stk unsafe.Pointer, mp *m, gp *g, fn uintptr) {
|
|
||||||
// Machine dependent mcontext initialisation for LWP.
|
|
||||||
mc.__gregs[_REG_RIP] = uint64(funcPC(lwp_tramp))
|
|
||||||
mc.__gregs[_REG_RSP] = uint64(uintptr(stk))
|
|
||||||
mc.__gregs[_REG_R8] = uint64(uintptr(unsafe.Pointer(mp)))
|
|
||||||
mc.__gregs[_REG_R9] = uint64(uintptr(unsafe.Pointer(gp)))
|
|
||||||
mc.__gregs[_REG_R12] = uint64(fn)
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
// Copyright 2015 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 runtime
|
|
||||||
|
|
||||||
func checkgoarm() {
|
|
||||||
return // TODO(minux)
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:nosplit
|
|
||||||
func cputicks() int64 {
|
|
||||||
// Currently cputicks() is used in blocking profiler and to seed runtime·fastrand1().
|
|
||||||
// runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
|
|
||||||
// TODO: need more entropy to better seed fastrand1.
|
|
||||||
return nanotime()
|
|
||||||
}
|
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd
|
// +build darwin dragonfly freebsd linux netbsd openbsd
|
||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
// Copyright 2015 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 linux
|
|
||||||
// +build mips64 mips64le
|
|
||||||
|
|
||||||
package runtime
|
|
||||||
|
|
||||||
import (
|
|
||||||
"runtime/internal/sys"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
type sigctxt struct {
|
|
||||||
info *siginfo
|
|
||||||
ctxt unsafe.Pointer
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *sigctxt) regs() *sigcontext { return &(*ucontext)(c.ctxt).uc_mcontext }
|
|
||||||
func (c *sigctxt) r0() uint64 { return c.regs().sc_regs[0] }
|
|
||||||
func (c *sigctxt) r1() uint64 { return c.regs().sc_regs[1] }
|
|
||||||
func (c *sigctxt) r2() uint64 { return c.regs().sc_regs[2] }
|
|
||||||
func (c *sigctxt) r3() uint64 { return c.regs().sc_regs[3] }
|
|
||||||
func (c *sigctxt) r4() uint64 { return c.regs().sc_regs[4] }
|
|
||||||
func (c *sigctxt) r5() uint64 { return c.regs().sc_regs[5] }
|
|
||||||
func (c *sigctxt) r6() uint64 { return c.regs().sc_regs[6] }
|
|
||||||
func (c *sigctxt) r7() uint64 { return c.regs().sc_regs[7] }
|
|
||||||
func (c *sigctxt) r8() uint64 { return c.regs().sc_regs[8] }
|
|
||||||
func (c *sigctxt) r9() uint64 { return c.regs().sc_regs[9] }
|
|
||||||
func (c *sigctxt) r10() uint64 { return c.regs().sc_regs[10] }
|
|
||||||
func (c *sigctxt) r11() uint64 { return c.regs().sc_regs[11] }
|
|
||||||
func (c *sigctxt) r12() uint64 { return c.regs().sc_regs[12] }
|
|
||||||
func (c *sigctxt) r13() uint64 { return c.regs().sc_regs[13] }
|
|
||||||
func (c *sigctxt) r14() uint64 { return c.regs().sc_regs[14] }
|
|
||||||
func (c *sigctxt) r15() uint64 { return c.regs().sc_regs[15] }
|
|
||||||
func (c *sigctxt) r16() uint64 { return c.regs().sc_regs[16] }
|
|
||||||
func (c *sigctxt) r17() uint64 { return c.regs().sc_regs[17] }
|
|
||||||
func (c *sigctxt) r18() uint64 { return c.regs().sc_regs[18] }
|
|
||||||
func (c *sigctxt) r19() uint64 { return c.regs().sc_regs[19] }
|
|
||||||
func (c *sigctxt) r20() uint64 { return c.regs().sc_regs[20] }
|
|
||||||
func (c *sigctxt) r21() uint64 { return c.regs().sc_regs[21] }
|
|
||||||
func (c *sigctxt) r22() uint64 { return c.regs().sc_regs[22] }
|
|
||||||
func (c *sigctxt) r23() uint64 { return c.regs().sc_regs[23] }
|
|
||||||
func (c *sigctxt) r24() uint64 { return c.regs().sc_regs[24] }
|
|
||||||
func (c *sigctxt) r25() uint64 { return c.regs().sc_regs[25] }
|
|
||||||
func (c *sigctxt) r26() uint64 { return c.regs().sc_regs[26] }
|
|
||||||
func (c *sigctxt) r27() uint64 { return c.regs().sc_regs[27] }
|
|
||||||
func (c *sigctxt) r28() uint64 { return c.regs().sc_regs[28] }
|
|
||||||
func (c *sigctxt) r29() uint64 { return c.regs().sc_regs[29] }
|
|
||||||
func (c *sigctxt) r30() uint64 { return c.regs().sc_regs[30] }
|
|
||||||
func (c *sigctxt) r31() uint64 { return c.regs().sc_regs[31] }
|
|
||||||
func (c *sigctxt) sp() uint64 { return c.regs().sc_regs[29] }
|
|
||||||
func (c *sigctxt) pc() uint64 { return c.regs().sc_pc }
|
|
||||||
func (c *sigctxt) link() uint64 { return c.regs().sc_regs[31] }
|
|
||||||
func (c *sigctxt) lo() uint64 { return c.regs().sc_mdlo }
|
|
||||||
func (c *sigctxt) hi() uint64 { return c.regs().sc_mdhi }
|
|
||||||
|
|
||||||
func (c *sigctxt) sigcode() uint32 { return uint32(c.info.si_code) }
|
|
||||||
func (c *sigctxt) sigaddr() uint64 { return c.info.si_addr }
|
|
||||||
|
|
||||||
func (c *sigctxt) set_r30(x uint64) { c.regs().sc_regs[30] = x }
|
|
||||||
func (c *sigctxt) set_pc(x uint64) { c.regs().sc_pc = x }
|
|
||||||
func (c *sigctxt) set_sp(x uint64) { c.regs().sc_regs[29] = x }
|
|
||||||
func (c *sigctxt) set_link(x uint64) { c.regs().sc_regs[31] = x }
|
|
||||||
|
|
||||||
func (c *sigctxt) set_sigcode(x uint32) { c.info.si_code = int32(x) }
|
|
||||||
func (c *sigctxt) set_sigaddr(x uint64) {
|
|
||||||
*(*uintptr)(add(unsafe.Pointer(c.info), 2*sys.PtrSize)) = uintptr(x)
|
|
||||||
}
|
|
@ -1,208 +0,0 @@
|
|||||||
// Copyright 2016 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 runtime
|
|
||||||
|
|
||||||
import (
|
|
||||||
"runtime/internal/sys"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
type sigctxt struct {
|
|
||||||
info *siginfo
|
|
||||||
ctxt unsafe.Pointer
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *sigctxt) regs() *sigcontext {
|
|
||||||
return (*sigcontext)(unsafe.Pointer(&(*ucontext)(c.ctxt).uc_mcontext))
|
|
||||||
}
|
|
||||||
func (c *sigctxt) r0() uint64 { return c.regs().gregs[0] }
|
|
||||||
func (c *sigctxt) r1() uint64 { return c.regs().gregs[1] }
|
|
||||||
func (c *sigctxt) r2() uint64 { return c.regs().gregs[2] }
|
|
||||||
func (c *sigctxt) r3() uint64 { return c.regs().gregs[3] }
|
|
||||||
func (c *sigctxt) r4() uint64 { return c.regs().gregs[4] }
|
|
||||||
func (c *sigctxt) r5() uint64 { return c.regs().gregs[5] }
|
|
||||||
func (c *sigctxt) r6() uint64 { return c.regs().gregs[6] }
|
|
||||||
func (c *sigctxt) r7() uint64 { return c.regs().gregs[7] }
|
|
||||||
func (c *sigctxt) r8() uint64 { return c.regs().gregs[8] }
|
|
||||||
func (c *sigctxt) r9() uint64 { return c.regs().gregs[9] }
|
|
||||||
func (c *sigctxt) r10() uint64 { return c.regs().gregs[10] }
|
|
||||||
func (c *sigctxt) r11() uint64 { return c.regs().gregs[11] }
|
|
||||||
func (c *sigctxt) r12() uint64 { return c.regs().gregs[12] }
|
|
||||||
func (c *sigctxt) r13() uint64 { return c.regs().gregs[13] }
|
|
||||||
func (c *sigctxt) r14() uint64 { return c.regs().gregs[14] }
|
|
||||||
func (c *sigctxt) r15() uint64 { return c.regs().gregs[15] }
|
|
||||||
func (c *sigctxt) link() uint64 { return c.regs().gregs[14] }
|
|
||||||
func (c *sigctxt) sp() uint64 { return c.regs().gregs[15] }
|
|
||||||
func (c *sigctxt) pc() uint64 { return c.regs().psw_addr }
|
|
||||||
func (c *sigctxt) sigcode() uint32 { return uint32(c.info.si_code) }
|
|
||||||
func (c *sigctxt) sigaddr() uint64 { return c.info.si_addr }
|
|
||||||
|
|
||||||
func (c *sigctxt) set_r0(x uint64) { c.regs().gregs[0] = x }
|
|
||||||
func (c *sigctxt) set_r13(x uint64) { c.regs().gregs[13] = x }
|
|
||||||
func (c *sigctxt) set_link(x uint64) { c.regs().gregs[14] = x }
|
|
||||||
func (c *sigctxt) set_sp(x uint64) { c.regs().gregs[15] = x }
|
|
||||||
func (c *sigctxt) set_pc(x uint64) { c.regs().psw_addr = x }
|
|
||||||
func (c *sigctxt) set_sigcode(x uint32) { c.info.si_code = int32(x) }
|
|
||||||
func (c *sigctxt) set_sigaddr(x uint64) {
|
|
||||||
*(*uintptr)(add(unsafe.Pointer(c.info), 2*sys.PtrSize)) = uintptr(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func dumpregs(c *sigctxt) {
|
|
||||||
print("r0 ", hex(c.r0()), "\t")
|
|
||||||
print("r1 ", hex(c.r1()), "\n")
|
|
||||||
print("r2 ", hex(c.r2()), "\t")
|
|
||||||
print("r3 ", hex(c.r3()), "\n")
|
|
||||||
print("r4 ", hex(c.r4()), "\t")
|
|
||||||
print("r5 ", hex(c.r5()), "\n")
|
|
||||||
print("r6 ", hex(c.r6()), "\t")
|
|
||||||
print("r7 ", hex(c.r7()), "\n")
|
|
||||||
print("r8 ", hex(c.r8()), "\t")
|
|
||||||
print("r9 ", hex(c.r9()), "\n")
|
|
||||||
print("r10 ", hex(c.r10()), "\t")
|
|
||||||
print("r11 ", hex(c.r11()), "\n")
|
|
||||||
print("r12 ", hex(c.r12()), "\t")
|
|
||||||
print("r13 ", hex(c.r13()), "\n")
|
|
||||||
print("r14 ", hex(c.r14()), "\t")
|
|
||||||
print("r15 ", hex(c.r15()), "\n")
|
|
||||||
print("pc ", hex(c.pc()), "\t")
|
|
||||||
print("link ", hex(c.link()), "\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
var crashing int32
|
|
||||||
|
|
||||||
// May run during STW, so write barriers are not allowed.
|
|
||||||
//
|
|
||||||
//go:nowritebarrierrec
|
|
||||||
func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
|
||||||
_g_ := getg()
|
|
||||||
c := &sigctxt{info, ctxt}
|
|
||||||
|
|
||||||
if sig == _SIGPROF {
|
|
||||||
sigprof(uintptr(c.pc()), uintptr(c.sp()), uintptr(c.link()), gp, _g_.m)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
flags := int32(_SigThrow)
|
|
||||||
if sig < uint32(len(sigtable)) {
|
|
||||||
flags = sigtable[sig].flags
|
|
||||||
}
|
|
||||||
if c.sigcode() != _SI_USER && flags&_SigPanic != 0 {
|
|
||||||
// Make it look like a call to the signal func.
|
|
||||||
// Have to pass arguments out of band since
|
|
||||||
// augmenting the stack frame would break
|
|
||||||
// the unwinding code.
|
|
||||||
gp.sig = sig
|
|
||||||
gp.sigcode0 = uintptr(c.sigcode())
|
|
||||||
gp.sigcode1 = uintptr(c.sigaddr())
|
|
||||||
gp.sigpc = uintptr(c.pc())
|
|
||||||
|
|
||||||
// We arrange link, and pc to pretend the panicking
|
|
||||||
// function calls sigpanic directly.
|
|
||||||
// Always save LINK to stack so that panics in leaf
|
|
||||||
// functions are correctly handled. This smashes
|
|
||||||
// the stack frame but we're not going back there
|
|
||||||
// anyway.
|
|
||||||
sp := c.sp() - sys.MinFrameSize
|
|
||||||
c.set_sp(sp)
|
|
||||||
*(*uint64)(unsafe.Pointer(uintptr(sp))) = c.link()
|
|
||||||
|
|
||||||
pc := uintptr(gp.sigpc)
|
|
||||||
|
|
||||||
// If we don't recognize the PC as code
|
|
||||||
// but we do recognize the link register as code,
|
|
||||||
// then assume this was a call to non-code and treat like
|
|
||||||
// pc == 0, to make unwinding show the context.
|
|
||||||
if pc != 0 && findfunc(pc) == nil && findfunc(uintptr(c.link())) != nil {
|
|
||||||
pc = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't bother saving PC if it's zero, which is
|
|
||||||
// probably a call to a nil func: the old link register
|
|
||||||
// is more useful in the stack trace.
|
|
||||||
if pc != 0 {
|
|
||||||
c.set_link(uint64(pc))
|
|
||||||
}
|
|
||||||
|
|
||||||
// In case we are panicking from external C code
|
|
||||||
c.set_r0(0)
|
|
||||||
c.set_r13(uint64(uintptr(unsafe.Pointer(gp))))
|
|
||||||
c.set_pc(uint64(funcPC(sigpanic)))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.sigcode() == _SI_USER || flags&_SigNotify != 0 {
|
|
||||||
if sigsend(sig) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.sigcode() == _SI_USER && signal_ignored(sig) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if flags&_SigKill != 0 {
|
|
||||||
dieFromSignal(int32(sig))
|
|
||||||
}
|
|
||||||
|
|
||||||
if flags&_SigThrow == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
_g_.m.throwing = 1
|
|
||||||
_g_.m.caughtsig.set(gp)
|
|
||||||
|
|
||||||
if crashing == 0 {
|
|
||||||
startpanic()
|
|
||||||
}
|
|
||||||
|
|
||||||
if sig < uint32(len(sigtable)) {
|
|
||||||
print(sigtable[sig].name, "\n")
|
|
||||||
} else {
|
|
||||||
print("Signal ", sig, "\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
print("PC=", hex(c.pc()), " m=", _g_.m.id, "\n")
|
|
||||||
if _g_.m.lockedg != nil && _g_.m.ncgo > 0 && gp == _g_.m.g0 {
|
|
||||||
print("signal arrived during cgo execution\n")
|
|
||||||
gp = _g_.m.lockedg
|
|
||||||
}
|
|
||||||
print("\n")
|
|
||||||
|
|
||||||
level, _, docrash := gotraceback()
|
|
||||||
if level > 0 {
|
|
||||||
goroutineheader(gp)
|
|
||||||
tracebacktrap(uintptr(c.pc()), uintptr(c.sp()), uintptr(c.link()), gp)
|
|
||||||
if crashing > 0 && gp != _g_.m.curg && _g_.m.curg != nil && readgstatus(_g_.m.curg)&^_Gscan == _Grunning {
|
|
||||||
// tracebackothers on original m skipped this one; trace it now.
|
|
||||||
goroutineheader(_g_.m.curg)
|
|
||||||
traceback(^uintptr(0), ^uintptr(0), 0, gp)
|
|
||||||
} else if crashing == 0 {
|
|
||||||
tracebackothers(gp)
|
|
||||||
print("\n")
|
|
||||||
}
|
|
||||||
dumpregs(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
if docrash {
|
|
||||||
crashing++
|
|
||||||
if crashing < sched.mcount {
|
|
||||||
// There are other m's that need to dump their stacks.
|
|
||||||
// Relay SIGQUIT to the next m by sending it to the current process.
|
|
||||||
// All m's that have already received SIGQUIT have signal masks blocking
|
|
||||||
// receipt of any signals, so the SIGQUIT will go to an m that hasn't seen it yet.
|
|
||||||
// When the last m receives the SIGQUIT, it will fall through to the call to
|
|
||||||
// crash below. Just in case the relaying gets botched, each m involved in
|
|
||||||
// the relay sleeps for 5 seconds and then does the crash/exit itself.
|
|
||||||
// In expected operation, the last m has received the SIGQUIT and run
|
|
||||||
// crash/exit and the process is gone, all long before any of the
|
|
||||||
// 5-second sleeps have finished.
|
|
||||||
print("\n-----\n\n")
|
|
||||||
raiseproc(_SIGQUIT)
|
|
||||||
usleep(5 * 1000 * 1000)
|
|
||||||
}
|
|
||||||
crash()
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(2)
|
|
||||||
}
|
|
@ -1,188 +0,0 @@
|
|||||||
// Copyright 2015 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 linux
|
|
||||||
// +build mips64 mips64le
|
|
||||||
|
|
||||||
package runtime
|
|
||||||
|
|
||||||
import (
|
|
||||||
"runtime/internal/sys"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
func dumpregs(c *sigctxt) {
|
|
||||||
print("r0 ", hex(c.r0()), "\t")
|
|
||||||
print("r1 ", hex(c.r1()), "\n")
|
|
||||||
print("r2 ", hex(c.r2()), "\t")
|
|
||||||
print("r3 ", hex(c.r3()), "\n")
|
|
||||||
print("r4 ", hex(c.r4()), "\t")
|
|
||||||
print("r5 ", hex(c.r5()), "\n")
|
|
||||||
print("r6 ", hex(c.r6()), "\t")
|
|
||||||
print("r7 ", hex(c.r7()), "\n")
|
|
||||||
print("r8 ", hex(c.r8()), "\t")
|
|
||||||
print("r9 ", hex(c.r9()), "\n")
|
|
||||||
print("r10 ", hex(c.r10()), "\t")
|
|
||||||
print("r11 ", hex(c.r11()), "\n")
|
|
||||||
print("r12 ", hex(c.r12()), "\t")
|
|
||||||
print("r13 ", hex(c.r13()), "\n")
|
|
||||||
print("r14 ", hex(c.r14()), "\t")
|
|
||||||
print("r15 ", hex(c.r15()), "\n")
|
|
||||||
print("r16 ", hex(c.r16()), "\t")
|
|
||||||
print("r17 ", hex(c.r17()), "\n")
|
|
||||||
print("r18 ", hex(c.r18()), "\t")
|
|
||||||
print("r19 ", hex(c.r19()), "\n")
|
|
||||||
print("r20 ", hex(c.r20()), "\t")
|
|
||||||
print("r21 ", hex(c.r21()), "\n")
|
|
||||||
print("r22 ", hex(c.r22()), "\t")
|
|
||||||
print("r23 ", hex(c.r23()), "\n")
|
|
||||||
print("r24 ", hex(c.r24()), "\t")
|
|
||||||
print("r25 ", hex(c.r25()), "\n")
|
|
||||||
print("r26 ", hex(c.r26()), "\t")
|
|
||||||
print("r27 ", hex(c.r27()), "\n")
|
|
||||||
print("r28 ", hex(c.r28()), "\t")
|
|
||||||
print("r29 ", hex(c.r29()), "\n")
|
|
||||||
print("r30 ", hex(c.r30()), "\t")
|
|
||||||
print("r31 ", hex(c.r31()), "\n")
|
|
||||||
print("pc ", hex(c.pc()), "\t")
|
|
||||||
print("link ", hex(c.link()), "\n")
|
|
||||||
print("lo ", hex(c.lo()), "\t")
|
|
||||||
print("hi ", hex(c.hi()), "\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
var crashing int32
|
|
||||||
|
|
||||||
// May run during STW, so write barriers are not allowed.
|
|
||||||
//
|
|
||||||
//go:nowritebarrierrec
|
|
||||||
func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
|
||||||
_g_ := getg()
|
|
||||||
c := &sigctxt{info, ctxt}
|
|
||||||
|
|
||||||
if sig == _SIGPROF {
|
|
||||||
sigprof(uintptr(c.pc()), uintptr(c.sp()), uintptr(c.link()), gp, _g_.m)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
flags := int32(_SigThrow)
|
|
||||||
if sig < uint32(len(sigtable)) {
|
|
||||||
flags = sigtable[sig].flags
|
|
||||||
}
|
|
||||||
if c.sigcode() != _SI_USER && flags&_SigPanic != 0 {
|
|
||||||
// Make it look like a call to the signal func.
|
|
||||||
// Have to pass arguments out of band since
|
|
||||||
// augmenting the stack frame would break
|
|
||||||
// the unwinding code.
|
|
||||||
gp.sig = sig
|
|
||||||
gp.sigcode0 = uintptr(c.sigcode())
|
|
||||||
gp.sigcode1 = uintptr(c.sigaddr())
|
|
||||||
gp.sigpc = uintptr(c.pc())
|
|
||||||
|
|
||||||
// We arrange link, and pc to pretend the panicking
|
|
||||||
// function calls sigpanic directly.
|
|
||||||
// Always save LINK to stack so that panics in leaf
|
|
||||||
// functions are correctly handled. This smashes
|
|
||||||
// the stack frame but we're not going back there
|
|
||||||
// anyway.
|
|
||||||
sp := c.sp() - sys.PtrSize
|
|
||||||
c.set_sp(sp)
|
|
||||||
*(*uint64)(unsafe.Pointer(uintptr(sp))) = c.link()
|
|
||||||
|
|
||||||
pc := gp.sigpc
|
|
||||||
|
|
||||||
// If we don't recognize the PC as code
|
|
||||||
// but we do recognize the link register as code,
|
|
||||||
// then assume this was a call to non-code and treat like
|
|
||||||
// pc == 0, to make unwinding show the context.
|
|
||||||
if pc != 0 && findfunc(pc) == nil && findfunc(uintptr(c.link())) != nil {
|
|
||||||
pc = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't bother saving PC if it's zero, which is
|
|
||||||
// probably a call to a nil func: the old link register
|
|
||||||
// is more useful in the stack trace.
|
|
||||||
if pc != 0 {
|
|
||||||
c.set_link(uint64(pc))
|
|
||||||
}
|
|
||||||
|
|
||||||
// In case we are panicking from external C code
|
|
||||||
c.set_r30(uint64(uintptr(unsafe.Pointer(gp))))
|
|
||||||
c.set_pc(uint64(funcPC(sigpanic)))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.sigcode() == _SI_USER || flags&_SigNotify != 0 {
|
|
||||||
if sigsend(sig) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.sigcode() == _SI_USER && signal_ignored(sig) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if flags&_SigKill != 0 {
|
|
||||||
dieFromSignal(int32(sig))
|
|
||||||
}
|
|
||||||
|
|
||||||
if flags&_SigThrow == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
_g_.m.throwing = 1
|
|
||||||
_g_.m.caughtsig.set(gp)
|
|
||||||
|
|
||||||
if crashing == 0 {
|
|
||||||
startpanic()
|
|
||||||
}
|
|
||||||
|
|
||||||
if sig < uint32(len(sigtable)) {
|
|
||||||
print(sigtable[sig].name, "\n")
|
|
||||||
} else {
|
|
||||||
print("Signal ", sig, "\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
print("PC=", hex(c.pc()), " m=", _g_.m.id, "\n")
|
|
||||||
if _g_.m.lockedg != nil && _g_.m.ncgo > 0 && gp == _g_.m.g0 {
|
|
||||||
print("signal arrived during cgo execution\n")
|
|
||||||
gp = _g_.m.lockedg
|
|
||||||
}
|
|
||||||
print("\n")
|
|
||||||
|
|
||||||
level, _, docrash := gotraceback()
|
|
||||||
if level > 0 {
|
|
||||||
goroutineheader(gp)
|
|
||||||
tracebacktrap(uintptr(c.pc()), uintptr(c.sp()), uintptr(c.link()), gp)
|
|
||||||
if crashing > 0 && gp != _g_.m.curg && _g_.m.curg != nil && readgstatus(_g_.m.curg)&^_Gscan == _Grunning {
|
|
||||||
// tracebackothers on original m skipped this one; trace it now.
|
|
||||||
goroutineheader(_g_.m.curg)
|
|
||||||
traceback(^uintptr(0), ^uintptr(0), 0, gp)
|
|
||||||
} else if crashing == 0 {
|
|
||||||
tracebackothers(gp)
|
|
||||||
print("\n")
|
|
||||||
}
|
|
||||||
dumpregs(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
if docrash {
|
|
||||||
crashing++
|
|
||||||
if crashing < sched.mcount {
|
|
||||||
// There are other m's that need to dump their stacks.
|
|
||||||
// Relay SIGQUIT to the next m by sending it to the current process.
|
|
||||||
// All m's that have already received SIGQUIT have signal masks blocking
|
|
||||||
// receipt of any signals, so the SIGQUIT will go to an m that hasn't seen it yet.
|
|
||||||
// When the last m receives the SIGQUIT, it will fall through to the call to
|
|
||||||
// crash below. Just in case the relaying gets botched, each m involved in
|
|
||||||
// the relay sleeps for 5 seconds and then does the crash/exit itself.
|
|
||||||
// In expected operation, the last m has received the SIGQUIT and run
|
|
||||||
// crash/exit and the process is gone, all long before any of the
|
|
||||||
// 5-second sleeps have finished.
|
|
||||||
print("\n-----\n\n")
|
|
||||||
raiseproc(_SIGQUIT)
|
|
||||||
usleep(5 * 1000 * 1000)
|
|
||||||
}
|
|
||||||
crash()
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(2)
|
|
||||||
}
|
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
// +build dragonfly linux netbsd
|
// +build dragonfly linux netbsd
|
||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
|
@ -1,82 +0,0 @@
|
|||||||
// Copyright 2009 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 !mips64
|
|
||||||
// +build !mips64le
|
|
||||||
// +build linux
|
|
||||||
|
|
||||||
package runtime
|
|
||||||
|
|
||||||
type sigTabT struct {
|
|
||||||
flags int32
|
|
||||||
name string
|
|
||||||
}
|
|
||||||
|
|
||||||
var sigtable = [...]sigTabT{
|
|
||||||
/* 0 */ {0, "SIGNONE: no trap"},
|
|
||||||
/* 1 */ {_SigNotify + _SigKill, "SIGHUP: terminal line hangup"},
|
|
||||||
/* 2 */ {_SigNotify + _SigKill, "SIGINT: interrupt"},
|
|
||||||
/* 3 */ {_SigNotify + _SigThrow, "SIGQUIT: quit"},
|
|
||||||
/* 4 */ {_SigThrow + _SigUnblock, "SIGILL: illegal instruction"},
|
|
||||||
/* 5 */ {_SigThrow + _SigUnblock, "SIGTRAP: trace trap"},
|
|
||||||
/* 6 */ {_SigNotify + _SigThrow, "SIGABRT: abort"},
|
|
||||||
/* 7 */ {_SigPanic + _SigUnblock, "SIGBUS: bus error"},
|
|
||||||
/* 8 */ {_SigPanic + _SigUnblock, "SIGFPE: floating-point exception"},
|
|
||||||
/* 9 */ {0, "SIGKILL: kill"},
|
|
||||||
/* 10 */ {_SigNotify, "SIGUSR1: user-defined signal 1"},
|
|
||||||
/* 11 */ {_SigPanic + _SigUnblock, "SIGSEGV: segmentation violation"},
|
|
||||||
/* 12 */ {_SigNotify, "SIGUSR2: user-defined signal 2"},
|
|
||||||
/* 13 */ {_SigNotify, "SIGPIPE: write to broken pipe"},
|
|
||||||
/* 14 */ {_SigNotify, "SIGALRM: alarm clock"},
|
|
||||||
/* 15 */ {_SigNotify + _SigKill, "SIGTERM: termination"},
|
|
||||||
/* 16 */ {_SigThrow + _SigUnblock, "SIGSTKFLT: stack fault"},
|
|
||||||
/* 17 */ {_SigNotify + _SigUnblock, "SIGCHLD: child status has changed"},
|
|
||||||
/* 18 */ {_SigNotify + _SigDefault, "SIGCONT: continue"},
|
|
||||||
/* 19 */ {0, "SIGSTOP: stop, unblockable"},
|
|
||||||
/* 20 */ {_SigNotify + _SigDefault, "SIGTSTP: keyboard stop"},
|
|
||||||
/* 21 */ {_SigNotify + _SigDefault, "SIGTTIN: background read from tty"},
|
|
||||||
/* 22 */ {_SigNotify + _SigDefault, "SIGTTOU: background write to tty"},
|
|
||||||
/* 23 */ {_SigNotify, "SIGURG: urgent condition on socket"},
|
|
||||||
/* 24 */ {_SigNotify, "SIGXCPU: cpu limit exceeded"},
|
|
||||||
/* 25 */ {_SigNotify, "SIGXFSZ: file size limit exceeded"},
|
|
||||||
/* 26 */ {_SigNotify, "SIGVTALRM: virtual alarm clock"},
|
|
||||||
/* 27 */ {_SigNotify + _SigUnblock, "SIGPROF: profiling alarm clock"},
|
|
||||||
/* 28 */ {_SigNotify, "SIGWINCH: window size change"},
|
|
||||||
/* 29 */ {_SigNotify, "SIGIO: i/o now possible"},
|
|
||||||
/* 30 */ {_SigNotify, "SIGPWR: power failure restart"},
|
|
||||||
/* 31 */ {_SigThrow, "SIGSYS: bad system call"},
|
|
||||||
/* 32 */ {_SigSetStack + _SigUnblock, "signal 32"}, /* SIGCANCEL; see issue 6997 */
|
|
||||||
/* 33 */ {_SigSetStack + _SigUnblock, "signal 33"}, /* SIGSETXID; see issues 3871, 9400, 12498 */
|
|
||||||
/* 34 */ {_SigNotify, "signal 34"},
|
|
||||||
/* 35 */ {_SigNotify, "signal 35"},
|
|
||||||
/* 36 */ {_SigNotify, "signal 36"},
|
|
||||||
/* 37 */ {_SigNotify, "signal 37"},
|
|
||||||
/* 38 */ {_SigNotify, "signal 38"},
|
|
||||||
/* 39 */ {_SigNotify, "signal 39"},
|
|
||||||
/* 40 */ {_SigNotify, "signal 40"},
|
|
||||||
/* 41 */ {_SigNotify, "signal 41"},
|
|
||||||
/* 42 */ {_SigNotify, "signal 42"},
|
|
||||||
/* 43 */ {_SigNotify, "signal 43"},
|
|
||||||
/* 44 */ {_SigNotify, "signal 44"},
|
|
||||||
/* 45 */ {_SigNotify, "signal 45"},
|
|
||||||
/* 46 */ {_SigNotify, "signal 46"},
|
|
||||||
/* 47 */ {_SigNotify, "signal 47"},
|
|
||||||
/* 48 */ {_SigNotify, "signal 48"},
|
|
||||||
/* 49 */ {_SigNotify, "signal 49"},
|
|
||||||
/* 50 */ {_SigNotify, "signal 50"},
|
|
||||||
/* 51 */ {_SigNotify, "signal 51"},
|
|
||||||
/* 52 */ {_SigNotify, "signal 52"},
|
|
||||||
/* 53 */ {_SigNotify, "signal 53"},
|
|
||||||
/* 54 */ {_SigNotify, "signal 54"},
|
|
||||||
/* 55 */ {_SigNotify, "signal 55"},
|
|
||||||
/* 56 */ {_SigNotify, "signal 56"},
|
|
||||||
/* 57 */ {_SigNotify, "signal 57"},
|
|
||||||
/* 58 */ {_SigNotify, "signal 58"},
|
|
||||||
/* 59 */ {_SigNotify, "signal 59"},
|
|
||||||
/* 60 */ {_SigNotify, "signal 60"},
|
|
||||||
/* 61 */ {_SigNotify, "signal 61"},
|
|
||||||
/* 62 */ {_SigNotify, "signal 62"},
|
|
||||||
/* 63 */ {_SigNotify, "signal 63"},
|
|
||||||
/* 64 */ {_SigNotify, "signal 64"},
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
// Copyright 2015 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 mips64 mips64le
|
|
||||||
// +build linux
|
|
||||||
|
|
||||||
package runtime
|
|
||||||
|
|
||||||
type sigTabT struct {
|
|
||||||
flags int32
|
|
||||||
name string
|
|
||||||
}
|
|
||||||
|
|
||||||
var sigtable = [...]sigTabT{
|
|
||||||
/* 0 */ {0, "SIGNONE: no trap"},
|
|
||||||
/* 1 */ {_SigNotify + _SigKill, "SIGHUP: terminal line hangup"},
|
|
||||||
/* 2 */ {_SigNotify + _SigKill, "SIGINT: interrupt"},
|
|
||||||
/* 3 */ {_SigNotify + _SigThrow, "SIGQUIT: quit"},
|
|
||||||
/* 4 */ {_SigThrow + _SigUnblock, "SIGILL: illegal instruction"},
|
|
||||||
/* 5 */ {_SigThrow + _SigUnblock, "SIGTRAP: trace trap"},
|
|
||||||
/* 6 */ {_SigNotify + _SigThrow, "SIGABRT: abort"},
|
|
||||||
/* 7 */ {_SigThrow, "SIGEMT"},
|
|
||||||
/* 8 */ {_SigPanic + _SigUnblock, "SIGFPE: floating-point exception"},
|
|
||||||
/* 9 */ {0, "SIGKILL: kill"},
|
|
||||||
/* 10 */ {_SigPanic + _SigUnblock, "SIGBUS: bus error"},
|
|
||||||
/* 11 */ {_SigPanic + _SigUnblock, "SIGSEGV: segmentation violation"},
|
|
||||||
/* 12 */ {_SigThrow, "SIGSYS: bad system call"},
|
|
||||||
/* 13 */ {_SigNotify, "SIGPIPE: write to broken pipe"},
|
|
||||||
/* 14 */ {_SigNotify, "SIGALRM: alarm clock"},
|
|
||||||
/* 15 */ {_SigNotify + _SigKill, "SIGTERM: termination"},
|
|
||||||
/* 16 */ {_SigNotify, "SIGUSR1: user-defined signal 1"},
|
|
||||||
/* 17 */ {_SigNotify, "SIGUSR2: user-defined signal 2"},
|
|
||||||
/* 18 */ {_SigNotify + _SigUnblock, "SIGCHLD: child status has changed"},
|
|
||||||
/* 19 */ {_SigNotify, "SIGPWR: power failure restart"},
|
|
||||||
/* 20 */ {_SigNotify, "SIGWINCH: window size change"},
|
|
||||||
/* 21 */ {_SigNotify, "SIGURG: urgent condition on socket"},
|
|
||||||
/* 22 */ {_SigNotify, "SIGIO: i/o now possible"},
|
|
||||||
/* 23 */ {0, "SIGSTOP: stop, unblockable"},
|
|
||||||
/* 24 */ {_SigNotify + _SigDefault, "SIGTSTP: keyboard stop"},
|
|
||||||
/* 25 */ {_SigNotify + _SigDefault, "SIGCONT: continue"},
|
|
||||||
/* 26 */ {_SigNotify + _SigDefault, "SIGTTIN: background read from tty"},
|
|
||||||
/* 27 */ {_SigNotify + _SigDefault, "SIGTTOU: background write to tty"},
|
|
||||||
/* 28 */ {_SigNotify, "SIGVTALRM: virtual alarm clock"},
|
|
||||||
/* 29 */ {_SigNotify + _SigUnblock, "SIGPROF: profiling alarm clock"},
|
|
||||||
/* 30 */ {_SigNotify, "SIGXCPU: cpu limit exceeded"},
|
|
||||||
/* 31 */ {_SigNotify, "SIGXFSZ: file size limit exceeded"},
|
|
||||||
/* 32 */ {_SigSetStack + _SigUnblock, "signal 32"}, /* SIGCANCEL; see issue 6997 */
|
|
||||||
/* 33 */ {_SigSetStack + _SigUnblock, "signal 33"}, /* SIGSETXID; see issues 3871, 9400, 12498 */
|
|
||||||
/* 34 */ {_SigNotify, "signal 34"},
|
|
||||||
/* 35 */ {_SigNotify, "signal 35"},
|
|
||||||
/* 36 */ {_SigNotify, "signal 36"},
|
|
||||||
/* 37 */ {_SigNotify, "signal 37"},
|
|
||||||
/* 38 */ {_SigNotify, "signal 38"},
|
|
||||||
/* 39 */ {_SigNotify, "signal 39"},
|
|
||||||
/* 40 */ {_SigNotify, "signal 40"},
|
|
||||||
/* 41 */ {_SigNotify, "signal 41"},
|
|
||||||
/* 42 */ {_SigNotify, "signal 42"},
|
|
||||||
/* 43 */ {_SigNotify, "signal 43"},
|
|
||||||
/* 44 */ {_SigNotify, "signal 44"},
|
|
||||||
/* 45 */ {_SigNotify, "signal 45"},
|
|
||||||
/* 46 */ {_SigNotify, "signal 46"},
|
|
||||||
/* 47 */ {_SigNotify, "signal 47"},
|
|
||||||
/* 48 */ {_SigNotify, "signal 48"},
|
|
||||||
/* 49 */ {_SigNotify, "signal 49"},
|
|
||||||
/* 50 */ {_SigNotify, "signal 50"},
|
|
||||||
/* 51 */ {_SigNotify, "signal 51"},
|
|
||||||
/* 52 */ {_SigNotify, "signal 52"},
|
|
||||||
/* 53 */ {_SigNotify, "signal 53"},
|
|
||||||
/* 54 */ {_SigNotify, "signal 54"},
|
|
||||||
/* 55 */ {_SigNotify, "signal 55"},
|
|
||||||
/* 56 */ {_SigNotify, "signal 56"},
|
|
||||||
/* 57 */ {_SigNotify, "signal 57"},
|
|
||||||
/* 58 */ {_SigNotify, "signal 58"},
|
|
||||||
/* 59 */ {_SigNotify, "signal 59"},
|
|
||||||
/* 60 */ {_SigNotify, "signal 60"},
|
|
||||||
/* 61 */ {_SigNotify, "signal 61"},
|
|
||||||
/* 62 */ {_SigNotify, "signal 62"},
|
|
||||||
/* 63 */ {_SigNotify, "signal 63"},
|
|
||||||
/* 64 */ {_SigNotify, "signal 64"},
|
|
||||||
}
|
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
// Copyright 2015 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 mips64 mips64le
|
|
||||||
|
|
||||||
package runtime
|
|
||||||
|
|
||||||
import "unsafe"
|
|
||||||
|
|
||||||
// adjust Gobuf as if it executed a call to fn with context ctxt
|
|
||||||
// and then did an immediate Gosave.
|
|
||||||
func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) {
|
|
||||||
if buf.lr != 0 {
|
|
||||||
throw("invalid use of gostartcall")
|
|
||||||
}
|
|
||||||
buf.lr = buf.pc
|
|
||||||
buf.pc = uintptr(fn)
|
|
||||||
buf.ctxt = ctxt
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called to rewind context saved during morestack back to beginning of function.
|
|
||||||
// To help us, the linker emits a jmp back to the beginning right after the
|
|
||||||
// call to morestack. We just have to decode and apply that jump.
|
|
||||||
func rewindmorestack(buf *gobuf) {
|
|
||||||
var inst uint32
|
|
||||||
if buf.pc&3 == 0 && buf.pc != 0 {
|
|
||||||
inst = *(*uint32)(unsafe.Pointer(buf.pc))
|
|
||||||
if inst>>26 == 2 { // JMP addr
|
|
||||||
//print("runtime: rewind pc=", hex(buf.pc), " to pc=", hex(buf.pc &^ uintptr(1<<28-1) | uintptr((inst&^0xfc000000)<<2)), "\n");
|
|
||||||
buf.pc &^= 1<<28 - 1
|
|
||||||
buf.pc |= uintptr((inst &^ 0xfc000000) << 2)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if inst>>16 == 0x1000 { // BEQ R0, R0, offset
|
|
||||||
//print("runtime: rewind pc=", hex(buf.pc), " to pc=", hex(buf.pc + uintptr(int32(int16(inst&0xffff))<<2 + 4)), "\n");
|
|
||||||
buf.pc += uintptr(int32(int16(inst&0xffff))<<2 + 4)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print("runtime: pc=", hex(buf.pc), " ", hex(inst), "\n")
|
|
||||||
throw("runtime: misuse of rewindmorestack")
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
// Copyright 2015 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 runtime
|
|
||||||
|
|
||||||
func prepGoExitFrame(sp uintptr) {
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
// Copyright 2016 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 runtime
|
|
||||||
|
|
||||||
import "unsafe"
|
|
||||||
|
|
||||||
// adjust Gobuf as if it executed a call to fn with context ctxt
|
|
||||||
// and then did an immediate Gosave.
|
|
||||||
func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) {
|
|
||||||
if buf.lr != 0 {
|
|
||||||
throw("invalid use of gostartcall")
|
|
||||||
}
|
|
||||||
buf.lr = buf.pc
|
|
||||||
buf.pc = uintptr(fn)
|
|
||||||
buf.ctxt = ctxt
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called to rewind context saved during morestack back to beginning of function.
|
|
||||||
// To help us, the linker emits a jmp back to the beginning right after the
|
|
||||||
// call to morestack. We just have to decode and apply that jump.
|
|
||||||
func rewindmorestack(buf *gobuf) {
|
|
||||||
var inst uint64
|
|
||||||
if buf.pc&1 == 0 && buf.pc != 0 {
|
|
||||||
inst = *(*uint64)(unsafe.Pointer(buf.pc))
|
|
||||||
switch inst >> 48 {
|
|
||||||
case 0xa7f4: // BRC (branch relative on condition) instruction.
|
|
||||||
inst >>= 32
|
|
||||||
inst &= 0xFFFF
|
|
||||||
offset := int64(int16(inst))
|
|
||||||
offset <<= 1
|
|
||||||
buf.pc += uintptr(offset)
|
|
||||||
return
|
|
||||||
case 0xc0f4: // BRCL (branch relative on condition long) instruction.
|
|
||||||
inst >>= 16
|
|
||||||
inst = inst & 0xFFFFFFFF
|
|
||||||
inst = (inst << 1) & 0xFFFFFFFF
|
|
||||||
buf.pc += uintptr(int32(inst))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print("runtime: pc=", hex(buf.pc), " ", hex(inst), "\n")
|
|
||||||
throw("runtime: misuse of rewindmorestack")
|
|
||||||
}
|
|
@ -1,257 +0,0 @@
|
|||||||
// Inferno's libkern/vlrt-arm.c
|
|
||||||
// http://code.google.com/p/inferno-os/source/browse/libkern/vlrt-arm.c
|
|
||||||
//
|
|
||||||
// Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
|
|
||||||
// Revisions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com). All rights reserved.
|
|
||||||
// Portions Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
// +build arm 386
|
|
||||||
|
|
||||||
package runtime
|
|
||||||
|
|
||||||
import "unsafe"
|
|
||||||
|
|
||||||
const (
|
|
||||||
sign32 = 1 << (32 - 1)
|
|
||||||
sign64 = 1 << (64 - 1)
|
|
||||||
)
|
|
||||||
|
|
||||||
func float64toint64(d float64) (y uint64) {
|
|
||||||
_d2v(&y, d)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func float64touint64(d float64) (y uint64) {
|
|
||||||
_d2v(&y, d)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func int64tofloat64(y int64) float64 {
|
|
||||||
if y < 0 {
|
|
||||||
return -uint64tofloat64(-uint64(y))
|
|
||||||
}
|
|
||||||
return uint64tofloat64(uint64(y))
|
|
||||||
}
|
|
||||||
|
|
||||||
func uint64tofloat64(y uint64) float64 {
|
|
||||||
hi := float64(uint32(y >> 32))
|
|
||||||
lo := float64(uint32(y))
|
|
||||||
d := hi*(1<<32) + lo
|
|
||||||
return d
|
|
||||||
}
|
|
||||||
|
|
||||||
func _d2v(y *uint64, d float64) {
|
|
||||||
x := *(*uint64)(unsafe.Pointer(&d))
|
|
||||||
|
|
||||||
xhi := uint32(x>>32)&0xfffff | 0x100000
|
|
||||||
xlo := uint32(x)
|
|
||||||
sh := 1075 - int32(uint32(x>>52)&0x7ff)
|
|
||||||
|
|
||||||
var ylo, yhi uint32
|
|
||||||
if sh >= 0 {
|
|
||||||
sh := uint32(sh)
|
|
||||||
/* v = (hi||lo) >> sh */
|
|
||||||
if sh < 32 {
|
|
||||||
if sh == 0 {
|
|
||||||
ylo = xlo
|
|
||||||
yhi = xhi
|
|
||||||
} else {
|
|
||||||
ylo = xlo>>sh | xhi<<(32-sh)
|
|
||||||
yhi = xhi >> sh
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if sh == 32 {
|
|
||||||
ylo = xhi
|
|
||||||
} else if sh < 64 {
|
|
||||||
ylo = xhi >> (sh - 32)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* v = (hi||lo) << -sh */
|
|
||||||
sh := uint32(-sh)
|
|
||||||
if sh <= 11 {
|
|
||||||
ylo = xlo << sh
|
|
||||||
yhi = xhi<<sh | xlo>>(32-sh)
|
|
||||||
} else {
|
|
||||||
/* overflow */
|
|
||||||
yhi = uint32(d) /* causes something awful */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if x&sign64 != 0 {
|
|
||||||
if ylo != 0 {
|
|
||||||
ylo = -ylo
|
|
||||||
yhi = ^yhi
|
|
||||||
} else {
|
|
||||||
yhi = -yhi
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*y = uint64(yhi)<<32 | uint64(ylo)
|
|
||||||
}
|
|
||||||
|
|
||||||
func uint64div(n, d uint64) uint64 {
|
|
||||||
// Check for 32 bit operands
|
|
||||||
if uint32(n>>32) == 0 && uint32(d>>32) == 0 {
|
|
||||||
if uint32(d) == 0 {
|
|
||||||
panicdivide()
|
|
||||||
}
|
|
||||||
return uint64(uint32(n) / uint32(d))
|
|
||||||
}
|
|
||||||
q, _ := dodiv(n, d)
|
|
||||||
return q
|
|
||||||
}
|
|
||||||
|
|
||||||
func uint64mod(n, d uint64) uint64 {
|
|
||||||
// Check for 32 bit operands
|
|
||||||
if uint32(n>>32) == 0 && uint32(d>>32) == 0 {
|
|
||||||
if uint32(d) == 0 {
|
|
||||||
panicdivide()
|
|
||||||
}
|
|
||||||
return uint64(uint32(n) % uint32(d))
|
|
||||||
}
|
|
||||||
_, r := dodiv(n, d)
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
|
|
||||||
func int64div(n, d int64) int64 {
|
|
||||||
// Check for 32 bit operands
|
|
||||||
if int64(int32(n)) == n && int64(int32(d)) == d {
|
|
||||||
if int32(n) == -0x80000000 && int32(d) == -1 {
|
|
||||||
// special case: 32-bit -0x80000000 / -1 = -0x80000000,
|
|
||||||
// but 64-bit -0x80000000 / -1 = 0x80000000.
|
|
||||||
return 0x80000000
|
|
||||||
}
|
|
||||||
if int32(d) == 0 {
|
|
||||||
panicdivide()
|
|
||||||
}
|
|
||||||
return int64(int32(n) / int32(d))
|
|
||||||
}
|
|
||||||
|
|
||||||
nneg := n < 0
|
|
||||||
dneg := d < 0
|
|
||||||
if nneg {
|
|
||||||
n = -n
|
|
||||||
}
|
|
||||||
if dneg {
|
|
||||||
d = -d
|
|
||||||
}
|
|
||||||
uq, _ := dodiv(uint64(n), uint64(d))
|
|
||||||
q := int64(uq)
|
|
||||||
if nneg != dneg {
|
|
||||||
q = -q
|
|
||||||
}
|
|
||||||
return q
|
|
||||||
}
|
|
||||||
|
|
||||||
func int64mod(n, d int64) int64 {
|
|
||||||
// Check for 32 bit operands
|
|
||||||
if int64(int32(n)) == n && int64(int32(d)) == d {
|
|
||||||
if int32(d) == 0 {
|
|
||||||
panicdivide()
|
|
||||||
}
|
|
||||||
return int64(int32(n) % int32(d))
|
|
||||||
}
|
|
||||||
|
|
||||||
nneg := n < 0
|
|
||||||
if nneg {
|
|
||||||
n = -n
|
|
||||||
}
|
|
||||||
if d < 0 {
|
|
||||||
d = -d
|
|
||||||
}
|
|
||||||
_, ur := dodiv(uint64(n), uint64(d))
|
|
||||||
r := int64(ur)
|
|
||||||
if nneg {
|
|
||||||
r = -r
|
|
||||||
}
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:noescape
|
|
||||||
func _mul64by32(lo64 *uint64, a uint64, b uint32) (hi32 uint32)
|
|
||||||
|
|
||||||
//go:noescape
|
|
||||||
func _div64by32(a uint64, b uint32, r *uint32) (q uint32)
|
|
||||||
|
|
||||||
func dodiv(n, d uint64) (q, r uint64) {
|
|
||||||
if GOARCH == "arm" {
|
|
||||||
// arm doesn't have a division instruction, so
|
|
||||||
// slowdodiv is the best that we can do.
|
|
||||||
return slowdodiv(n, d)
|
|
||||||
}
|
|
||||||
|
|
||||||
if d > n {
|
|
||||||
return 0, n
|
|
||||||
}
|
|
||||||
|
|
||||||
if uint32(d>>32) != 0 {
|
|
||||||
t := uint32(n>>32) / uint32(d>>32)
|
|
||||||
var lo64 uint64
|
|
||||||
hi32 := _mul64by32(&lo64, d, t)
|
|
||||||
if hi32 != 0 || lo64 > n {
|
|
||||||
return slowdodiv(n, d)
|
|
||||||
}
|
|
||||||
return uint64(t), n - lo64
|
|
||||||
}
|
|
||||||
|
|
||||||
// d is 32 bit
|
|
||||||
var qhi uint32
|
|
||||||
if uint32(n>>32) >= uint32(d) {
|
|
||||||
if uint32(d) == 0 {
|
|
||||||
panicdivide()
|
|
||||||
}
|
|
||||||
qhi = uint32(n>>32) / uint32(d)
|
|
||||||
n -= uint64(uint32(d)*qhi) << 32
|
|
||||||
} else {
|
|
||||||
qhi = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
var rlo uint32
|
|
||||||
qlo := _div64by32(n, uint32(d), &rlo)
|
|
||||||
return uint64(qhi)<<32 + uint64(qlo), uint64(rlo)
|
|
||||||
}
|
|
||||||
|
|
||||||
func slowdodiv(n, d uint64) (q, r uint64) {
|
|
||||||
if d == 0 {
|
|
||||||
panicdivide()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up the divisor and find the number of iterations needed.
|
|
||||||
capn := n
|
|
||||||
if n >= sign64 {
|
|
||||||
capn = sign64
|
|
||||||
}
|
|
||||||
i := 0
|
|
||||||
for d < capn {
|
|
||||||
d <<= 1
|
|
||||||
i++
|
|
||||||
}
|
|
||||||
|
|
||||||
for ; i >= 0; i-- {
|
|
||||||
q <<= 1
|
|
||||||
if n >= d {
|
|
||||||
n -= d
|
|
||||||
q |= 1
|
|
||||||
}
|
|
||||||
d >>= 1
|
|
||||||
}
|
|
||||||
return q, n
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
// Copyright 2009 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
|
|
||||||
|
|
||||||
package runtime
|
|
||||||
|
|
||||||
import "unsafe"
|
|
||||||
|
|
||||||
func writeErr(b []byte) {
|
|
||||||
write(2, unsafe.Pointer(&b[0]), int32(len(b)))
|
|
||||||
}
|
|
@ -1,160 +0,0 @@
|
|||||||
// 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 runtime
|
|
||||||
|
|
||||||
import "unsafe"
|
|
||||||
|
|
||||||
var (
|
|
||||||
writeHeader = []byte{6 /* ANDROID_LOG_ERROR */, 'G', 'o', 0}
|
|
||||||
writePath = []byte("/dev/log/main\x00")
|
|
||||||
writeLogd = []byte("/dev/socket/logdw\x00")
|
|
||||||
|
|
||||||
// guarded by printlock/printunlock.
|
|
||||||
writeFD uintptr
|
|
||||||
writeBuf [1024]byte
|
|
||||||
writePos int
|
|
||||||
)
|
|
||||||
|
|
||||||
// Prior to Android-L, logging was done through writes to /dev/log files implemented
|
|
||||||
// in kernel ring buffers. In Android-L, those /dev/log files are no longer
|
|
||||||
// accessible and logging is done through a centralized user-mode logger, logd.
|
|
||||||
//
|
|
||||||
// https://android.googlesource.com/platform/system/core/+/master/liblog/logd_write.c
|
|
||||||
type loggerType int32
|
|
||||||
|
|
||||||
const (
|
|
||||||
unknown loggerType = iota
|
|
||||||
legacy
|
|
||||||
logd
|
|
||||||
// TODO(hakim): logging for emulator?
|
|
||||||
)
|
|
||||||
|
|
||||||
var logger loggerType
|
|
||||||
|
|
||||||
func writeErr(b []byte) {
|
|
||||||
if logger == unknown {
|
|
||||||
// Use logd if /dev/socket/logdw is available.
|
|
||||||
if v := uintptr(access(&writeLogd[0], 0x02 /* W_OK */)); v == 0 {
|
|
||||||
logger = logd
|
|
||||||
initLogd()
|
|
||||||
} else {
|
|
||||||
logger = legacy
|
|
||||||
initLegacy()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write to stderr for command-line programs.
|
|
||||||
write(2, unsafe.Pointer(&b[0]), int32(len(b)))
|
|
||||||
|
|
||||||
// Log format: "<header>\x00<message m bytes>\x00"
|
|
||||||
//
|
|
||||||
// <header>
|
|
||||||
// In legacy mode: "<priority 1 byte><tag n bytes>".
|
|
||||||
// In logd mode: "<android_log_header_t 11 bytes><priority 1 byte><tag n bytes>"
|
|
||||||
//
|
|
||||||
// The entire log needs to be delivered in a single syscall (the NDK
|
|
||||||
// does this with writev). Each log is its own line, so we need to
|
|
||||||
// buffer writes until we see a newline.
|
|
||||||
var hlen int
|
|
||||||
switch logger {
|
|
||||||
case logd:
|
|
||||||
hlen = writeLogdHeader()
|
|
||||||
case legacy:
|
|
||||||
hlen = len(writeHeader)
|
|
||||||
}
|
|
||||||
|
|
||||||
dst := writeBuf[hlen:]
|
|
||||||
for _, v := range b {
|
|
||||||
if v == 0 { // android logging won't print a zero byte
|
|
||||||
v = '0'
|
|
||||||
}
|
|
||||||
dst[writePos] = v
|
|
||||||
writePos++
|
|
||||||
if v == '\n' || writePos == len(dst)-1 {
|
|
||||||
dst[writePos] = 0
|
|
||||||
write(writeFD, unsafe.Pointer(&writeBuf[0]), int32(hlen+writePos))
|
|
||||||
memclrBytes(dst)
|
|
||||||
writePos = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func initLegacy() {
|
|
||||||
// In legacy mode, logs are written to /dev/log/main
|
|
||||||
writeFD = uintptr(open(&writePath[0], 0x1 /* O_WRONLY */, 0))
|
|
||||||
if writeFD == 0 {
|
|
||||||
// It is hard to do anything here. Write to stderr just
|
|
||||||
// in case user has root on device and has run
|
|
||||||
// adb shell setprop log.redirect-stdio true
|
|
||||||
msg := []byte("runtime: cannot open /dev/log/main\x00")
|
|
||||||
write(2, unsafe.Pointer(&msg[0]), int32(len(msg)))
|
|
||||||
exit(2)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prepopulate the invariant header part.
|
|
||||||
copy(writeBuf[:len(writeHeader)], writeHeader)
|
|
||||||
}
|
|
||||||
|
|
||||||
// used in initLogdWrite but defined here to avoid heap allocation.
|
|
||||||
var logdAddr sockaddr_un
|
|
||||||
|
|
||||||
func initLogd() {
|
|
||||||
// In logd mode, logs are sent to the logd via a unix domain socket.
|
|
||||||
logdAddr.family = _AF_UNIX
|
|
||||||
copy(logdAddr.path[:], writeLogd)
|
|
||||||
|
|
||||||
// We are not using non-blocking I/O because writes taking this path
|
|
||||||
// are most likely triggered by panic, we cannot think of the advantage of
|
|
||||||
// non-blocking I/O for panic but see disadvantage (dropping panic message),
|
|
||||||
// and blocking I/O simplifies the code a lot.
|
|
||||||
fd := socket(_AF_UNIX, _SOCK_DGRAM|_O_CLOEXEC, 0)
|
|
||||||
if fd < 0 {
|
|
||||||
msg := []byte("runtime: cannot create a socket for logging\x00")
|
|
||||||
write(2, unsafe.Pointer(&msg[0]), int32(len(msg)))
|
|
||||||
exit(2)
|
|
||||||
}
|
|
||||||
|
|
||||||
errno := connect(fd, unsafe.Pointer(&logdAddr), int32(unsafe.Sizeof(logdAddr)))
|
|
||||||
if errno < 0 {
|
|
||||||
msg := []byte("runtime: cannot connect to /dev/socket/logdw\x00")
|
|
||||||
write(2, unsafe.Pointer(&msg[0]), int32(len(msg)))
|
|
||||||
// TODO(hakim): or should we just close fd and hope for better luck next time?
|
|
||||||
exit(2)
|
|
||||||
}
|
|
||||||
writeFD = uintptr(fd)
|
|
||||||
|
|
||||||
// Prepopulate invariant part of the header.
|
|
||||||
// The first 11 bytes will be populated later in writeLogdHeader.
|
|
||||||
copy(writeBuf[11:11+len(writeHeader)], writeHeader)
|
|
||||||
}
|
|
||||||
|
|
||||||
// writeLogdHeader populates the header and returns the length of the payload.
|
|
||||||
func writeLogdHeader() int {
|
|
||||||
hdr := writeBuf[:11]
|
|
||||||
|
|
||||||
// The first 11 bytes of the header corresponds to android_log_header_t
|
|
||||||
// as defined in system/core/include/private/android_logger.h
|
|
||||||
// hdr[0] log type id (unsigned char), defined in <log/log.h>
|
|
||||||
// hdr[1:2] tid (uint16_t)
|
|
||||||
// hdr[3:11] log_time defined in <log/log_read.h>
|
|
||||||
// hdr[3:7] sec unsigned uint32, little endian.
|
|
||||||
// hdr[7:11] nsec unsigned uint32, little endian.
|
|
||||||
hdr[0] = 0 // LOG_ID_MAIN
|
|
||||||
sec, nsec := time_now()
|
|
||||||
packUint32(hdr[3:7], uint32(sec))
|
|
||||||
packUint32(hdr[7:11], uint32(nsec))
|
|
||||||
|
|
||||||
// TODO(hakim): hdr[1:2] = gettid?
|
|
||||||
|
|
||||||
return 11 + len(writeHeader)
|
|
||||||
}
|
|
||||||
|
|
||||||
func packUint32(b []byte, v uint32) {
|
|
||||||
// little-endian.
|
|
||||||
b[0] = byte(v)
|
|
||||||
b[1] = byte(v >> 8)
|
|
||||||
b[2] = byte(v >> 16)
|
|
||||||
b[3] = byte(v >> 24)
|
|
||||||
}
|
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
package strings
|
package strings
|
||||||
|
|
||||||
// indexShortStr returns the index of the first instance of c in s, or -1 if c is not present in s.
|
// indexShortStr returns the index of the first instance of c in s, or -1 if c is not present in s.
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !amd64
|
|
||||||
|
|
||||||
package strings
|
package strings
|
||||||
|
|
||||||
// TODO: implements short string optimization on non amd64 platforms
|
// TODO: implements short string optimization on non amd64 platforms
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !linux
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
//sysnb strerror_r(errnum int, buf []byte) (err Errno)
|
//sysnb strerror_r(errnum int, buf []byte) (err Errno)
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
// errstr_rtems.go -- RTEMS specific error strings.
|
// errstr_linux.go -- GNU/Linux specific error strings.
|
||||||
|
|
||||||
// Copyright 2010 The Go Authors. All rights reserved.
|
// Copyright 2010 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// We use this rather than errstr.go because on GNU/Linux sterror_r
|
||||||
|
// returns a pointer to the error message, and may not use buf at all.
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
import "unsafe"
|
import "unsafe"
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
// errstr.go -- Error strings when there is no strerror_r.
|
|
||||||
|
|
||||||
// Copyright 2011 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 syscall
|
|
||||||
|
|
||||||
import (
|
|
||||||
"sync"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
//sysnb strerror(errnum int) (buf *byte)
|
|
||||||
//strerror(errnum _C_int) *byte
|
|
||||||
|
|
||||||
var errstr_lock sync.Mutex
|
|
||||||
|
|
||||||
func Errstr(errno int) string {
|
|
||||||
errstr_lock.Lock()
|
|
||||||
|
|
||||||
bp := strerror(errno)
|
|
||||||
b := (*[1000]byte)(unsafe.Pointer(bp))
|
|
||||||
i := 0
|
|
||||||
for b[i] != 0 {
|
|
||||||
i++
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
|
||||||
var s string
|
|
||||||
if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
|
|
||||||
c := b[0] + 'a' - 'A'
|
|
||||||
s = string(c) + string(b[1:i])
|
|
||||||
} else {
|
|
||||||
s = string(b[:i])
|
|
||||||
}
|
|
||||||
|
|
||||||
errstr_lock.Unlock()
|
|
||||||
|
|
||||||
return s
|
|
||||||
}
|
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd netbsd openbsd
|
// +build darwin dragonfly freebsd netbsd openbsd solaris
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build rtems
|
||||||
|
|
||||||
// Stubs for fork, exec and wait.
|
// Stubs for fork, exec and wait.
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin dragonfly freebsd netbsd openbsd solaris
|
||||||
|
|
||||||
// BSD library calls.
|
// BSD library calls.
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build irix
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
//sysnb raw_ptrace(request int, pid int, addr *byte, data *byte) (err Errno)
|
//sysnb raw_ptrace(request int, pid int, addr *byte, data *byte) (err Errno)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
// GNU/Linux library ustat call.
|
// GNU/Linux library ustat call.
|
||||||
// This is not supported on some kernels, such as arm64.
|
// This is not supported on some kernels, such as arm64.
|
||||||
|
// +build !arm64
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build linux solaris,386 solaris,sparc
|
||||||
|
|
||||||
// POSIX library calls on systems which use the largefile interface.
|
// POSIX library calls on systems which use the largefile interface.
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !linux
|
||||||
|
// +build !solaris !386
|
||||||
|
// +build !solaris !sparc
|
||||||
|
|
||||||
// POSIX library calls on systems which do not use the largefile
|
// POSIX library calls on systems which do not use the largefile
|
||||||
// interface.
|
// interface.
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin dragonfly freebsd openbsd netbsd solaris
|
||||||
|
|
||||||
// General POSIX version of UtimesNano.
|
// General POSIX version of UtimesNano.
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Build on all systems other than solaris/386.
|
||||||
|
// 32-bit Solaris 2/x86 needs _nuname, handled in libcall_solaris_386.go.
|
||||||
|
// +build !386 !solaris
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
//sysnb Uname(buf *Utsname) (err error)
|
//sysnb Uname(buf *Utsname) (err error)
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright 2009 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.
|
|
||||||
|
|
||||||
// For systems with the waitpid library call.
|
|
||||||
|
|
||||||
package syscall
|
|
||||||
|
|
||||||
//sys waitpid(pid Pid_t, status *_C_int, options int) (wpid Pid_t, err error)
|
|
||||||
//waitpid(pid Pid_t, status *_C_int, options _C_int) Pid_t
|
|
||||||
|
|
||||||
func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
|
|
||||||
var status _C_int
|
|
||||||
r, err := waitpid(Pid_t(pid), &status, options)
|
|
||||||
wpid = int(r)
|
|
||||||
if wstatus != nil {
|
|
||||||
*wstatus = WaitStatus(status)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright 2015 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 msan
|
|
||||||
|
|
||||||
package syscall
|
|
||||||
|
|
||||||
import (
|
|
||||||
"runtime"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
const msanenabled = true
|
|
||||||
|
|
||||||
func msanRead(addr unsafe.Pointer, len int) {
|
|
||||||
runtime.MSanRead(addr, len)
|
|
||||||
}
|
|
||||||
|
|
||||||
func msanWrite(addr unsafe.Pointer, len int) {
|
|
||||||
runtime.MSanWrite(addr, len)
|
|
||||||
}
|
|
@ -4,6 +4,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build rtems
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
func Sleep(nsec int64) (err error) {
|
func Sleep(nsec int64) (err error) {
|
||||||
|
@ -4,10 +4,12 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !rtems
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
func Sleep(nsec int64) (err error) {
|
func Sleep(nsec int64) (err error) {
|
||||||
tv := NsecToTimeval(nsec);
|
tv := NsecToTimeval(nsec)
|
||||||
_, err = Select(0, nil, nil, nil, &tv);
|
_, err = Select(0, nil, nil, nil, &tv)
|
||||||
return err;
|
return err
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin dragonfly freebsd openbsd netbsd
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
const SizeofSockaddrInet4 = 16
|
const SizeofSockaddrInet4 = 16
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build irix
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
const SizeofSockaddrInet4 = 16
|
const SizeofSockaddrInet4 = 16
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user