зеркало из https://github.com/golang/sys.git
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:
Родитель
20acc5cf31
Коммит
8442dd2c63
|
@ -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, Plan 9
|
||||
|
@ -139,7 +139,7 @@ TEXT ·seek(SB),NOSPLIT,$0-36
|
|||
MOVL AX, 28(SP) // newoffset high
|
||||
|
||||
SUBL $8, SP
|
||||
CALL syscall·errstr(SB)
|
||||
CALL plan9·errstr(SB)
|
||||
MOVL SP, SI
|
||||
ADDL $8, SP
|
||||
JMP copyresult6
|
||||
|
|
|
@ -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 Plan 9
|
||||
|
@ -137,7 +137,7 @@ TEXT ·seek(SB),NOSPLIT,$0-56
|
|||
MOVQ $-1, newoffset+40(SP)
|
||||
|
||||
SUBQ $16, SP
|
||||
CALL syscall·errstr(SB)
|
||||
CALL plan9·errstr(SB)
|
||||
MOVQ SP, SI
|
||||
ADDQ $16, SP
|
||||
JMP copyresult6
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Plan 9 directory marshalling. See intro(5).
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
import "errors"
|
||||
|
||||
|
@ -18,7 +18,7 @@ var (
|
|||
type Qid struct {
|
||||
Path uint64 // the file server's unique identification for the file
|
||||
Vers uint32 // version number for given Path
|
||||
Type uint8 // the type of the file (syscall.QTDIR for example)
|
||||
Type uint8 // the type of the file (plan9.QTDIR for example)
|
||||
}
|
||||
|
||||
// A Dir contains the metadata for a file.
|
||||
|
@ -54,7 +54,7 @@ var nullDir = Dir{
|
|||
}
|
||||
|
||||
// Null assigns special "don't touch" values to members of d to
|
||||
// avoid modifying them during syscall.Wstat.
|
||||
// avoid modifying them during plan9.Wstat.
|
||||
func (d *Dir) Null() { *d = nullDir }
|
||||
|
||||
// Marshal encodes a 9P stat message corresponding to d into b
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Plan 9 environment variables.
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Fork, exec, wait, etc.
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
|
129
plan9/mkall.sh
129
plan9/mkall.sh
|
@ -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 plan9 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
|
||||
|
@ -112,127 +112,12 @@ _* | *_ | _)
|
|||
echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
darwin_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32"
|
||||
mksysnum="./mksysnum_darwin.pl /usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
darwin_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_darwin.pl /usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
dragonfly_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32 -dragonfly"
|
||||
mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
dragonfly_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksyscall="./mksyscall.pl -dragonfly"
|
||||
mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
freebsd_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32"
|
||||
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
freebsd_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
freebsd_arm)
|
||||
mkerrors="$mkerrors"
|
||||
mksyscall="./mksyscall.pl -l32 -arm"
|
||||
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
|
||||
# Let the type of C char be singed for making the bare syscall
|
||||
# API consistent across over platforms.
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||
;;
|
||||
linux_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32"
|
||||
mksysnum="./mksysnum_linux.pl /usr/include/asm/unistd_32.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
linux_amd64)
|
||||
unistd_h=$(ls -1 /usr/include/asm/unistd_64.h /usr/include/x86_64-linux-gnu/asm/unistd_64.h 2>/dev/null | head -1)
|
||||
if [ "$unistd_h" = "" ]; then
|
||||
echo >&2 cannot find unistd_64.h
|
||||
exit 1
|
||||
fi
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
linux_arm)
|
||||
mkerrors="$mkerrors"
|
||||
mksyscall="./mksyscall.pl -l32 -arm"
|
||||
mksysnum="curl -s 'http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/arch/arm/include/uapi/asm/unistd.h' | ./mksysnum_linux.pl"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
nacl_386)
|
||||
mkerrors=""
|
||||
mksyscall="./mksyscall.pl -l32 -nacl"
|
||||
mksysnum=""
|
||||
mktypes=""
|
||||
;;
|
||||
nacl_amd64p32)
|
||||
mkerrors=""
|
||||
mksyscall="./mksyscall.pl -nacl"
|
||||
mksysnum=""
|
||||
mktypes=""
|
||||
;;
|
||||
netbsd_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32 -netbsd"
|
||||
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
netbsd_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksyscall="./mksyscall.pl -netbsd"
|
||||
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
openbsd_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32 -openbsd"
|
||||
mksysctl="./mksysctl_openbsd.pl"
|
||||
zsysctl="zsysctl_openbsd.go"
|
||||
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"
|
||||
;;
|
||||
openbsd_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksyscall="./mksyscall.pl -openbsd"
|
||||
mksysctl="./mksysctl_openbsd.pl"
|
||||
zsysctl="zsysctl_openbsd.go"
|
||||
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,18 +127,8 @@ 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"
|
||||
;;
|
||||
*)
|
||||
plan9)
|
||||
syscall_goos="syscall_$GOOS.go"
|
||||
case "$GOOS" in
|
||||
darwin | dragonfly | freebsd | netbsd | openbsd)
|
||||
syscall_goos="syscall_bsd.go $syscall_goos"
|
||||
;;
|
||||
esac
|
||||
if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos syscall_$GOOSARCH.go |gofmt >zsyscall_$GOOSARCH.go"; fi
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -15,193 +15,6 @@ CC=${CC:-gcc}
|
|||
|
||||
uname=$(uname)
|
||||
|
||||
includes_Darwin='
|
||||
#define _DARWIN_C_SOURCE
|
||||
#define KERNEL
|
||||
#define _DARWIN_USE_64_BIT_INODE
|
||||
#include <sys/types.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/route.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_mroute.h>
|
||||
#include <termios.h>
|
||||
'
|
||||
|
||||
includes_DragonFly='
|
||||
#include <sys/types.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/route.h>
|
||||
#include <netinet/in.h>
|
||||
#include <termios.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <net/ip_mroute/ip_mroute.h>
|
||||
'
|
||||
|
||||
includes_FreeBSD='
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/route.h>
|
||||
#include <netinet/in.h>
|
||||
#include <termios.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_mroute.h>
|
||||
|
||||
#if __FreeBSD__ >= 10
|
||||
#define IFT_CARP 0xf8 // IFT_CARP is deprecated in FreeBSD 10
|
||||
#undef SIOCAIFADDR
|
||||
#define SIOCAIFADDR _IOW(105, 26, struct oifaliasreq) // ifaliasreq contains if_data
|
||||
#undef SIOCSIFPHYADDR
|
||||
#define SIOCSIFPHYADDR _IOW(105, 70, struct oifaliasreq) // ifaliasreq contains if_data
|
||||
#endif
|
||||
'
|
||||
|
||||
includes_Linux='
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <bits/sockaddr.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/inotify.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_tun.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <linux/if_addr.h>
|
||||
#include <linux/filter.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/icmpv6.h>
|
||||
#include <net/route.h>
|
||||
#include <termios.h>
|
||||
|
||||
#ifndef MSG_FASTOPEN
|
||||
#define MSG_FASTOPEN 0x20000000
|
||||
#endif
|
||||
'
|
||||
|
||||
includes_NetBSD='
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/termios.h>
|
||||
#include <sys/ttycom.h>
|
||||
#include <sys/wait.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/route.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_mroute.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
// Needed since <sys/param.h> refers to it...
|
||||
#define schedppq 1
|
||||
'
|
||||
|
||||
includes_OpenBSD='
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/termios.h>
|
||||
#include <sys/ttycom.h>
|
||||
#include <sys/wait.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/route.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_mroute.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <net/if_bridge.h>
|
||||
|
||||
// We keep some constants not supported in OpenBSD 5.5 and beyond for
|
||||
// the promise of compatibility.
|
||||
#define EMUL_ENABLED 0x1
|
||||
#define EMUL_NATIVE 0x2
|
||||
#define IPV6_FAITH 0x1d
|
||||
#define IPV6_OPTIONS 0x1
|
||||
#define IPV6_RTHDR_STRICT 0x1
|
||||
#define IPV6_SOCKOPT_RESERVED1 0x3
|
||||
#define SIOCGIFGENERIC 0xc020693a
|
||||
#define SIOCSIFGENERIC 0x80206939
|
||||
#define WALTSIG 0x4
|
||||
'
|
||||
|
||||
includes_SunOS='
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/route.h>
|
||||
#include <netinet/in.h>
|
||||
#include <termios.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_mroute.h>
|
||||
'
|
||||
|
||||
includes='
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
|
@ -222,7 +35,7 @@ ccflags="$@"
|
|||
|
||||
# Write go tool cgo -godefs input.
|
||||
(
|
||||
echo package syscall
|
||||
echo package plan9
|
||||
echo
|
||||
echo '/*'
|
||||
indirect="includes_$(uname)"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# license that can be found in the LICENSE file.
|
||||
|
||||
# This program reads a file containing function prototypes
|
||||
# (like syscall_darwin.go) and generates system call bodies.
|
||||
# (like syscall_plan9.go) and generates system call bodies.
|
||||
# The prototypes are marked by lines beginning with "//sys"
|
||||
# and read like func declarations if //sys is replaced by func, but:
|
||||
# * The parameter lists must give a name for each argument.
|
||||
|
@ -304,7 +304,7 @@ print <<EOF;
|
|||
// $cmdline
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ cat <<EOF
|
|||
// $COMMAND
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
const(
|
||||
EOF
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// +build race
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// +build !race
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
|
|
@ -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 plan9
|
||||
|
||||
func itoa(val int) string { // do it here rather than with fmt to avoid dependency
|
||||
if val < 0 {
|
||||
|
|
|
@ -2,22 +2,21 @@
|
|||
// 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 plan9 contains an interface to the low-level operating system
|
||||
// primitives. OS details vary depending on the underlying system, and
|
||||
// by default, godoc will display the OS-specific documentation for the current
|
||||
// system. If you want godoc to display 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
|
||||
// err represents an operating system error describing the failure.
|
||||
package plan9
|
||||
|
||||
// StringByteSlice is deprecated. Use ByteSliceFromString instead.
|
||||
// If s contains a NUL byte this function panics instead of
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// Note that sometimes we use a lowercase //sys name and
|
||||
// wrap it in our own nicer implementation.
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -2,19 +2,20 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package syscall_test
|
||||
package plan9_test
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
"code.google.com/p/go.sys/plan9"
|
||||
)
|
||||
|
||||
func testSetGetenv(t *testing.T, key, value string) {
|
||||
err := syscall.Setenv(key, value)
|
||||
err := plan9.Setenv(key, value)
|
||||
if err != nil {
|
||||
t.Fatalf("Setenv failed to set %q: %v", value, err)
|
||||
}
|
||||
newvalue, found := syscall.Getenv(key)
|
||||
newvalue, found := plan9.Getenv(key)
|
||||
if !found {
|
||||
t.Fatalf("Getenv failed to find %v variable (want value %q)", key, value)
|
||||
}
|
||||
|
|
|
@ -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 plan9
|
||||
|
||||
// Constants
|
||||
const (
|
||||
|
|
|
@ -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 plan9
|
||||
|
||||
// Constants
|
||||
const (
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// mksyscall.pl -l32 -plan9 syscall_plan9.go syscall_plan9_386.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// mksyscall.pl -l32 -plan9 syscall_plan9.go syscall_plan9_amd64.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// mksysnum_plan9.sh /media/sys/src/libc/9syscall/sys.h
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
const (
|
||||
SYS_SYSR1 = 0
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// mksysnum_plan9.sh /media/sys/src/libc/9syscall/sys.h
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
const (
|
||||
SYS_SYSR1 = 0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// MACHINE GENERATED - DO NOT EDIT.
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
// Constants
|
||||
const (
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// MACHINE GENERATED - DO NOT EDIT.
|
||||
|
||||
package syscall
|
||||
package plan9
|
||||
|
||||
// Constants
|
||||
const (
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
//
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
// Berkeley packet filter for BSD variants
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
// Unix environment variables.
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import "sync"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// +build darwin dragonfly freebsd netbsd openbsd
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// +build linux
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
// Fork, exec, wait, etc.
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
//
|
||||
// TODO: Perhaps support symlinks, although they muck everything up.
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Linux socket filter
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -304,7 +304,7 @@ print <<EOF;
|
|||
// $cmdline
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -13,7 +13,7 @@ print <<EOF;
|
|||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
|
|
@ -14,7 +14,7 @@ print <<EOF;
|
|||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
|
|
@ -14,7 +14,7 @@ print <<EOF;
|
|||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
|
|
@ -11,7 +11,7 @@ print <<EOF;
|
|||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
const(
|
||||
EOF
|
||||
|
|
|
@ -14,7 +14,7 @@ print <<EOF;
|
|||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
|
|
@ -14,7 +14,7 @@ print <<EOF;
|
|||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
// The simulation is not particularly tied to NaCl,
|
||||
// but other systems have real networks.
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Netlink sockets and messages
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// +build race
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// +build !race
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
// Routing sockets and messages
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Routing sockets and messages for Darwin
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Routing sockets and messages for Dragonfly
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Routing sockets and messages for FreeBSD
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// +build freebsd,386 freebsd,arm
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// +build freebsd,amd64
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Routing sockets and messages for NetBSD
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Routing sockets and messages for OpenBSD
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -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...)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Socket control messages
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
// Socket control messages
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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 }
|
||||
|
||||
|
|
|
@ -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 }
|
||||
|
||||
|
|
|
@ -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,7 +4,7 @@
|
|||
|
||||
// +build dragonfly freebsd netbsd openbsd
|
||||
|
||||
package syscall
|
||||
package unix
|
||||
|
||||
const ImplementsGetwd = false
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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 }
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче