1
0
mirror of https://github.com/golang/go synced 2024-11-25 02:17:57 -07:00

syscall: fix mkall.sh, mksyscall_linux.pl, and regen for Linux/ARM

CL 3075041 says ARM is not little-endian, but my test suggests otherwise.
My test program is:

    package main
    import ("fmt"; "syscall"; "os")
    func main() {
       err := syscall.Fallocate(1, 1/*FALLOC_FL_KEEP_SIZE*/, 0, int64(40960));
       fmt.Fprintln(os.Stderr, err)
    }

Without this CL, ./test > testfile will show: file too large; and strace shows:
    fallocate(1, 01, 0, 175921860444160)    = -1 EFBIG (File too large)
With this CL, ./test > testfile will show: <nil>; and strace shows:
    fallocate(1, 01, 0, 40960)              = 0

Quoting rsc:
"[It turns out that] ARM syscall ABI requires 64-bit arguments to use an
(even, odd) register pair, not an (odd, even) pair. Switching to "big-endian"
worked because it ended up using the high 32-bits (always zero in the tests
we had) as the padding word, because the 64-bit argument was the last one,
and because we fill in zeros for the rest of the system call arguments, up to
six. So it happened to work."

I updated mksyscall_linux.pl to accommodate the register pair ABI requirement,
and removed all hand-tweaked syscall routines in favor of the auto-generated
ones. These including: Ftruncate, Truncate, Pread and Pwrite.

Some recent Linux/ARM distributions do not bundle kernel asm headers,
so instead we always get latest asm/unistd.h from git.kernel.org (just like
what we do for FreeBSD).

R=ken, r, rsc, r, dave, iant
CC=golang-dev
https://golang.org/cl/5726051
This commit is contained in:
Shenghou Ma 2012-03-06 03:12:11 +08:00
parent 1042d7d5ef
commit 6e211225d7
7 changed files with 149 additions and 64 deletions

View File

@ -144,8 +144,8 @@ linux_amd64)
;; ;;
linux_arm) linux_arm)
mkerrors="$mkerrors" mkerrors="$mkerrors"
mksyscall="./mksyscall.pl -b32" mksyscall="./mksyscall.pl -l32 -arm"
mksysnum="./mksysnum_linux.pl /usr/include/asm/unistd.h" mksysnum="curl -s 'http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=arch/arm/include/asm/unistd.h;hb=HEAD' | ./mksysnum_linux.pl"
mktypes="GOARCH=$GOARCH go tool cgo -godefs" mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;; ;;
netbsd_386) netbsd_386)

View File

