]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: fix mkall.sh, mksyscall_linux.pl, and regen for Linux/ARM
authorShenghou Ma <minux.ma@gmail.com>
Mon, 5 Mar 2012 19:12:11 +0000 (03:12 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Mon, 5 Mar 2012 19:12:11 +0000 (03:12 +0800)
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

src/pkg/syscall/mkall.sh
src/pkg/syscall/mksyscall.pl
src/pkg/syscall/syscall_linux_arm.go
src/pkg/syscall/zerrors_linux_arm.go
src/pkg/syscall/zsyscall_linux_arm.go
src/pkg/syscall/zsysnum_linux_arm.go
src/pkg/syscall/ztypes_linux_arm.go

index 853c3f7a08568af6a16c85f92fb439076bec5392..9e2d98f0d29cffb311020834d5b8d4ac3481956f 100755 (executable)
@@ -144,8 +144,8 @@ linux_amd64)
        ;;
 linux_arm)
        mkerrors="$mkerrors"
-       mksyscall="./mksyscall.pl -b32"
-       mksysnum="./mksysnum_linux.pl /usr/include/asm/unistd.h"
+       mksyscall="./mksyscall.pl -l32 -arm"
+       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"
        ;;
 netbsd_386)
index 963599c3ab535267f94ddec8acddad57708ee5ac..09949688ed1deb302833823cedde4136df8a04d4 100755 (executable)
@@ -27,6 +27,7 @@ my $_32bit = "";
 my $plan9 = 0;
 my $openbsd = 0;
 my $netbsd = 0;
+my $arm = 0; # 64-bit value should use (even, odd)-pair
 
 if($ARGV[0] eq "-b32") {
        $_32bit = "big-endian";
@@ -47,6 +48,10 @@ if($ARGV[0] eq "-netbsd") {
        $netbsd = 1;
        shift;
 }
+if($ARGV[0] eq "-arm") {
+       $arm = 1;
+       shift;
+}
 
 if($ARGV[0] =~ /^-/) {
        print STDERR "usage: mksyscall.pl [-b32 | -l32] [file ...]\n";
@@ -135,6 +140,11 @@ while(<>) {
                                push @args, "uintptr($name)";
                        }
                } 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") {
                                push @args, "uintptr($name>>32)", "uintptr($name)";
                        } else {
index 744e035f7b3cc3e637f8e4e7c10c09cf6552f6ed..48b5d31d742062a4042f1745fc25c2619457d74a 100644 (file)
@@ -4,8 +4,6 @@
 
 package syscall
 
-import "unsafe"
-
 func Getpagesize() int { return 4096 }
 
 func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
@@ -23,52 +21,6 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
        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.
 
 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        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)
 
 func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
