[project] change syscall to /x/sys/unix|windows

Changes most references of syscall to golang.org/x/sys/
Ones aren't changes include, Errno, Signal and SysProcAttr
as they haven't been implemented in /x/sys/.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>

[s390x] switch utsname from unsigned to signed

per 33267e036f
char in s390x in the /x/sys/unix package is now signed, so
change the buildtags

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
This commit is contained in:
Christopher Jones
2017-05-23 10:22:32 -04:00
parent 6978a6e25a
commit 069fdc8a08
93 changed files with 499 additions and 474 deletions

View File

@@ -6,8 +6,9 @@ import (
"fmt"
"io/ioutil"
"os"
"syscall"
"unsafe"
"golang.org/x/sys/unix"
)
func locateDummyIfEmpty(path string) (string, error) {
@@ -40,9 +41,9 @@ func SupportsDType(path string) (bool, error) {
visited := 0
supportsDType := true
fn := func(ent *syscall.Dirent) bool {
fn := func(ent *unix.Dirent) bool {
visited++
if ent.Type == syscall.DT_UNKNOWN {
if ent.Type == unix.DT_UNKNOWN {
supportsDType = false
// stop iteration
return true
@@ -59,7 +60,7 @@ func SupportsDType(path string) (bool, error) {
return supportsDType, nil
}
func iterateReadDir(path string, fn func(*syscall.Dirent) bool) error {
func iterateReadDir(path string, fn func(*unix.Dirent) bool) error {
d, err := os.Open(path)
if err != nil {
return err
@@ -68,7 +69,7 @@ func iterateReadDir(path string, fn func(*syscall.Dirent) bool) error {
fd := int(d.Fd())
buf := make([]byte, 4096)
for {
nbytes, err := syscall.ReadDirent(fd, buf)
nbytes, err := unix.ReadDirent(fd, buf)
if err != nil {
return err
}
@@ -76,7 +77,7 @@ func iterateReadDir(path string, fn func(*syscall.Dirent) bool) error {
break
}
for off := 0; off < nbytes; {
ent := (*syscall.Dirent)(unsafe.Pointer(&buf[off]))
ent := (*unix.Dirent)(unsafe.Pointer(&buf[off]))
if stop := fn(ent); stop {
return nil
}

View File

@@ -6,8 +6,9 @@ import (
"io/ioutil"
"os"
"os/exec"
"syscall"
"testing"
"golang.org/x/sys/unix"
)
func testSupportsDType(t *testing.T, expected bool, mkfsCommand string, mkfsArg ...string) {
@@ -53,7 +54,7 @@ func testSupportsDType(t *testing.T, expected bool, mkfsCommand string, mkfsArg
}
// loopback-mount the image.
// for ease of setting up loopback device, we use os/exec rather than syscall.Mount
// for ease of setting up loopback device, we use os/exec rather than unix.Mount
out, err = exec.Command("mount", "-o", "loop", imageFileName, mountpoint).CombinedOutput()
if len(out) > 0 {
t.Log(string(out))
@@ -62,7 +63,7 @@ func testSupportsDType(t *testing.T, expected bool, mkfsCommand string, mkfsArg
t.Skip("skipping the test because mount failed")
}
defer func() {
if err := syscall.Unmount(mountpoint, 0); err != nil {
if err := unix.Unmount(mountpoint, 0); err != nil {
t.Fatal(err)
}
}()