@ -27,6 +27,7 @@ my $_32bit = "";
my $plan9 = 0; my $plan9 = 0;
my $openbsd = 0; my $openbsd = 0;
my $netbsd = 0; my $netbsd = 0;
my $arm = 0; # 64-bit value should use (even, odd)-pair
if($ARGV[0] eq "-b32") { if($ARGV[0] eq "-b32") {
$_32bit = "big-endian"; $_32bit = "big-endian";
@ -47,6 +48,10 @@ if($ARGV[0] eq "-netbsd") {
$netbsd = 1; $netbsd = 1;
shift; shift;
} }
if($ARGV[0] eq "-arm") {
$arm = 1;
shift;
}
if($ARGV[0] =~ /^-/) { if($ARGV[0] =~ /^-/) {
print STDERR "usage: mksyscall.pl [-b32 | -l32] [file ...]\n"; print STDERR "usage: mksyscall.pl [-b32 | -l32] [file ...]\n";
@ -135,6 +140,11 @@ while(<>) {
push @args, "uintptr($name)"; push @args, "uintptr($name)";
} }
} elsif($type eq "int64" && $_32bit ne "") { } elsif($type eq "int64" && $_32bit ne "") {
if(@args % 2 && $arm) {
# arm abi specifies 64-bit argument uses
# (even, odd) pair
push @args, "0"
}
if($_32bit eq "big-endian") { if($_32bit eq "big-endian") {
push @args, "uintptr($name>>32)", "uintptr($name)"; push @args, "uintptr($name>>32)", "uintptr($name)";
} else { } else {

View File

@ -4,8 +4,6 @@
package syscall package syscall
import "unsafe"
func Getpagesize() int { return 4096 } func Getpagesize() int { return 4096 }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
@ -23,52 +21,6 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
return return
} }
// Pread and Pwrite are special: they insert padding before the int64.
func Pread(fd int, p []byte, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32))
n = int(r0)
if e1 != 0 {
err = e1
}
return
}
func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
}
r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32))
n = int(r0)
if e1 != 0 {
err = e1
}
return
}
func Ftruncate(fd int, length int64) (err error) {
// ARM EABI requires 64-bit arguments should be put in a pair
// of registers from an even register number.
_, _, e1 := Syscall6(SYS_FTRUNCATE64, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0)
if e1 != 0 {
err = e1
}
return
}
func Truncate(path string, length int64) (err error) {
_, _, e1 := Syscall6(SYS_TRUNCATE64, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, uintptr(length), uintptr(length>>32), 0, 0)
if e1 != 0 {
err = e1
}
return
}
// Seek is defined in assembly. // Seek is defined in assembly.
func Seek(fd int, offset int64, whence int) (newoffset int64, err error) func Seek(fd int, offset int64, whence int) (newoffset int64, err error)
@ -118,6 +70,11 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error)
//sysnb Gettimeofday(tv *Timeval) (err error) //sysnb Gettimeofday(tv *Timeval) (err error)
//sysnb Time(t *Time_t) (tt Time_t, err error) //sysnb Time(t *Time_t) (tt Time_t, err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) //sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {

View File

