go.sys: update package names

Semi-automatic migration from package syscall to package {plan9,windows,unix}.
No builds attempted yet, but this gets a lot of noise behind us so subsequent
CLs will be more concise and easier to follow.
Subsequent CLs will have semantic content.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/121520043
This commit is contained in:
Rob Pike
2014-08-11 15:58:26 -07:00
parent 20acc5cf31
commit 8442dd2c63
214 changed files with 372 additions and 825 deletions
+3 -3
View File
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#include "../runtime/syscall_nacl.h"
#include "../../cmd/ld/textflag.h" // TODO: how to refer to this?
#include "../runtime/syscall_nacl.h" // TODO: how to refer to this?
//
// System call support for 386, Native Client
@@ -15,7 +15,7 @@
#define NACL_SYSJMP(code) \
MOVL $(0x10000 + ((code)<<5)), AX; JMP AX
TEXT syscall·Syscall(SB),NOSPLIT,$12-28
TEXT unix·Syscall(SB),NOSPLIT,$12-28
CALL runtime·entersyscall(SB)
MOVL trap+0(FP), AX
MOVL a1+4(FP), BX
+3 -3
View File
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#include "../runtime/syscall_nacl.h"
#include "../../cmd/ld/textflag.h" // TODO: how to refer to this?
#include "../runtime/syscall_nacl.h" // TODO: how to refer to this?
//
// System call support for amd64, Native Client
@@ -15,7 +15,7 @@
#define NACL_SYSJMP(code) \
MOVL $(0x10000 + ((code)<<5)), AX; JMP AX
TEXT syscall·Syscall(SB),NOSPLIT,$0-28
TEXT unix·Syscall(SB),NOSPLIT,$0-28
CALL runtime·entersyscall(SB)
MOVL trap+0(FP), AX
MOVL a1+4(FP), DI
+3 -3
View File
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#include "../runtime/syscall_nacl.h"
#include "../../cmd/ld/textflag.h" // TODO: how to refer to this?
#include "../runtime/syscall_nacl.h" // TODO: how to refer to this?
//
// System call support for ARM, Native Client
@@ -15,7 +15,7 @@
#define NACL_SYSJMP(code) \
MOVW $(0x10000 + ((code)<<5)), R8; B (R8)
TEXT syscall·Syscall(SB),NOSPLIT,$0-28
TEXT unix·Syscall(SB),NOSPLIT,$0-28
BL runtime·entersyscall(SB)
MOVW trap+0(FP), R8
MOVW a1+4(FP), R0
+1 -1
View File
@@ -5,7 +5,7 @@
// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
// so that go vet can check that they are correct.
#include "../../cmd/ld/textflag.h"
#include "../../cmd/ld/textflag.h" // TODO: how to refer to this?
//
// System call support for 386, NetBSD
+1 -1
View File
@@ -5,7 +5,7 @@
// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
// so that go vet can check that they are correct.
#include "../../cmd/ld/textflag.h"
#include "../../cmd/ld/textflag.h" // TODO: how to refer to this?
//
// System call support for AMD64, NetBSD
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#include "../../cmd/ld/textflag.h" // TODO: how to refer to this?
//
// System call support for ARM, NetBSD
+1 -1
View File
@@ -5,7 +5,7 @@
// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
// so that go vet can check that they are correct.
#include "../../cmd/ld/textflag.h"
#include "../../cmd/ld/textflag.h" // TODO: how to refer to this?
//
// System call support for 386, OpenBSD
+1 -1
View File
@@ -5,7 +5,7 @@
// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
// so that go vet can check that they are correct.
#include "../../cmd/ld/textflag.h"
#include "../../cmd/ld/textflag.h" // TODO: how to refer to this?
//
// System call support for AMD64, OpenBSD
+1 -1
View File
@@ -3,5 +3,5 @@
// license that can be found in the LICENSE file.
//
// System calls for amd64, Solaris are implemented in ../runtime/syscall_solaris.goc
// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.goc
//
+1 -1
View File
@@ -6,7 +6,7 @@
// Berkeley packet filter for BSD variants
package syscall
package unix
import (
"unsafe"
+12 -12
View File
@@ -4,14 +4,14 @@
// +build linux
package syscall_test
package unix_test
import (
"bytes"
"net"
"os"
"syscall"
"testing"
"unix"
)
// TestSCMCredentials tests the sending and receiving of credentials
@@ -19,14 +19,14 @@ import (
// sockets. The SO_PASSCRED socket option is enabled on the sending
// socket for this to work.
func TestSCMCredentials(t *testing.T) {
fds, err := syscall.Socketpair(syscall.AF_LOCAL, syscall.SOCK_STREAM, 0)
fds, err := unix.Socketpair(unix.AF_LOCAL, unix.SOCK_STREAM, 0)
if err != nil {
t.Fatalf("Socketpair: %v", err)
}
defer syscall.Close(fds[0])
defer syscall.Close(fds[1])
defer unix.Close(fds[0])
defer unix.Close(fds[1])
err = syscall.SetsockoptInt(fds[0], syscall.SOL_SOCKET, syscall.SO_PASSCRED, 1)
err = unix.SetsockoptInt(fds[0], unix.SOL_SOCKET, unix.SO_PASSCRED, 1)
if err != nil {
t.Fatalf("SetsockoptInt: %v", err)
}
@@ -49,14 +49,14 @@ func TestSCMCredentials(t *testing.T) {
}
defer cli.Close()
var ucred syscall.Ucred
var ucred unix.Ucred
if os.Getuid() != 0 {
ucred.Pid = int32(os.Getpid())
ucred.Uid = 0
ucred.Gid = 0
oob := syscall.UnixCredentials(&ucred)
oob := unix.UnixCredentials(&ucred)
_, _, err := cli.(*net.UnixConn).WriteMsgUnix(nil, oob, nil)
if err.(*net.OpError).Err != syscall.EPERM {
if err.(*net.OpError).Err != unix.EPERM {
t.Fatalf("WriteMsgUnix failed with %v, want EPERM", err)
}
}
@@ -64,7 +64,7 @@ func TestSCMCredentials(t *testing.T) {
ucred.Pid = int32(os.Getpid())
ucred.Uid = uint32(os.Getuid())
ucred.Gid = uint32(os.Getgid())
oob := syscall.UnixCredentials(&ucred)
oob := unix.UnixCredentials(&ucred)
// this is going to send a dummy byte
n, oobn, err := cli.(*net.UnixConn).WriteMsgUnix(nil, oob, nil)
@@ -99,11 +99,11 @@ func TestSCMCredentials(t *testing.T) {
t.Fatal("ReadMsgUnix oob bytes don't match")
}
scm, err := syscall.ParseSocketControlMessage(oob2)
scm, err := unix.ParseSocketControlMessage(oob2)
if err != nil {
t.Fatalf("ParseSocketControlMessage: %v", err)
}
newUcred, err := syscall.ParseUnixCredentials(&scm[0])
newUcred, err := unix.ParseUnixCredentials(&scm[0])
if err != nil {
t.Fatalf("ParseUnixCredentials: %v", err)
}
+1 -1
View File
@@ -6,7 +6,7 @@
// Unix environment variables.
package syscall
package unix
import "sync"
+1 -1
View File
@@ -4,7 +4,7 @@
// +build darwin dragonfly freebsd netbsd openbsd
package syscall
package unix
import (
"runtime"
+1 -1
View File
@@ -4,7 +4,7 @@
// +build linux
package syscall
package unix
import (
"unsafe"
+2 -2
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
import (
"unsafe"
@@ -44,7 +44,7 @@ func write1(fd uintptr, buf uintptr, nbyte uintptr) (n uintptr, err Errno)
// no rescheduling, no malloc calls, and no new stack segments.
//
// We call hand-crafted syscalls, implemented in
// ../runtime/syscall_solaris.goc, rather than generated libc wrappers
// runtime/syscall_solaris.goc, rather than generated libc wrappers
// because we need to avoid lazy-loading the functions (might malloc,
// split the stack, or acquire mutexes). We can't call RawSyscall
// because it's not safe even for BSD-subsystem calls.
+1 -1
View File
@@ -6,7 +6,7 @@
// Fork, exec, wait, etc.
package syscall
package unix
import (
"runtime"
+1 -1
View File
@@ -7,7 +7,7 @@
// Native Client allows, so we maintain our own file descriptor table exposed
// to higher-level packages.
package syscall
package unix
import (
"sync"
+1 -1
View File
@@ -4,7 +4,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -4,7 +4,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
func init() {
// On 32-bit Linux systems, the fcntl syscall that matches Go's
+1 -1
View File
@@ -12,7 +12,7 @@
//
// TODO: Perhaps support symlinks, although they muck everything up.
package syscall
package unix
import (
"sync"
+1 -1
View File
@@ -4,7 +4,7 @@
// Linux socket filter
package syscall
package unix
import (
"unsafe"
+1 -17
View File
@@ -3,7 +3,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# The syscall package provides access to the raw system call
# The unix package provides access to the raw system call
# interface of the underlying operating system. Porting Go to
# a new architecture/operating system combination requires
# some manual effort, though there are tools that automate
@@ -216,23 +216,12 @@ openbsd_amd64)
mksysnum="curl -s 'http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
plan9_386)
mkerrors=
mksyscall="./mksyscall.pl -l32 -plan9"
mksysnum="./mksysnum_plan9.sh /n/sources/plan9/sys/src/libc/9syscall/sys.h"
mktypes="XXX"
;;
solaris_amd64)
mksyscall="./mksyscall_solaris.pl"
mkerrors="$mkerrors -m64"
mksysnum=
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
windows_*)
mksyscall=
mkerrors=
zerrors=
;;
*)
echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
exit 1
@@ -242,11 +231,6 @@ esac
(
if [ -n "$mkerrors" ]; then echo "$mkerrors |gofmt >$zerrors"; fi
case "$GOOS" in
windows)
echo "GOOS= GOARCH= go build mksyscall_windows.go"
echo "./mksyscall_windows syscall_windows.go security_windows.go syscall_$GOOSARCH.go |gofmt >zsyscall_$GOOSARCH.go"
echo "rm -f ./mksyscall_windows"
;;
*)
syscall_goos="syscall_$GOOS.go"
case "$GOOS" in
+1 -1
View File
@@ -304,7 +304,7 @@ print <<EOF;
// $cmdline
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -264,7 +264,7 @@ package $package
import "unsafe"
EOF
print "import \"syscall\"\n" if $package ne "syscall";
print "import \"unix\"\n" if $package ne "unix";
print <<EOF;
+1 -1
View File
@@ -237,7 +237,7 @@ print <<EOF;
// mksysctl_openbsd.pl
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
package syscall;
package unix;
type mibentry struct {
ctlname string
+1 -1
View File
@@ -13,7 +13,7 @@ print <<EOF;
// $command
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
package syscall
package unix
const (
EOF
+1 -1
View File
@@ -14,7 +14,7 @@ print <<EOF;
// $command
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
package syscall
package unix
const (
EOF
+1 -1
View File
@@ -14,7 +14,7 @@ print <<EOF;
// $command
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
package syscall
package unix
const (
EOF
+1 -1
View File
@@ -11,7 +11,7 @@ print <<EOF;
// $command
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
package syscall
package unix
const(
EOF
+1 -1
View File
@@ -14,7 +14,7 @@ print <<EOF;
// $command
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
package syscall
package unix
const (
EOF
+1 -1
View File
@@ -14,7 +14,7 @@ print <<EOF;
// $command
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
package syscall
package unix
const (
EOF
+4 -4
View File
@@ -4,19 +4,19 @@
// +build darwin dragonfly freebsd linux netbsd openbsd
package syscall_test
package unix_test
import (
"syscall"
"testing"
"unix"
)
func TestMmap(t *testing.T) {
b, err := syscall.Mmap(-1, 0, syscall.Getpagesize(), syscall.PROT_NONE, syscall.MAP_ANON|syscall.MAP_PRIVATE)
b, err := unix.Mmap(-1, 0, unix.Getpagesize(), unix.PROT_NONE, unix.MAP_ANON|unix.MAP_PRIVATE)
if err != nil {
t.Fatalf("Mmap: %v", err)
}
if err := syscall.Munmap(b); err != nil {
if err := unix.Munmap(b); err != nil {
t.Fatalf("Munmap: %v", err)
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
// The simulation is not particularly tied to NaCl,
// but other systems have real networks.
package syscall
package unix
import (
"sync"
+1 -1
View File
@@ -4,7 +4,7 @@
// Netlink sockets and messages
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -4,7 +4,7 @@
// +build race
package syscall
package unix
import (
"runtime"
+1 -1
View File
@@ -4,7 +4,7 @@
// +build !race
package syscall
package unix
import (
"unsafe"
+1 -1
View File
@@ -6,7 +6,7 @@
// Routing sockets and messages
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -4,7 +4,7 @@
// Routing sockets and messages for Darwin
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -4,7 +4,7 @@
// Routing sockets and messages for Dragonfly
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -4,7 +4,7 @@
// Routing sockets and messages for FreeBSD
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -4,7 +4,7 @@
// +build freebsd,386 freebsd,arm
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -4,7 +4,7 @@
// +build freebsd,amd64
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -4,7 +4,7 @@
// Routing sockets and messages for NetBSD
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -4,7 +4,7 @@
// Routing sockets and messages for OpenBSD
package syscall
package unix
import "unsafe"
+9 -9
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
import (
"sync"
@@ -19,12 +19,12 @@ type soError struct {
func (e *soError) Error() string { return e.Msg }
// Implemented in ../runtime/syscall_solaris.goc.
func rawSysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
func dlclose(handle uintptr) (err Errno)
func dlopen(name *uint8, mode uintptr) (handle uintptr, err Errno)
func dlsym(handle uintptr, name *uint8) (proc uintptr, err Errno)
// Implemented in runtime/syscall_solaris.goc.
func rawSysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) // TODO: export
func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) // TODO: export
func dlclose(handle uintptr) (err Errno) // TODO: export
func dlopen(name *uint8, mode uintptr) (handle uintptr, err Errno) // TODO: export
func dlsym(handle uintptr, name *uint8) (proc uintptr, err Errno) // TODO: export
// A so implements access to a single shared library object.
type so struct {
@@ -119,7 +119,7 @@ func (p *proc) Addr() uintptr {
// GetLastError. Callers must inspect the primary return value to decide
// whether an error occurred (according to the semantics of the specific
// function being called) before consulting the error. The error will be
// guaranteed to contain syscall.Errno.
// guaranteed to contain unix.Errno.
func (p *proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
switch len(a) {
case 0:
@@ -253,7 +253,7 @@ func (p *lazyProc) Addr() uintptr {
// GetLastError. Callers must inspect the primary return value to decide
// whether an error occurred (according to the semantics of the specific
// function being called) before consulting the error. The error will be
// guaranteed to contain syscall.Errno.
// guaranteed to contain unix.Errno.
func (p *lazyProc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
p.mustFind()
return p.proc.Call(a...)
+1 -1
View File
@@ -4,7 +4,7 @@
// Socket control messages
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -6,7 +6,7 @@
// Socket control messages
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -5,7 +5,7 @@
// Native Client SRPC message passing.
// This code is needed to invoke SecureRandom, the NaCl equivalent of /dev/random.
package syscall
package unix
import (
"errors"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
func itoa(val int) string { // do it here rather than with fmt to avoid dependency
if val < 0 {
+9 -9
View File
@@ -2,22 +2,22 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package syscall contains an interface to the low-level operating system
// primitives. The details vary depending on the underlying system, and
// by default, godoc will display the syscall documentation for the current
// system. If you want godoc to display syscall documentation for another
// Package unix contains an interface to the low-level operating system
// primitives. OS details vary depending on the underlying system, and
// by default, godoc will display OS-specific documentation for the current
// system. If you want godoc to display OS documentation for another
// system, set $GOOS and $GOARCH to the desired system. For example, if
// you want to view documentation for freebsd/arm on linux/amd64, set $GOOS
// to freebsd and $GOARCH to arm.
// The primary use of syscall is inside other packages that provide a more
// The primary use of this package is inside other packages that provide a more
// portable interface to the system, such as "os", "time" and "net". Use
// those packages rather than this one if you can.
// For details of the functions and data types in this package consult
// the manuals for the appropriate operating system.
// These calls return err == nil to indicate success; otherwise
// err is an operating system error describing the failure.
// On most systems, that error has type syscall.Errno.
package syscall
// On Unix systems, that error has type unix.Errno.
package unix
// StringByteSlice is deprecated. Use ByteSliceFromString instead.
// If s contains a NUL byte this function panics instead of
@@ -25,7 +25,7 @@ package syscall
func StringByteSlice(s string) []byte {
a, err := ByteSliceFromString(s)
if err != nil {
panic("syscall: string with NUL passed to StringByteSlice")
panic("unix: string with NUL passed to StringByteSlice")
}
return a
}
@@ -61,7 +61,7 @@ func BytePtrFromString(s string) (*byte, error) {
}
// Single-word zero for use when we need a valid pointer to 0 bytes.
// See mksyscall.pl.
// See mkunix.pl.
var _zero uintptr
func (ts *Timespec) Unix() (sec int64, nsec int64) {
+1 -1
View File
@@ -10,7 +10,7 @@
// used as input to mksyscall which parses the //sys
// lines and generates system call stubs.
package syscall
package unix
import (
"runtime"
+6 -6
View File
@@ -4,28 +4,28 @@
// +build darwin dragonfly freebsd openbsd
package syscall_test
package unix_test
import (
"syscall"
"testing"
"unix"
)
const MNT_WAIT = 1
func TestGetfsstat(t *testing.T) {
n, err := syscall.Getfsstat(nil, MNT_WAIT)
n, err := unix.Getfsstat(nil, MNT_WAIT)
if err != nil {
t.Fatal(err)
}
data := make([]syscall.Statfs_t, n)
n, err = syscall.Getfsstat(data, MNT_WAIT)
data := make([]unix.Statfs_t, n)
n, err = unix.Getfsstat(data, MNT_WAIT)
if err != nil {
t.Fatal(err)
}
empty := syscall.Statfs_t{}
empty := unix.Statfs_t{}
for _, stat := range data {
if stat == empty {
t.Fatal("an empty Statfs_t struct was returned")
+1 -1
View File
@@ -10,7 +10,7 @@
// it in our own nicer implementation, either here or in
// syscall_bsd.go or syscall_unix.go.
package syscall
package unix
import (
errorspkg "errors"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -10,7 +10,7 @@
// it in our own nicer implementation, either here or in
// syscall_bsd.go or syscall_unix.go.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -10,7 +10,7 @@
// it in our own nicer implementation, either here or in
// syscall_bsd.go or syscall_unix.go.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -9,7 +9,7 @@
// Note that sometimes we use a lowercase //sys name and
// wrap it in our own nicer implementation.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -5,7 +5,7 @@
// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
// so that go vet can check that they are correct.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
//sys Chown(path string, uid int, gid int) (err error)
//sys Fchown(fd int, uid int, gid int) (err error)
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
import (
"sync"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
type Timespec struct {
Sec int64
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
type Timespec struct {
Sec int64
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
type Timespec struct {
Sec int64
+1 -1
View File
@@ -10,7 +10,7 @@
// it in our own nicer implementation, either here or in
// syscall_bsd.go or syscall_unix.go.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
func Getpagesize() int { return 4096 }
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
func Getpagesize() int { return 4096 }
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
func Getpagesize() int { return 4096 }
+1 -1
View File
@@ -4,7 +4,7 @@
// +build dragonfly freebsd netbsd openbsd
package syscall
package unix
const ImplementsGetwd = false
+1 -1
View File
@@ -10,7 +10,7 @@
// it in our own nicer implementation, either here or in
// syscall_bsd.go or syscall_unix.go.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
func Getpagesize() int { return 4096 }
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
func Getpagesize() int { return 4096 }
+1 -1
View File
@@ -10,7 +10,7 @@
// it in our own nicer implementation, either here or in
// syscall_solaris.go or syscall_unix.go.
package syscall
package unix
import "unsafe"
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
func Getpagesize() int { return 4096 }
+4 -4
View File
@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall_test
package unix_test
import (
"syscall"
"testing"
"unix"
)
func testSetGetenv(t *testing.T, key, value string) {
err := syscall.Setenv(key, value)
err := unix.Setenv(key, value)
if err != nil {
t.Fatalf("Setenv failed to set %q: %v", value, err)
}
newvalue, found := syscall.Getenv(key)
newvalue, found := unix.Getenv(key)
if !found {
t.Fatalf("Getenv failed to find %v variable (want value %q)", key, value)
}
+1 -1
View File
@@ -4,7 +4,7 @@
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package syscall
package unix
import (
"runtime"
+38 -38
View File
@@ -4,7 +4,7 @@
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package syscall_test
package unix_test
import (
"flag"
@@ -15,9 +15,9 @@ import (
"os/exec"
"path/filepath"
"runtime"
"syscall"
"testing"
"time"
"unix"
)
// Tests that below functions, structures and constants are consistent
@@ -25,25 +25,25 @@ import (
func _() {
// program scheduling priority functions and constants
var (
_ func(int, int, int) error = syscall.Setpriority
_ func(int, int) (int, error) = syscall.Getpriority
_ func(int, int, int) error = unix.Setpriority
_ func(int, int) (int, error) = unix.Getpriority
)
const (
_ int = syscall.PRIO_USER
_ int = syscall.PRIO_PROCESS
_ int = syscall.PRIO_PGRP
_ int = unix.PRIO_USER
_ int = unix.PRIO_PROCESS
_ int = unix.PRIO_PGRP
)
// termios constants
const (
_ int = syscall.TCIFLUSH
_ int = syscall.TCIOFLUSH
_ int = syscall.TCOFLUSH
_ int = unix.TCIFLUSH
_ int = unix.TCIOFLUSH
_ int = unix.TCOFLUSH
)
// fcntl file locking structure and constants
var (
_ = syscall.Flock_t{
_ = unix.Flock_t{
Type: int16(0),
Whence: int16(0),
Start: int64(0),
@@ -52,9 +52,9 @@ func _() {
}
)
const (
_ = syscall.F_GETLK
_ = syscall.F_SETLK
_ = syscall.F_SETLKW
_ = unix.F_GETLK
_ = unix.F_SETLK
_ = unix.F_SETLKW
)
}
@@ -62,17 +62,17 @@ func _() {
// the calling convention of each kernel.
func TestFcntlFlock(t *testing.T) {
name := filepath.Join(os.TempDir(), "TestFcntlFlock")
fd, err := syscall.Open(name, syscall.O_CREAT|syscall.O_RDWR|syscall.O_CLOEXEC, 0)
fd, err := unix.Open(name, unix.O_CREAT|unix.O_RDWR|unix.O_CLOEXEC, 0)
if err != nil {
t.Fatalf("Open failed: %v", err)
}
defer syscall.Unlink(name)
defer syscall.Close(fd)
flock := syscall.Flock_t{
Type: syscall.F_RDLCK,
defer unix.Unlink(name)
defer unix.Close(fd)
flock := unix.Flock_t{
Type: unix.F_RDLCK,
Start: 0, Len: 0, Whence: 1,
}
if err := syscall.FcntlFlock(uintptr(fd), syscall.F_GETLK, &flock); err != nil {
if err := unix.FcntlFlock(uintptr(fd), unix.F_GETLK, &flock); err != nil {
t.Fatalf("FcntlFlock failed: %v", err)
}
}
@@ -104,12 +104,12 @@ func TestPassFD(t *testing.T) {
}
defer os.RemoveAll(tempDir)
fds, err := syscall.Socketpair(syscall.AF_LOCAL, syscall.SOCK_STREAM, 0)
fds, err := unix.Socketpair(unix.AF_LOCAL, unix.SOCK_STREAM, 0)
if err != nil {
t.Fatalf("Socketpair: %v", err)
}
defer syscall.Close(fds[0])
defer syscall.Close(fds[1])
defer unix.Close(fds[0])
defer unix.Close(fds[1])
writeFile := os.NewFile(uintptr(fds[0]), "child-writes")
readFile := os.NewFile(uintptr(fds[1]), "parent-reads")
defer writeFile.Close()
@@ -144,7 +144,7 @@ func TestPassFD(t *testing.T) {
_, oobn, _, _, err := uc.ReadMsgUnix(buf, oob)
closeUnix.Stop()
scms, err := syscall.ParseSocketControlMessage(oob[:oobn])
scms, err := unix.ParseSocketControlMessage(oob[:oobn])
if err != nil {
t.Fatalf("ParseSocketControlMessage: %v", err)
}
@@ -152,9 +152,9 @@ func TestPassFD(t *testing.T) {
t.Fatalf("expected 1 SocketControlMessage; got scms = %#v", scms)
}
scm := scms[0]
gotFds, err := syscall.ParseUnixRights(&scm)
gotFds, err := unix.ParseUnixRights(&scm)
if err != nil {
t.Fatalf("syscall.ParseUnixRights: %v", err)
t.Fatalf("unix.ParseUnixRights: %v", err)
}
if len(gotFds) != 1 {
t.Fatalf("wanted 1 fd; got %#v", gotFds)
@@ -204,7 +204,7 @@ func passFDChild() {
f.Write([]byte("Hello from child process!\n"))
f.Seek(0, 0)
rights := syscall.UnixRights(int(f.Fd()))
rights := unix.UnixRights(int(f.Fd()))
dummyByte := []byte("x")
n, oobn, err := uc.WriteMsgUnix(dummyByte, rights, nil)
if err != nil {
@@ -232,13 +232,13 @@ func TestUnixRightsRoundtrip(t *testing.T) {
var n int
for _, fds := range testCase {
// Last assignment to n wins
n = len(b) + syscall.CmsgLen(4*len(fds))
b = append(b, syscall.UnixRights(fds...)...)
n = len(b) + unix.CmsgLen(4*len(fds))
b = append(b, unix.UnixRights(fds...)...)
}
// Truncate b
b = b[:n]
scms, err := syscall.ParseSocketControlMessage(b)
scms, err := unix.ParseSocketControlMessage(b)
if err != nil {
t.Fatalf("ParseSocketControlMessage: %v", err)
}
@@ -246,7 +246,7 @@ func TestUnixRightsRoundtrip(t *testing.T) {
t.Fatalf("expected %v SocketControlMessage; got scms = %#v", len(testCase), scms)
}
for i, scm := range scms {
gotFds, err := syscall.ParseUnixRights(&scm)
gotFds, err := unix.ParseUnixRights(&scm)
if err != nil {
t.Fatalf("ParseUnixRights: %v", err)
}
@@ -264,8 +264,8 @@ func TestUnixRightsRoundtrip(t *testing.T) {
}
func TestRlimit(t *testing.T) {
var rlimit, zero syscall.Rlimit
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit)
var rlimit, zero unix.Rlimit
err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlimit)
if err != nil {
t.Fatalf("Getrlimit: save failed: %v", err)
}
@@ -274,12 +274,12 @@ func TestRlimit(t *testing.T) {
}
set := rlimit
set.Cur = set.Max - 1
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &set)
err = unix.Setrlimit(unix.RLIMIT_NOFILE, &set)
if err != nil {
t.Fatalf("Setrlimit: set failed: %#v %v", set, err)
}
var get syscall.Rlimit
err = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &get)
var get unix.Rlimit
err = unix.Getrlimit(unix.RLIMIT_NOFILE, &get)
if err != nil {
t.Fatalf("Getrlimit: get failed: %v", err)
}
@@ -295,14 +295,14 @@ func TestRlimit(t *testing.T) {
t.Fatalf("Rlimit: change failed: wanted %#v got %#v", set, get)
}
}
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlimit)
err = unix.Setrlimit(unix.RLIMIT_NOFILE, &rlimit)
if err != nil {
t.Fatalf("Setrlimit: restore failed: %#v %v", rlimit, err)
}
}
func TestSeekFailure(t *testing.T) {
_, err := syscall.Seek(-1, 0, 0)
_, err := unix.Seek(-1, 0, 0)
if err == nil {
t.Fatalf("Seek(-1, 0, 0) did not fail")
}
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
package unix
// TODO: generate with runtime/mknacl.sh, allow override with IRT.
const (
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#include "../../cmd/ld/textflag.h" // TODO: how to refer to this?
TEXT ·startTimer(SB),NOSPLIT,$0
JMP time·startTimer(SB)
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#include "../../cmd/ld/textflag.h" // TODO: how to refer to this?
TEXT ·startTimer(SB),NOSPLIT,$0
JMP time·startTimer(SB)
+1 -1
View File
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../cmd/ld/textflag.h"
#include "../../cmd/ld/textflag.h" // TODO: how to refer to this?
TEXT ·startTimer(SB),NOSPLIT,$0
B time·startTimer(SB)
+1 -1
View File
@@ -11,7 +11,7 @@ Input to cgo -godefs. See also mkerrors.sh and mkall.sh
// +godefs map struct_in_addr [4]byte /* in_addr */
// +godefs map struct_in6_addr [16]byte /* in6_addr */
package syscall
package unix
/*
#define __DARWIN_UNIX03 0
+1 -1
View File
@@ -11,7 +11,7 @@ Input to cgo -godefs. See also mkerrors.sh and mkall.sh
// +godefs map struct_in_addr [4]byte /* in_addr */
// +godefs map struct_in6_addr [16]byte /* in6_addr */
package syscall
package unix
/*
#define KERNEL
+1 -1
View File
@@ -11,7 +11,7 @@ Input to cgo -godefs. See also mkerrors.sh and mkall.sh
// +godefs map struct_in_addr [4]byte /* in_addr */
// +godefs map struct_in6_addr [16]byte /* in6_addr */
package syscall
package unix
/*
#define KERNEL
+1 -1
View File
@@ -11,7 +11,7 @@ Input to cgo -godefs. See also mkerrors.sh and mkall.sh
// +godefs map struct_in_addr [4]byte /* in_addr */
// +godefs map struct_in6_addr [16]byte /* in6_addr */
package syscall
package unix
/*
#define _LARGEFILE_SOURCE
+1 -1
View File
@@ -11,7 +11,7 @@ Input to cgo -godefs. See also mkerrors.sh and mkall.sh
// +godefs map struct_in_addr [4]byte /* in_addr */
// +godefs map struct_in6_addr [16]byte /* in6_addr */
package syscall
package unix
/*
#define KERNEL
+1 -1
View File
@@ -11,7 +11,7 @@ Input to cgo -godefs. See also mkerrors.sh and mkall.sh
// +godefs map struct_in_addr [4]byte /* in_addr */
// +godefs map struct_in6_addr [16]byte /* in6_addr */
package syscall
package unix
/*
#define KERNEL
+1 -1
View File
@@ -11,7 +11,7 @@ Input to cgo -godefs. See also mkerrors.sh and mkall.sh
// +godefs map struct_in_addr [4]byte /* in_addr */
// +godefs map struct_in6_addr [16]byte /* in6_addr */
package syscall
package unix
/*
#define KERNEL
+1 -1
View File
@@ -7,7 +7,7 @@
// and a modified copy of the zip reader in package time.
// (The one in package time does not support decompression; this one does.)
package syscall
package unix
const (
maxCodeLen = 16 // max length of Huffman code
+1 -1
View File
@@ -4,7 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m32 _const.go
package syscall
package unix
const (
AF_APPLETALK = 0x10
+1 -1
View File
@@ -4,7 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m64 _const.go
package syscall
package unix
const (
AF_APPLETALK = 0x10
+1 -1
View File
@@ -4,7 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m32 _const.go
package syscall
package unix
const (
AF_APPLETALK = 0x10
+1 -1
View File
@@ -4,7 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m64 _const.go
package syscall
package unix
const (
AF_APPLETALK = 0x10
+1 -1
View File
@@ -4,7 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m32 _const.go
package syscall
package unix
const (
AF_APPLETALK = 0x10

Some files were not shown because too many files have changed in this diff Show More