index 9f49807b80c671dc783f5d6176a6b98c14ce6ee6..9b99cf83f1f146b44cb68254ac2cf9625b597713 100644 (file)
@@ -189,6 +189,7 @@ const (
        ETH_P_ATMMPOA                    = 0x884c
        ETH_P_AX25                       = 0x2
        ETH_P_BPQ                        = 0x8ff
+       ETH_P_CAIF                       = 0xf7
        ETH_P_CAN                        = 0xc
        ETH_P_CONTROL                    = 0x16
        ETH_P_CUST                       = 0x6006
@@ -212,6 +213,7 @@ const (
        ETH_P_IPX                        = 0x8137
        ETH_P_IRDA                       = 0x17
        ETH_P_LAT                        = 0x6004
+       ETH_P_LINK_CTL                   = 0x886c
        ETH_P_LOCALTALK                  = 0x9
        ETH_P_LOOP                       = 0x60
        ETH_P_MOBITEX                    = 0x15
@@ -249,6 +251,7 @@ const (
        F_GETLK64                        = 0xc
        F_GETOWN                         = 0x9
        F_GETOWN_EX                      = 0x10
+       F_GETPIPE_SZ                     = 0x408
        F_GETSIG                         = 0xb
        F_LOCK                           = 0x1
        F_NOTIFY                         = 0x402
@@ -263,6 +266,7 @@ const (
        F_SETLKW64                       = 0xe
        F_SETOWN                         = 0x8
        F_SETOWN_EX                      = 0xf
+       F_SETPIPE_SZ                     = 0x407
        F_SETSIG                         = 0xa
        F_SHLCK                          = 0x8
        F_TEST                           = 0x3
@@ -325,6 +329,7 @@ const (
        IN_DELETE                        = 0x200
        IN_DELETE_SELF                   = 0x400
        IN_DONT_FOLLOW                   = 0x2000000
+       IN_EXCL_UNLINK                   = 0x4000000
        IN_IGNORED                       = 0x8000
        IN_ISDIR                         = 0x40000000
        IN_LOOPBACKNET                   = 0x7f
@@ -426,18 +431,24 @@ const (
        IP_DF                            = 0x4000
        IP_DROP_MEMBERSHIP               = 0x24
        IP_DROP_SOURCE_MEMBERSHIP        = 0x28
+       IP_FREEBIND                      = 0xf
        IP_HDRINCL                       = 0x3
+       IP_IPSEC_POLICY                  = 0x10
        IP_MAXPACKET                     = 0xffff
        IP_MAX_MEMBERSHIPS               = 0x14
        IP_MF                            = 0x2000
+       IP_MINTTL                        = 0x15
        IP_MSFILTER                      = 0x29
        IP_MSS                           = 0x240
+       IP_MTU                           = 0xe
        IP_MTU_DISCOVER                  = 0xa
        IP_MULTICAST_IF                  = 0x20
        IP_MULTICAST_LOOP                = 0x22
        IP_MULTICAST_TTL                 = 0x21
        IP_OFFMASK                       = 0x1fff
        IP_OPTIONS                       = 0x4
+       IP_ORIGDSTADDR                   = 0x14
+       IP_PASSSEC                       = 0x12
        IP_PKTINFO                       = 0x8
        IP_PKTOPTIONS                    = 0x9
        IP_PMTUDISC                      = 0xa
@@ -447,6 +458,7 @@ const (
        IP_PMTUDISC_WANT                 = 0x1
        IP_RECVERR                       = 0xb
        IP_RECVOPTS                      = 0x6
+       IP_RECVORIGDSTADDR               = 0x14
        IP_RECVRETOPTS                   = 0x7
        IP_RECVTOS                       = 0xd
        IP_RECVTTL                       = 0xc
@@ -454,8 +466,10 @@ const (
        IP_RF                            = 0x8000
        IP_ROUTER_ALERT                  = 0x5
        IP_TOS                           = 0x1
+       IP_TRANSPARENT                   = 0x13
        IP_TTL                           = 0x2
        IP_UNBLOCK_SOURCE                = 0x25
+       IP_XFRM_POLICY                   = 0x11
        LINUX_REBOOT_CMD_CAD_OFF         = 0x0
        LINUX_REBOOT_CMD_CAD_ON          = 0x89abcdef
        LINUX_REBOOT_CMD_HALT            = 0xcdef0123
@@ -520,22 +534,38 @@ const (
        MSG_TRUNC                        = 0x20
        MSG_TRYHARD                      = 0x4
        MSG_WAITALL                      = 0x100
+       MSG_WAITFORONE                   = 0x10000
+       MS_ACTIVE                        = 0x40000000
        MS_ASYNC                         = 0x1
        MS_BIND                          = 0x1000
+       MS_DIRSYNC                       = 0x80
        MS_INVALIDATE                    = 0x2
+       MS_I_VERSION                     = 0x800000
+       MS_KERNMOUNT                     = 0x400000
        MS_MANDLOCK                      = 0x40
        MS_MGC_MSK                       = 0xffff0000
        MS_MGC_VAL                       = 0xc0ed0000
+       MS_MOVE                          = 0x2000
        MS_NOATIME                       = 0x400
        MS_NODEV                         = 0x4
        MS_NODIRATIME                    = 0x800
        MS_NOEXEC                        = 0x8
        MS_NOSUID                        = 0x2
+       MS_NOUSER                        = -0x80000000
+       MS_POSIXACL                      = 0x10000
+       MS_PRIVATE                       = 0x40000
        MS_RDONLY                        = 0x1
+       MS_REC                           = 0x4000
+       MS_RELATIME                      = 0x200000
        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_SYNCHRONOUS                   = 0x10
+       MS_UNBINDABLE                    = 0x20000
        NAME_MAX                         = 0xff
        NETLINK_ADD_MEMBERSHIP           = 0x1
        NETLINK_AUDIT                    = 0x9
@@ -555,6 +585,7 @@ const (
        NETLINK_NFLOG                    = 0x5
        NETLINK_NO_ENOBUFS               = 0x5
        NETLINK_PKTINFO                  = 0x3
+       NETLINK_RDMA                     = 0x14
        NETLINK_ROUTE                    = 0x0
        NETLINK_SCSITRANSPORT            = 0x12
        NETLINK_SELINUX                  = 0x7
@@ -629,6 +660,7 @@ const (
        PROT_WRITE                       = 0x2
        PR_CAPBSET_DROP                  = 0x18
        PR_CAPBSET_READ                  = 0x17
+       PR_CLEAR_SECCOMP_FILTER          = 0x25
        PR_ENDIAN_BIG                    = 0x0
        PR_ENDIAN_LITTLE                 = 0x1
        PR_ENDIAN_PPC_LITTLE             = 0x2
@@ -652,6 +684,7 @@ const (
        PR_GET_NAME                      = 0x10
        PR_GET_PDEATHSIG                 = 0x2
        PR_GET_SECCOMP                   = 0x15
+       PR_GET_SECCOMP_FILTER            = 0x23
        PR_GET_SECUREBITS                = 0x1b
        PR_GET_TIMERSLACK                = 0x1e
        PR_GET_TIMING                    = 0xd
@@ -664,6 +697,8 @@ const (
        PR_MCE_KILL_GET                  = 0x22
        PR_MCE_KILL_LATE                 = 0x0
        PR_MCE_KILL_SET                  = 0x1
+       PR_SECCOMP_FILTER_EVENT          = 0x1
+       PR_SECCOMP_FILTER_SYSCALL        = 0x0
        PR_SET_DUMPABLE                  = 0x4
        PR_SET_ENDIAN                    = 0x14
        PR_SET_FPEMU                     = 0xa
@@ -671,7 +706,9 @@ const (
        PR_SET_KEEPCAPS                  = 0x8
        PR_SET_NAME                      = 0xf
        PR_SET_PDEATHSIG                 = 0x1
+       PR_SET_PTRACER                   = 0x59616d61
        PR_SET_SECCOMP                   = 0x16
+       PR_SET_SECCOMP_FILTER            = 0x24
        PR_SET_SECUREBITS                = 0x1c
        PR_SET_TIMERSLACK                = 0x1d
        PR_SET_TIMING                    = 0xe
@@ -697,7 +734,9 @@ const (
        PTRACE_GETCRUNCHREGS             = 0x19
        PTRACE_GETEVENTMSG               = 0x4201
        PTRACE_GETFPREGS                 = 0xe
+       PTRACE_GETHBPREGS                = 0x1d
        PTRACE_GETREGS                   = 0xc
+       PTRACE_GETREGSET                 = 0x4204
        PTRACE_GETSIGINFO                = 0x4202
        PTRACE_GETVFPREGS                = 0x1b
        PTRACE_GETWMMXREGS               = 0x12
@@ -720,8 +759,10 @@ const (
        PTRACE_POKEUSR                   = 0x6
        PTRACE_SETCRUNCHREGS             = 0x1a
        PTRACE_SETFPREGS                 = 0xf
+       PTRACE_SETHBPREGS                = 0x1e
        PTRACE_SETOPTIONS                = 0x4200
        PTRACE_SETREGS                   = 0xd
+       PTRACE_SETREGSET                 = 0x4205
        PTRACE_SETSIGINFO                = 0x4203
        PTRACE_SETVFPREGS                = 0x1c
        PTRACE_SETWMMXREGS               = 0x13
@@ -749,8 +790,9 @@ const (
        RTAX_FEATURE_TIMESTAMP           = 0x4
        RTAX_HOPLIMIT                    = 0xa
        RTAX_INITCWND                    = 0xb
+       RTAX_INITRWND                    = 0xe
        RTAX_LOCK                        = 0x1
-       RTAX_MAX                         = 0xd
+       RTAX_MAX                         = 0xe
        RTAX_MTU                         = 0x2
        RTAX_REORDERING                  = 0x9
        RTAX_RTO_MIN                     = 0xd
@@ -760,7 +802,7 @@ const (
        RTAX_UNSPEC                      = 0x0
        RTAX_WINDOW                      = 0x3
        RTA_ALIGNTO                      = 0x4
-       RTA_MAX                          = 0xf
+       RTA_MAX                          = 0x10
        RTCF_DIRECTSRC                   = 0x4000000
        RTCF_DOREDIRECT                  = 0x1000000
        RTCF_LOG                         = 0x2000000
@@ -987,6 +1029,7 @@ const (
        SO_RCVLOWAT                      = 0x12
        SO_RCVTIMEO                      = 0x14
        SO_REUSEADDR                     = 0x2
+       SO_RXQ_OVFL                      = 0x28
        SO_SECURITY_AUTHENTICATION       = 0x16
        SO_SECURITY_ENCRYPTION_NETWORK   = 0x18
        SO_SECURITY_ENCRYPTION_TRANSPORT = 0x17
@@ -998,7 +1041,6 @@ const (
        SO_TIMESTAMPING                  = 0x25
        SO_TIMESTAMPNS                   = 0x23
        SO_TYPE                          = 0x3
-       S_APPEND                         = 0x100
        S_BLKSIZE                        = 0x200
        S_IEXEC                          = 0x40
        S_IFBLK                          = 0x6000
@@ -1009,7 +1051,6 @@ const (
        S_IFMT                           = 0xf000
        S_IFREG                          = 0x8000
        S_IFSOCK                         = 0xc000
-       S_IMMUTABLE                      = 0x200
        S_IREAD                          = 0x100
        S_IRGRP                          = 0x20
        S_IROTH                          = 0x4
@@ -1027,7 +1068,6 @@ const (
        S_IXGRP                          = 0x8
        S_IXOTH                          = 0x1
        S_IXUSR                          = 0x40
-       S_WRITE                          = 0x80
        TCP_CONGESTION                   = 0xd
        TCP_CORK                         = 0x3
        TCP_DEFER_ACCEPT                 = 0x9
@@ -1049,11 +1089,13 @@ const (
        TIOCCBRK                         = 0x5428
        TIOCCONS                         = 0x541d
        TIOCEXCL                         = 0x540c
+       TIOCGDEV                         = 0x80045432
        TIOCGETD                         = 0x5424
        TIOCGICOUNT                      = 0x545d
        TIOCGLCKTRMIOS                   = 0x5456
        TIOCGPGRP                        = 0x540f
        TIOCGPTN                         = 0x80045430
+       TIOCGRS485                       = 0x542e
        TIOCGSERIAL                      = 0x541e
        TIOCGSID                         = 0x5429
        TIOCGSOFTCAR                     = 0x5419
@@ -1084,6 +1126,7 @@ const (
        TIOCPKT_DOSTOP                   = 0x20
        TIOCPKT_FLUSHREAD                = 0x1
        TIOCPKT_FLUSHWRITE               = 0x2
+       TIOCPKT_IOCTL                    = 0x40
        TIOCPKT_NOSTOP                   = 0x10
        TIOCPKT_START                    = 0x8
        TIOCPKT_STOP                     = 0x4
@@ -1098,16 +1141,22 @@ const (
        TIOCSERSWILD                     = 0x5455
        TIOCSER_TEMT                     = 0x1
        TIOCSETD                         = 0x5423
+       TIOCSIG                          = 0x40045436
        TIOCSLCKTRMIOS                   = 0x5457
        TIOCSPGRP                        = 0x5410
        TIOCSPTLCK                       = 0x40045431
+       TIOCSRS485                       = 0x542f
        TIOCSSERIAL                      = 0x541f
        TIOCSSOFTCAR                     = 0x541a
        TIOCSTI                          = 0x5412
        TIOCSWINSZ                       = 0x5414
+       TIOCVHANGUP                      = 0x5437
+       TUNATTACHFILTER                  = 0x400854d5
+       TUNDETACHFILTER                  = 0x400854d6
        TUNGETFEATURES                   = 0x800454cf
        TUNGETIFF                        = 0x800454d2
        TUNGETSNDBUF                     = 0x800454d3
+       TUNGETVNETHDRSZ                  = 0x800454d7
        TUNSETDEBUG                      = 0x400454c9
        TUNSETGROUP                      = 0x400454ce
        TUNSETIFF                        = 0x400454ca
@@ -1118,6 +1167,7 @@ const (
        TUNSETPERSIST                    = 0x400454cb
        TUNSETSNDBUF                     = 0x400454d4
        TUNSETTXFILTER                   = 0x400454d1
+       TUNSETVNETHDRSZ                  = 0x400454d8
        WALL                             = 0x40000000
        WCLONE                           = 0x80000000
        WCONTINUED                       = 0x8
@@ -1167,6 +1217,7 @@ const (
        EFBIG           = Errno(0x1b)
        EHOSTDOWN       = Errno(0x70)
        EHOSTUNREACH    = Errno(0x71)
+       EHWPOISON       = Errno(0x85)
        EIDRM           = Errno(0x2b)
        EILSEQ          = Errno(0x54)
        EINPROGRESS     = Errno(0x73)
@@ -1437,7 +1488,8 @@ var errors = [...]string{
        129: "key was rejected by service",
        130: "owner died",
        131: "state not recoverable",
-       132: "unknown error 132",
+       132: "operation not possible due to RF-kill",
+       133: "unknown error 133",
 }
 
 // Signal table
index 4e9848a107fc4eac0de37d6dec1d53f214f26e68..1e86d3b7f1972a9db7546c43ff0d50a2606e554e 100644 (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
 
 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
 
 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 {
                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) {
        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 {
                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
 
+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) {
        r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset))
        xaddr = uintptr(r0)
index 1376af72b6adfa965a187eb1c14c6a5eb1f7281b..7f5d9498c295c2259c71b9deecd5a1475993ec2c 100644 (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
 
 package syscall
@@ -338,5 +338,17 @@ const (
        SYS_PWRITEV                = 362
        SYS_RT_TGSIGQUEUEINFO      = 363
        SYS_PERF_EVENT_OPEN        = 364
+       SYS_RECVMMSG               = 365
        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
 )
index 41b49e78c82f23c5598f6d4f822dd680573ec1b7..cd680c3ade9fa0deeeeaf852d59ee3ac125afffd 100644 (file)
@@ -233,7 +233,7 @@ type Cmsghdr struct {
        Len          uint32
        Level        int32
        Type         int32
-       X__cmsg_data [0]byte
+       X__cmsg_data [0]uint8
 }
 
 type Inet4Pktinfo struct {
@@ -301,7 +301,7 @@ const (
        IFLA_LINKINFO     = 0x12
        IFLA_NET_NS_PID   = 0x13
        IFLA_IFALIAS      = 0x14
-       IFLA_MAX          = 0x14
+       IFLA_MAX          = 0x1c
        RT_SCOPE_UNIVERSE = 0x0
        RT_SCOPE_SITE     = 0xc8
        RT_SCOPE_LINK     = 0xfd
@@ -435,7 +435,7 @@ type InotifyEvent struct {
        Mask   uint32
        Cookie uint32
        Len    uint32
-       Name   [0]byte
+       Name   [0]uint8
 }
 
 const SizeofInotifyEvent = 0x10