@ -189,6 +189,7 @@ const (
ETH_P_ATMMPOA = 0x884c ETH_P_ATMMPOA = 0x884c
ETH_P_AX25 = 0x2 ETH_P_AX25 = 0x2
ETH_P_BPQ = 0x8ff ETH_P_BPQ = 0x8ff
ETH_P_CAIF = 0xf7
ETH_P_CAN = 0xc ETH_P_CAN = 0xc
ETH_P_CONTROL = 0x16 ETH_P_CONTROL = 0x16
ETH_P_CUST = 0x6006 ETH_P_CUST = 0x6006
@ -212,6 +213,7 @@ const (
ETH_P_IPX = 0x8137 ETH_P_IPX = 0x8137
ETH_P_IRDA = 0x17 ETH_P_IRDA = 0x17
ETH_P_LAT = 0x6004 ETH_P_LAT = 0x6004
ETH_P_LINK_CTL = 0x886c
ETH_P_LOCALTALK = 0x9 ETH_P_LOCALTALK = 0x9
ETH_P_LOOP = 0x60 ETH_P_LOOP = 0x60
ETH_P_MOBITEX = 0x15 ETH_P_MOBITEX = 0x15
@ -249,6 +251,7 @@ const (
F_GETLK64 = 0xc F_GETLK64 = 0xc
F_GETOWN = 0x9 F_GETOWN = 0x9
F_GETOWN_EX = 0x10 F_GETOWN_EX = 0x10
F_GETPIPE_SZ = 0x408
F_GETSIG = 0xb F_GETSIG = 0xb
F_LOCK = 0x1 F_LOCK = 0x1
F_NOTIFY = 0x402 F_NOTIFY = 0x402
@ -263,6 +266,7 @@ const (
F_SETLKW64 = 0xe F_SETLKW64 = 0xe
F_SETOWN = 0x8 F_SETOWN = 0x8
F_SETOWN_EX = 0xf F_SETOWN_EX = 0xf
F_SETPIPE_SZ = 0x407
F_SETSIG = 0xa F_SETSIG = 0xa
F_SHLCK = 0x8 F_SHLCK = 0x8
F_TEST = 0x3 F_TEST = 0x3
@ -325,6 +329,7 @@ const (
IN_DELETE = 0x200 IN_DELETE = 0x200
IN_DELETE_SELF = 0x400 IN_DELETE_SELF = 0x400
IN_DONT_FOLLOW = 0x2000000 IN_DONT_FOLLOW = 0x2000000
IN_EXCL_UNLINK = 0x4000000
IN_IGNORED = 0x8000 IN_IGNORED = 0x8000
IN_ISDIR = 0x40000000 IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f IN_LOOPBACKNET = 0x7f
@ -426,18 +431,24 @@ const (
IP_DF = 0x4000 IP_DF = 0x4000
IP_DROP_MEMBERSHIP = 0x24 IP_DROP_MEMBERSHIP = 0x24
IP_DROP_SOURCE_MEMBERSHIP = 0x28 IP_DROP_SOURCE_MEMBERSHIP = 0x28
IP_FREEBIND = 0xf
IP_HDRINCL = 0x3 IP_HDRINCL = 0x3
IP_IPSEC_POLICY = 0x10
IP_MAXPACKET = 0xffff IP_MAXPACKET = 0xffff
IP_MAX_MEMBERSHIPS = 0x14 IP_MAX_MEMBERSHIPS = 0x14
IP_MF = 0x2000 IP_MF = 0x2000
IP_MINTTL = 0x15
IP_MSFILTER = 0x29 IP_MSFILTER = 0x29
IP_MSS = 0x240 IP_MSS = 0x240
IP_MTU = 0xe
IP_MTU_DISCOVER = 0xa IP_MTU_DISCOVER = 0xa
IP_MULTICAST_IF = 0x20 IP_MULTICAST_IF = 0x20
IP_MULTICAST_LOOP = 0x22 IP_MULTICAST_LOOP = 0x22
IP_MULTICAST_TTL = 0x21 IP_MULTICAST_TTL = 0x21
IP_OFFMASK = 0x1fff IP_OFFMASK = 0x1fff
IP_OPTIONS = 0x4 IP_OPTIONS = 0x4
IP_ORIGDSTADDR = 0x14
IP_PASSSEC = 0x12
IP_PKTINFO = 0x8 IP_PKTINFO = 0x8
IP_PKTOPTIONS = 0x9 IP_PKTOPTIONS = 0x9
IP_PMTUDISC = 0xa IP_PMTUDISC = 0xa
@ -447,6 +458,7 @@ const (
IP_PMTUDISC_WANT = 0x1 IP_PMTUDISC_WANT = 0x1
IP_RECVERR = 0xb IP_RECVERR = 0xb
IP_RECVOPTS = 0x6 IP_RECVOPTS = 0x6
IP_RECVORIGDSTADDR = 0x14
IP_RECVRETOPTS = 0x7 IP_RECVRETOPTS = 0x7
IP_RECVTOS = 0xd IP_RECVTOS = 0xd
IP_RECVTTL = 0xc IP_RECVTTL = 0xc
@ -454,8 +466,10 @@ const (
IP_RF = 0x8000 IP_RF = 0x8000
IP_ROUTER_ALERT = 0x5 IP_ROUTER_ALERT = 0x5
IP_TOS = 0x1 IP_TOS = 0x1
IP_TRANSPARENT = 0x13
IP_TTL = 0x2 IP_TTL = 0x2
IP_UNBLOCK_SOURCE = 0x25 IP_UNBLOCK_SOURCE = 0x25
IP_XFRM_POLICY = 0x11
LINUX_REBOOT_CMD_CAD_OFF = 0x0 LINUX_REBOOT_CMD_CAD_OFF = 0x0
LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef
LINUX_REBOOT_CMD_HALT = 0xcdef0123 LINUX_REBOOT_CMD_HALT = 0xcdef0123
@ -520,22 +534,38 @@ const (
MSG_TRUNC = 0x20 MSG_TRUNC = 0x20
MSG_TRYHARD = 0x4 MSG_TRYHARD = 0x4
MSG_WAITALL = 0x100 MSG_WAITALL = 0x100
MSG_WAITFORONE = 0x10000
MS_ACTIVE = 0x40000000
MS_ASYNC = 0x1 MS_ASYNC = 0x1
MS_BIND = 0x1000 MS_BIND = 0x1000
MS_DIRSYNC = 0x80
MS_INVALIDATE = 0x2 MS_INVALIDATE = 0x2
MS_I_VERSION = 0x800000
MS_KERNMOUNT = 0x400000
MS_MANDLOCK = 0x40 MS_MANDLOCK = 0x40
MS_MGC_MSK = 0xffff0000 MS_MGC_MSK = 0xffff0000
MS_MGC_VAL = 0xc0ed0000 MS_MGC_VAL = 0xc0ed0000
MS_MOVE = 0x2000
MS_NOATIME = 0x400 MS_NOATIME = 0x400
MS_NODEV = 0x4 MS_NODEV = 0x4
MS_NODIRATIME = 0x800 MS_NODIRATIME = 0x800
MS_NOEXEC = 0x8 MS_NOEXEC = 0x8
MS_NOSUID = 0x2 MS_NOSUID = 0x2
MS_NOUSER = -0x80000000
MS_POSIXACL = 0x10000
MS_PRIVATE = 0x40000
MS_RDONLY = 0x1 MS_RDONLY = 0x1
MS_REC = 0x4000
MS_RELATIME = 0x200000
MS_REMOUNT = 0x20 MS_REMOUNT = 0x20
MS_RMT_MASK = 0xc51 MS_RMT_MASK = 0x800051
MS_SHARED = 0x100000
MS_SILENT = 0x8000
MS_SLAVE = 0x80000
MS_STRICTATIME = 0x1000000
MS_SYNC = 0x4 MS_SYNC = 0x4
MS_SYNCHRONOUS = 0x10 MS_SYNCHRONOUS = 0x10
MS_UNBINDABLE = 0x20000
NAME_MAX = 0xff NAME_MAX = 0xff
NETLINK_ADD_MEMBERSHIP = 0x1 NETLINK_ADD_MEMBERSHIP = 0x1
NETLINK_AUDIT = 0x9 NETLINK_AUDIT = 0x9
@ -555,6 +585,7 @@ const (
NETLINK_NFLOG = 0x5 NETLINK_NFLOG = 0x5
NETLINK_NO_ENOBUFS = 0x5 NETLINK_NO_ENOBUFS = 0x5
NETLINK_PKTINFO = 0x3 NETLINK_PKTINFO = 0x3
NETLINK_RDMA = 0x14
NETLINK_ROUTE = 0x0 NETLINK_ROUTE = 0x0
NETLINK_SCSITRANSPORT = 0x12 NETLINK_SCSITRANSPORT = 0x12
NETLINK_SELINUX = 0x7 NETLINK_SELINUX = 0x7
@ -629,6 +660,7 @@ const (
PROT_WRITE = 0x2 PROT_WRITE = 0x2
PR_CAPBSET_DROP = 0x18 PR_CAPBSET_DROP = 0x18
PR_CAPBSET_READ = 0x17 PR_CAPBSET_READ = 0x17
PR_CLEAR_SECCOMP_FILTER = 0x25
PR_ENDIAN_BIG = 0x0 PR_ENDIAN_BIG = 0x0
PR_ENDIAN_LITTLE = 0x1 PR_ENDIAN_LITTLE = 0x1
PR_ENDIAN_PPC_LITTLE = 0x2 PR_ENDIAN_PPC_LITTLE = 0x2
@ -652,6 +684,7 @@ const (
PR_GET_NAME = 0x10 PR_GET_NAME = 0x10
PR_GET_PDEATHSIG = 0x2 PR_GET_PDEATHSIG = 0x2
PR_GET_SECCOMP = 0x15 PR_GET_SECCOMP = 0x15
PR_GET_SECCOMP_FILTER = 0x23
PR_GET_SECUREBITS = 0x1b PR_GET_SECUREBITS = 0x1b
PR_GET_TIMERSLACK = 0x1e PR_GET_TIMERSLACK = 0x1e
PR_GET_TIMING = 0xd PR_GET_TIMING = 0xd
@ -664,6 +697,8 @@ const (
PR_MCE_KILL_GET = 0x22 PR_MCE_KILL_GET = 0x22
PR_MCE_KILL_LATE = 0x0 PR_MCE_KILL_LATE = 0x0
PR_MCE_KILL_SET = 0x1 PR_MCE_KILL_SET = 0x1
PR_SECCOMP_FILTER_EVENT = 0x1
PR_SECCOMP_FILTER_SYSCALL = 0x0
PR_SET_DUMPABLE = 0x4 PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14 PR_SET_ENDIAN = 0x14
PR_SET_FPEMU = 0xa PR_SET_FPEMU = 0xa
@ -671,7 +706,9 @@ const (
PR_SET_KEEPCAPS = 0x8 PR_SET_KEEPCAPS = 0x8
PR_SET_NAME = 0xf PR_SET_NAME = 0xf
PR_SET_PDEATHSIG = 0x1 PR_SET_PDEATHSIG = 0x1
PR_SET_PTRACER = 0x59616d61
PR_SET_SECCOMP = 0x16 PR_SET_SECCOMP = 0x16
PR_SET_SECCOMP_FILTER = 0x24
PR_SET_SECUREBITS = 0x1c PR_SET_SECUREBITS = 0x1c
PR_SET_TIMERSLACK = 0x1d PR_SET_TIMERSLACK = 0x1d
PR_SET_TIMING = 0xe PR_SET_TIMING = 0xe
@ -697,7 +734,9 @@ const (
PTRACE_GETCRUNCHREGS = 0x19 PTRACE_GETCRUNCHREGS = 0x19
PTRACE_GETEVENTMSG = 0x4201 PTRACE_GETEVENTMSG = 0x4201
PTRACE_GETFPREGS = 0xe PTRACE_GETFPREGS = 0xe
PTRACE_GETHBPREGS = 0x1d
PTRACE_GETREGS = 0xc PTRACE_GETREGS = 0xc
PTRACE_GETREGSET = 0x4204
PTRACE_GETSIGINFO = 0x4202 PTRACE_GETSIGINFO = 0x4202
PTRACE_GETVFPREGS = 0x1b PTRACE_GETVFPREGS = 0x1b
PTRACE_GETWMMXREGS = 0x12 PTRACE_GETWMMXREGS = 0x12
@ -720,8 +759,10 @@ const (
PTRACE_POKEUSR = 0x6 PTRACE_POKEUSR = 0x6
PTRACE_SETCRUNCHREGS = 0x1a PTRACE_SETCRUNCHREGS = 0x1a
PTRACE_SETFPREGS = 0xf PTRACE_SETFPREGS = 0xf
PTRACE_SETHBPREGS = 0x1e
PTRACE_SETOPTIONS = 0x4200 PTRACE_SETOPTIONS = 0x4200
PTRACE_SETREGS = 0xd PTRACE_SETREGS = 0xd
PTRACE_SETREGSET = 0x4205
PTRACE_SETSIGINFO = 0x4203 PTRACE_SETSIGINFO = 0x4203
PTRACE_SETVFPREGS = 0x1c PTRACE_SETVFPREGS = 0x1c
PTRACE_SETWMMXREGS = 0x13 PTRACE_SETWMMXREGS = 0x13
@ -749,8 +790,9 @@ const (
RTAX_FEATURE_TIMESTAMP = 0x4 RTAX_FEATURE_TIMESTAMP = 0x4
RTAX_HOPLIMIT = 0xa RTAX_HOPLIMIT = 0xa
RTAX_INITCWND = 0xb RTAX_INITCWND = 0xb
RTAX_INITRWND = 0xe
RTAX_LOCK = 0x1 RTAX_LOCK = 0x1
RTAX_MAX = 0xd RTAX_MAX = 0xe
RTAX_MTU = 0x2 RTAX_MTU = 0x2
RTAX_REORDERING = 0x9 RTAX_REORDERING = 0x9
RTAX_RTO_MIN = 0xd RTAX_RTO_MIN = 0xd
@ -760,7 +802,7 @@ const (
RTAX_UNSPEC = 0x0 RTAX_UNSPEC = 0x0
RTAX_WINDOW = 0x3 RTAX_WINDOW = 0x3
RTA_ALIGNTO = 0x4 RTA_ALIGNTO = 0x4
RTA_MAX = 0xf RTA_MAX = 0x10
RTCF_DIRECTSRC = 0x4000000 RTCF_DIRECTSRC = 0x4000000
RTCF_DOREDIRECT = 0x1000000 RTCF_DOREDIRECT = 0x1000000
RTCF_LOG = 0x2000000 RTCF_LOG = 0x2000000
@ -987,6 +1029,7 @@ const (
SO_RCVLOWAT = 0x12 SO_RCVLOWAT = 0x12
SO_RCVTIMEO = 0x14 SO_RCVTIMEO = 0x14
SO_REUSEADDR = 0x2 SO_REUSEADDR = 0x2
SO_RXQ_OVFL = 0x28
SO_SECURITY_AUTHENTICATION = 0x16 SO_SECURITY_AUTHENTICATION = 0x16
SO_SECURITY_ENCRYPTION_NETWORK = 0x18 SO_SECURITY_ENCRYPTION_NETWORK = 0x18
SO_SECURITY_ENCRYPTION_TRANSPORT = 0x17 SO_SECURITY_ENCRYPTION_TRANSPORT = 0x17
@ -998,7 +1041,6 @@ const (
SO_TIMESTAMPING = 0x25 SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23 SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3 SO_TYPE = 0x3
S_APPEND = 0x100
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
S_IFBLK = 0x6000 S_IFBLK = 0x6000
@ -1009,7 +1051,6 @@ const (
S_IFMT = 0xf000 S_IFMT = 0xf000
S_IFREG = 0x8000 S_IFREG = 0x8000
S_IFSOCK = 0xc000 S_IFSOCK = 0xc000
S_IMMUTABLE = 0x200
S_IREAD = 0x100 S_IREAD = 0x100
S_IRGRP = 0x20 S_IRGRP = 0x20
S_IROTH = 0x4 S_IROTH = 0x4
@ -1027,7 +1068,6 @@ const (
S_IXGRP = 0x8 S_IXGRP = 0x8
S_IXOTH = 0x1 S_IXOTH = 0x1
S_IXUSR = 0x40 S_IXUSR = 0x40
S_WRITE = 0x80
TCP_CONGESTION = 0xd TCP_CONGESTION = 0xd
TCP_CORK = 0x3 TCP_CORK = 0x3
TCP_DEFER_ACCEPT = 0x9 TCP_DEFER_ACCEPT = 0x9
@ -1049,11 +1089,13 @@ const (
TIOCCBRK = 0x5428 TIOCCBRK = 0x5428
TIOCCONS = 0x541d TIOCCONS = 0x541d
TIOCEXCL = 0x540c TIOCEXCL = 0x540c
TIOCGDEV = 0x80045432
TIOCGETD = 0x5424 TIOCGETD = 0x5424
TIOCGICOUNT = 0x545d TIOCGICOUNT = 0x545d
TIOCGLCKTRMIOS = 0x5456 TIOCGLCKTRMIOS = 0x5456
TIOCGPGRP = 0x540f TIOCGPGRP = 0x540f
TIOCGPTN = 0x80045430 TIOCGPTN = 0x80045430
TIOCGRS485 = 0x542e
TIOCGSERIAL = 0x541e TIOCGSERIAL = 0x541e
TIOCGSID = 0x5429 TIOCGSID = 0x5429
TIOCGSOFTCAR = 0x5419 TIOCGSOFTCAR = 0x5419
@ -1084,6 +1126,7 @@ const (
TIOCPKT_DOSTOP = 0x20 TIOCPKT_DOSTOP = 0x20
TIOCPKT_FLUSHREAD = 0x1 TIOCPKT_FLUSHREAD = 0x1
TIOCPKT_FLUSHWRITE = 0x2 TIOCPKT_FLUSHWRITE = 0x2
TIOCPKT_IOCTL = 0x40
TIOCPKT_NOSTOP = 0x10 TIOCPKT_NOSTOP = 0x10
TIOCPKT_START = 0x8 TIOCPKT_START = 0x8
TIOCPKT_STOP = 0x4 TIOCPKT_STOP = 0x4
@ -1098,16 +1141,22 @@ const (
TIOCSERSWILD = 0x5455 TIOCSERSWILD = 0x5455
TIOCSER_TEMT = 0x1 TIOCSER_TEMT = 0x1
TIOCSETD = 0x5423 TIOCSETD = 0x5423
TIOCSIG = 0x40045436
TIOCSLCKTRMIOS = 0x5457 TIOCSLCKTRMIOS = 0x5457
TIOCSPGRP = 0x5410 TIOCSPGRP = 0x5410
TIOCSPTLCK = 0x40045431 TIOCSPTLCK = 0x40045431
TIOCSRS485 = 0x542f
TIOCSSERIAL = 0x541f TIOCSSERIAL = 0x541f
TIOCSSOFTCAR = 0x541a TIOCSSOFTCAR = 0x541a
TIOCSTI = 0x5412 TIOCSTI = 0x5412
TIOCSWINSZ = 0x5414 TIOCSWINSZ = 0x5414
TIOCVHANGUP = 0x5437
TUNATTACHFILTER = 0x400854d5
TUNDETACHFILTER = 0x400854d6
TUNGETFEATURES = 0x800454cf TUNGETFEATURES = 0x800454cf
TUNGETIFF = 0x800454d2 TUNGETIFF = 0x800454d2
TUNGETSNDBUF = 0x800454d3 TUNGETSNDBUF = 0x800454d3
TUNGETVNETHDRSZ = 0x800454d7
TUNSETDEBUG = 0x400454c9 TUNSETDEBUG = 0x400454c9
TUNSETGROUP = 0x400454ce TUNSETGROUP = 0x400454ce
TUNSETIFF = 0x400454ca TUNSETIFF = 0x400454ca
@ -1118,6 +1167,7 @@ const (
TUNSETPERSIST = 0x400454cb TUNSETPERSIST = 0x400454cb
TUNSETSNDBUF = 0x400454d4 TUNSETSNDBUF = 0x400454d4
TUNSETTXFILTER = 0x400454d1 TUNSETTXFILTER = 0x400454d1
TUNSETVNETHDRSZ = 0x400454d8
WALL = 0x40000000 WALL = 0x40000000
WCLONE = 0x80000000 WCLONE = 0x80000000
WCONTINUED = 0x8 WCONTINUED = 0x8
@ -1167,6 +1217,7 @@ const (
EFBIG = Errno(0x1b) EFBIG = Errno(0x1b)
EHOSTDOWN = Errno(0x70) EHOSTDOWN = Errno(0x70)
EHOSTUNREACH = Errno(0x71) EHOSTUNREACH = Errno(0x71)
EHWPOISON = Errno(0x85)
EIDRM = Errno(0x2b) EIDRM = Errno(0x2b)
EILSEQ = Errno(0x54) EILSEQ = Errno(0x54)
EINPROGRESS = Errno(0x73) EINPROGRESS = Errno(0x73)
@ -1437,7 +1488,8 @@ var errors = [...]string{
129: "key was rejected by service", 129: "key was rejected by service",
130: "owner died", 130: "owner died",
131: "state not recoverable", 131: "state not recoverable",
132: "unknown error 132", 132: "operation not possible due to RF-kill",
133: "unknown error 133",
} }
// Signal table // Signal table

View File

@ -1,4 +1,4 @@
// mksyscall.pl -b32 syscall_linux.go syscall_linux_arm.go // mksyscall.pl -l32 -arm syscall_linux.go syscall_linux_arm.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
package syscall package syscall
@ -287,7 +287,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { func Fallocate(fd int, mode uint32, off int64, len int64) (err error) {
_, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off>>32), uintptr(off), uintptr(len>>32), uintptr(len)) _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(off>>32), uintptr(len), uintptr(len>>32))
if e1 != 0 { if e1 != 0 {
err = e1 err = e1
} }
@ -784,7 +784,7 @@ func Sysinfo(info *Sysinfo_t) (err error) {
func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
r0, r1, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) r0, r1, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0)
n = int64(int64(r0)<<32 | int64(r1)) n = int64(int64(r1)<<32 | int64(r0))
if e1 != 0 { if e1 != 0 {
err = e1 err = e1
} }
@ -1458,6 +1458,60 @@ func Time(t *Time_t) (tt Time_t, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pread(fd int, p []byte, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32))
n = int(r0)
if e1 != 0 {
err = e1
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32))
n = int(r0)
if e1 != 0 {
err = e1
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Truncate(path string, length int64) (err error) {
_, _, e1 := Syscall6(SYS_TRUNCATE64, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, uintptr(length), uintptr(length>>32), 0, 0)
if e1 != 0 {
err = e1
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Ftruncate(fd int, length int64) (err error) {
_, _, e1 := Syscall6(SYS_FTRUNCATE64, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0)
if e1 != 0 {
err = e1
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) { func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) {
r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset)) r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset))
xaddr = uintptr(r0) xaddr = uintptr(r0)

View File

@ -1,4 +1,4 @@
// mksysnum_linux.pl /usr/include/asm/unistd.h // mksysnum_linux.pl
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
package syscall package syscall
@ -338,5 +338,17 @@ const (
SYS_PWRITEV = 362 SYS_PWRITEV = 362
SYS_RT_TGSIGQUEUEINFO = 363 SYS_RT_TGSIGQUEUEINFO = 363
SYS_PERF_EVENT_OPEN = 364 SYS_PERF_EVENT_OPEN = 364
SYS_RECVMMSG = 365
SYS_ACCEPT4 = 366 SYS_ACCEPT4 = 366
SYS_FANOTIFY_INIT = 367
SYS_FANOTIFY_MARK = 368
SYS_PRLIMIT64 = 369
SYS_NAME_TO_HANDLE_AT = 370
SYS_OPEN_BY_HANDLE_AT = 371
SYS_CLOCK_ADJTIME = 372
SYS_SYNCFS = 373
SYS_SENDMMSG = 374
SYS_SETNS = 375
SYS_PROCESS_VM_READV = 376
SYS_PROCESS_VM_WRITEV = 377
) )

View File

@ -233,7 +233,7 @@ type Cmsghdr struct {
Len uint32 Len uint32
Level int32 Level int32
Type int32 Type int32
X__cmsg_data [0]byte X__cmsg_data [0]uint8
} }
type Inet4Pktinfo struct { type Inet4Pktinfo struct {
@ -301,7 +301,7 @@ const (
IFLA_LINKINFO = 0x12 IFLA_LINKINFO = 0x12
IFLA_NET_NS_PID = 0x13 IFLA_NET_NS_PID = 0x13
IFLA_IFALIAS = 0x14 IFLA_IFALIAS = 0x14
IFLA_MAX = 0x14 IFLA_MAX = 0x1c
RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8 RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd RT_SCOPE_LINK = 0xfd
@ -435,7 +435,7 @@ type InotifyEvent struct {
Mask uint32 Mask uint32
Cookie uint32 Cookie uint32
Len uint32 Len uint32
Name [0]byte Name [0]uint8
} }
const SizeofInotifyEvent = 0x10 const SizeofInotifyEvent = 0x10