Merge pull request #5311 from hashicorp/b-update-sys-unix-dep
dep: Update golang.org/x/sys/unix/... dependencies
This commit is contained in:
commit
5444223da3
|
@ -1179,7 +1179,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/sys/unix",
|
||||
"Rev": "c65f27ffe69a43ae814a5e64c2fabb6c6312a4af"
|
||||
"Rev": "5eaf0df67e70d6997a9fe0ed24383fa1b01638d3"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/api/compute/v1",
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
_obj/
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
TEXT ·use(SB),NOSPLIT,$0
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
@ -17,7 +19,10 @@ TEXT ·Syscall(SB),NOSPLIT,$0-56
|
|||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
||||
JMP syscall·Syscall9(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
// +build arm,darwin
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for ARM, Darwin
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
||||
B syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
||||
B syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
||||
B syscall·Syscall9(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
||||
B syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
||||
B syscall·RawSyscall6(SB)
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
// +build arm64,darwin
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for AMD64, Darwin
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
B syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
B syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
||||
B syscall·Syscall9(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
B syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
B syscall·RawSyscall6(SB)
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux
|
||||
// +build arm64
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
B syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
B syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
B syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
B syscall·RawSyscall6(SB)
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux
|
||||
// +build ppc64 ppc64le
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System calls for ppc64, Linux
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
BR syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
BR syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
BR syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
BR syscall·RawSyscall6(SB)
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
|
|
|
@ -2,21 +2,16 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.goc
|
||||
// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go
|
||||
//
|
||||
|
||||
TEXT ·sysvicall6(SB), 7, $0-64
|
||||
TEXT ·sysvicall6(SB),NOSPLIT,$0-64
|
||||
JMP syscall·sysvicall6(SB)
|
||||
|
||||
TEXT ·rawSysvicall6(SB), 7, $0-64
|
||||
TEXT ·rawSysvicall6(SB),NOSPLIT,$0-64
|
||||
JMP syscall·rawSysvicall6(SB)
|
||||
|
||||
TEXT ·dlopen(SB), 7, $0-16
|
||||
JMP syscall·dlopen(SB)
|
||||
|
||||
TEXT ·dlclose(SB), 7, $0-8
|
||||
JMP syscall·dlclose(SB)
|
||||
|
||||
TEXT ·dlsym(SB), 7, $0-16
|
||||
JMP syscall·dlsym(SB)
|
||||
|
|
|
@ -1,170 +0,0 @@
|
|||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd netbsd openbsd
|
||||
|
||||
// Berkeley packet filter for BSD variants
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func BpfStmt(code, k int) *BpfInsn {
|
||||
return &BpfInsn{Code: uint16(code), K: uint32(k)}
|
||||
}
|
||||
|
||||
func BpfJump(code, k, jt, jf int) *BpfInsn {
|
||||
return &BpfInsn{Code: uint16(code), Jt: uint8(jt), Jf: uint8(jf), K: uint32(k)}
|
||||
}
|
||||
|
||||
func BpfBuflen(fd int) (int, error) {
|
||||
var l int
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGBLEN, uintptr(unsafe.Pointer(&l)))
|
||||
if err != 0 {
|
||||
return 0, syscall.Errno(err)
|
||||
}
|
||||
return l, nil
|
||||
}
|
||||
|
||||
func SetBpfBuflen(fd, l int) (int, error) {
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSBLEN, uintptr(unsafe.Pointer(&l)))
|
||||
if err != 0 {
|
||||
return 0, syscall.Errno(err)
|
||||
}
|
||||
return l, nil
|
||||
}
|
||||
|
||||
func BpfDatalink(fd int) (int, error) {
|
||||
var t int
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGDLT, uintptr(unsafe.Pointer(&t)))
|
||||
if err != 0 {
|
||||
return 0, syscall.Errno(err)
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
||||
func SetBpfDatalink(fd, t int) (int, error) {
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSDLT, uintptr(unsafe.Pointer(&t)))
|
||||
if err != 0 {
|
||||
return 0, syscall.Errno(err)
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
||||
func SetBpfPromisc(fd, m int) error {
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCPROMISC, uintptr(unsafe.Pointer(&m)))
|
||||
if err != 0 {
|
||||
return syscall.Errno(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func FlushBpf(fd int) error {
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCFLUSH, 0)
|
||||
if err != 0 {
|
||||
return syscall.Errno(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ivalue struct {
|
||||
name [IFNAMSIZ]byte
|
||||
value int16
|
||||
}
|
||||
|
||||
func BpfInterface(fd int, name string) (string, error) {
|
||||
var iv ivalue
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGETIF, uintptr(unsafe.Pointer(&iv)))
|
||||
if err != 0 {
|
||||
return "", syscall.Errno(err)
|
||||
}
|
||||
return name, nil
|
||||
}
|
||||
|
||||
func SetBpfInterface(fd int, name string) error {
|
||||
var iv ivalue
|
||||
copy(iv.name[:], []byte(name))
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSETIF, uintptr(unsafe.Pointer(&iv)))
|
||||
if err != 0 {
|
||||
return syscall.Errno(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func BpfTimeout(fd int) (*Timeval, error) {
|
||||
var tv Timeval
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGRTIMEOUT, uintptr(unsafe.Pointer(&tv)))
|
||||
if err != 0 {
|
||||
return nil, syscall.Errno(err)
|
||||
}
|
||||
return &tv, nil
|
||||
}
|
||||
|
||||
func SetBpfTimeout(fd int, tv *Timeval) error {
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSRTIMEOUT, uintptr(unsafe.Pointer(tv)))
|
||||
if err != 0 {
|
||||
return syscall.Errno(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func BpfStats(fd int) (*BpfStat, error) {
|
||||
var s BpfStat
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGSTATS, uintptr(unsafe.Pointer(&s)))
|
||||
if err != 0 {
|
||||
return nil, syscall.Errno(err)
|
||||
}
|
||||
return &s, nil
|
||||
}
|
||||
|
||||
func SetBpfImmediate(fd, m int) error {
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCIMMEDIATE, uintptr(unsafe.Pointer(&m)))
|
||||
if err != 0 {
|
||||
return syscall.Errno(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func SetBpf(fd int, i []BpfInsn) error {
|
||||
var p BpfProgram
|
||||
p.Len = uint32(len(i))
|
||||
p.Insns = (*BpfInsn)(unsafe.Pointer(&i[0]))
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSETF, uintptr(unsafe.Pointer(&p)))
|
||||
if err != 0 {
|
||||
return syscall.Errno(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func CheckBpfVersion(fd int) error {
|
||||
var v BpfVersion
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCVERSION, uintptr(unsafe.Pointer(&v)))
|
||||
if err != 0 {
|
||||
return syscall.Errno(err)
|
||||
}
|
||||
if v.Major != BPF_MAJOR_VERSION || v.Minor != BPF_MINOR_VERSION {
|
||||
return EINVAL
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func BpfHeadercmpl(fd int) (int, error) {
|
||||
var f int
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCGHDRCMPLT, uintptr(unsafe.Pointer(&f)))
|
||||
if err != 0 {
|
||||
return 0, syscall.Errno(err)
|
||||
}
|
||||
return f, nil
|
||||
}
|
||||
|
||||
func SetBpfHeadercmpl(fd, f int) error {
|
||||
_, _, err := Syscall(SYS_IOCTL, uintptr(fd), BIOCSHDRCMPLT, uintptr(unsafe.Pointer(&f)))
|
||||
if err != 0 {
|
||||
return syscall.Errno(err)
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
R_OK = 0x4
|
||||
W_OK = 0x2
|
||||
X_OK = 0x1
|
||||
)
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build gccgo
|
||||
|
||||
package unix
|
||||
|
||||
import "syscall"
|
||||
|
||||
// We can't use the gc-syntax .s files for gccgo. On the plus side
|
||||
// much of the functionality can be written directly in Go.
|
||||
|
||||
//extern gccgoRealSyscall
|
||||
func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
|
||||
|
||||
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||
syscall.Entersyscall()
|
||||
r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
|
||||
syscall.Exitsyscall()
|
||||
return r, 0, syscall.Errno(errno)
|
||||
}
|
||||
|
||||
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||
syscall.Entersyscall()
|
||||
r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
|
||||
syscall.Exitsyscall()
|
||||
return r, 0, syscall.Errno(errno)
|
||||
}
|
||||
|
||||
func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||
syscall.Entersyscall()
|
||||
r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9)
|
||||
syscall.Exitsyscall()
|
||||
return r, 0, syscall.Errno(errno)
|
||||
}
|
||||
|
||||
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||
r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
|
||||
return r, 0, syscall.Errno(errno)
|
||||
}
|
||||
|
||||
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||
r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
|
||||
return r, 0, syscall.Errno(errno)
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build gccgo
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define _STRINGIFY2_(x) #x
|
||||
#define _STRINGIFY_(x) _STRINGIFY2_(x)
|
||||
#define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__)
|
||||
|
||||
// Call syscall from C code because the gccgo support for calling from
|
||||
// Go to C does not support varargs functions.
|
||||
|
||||
struct ret {
|
||||
uintptr_t r;
|
||||
uintptr_t err;
|
||||
};
|
||||
|
||||
struct ret
|
||||
gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
|
||||
{
|
||||
struct ret r;
|
||||
|
||||
errno = 0;
|
||||
r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
r.err = errno;
|
||||
return r;
|
||||
}
|
||||
|
||||
// Define the use function in C so that it is not inlined.
|
||||
|
||||
extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline));
|
||||
|
||||
void
|
||||
use(void *p __attribute__ ((unused)))
|
||||
{
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build gccgo,linux,amd64
|
||||
|
||||
package unix
|
||||
|
||||
import "syscall"
|
||||
|
||||
//extern gettimeofday
|
||||
func realGettimeofday(*Timeval, *byte) int32
|
||||
|
||||
func gettimeofday(tv *Timeval) (err syscall.Errno) {
|
||||
r := realGettimeofday(tv, nil)
|
||||
if r < 0 {
|
||||
return syscall.GetErrno()
|
||||
}
|
||||
return 0
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Linux socket filter
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func LsfStmt(code, k int) *SockFilter {
|
||||
return &SockFilter{Code: uint16(code), K: uint32(k)}
|
||||
}
|
||||
|
||||
func LsfJump(code, k, jt, jf int) *SockFilter {
|
||||
return &SockFilter{Code: uint16(code), Jt: uint8(jt), Jf: uint8(jf), K: uint32(k)}
|
||||
}
|
||||
|
||||
func LsfSocket(ifindex, proto int) (int, error) {
|
||||
var lsall SockaddrLinklayer
|
||||
s, e := Socket(AF_PACKET, SOCK_RAW, proto)
|
||||
if e != nil {
|
||||
return 0, e
|
||||
}
|
||||
p := (*[2]byte)(unsafe.Pointer(&lsall.Protocol))
|
||||
p[0] = byte(proto >> 8)
|
||||
p[1] = byte(proto)
|
||||
lsall.Ifindex = ifindex
|
||||
e = Bind(s, &lsall)
|
||||
if e != nil {
|
||||
Close(s)
|
||||
return 0, e
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
type iflags struct {
|
||||
name [IFNAMSIZ]byte
|
||||
flags uint16
|
||||
}
|
||||
|
||||
func SetLsfPromisc(name string, m bool) error {
|
||||
s, e := Socket(AF_INET, SOCK_DGRAM, 0)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
defer Close(s)
|
||||
var ifl iflags
|
||||
copy(ifl.name[:], []byte(name))
|
||||
_, _, ep := Syscall(SYS_IOCTL, uintptr(s), SIOCGIFFLAGS, uintptr(unsafe.Pointer(&ifl)))
|
||||
if ep != 0 {
|
||||
return syscall.Errno(ep)
|
||||
}
|
||||
if m {
|
||||
ifl.flags |= uint16(IFF_PROMISC)
|
||||
} else {
|
||||
ifl.flags &= ^uint16(IFF_PROMISC)
|
||||
}
|
||||
_, _, ep = Syscall(SYS_IOCTL, uintptr(s), SIOCSIFFLAGS, uintptr(unsafe.Pointer(&ifl)))
|
||||
if ep != 0 {
|
||||
return syscall.Errno(ep)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func AttachLsf(fd int, i []SockFilter) error {
|
||||
var p SockFprog
|
||||
p.Len = uint16(len(i))
|
||||
p.Filter = (*SockFilter)(unsafe.Pointer(&i[0]))
|
||||
return setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, unsafe.Pointer(&p), unsafe.Sizeof(p))
|
||||
}
|
||||
|
||||
func DetachLsf(fd int) error {
|
||||
var dummy int
|
||||
return setsockopt(fd, SOL_SOCKET, SO_DETACH_FILTER, unsafe.Pointer(&dummy), unsafe.Sizeof(dummy))
|
||||
}
|
|
@ -107,6 +107,7 @@ case "$#" in
|
|||
exit 2
|
||||
esac
|
||||
|
||||
GOOSARCH_in=syscall_$GOOSARCH.go
|
||||
case "$GOOSARCH" in
|
||||
_* | *_ | _)
|
||||
echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
|
||||
|
@ -115,12 +116,22 @@ _* | *_ | _)
|
|||
darwin_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32"
|
||||
mksysnum="./mksysnum_darwin.pl /usr/include/sys/syscall.h"
|
||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
darwin_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/syscall.h"
|
||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
darwin_arm)
|
||||
mkerrors="$mkerrors"
|
||||
mksysnum="./mksysnum_darwin.pl /usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
darwin_arm64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
dragonfly_386)
|
||||
|
@ -173,7 +184,32 @@ linux_amd64)
|
|||
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"
|
||||
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"
|
||||
;;
|
||||
linux_arm64)
|
||||
unistd_h=$(ls -1 /usr/include/asm/unistd.h /usr/include/asm-generic/unistd.h 2>/dev/null | head -1)
|
||||
if [ "$unistd_h" = "" ]; then
|
||||
echo >&2 cannot find unistd_64.h
|
||||
exit 1
|
||||
fi
|
||||
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||
# 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_ppc64)
|
||||
GOOSARCH_in=syscall_linux_ppc64x.go
|
||||
unistd_h=/usr/include/asm/unistd.h
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
linux_ppc64le)
|
||||
GOOSARCH_in=syscall_linux_ppc64x.go
|
||||
unistd_h=/usr/include/powerpc64le-linux-gnu/asm/unistd.h
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
netbsd_386)
|
||||
|
@ -193,7 +229,7 @@ openbsd_386)
|
|||
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"
|
||||
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
openbsd_amd64)
|
||||
|
@ -201,7 +237,7 @@ openbsd_amd64)
|
|||
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"
|
||||
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
solaris_amd64)
|
||||
|
@ -226,10 +262,13 @@ esac
|
|||
syscall_goos="syscall_bsd.go $syscall_goos"
|
||||
;;
|
||||
esac
|
||||
if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos syscall_$GOOSARCH.go |gofmt >zsyscall_$GOOSARCH.go"; fi
|
||||
if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi
|
||||
;;
|
||||
esac
|
||||
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
|
||||
if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
|
||||
if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go |gofmt >ztypes_$GOOSARCH.go"; fi
|
||||
if [ -n "$mktypes" ]; then
|
||||
echo "echo // +build $GOARCH,$GOOS > ztypes_$GOOSARCH.go";
|
||||
echo "$mktypes types_$GOOS.go | gofmt >>ztypes_$GOOSARCH.go";
|
||||
fi
|
||||
) | $run
|
||||
|
|
|
@ -11,7 +11,17 @@ unset LANG
|
|||
export LC_ALL=C
|
||||
export LC_CTYPE=C
|
||||
|
||||
CC=${CC:-gcc}
|
||||
if test -z "$GOARCH" -o -z "$GOOS"; then
|
||||
echo 1>&2 "GOARCH or GOOS not defined in environment"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CC=${CC:-cc}
|
||||
|
||||
if [[ "$GOOS" -eq "solaris" ]]; then
|
||||
# Assumes GNU versions of utilities in PATH.
|
||||
export PATH=/usr/gnu/bin:$PATH
|
||||
fi
|
||||
|
||||
uname=$(uname)
|
||||
|
||||
|
@ -33,7 +43,6 @@ includes_Darwin='
|
|||
#include <net/route.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_mroute.h>
|
||||
#include <termios.h>
|
||||
'
|
||||
|
||||
|
@ -74,6 +83,7 @@ includes_FreeBSD='
|
|||
#include <termios.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_mroute.h>
|
||||
#include <sys/extattr.h>
|
||||
|
||||
#if __FreeBSD__ >= 10
|
||||
#define IFT_CARP 0xf8 // IFT_CARP is deprecated in FreeBSD 10
|
||||
|
@ -87,7 +97,9 @@ includes_FreeBSD='
|
|||
includes_Linux='
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#ifndef __LP64__
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#endif
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <bits/sockaddr.h>
|
||||
|
@ -116,11 +128,19 @@ includes_Linux='
|
|||
#include <linux/wait.h>
|
||||
#include <linux/icmpv6.h>
|
||||
#include <net/route.h>
|
||||
#include <termios.h>
|
||||
#include <asm/termbits.h>
|
||||
|
||||
#ifndef MSG_FASTOPEN
|
||||
#define MSG_FASTOPEN 0x20000000
|
||||
#endif
|
||||
|
||||
#ifndef PTRACE_GETREGS
|
||||
#define PTRACE_GETREGS 0xc
|
||||
#endif
|
||||
|
||||
#ifndef PTRACE_SETREGS
|
||||
#define PTRACE_SETREGS 0xd
|
||||
#endif
|
||||
'
|
||||
|
||||
includes_NetBSD='
|
||||
|
@ -185,6 +205,7 @@ includes_OpenBSD='
|
|||
'
|
||||
|
||||
includes_SunOS='
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
|
@ -217,6 +238,7 @@ includes='
|
|||
#include <sys/signal.h>
|
||||
#include <signal.h>
|
||||
#include <sys/resource.h>
|
||||
#include <time.h>
|
||||
'
|
||||
ccflags="$@"
|
||||
|
||||
|
@ -243,6 +265,10 @@ ccflags="$@"
|
|||
$2 ~ /^(SIGEV_|SIGSTKSZ|SIGRT(MIN|MAX))/ {next}
|
||||
$2 ~ /^(SCM_SRCRT)$/ {next}
|
||||
$2 ~ /^(MAP_FAILED)$/ {next}
|
||||
$2 ~ /^ELF_.*$/ {next}# <asm/elf.h> contains ELF_ARCH, etc.
|
||||
|
||||
$2 ~ /^EXTATTR_NAMESPACE_NAMES/ ||
|
||||
$2 ~ /^EXTATTR_NAMESPACE_[A-Z]+_STRING/ {next}
|
||||
|
||||
$2 !~ /^ETH_/ &&
|
||||
$2 !~ /^EPROC_/ &&
|
||||
|
@ -250,21 +276,31 @@ ccflags="$@"
|
|||
$2 !~ /^EXPR_/ &&
|
||||
$2 ~ /^E[A-Z0-9_]+$/ ||
|
||||
$2 ~ /^B[0-9_]+$/ ||
|
||||
$2 == "BOTHER" ||
|
||||
$2 ~ /^CI?BAUD(EX)?$/ ||
|
||||
$2 == "IBSHIFT" ||
|
||||
$2 ~ /^V[A-Z0-9]+$/ ||
|
||||
$2 ~ /^CS[A-Z0-9]/ ||
|
||||
$2 ~ /^I(SIG|CANON|CRNL|EXTEN|MAXBEL|STRIP|UTF8)$/ ||
|
||||
$2 ~ /^I(SIG|CANON|CRNL|UCLC|EXTEN|MAXBEL|STRIP|UTF8)$/ ||
|
||||
$2 ~ /^IGN/ ||
|
||||
$2 ~ /^IX(ON|ANY|OFF)$/ ||
|
||||
$2 ~ /^IN(LCR|PCK)$/ ||
|
||||
$2 ~ /(^FLU?SH)|(FLU?SH$)/ ||
|
||||
$2 ~ /^C(LOCAL|READ)$/ ||
|
||||
$2 ~ /^C(LOCAL|READ|MSPAR|RTSCTS)$/ ||
|
||||
$2 == "BRKINT" ||
|
||||
$2 == "HUPCL" ||
|
||||
$2 == "PENDIN" ||
|
||||
$2 == "TOSTOP" ||
|
||||
$2 == "XCASE" ||
|
||||
$2 == "ALTWERASE" ||
|
||||
$2 == "NOKERNINFO" ||
|
||||
$2 ~ /^PAR/ ||
|
||||
$2 ~ /^SIG[^_]/ ||
|
||||
$2 ~ /^O[CNPFP][A-Z]+[^_][A-Z]+$/ ||
|
||||
$2 ~ /^O[CNPFPL][A-Z]+[^_][A-Z]+$/ ||
|
||||
$2 ~ /^(NL|CR|TAB|BS|VT|FF)DLY$/ ||
|
||||
$2 ~ /^(NL|CR|TAB|BS|VT|FF)[0-9]$/ ||
|
||||
$2 ~ /^O?XTABS$/ ||
|
||||
$2 ~ /^TC[IO](ON|OFF)$/ ||
|
||||
$2 ~ /^IN_/ ||
|
||||
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
|
||||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
|
||||
|
@ -283,6 +319,9 @@ ccflags="$@"
|
|||
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P)_/ ||
|
||||
$2 ~ /^SIOC/ ||
|
||||
$2 ~ /^TIOC/ ||
|
||||
$2 ~ /^TCGET/ ||
|
||||
$2 ~ /^TCSET/ ||
|
||||
$2 ~ /^TC(FLSH|SBRKP?|XONC)$/ ||
|
||||
$2 !~ "RTF_BITS" &&
|
||||
$2 ~ /^(IFF|IFT|NET_RT|RTM|RTF|RTV|RTA|RTAX)_/ ||
|
||||
$2 ~ /^BIOC/ ||
|
||||
|
@ -292,6 +331,7 @@ ccflags="$@"
|
|||
$2 ~ /^CLONE_[A-Z_]+/ ||
|
||||
$2 !~ /^(BPF_TIMEVAL)$/ &&
|
||||
$2 ~ /^(BPF|DLT)_/ ||
|
||||
$2 ~ /^CLOCK_/ ||
|
||||
$2 !~ "WMESGLEN" &&
|
||||
$2 ~ /^W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", $2, $2)}
|
||||
$2 ~ /^__WCOREFLAG$/ {next}
|
||||
|
@ -330,6 +370,8 @@ echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
|||
echo '// mkerrors.sh' "$@"
|
||||
echo '// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT'
|
||||
echo
|
||||
echo "// +build ${GOARCH},${GOOS}"
|
||||
echo
|
||||
go tool cgo -godefs -- "$@" _const.go >_error.out
|
||||
cat _error.out | grep -vf _error.grep | grep -vf _signal.grep
|
||||
echo
|
||||
|
|
|
@ -63,6 +63,11 @@ if($ARGV[0] =~ /^-/) {
|
|||
exit 1;
|
||||
}
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub parseparamlist($) {
|
||||
my ($list) = @_;
|
||||
$list =~ s/^\s*//;
|
||||
|
@ -284,7 +289,7 @@ while(<>) {
|
|||
$text .= "\t}\n";
|
||||
} elsif ($do_errno) {
|
||||
$text .= "\tif e1 != 0 {\n";
|
||||
$text .= "\t\terr = e1\n";
|
||||
$text .= "\t\terr = errnoErr(e1)\n";
|
||||
$text .= "\t}\n";
|
||||
}
|
||||
$text .= "\treturn\n";
|
||||
|
@ -302,9 +307,16 @@ print <<EOF;
|
|||
// $cmdline
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var _ syscall.Errno
|
||||
|
||||
$text
|
||||
EOF
|
||||
|
|
|
@ -38,6 +38,11 @@ if($ARGV[0] =~ /^-/) {
|
|||
exit 1;
|
||||
}
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub parseparamlist($) {
|
||||
my ($list) = @_;
|
||||
$list =~ s/^\s*//;
|
||||
|
@ -60,9 +65,9 @@ sub parseparam($) {
|
|||
|
||||
my $package = "";
|
||||
my $text = "";
|
||||
my $vars = "";
|
||||
my $mods = "";
|
||||
my $modnames = "";
|
||||
my $dynimports = "";
|
||||
my $linknames = "";
|
||||
my @vars = ();
|
||||
while(<>) {
|
||||
chomp;
|
||||
s/\s+/ /g;
|
||||
|
@ -90,11 +95,6 @@ while(<>) {
|
|||
if($modname eq "") {
|
||||
$modname = "libc";
|
||||
}
|
||||
my $modvname = "mod$modname";
|
||||
if($modnames !~ /$modname/) {
|
||||
$modnames .= ".$modname";
|
||||
$mods .= "\t$modvname = newLazySO(\"$modname.so\")\n";
|
||||
}
|
||||
|
||||
# System call name.
|
||||
if($sysname eq "") {
|
||||
|
@ -107,9 +107,14 @@ while(<>) {
|
|||
my $strconvfunc = "BytePtrFromString";
|
||||
my $strconvtype = "*byte";
|
||||
|
||||
# Library proc address variable.
|
||||
$sysname =~ y/A-Z/a-z/; # All libc functions are lowercase.
|
||||
$vars .= "\t$sysvarname = $modvname.NewProc(\"$sysname\")\n";
|
||||
|
||||
# Runtime import of function to allow cross-platform builds.
|
||||
$dynimports .= "//go:cgo_import_dynamic libc_${sysname} ${sysname} \"$modname.so\"\n";
|
||||
# Link symbol to proc address variable.
|
||||
$linknames .= "//go:linkname ${sysvarname} libc_${sysname}\n";
|
||||
# Library proc address variable.
|
||||
push @vars, $sysvarname;
|
||||
|
||||
# Go function header.
|
||||
$out = join(', ', @out);
|
||||
|
@ -193,7 +198,7 @@ while(<>) {
|
|||
|
||||
# Actual call.
|
||||
my $args = join(', ', @args);
|
||||
my $call = "$asm($sysvarname.Addr(), $nargs, $args)";
|
||||
my $call = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $args)";
|
||||
|
||||
# Assign return values.
|
||||
my $body = "";
|
||||
|
@ -260,21 +265,30 @@ print <<EOF;
|
|||
// $cmdline
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package $package
|
||||
|
||||
import "unsafe"
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
EOF
|
||||
|
||||
print "import \"code.google.com/p/go.sys/unix\"\n" if $package ne "unix";
|
||||
print "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
|
||||
|
||||
print <<EOF;
|
||||
my $vardecls = "\t" . join(",\n\t", @vars);
|
||||
$vardecls .= " syscallFunc";
|
||||
|
||||
chomp($_=<<EOF);
|
||||
|
||||
$dynimports
|
||||
$linknames
|
||||
var (
|
||||
$mods
|
||||
$vars
|
||||
$vardecls
|
||||
)
|
||||
|
||||
$text
|
||||
|
||||
EOF
|
||||
print $_;
|
||||
exit 0;
|
||||
|
|
|
@ -14,6 +14,11 @@
|
|||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $debug = 0;
|
||||
my %ctls = ();
|
||||
|
||||
|
@ -237,6 +242,8 @@ print <<EOF;
|
|||
// mksysctl_openbsd.pl
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix;
|
||||
|
||||
type mibentry struct {
|
||||
|
|
|
@ -7,12 +7,19 @@
|
|||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_darwin.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
|
|
|
@ -8,12 +8,19 @@
|
|||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_dragonfly.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
|
|
|
@ -8,12 +8,19 @@
|
|||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_freebsd.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
|
|
|
@ -5,12 +5,19 @@
|
|||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_linux.pl ". join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const(
|
||||
|
@ -18,13 +25,26 @@ EOF
|
|||
|
||||
sub fmt {
|
||||
my ($name, $num) = @_;
|
||||
if($num > 999){
|
||||
# ignore deprecated syscalls that are no longer implemented
|
||||
# https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/unistd.h?id=refs/heads/master#n716
|
||||
return;
|
||||
}
|
||||
$name =~ y/a-z/A-Z/;
|
||||
print " SYS_$name = $num;\n";
|
||||
}
|
||||
|
||||
my $prev;
|
||||
while(<>){
|
||||
if(/^#define __NR_(\w+)\s+([0-9]+)/){
|
||||
open(GCC, "gcc -E -dD $ARGV[0] |") || die "can't run gcc";
|
||||
while(<GCC>){
|
||||
if(/^#define __NR_syscalls\s+/) {
|
||||
# ignore redefinitions of __NR_syscalls
|
||||
}
|
||||
elsif(/^#define __NR_(\w+)\s+([0-9]+)/){
|
||||
$prev = $2;
|
||||
fmt($1, $2);
|
||||
}
|
||||
elsif(/^#define __NR3264_(\w+)\s+([0-9]+)/){
|
||||
$prev = $2;
|
||||
fmt($1, $2);
|
||||
}
|
||||
|
|
|
@ -8,12 +8,19 @@
|
|||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_netbsd.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
|
|
|
@ -8,12 +8,19 @@
|
|||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_openbsd.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
|
|
|
@ -1,178 +0,0 @@
|
|||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Netlink sockets and messages
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// Round the length of a netlink message up to align it properly.
|
||||
func nlmAlignOf(msglen int) int {
|
||||
return (msglen + NLMSG_ALIGNTO - 1) & ^(NLMSG_ALIGNTO - 1)
|
||||
}
|
||||
|
||||
// Round the length of a netlink route attribute up to align it
|
||||
// properly.
|
||||
func rtaAlignOf(attrlen int) int {
|
||||
return (attrlen + RTA_ALIGNTO - 1) & ^(RTA_ALIGNTO - 1)
|
||||
}
|
||||
|
||||
// NetlinkRouteRequest represents a request message to receive routing
|
||||
// and link states from the kernel.
|
||||
type NetlinkRouteRequest struct {
|
||||
Header NlMsghdr
|
||||
Data RtGenmsg
|
||||
}
|
||||
|
||||
func (rr *NetlinkRouteRequest) toWireFormat() []byte {
|
||||
b := make([]byte, rr.Header.Len)
|
||||
*(*uint32)(unsafe.Pointer(&b[0:4][0])) = rr.Header.Len
|
||||
*(*uint16)(unsafe.Pointer(&b[4:6][0])) = rr.Header.Type
|
||||
*(*uint16)(unsafe.Pointer(&b[6:8][0])) = rr.Header.Flags
|
||||
*(*uint32)(unsafe.Pointer(&b[8:12][0])) = rr.Header.Seq
|
||||
*(*uint32)(unsafe.Pointer(&b[12:16][0])) = rr.Header.Pid
|
||||
b[16] = byte(rr.Data.Family)
|
||||
return b
|
||||
}
|
||||
|
||||
func newNetlinkRouteRequest(proto, seq, family int) []byte {
|
||||
rr := &NetlinkRouteRequest{}
|
||||
rr.Header.Len = uint32(NLMSG_HDRLEN + SizeofRtGenmsg)
|
||||
rr.Header.Type = uint16(proto)
|
||||
rr.Header.Flags = NLM_F_DUMP | NLM_F_REQUEST
|
||||
rr.Header.Seq = uint32(seq)
|
||||
rr.Data.Family = uint8(family)
|
||||
return rr.toWireFormat()
|
||||
}
|
||||
|
||||
// NetlinkRIB returns routing information base, as known as RIB, which
|
||||
// consists of network facility information, states and parameters.
|
||||
func NetlinkRIB(proto, family int) ([]byte, error) {
|
||||
s, err := Socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer Close(s)
|
||||
lsa := &SockaddrNetlink{Family: AF_NETLINK}
|
||||
if err := Bind(s, lsa); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
wb := newNetlinkRouteRequest(proto, 1, family)
|
||||
if err := Sendto(s, wb, 0, lsa); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var tab []byte
|
||||
rbNew := make([]byte, Getpagesize())
|
||||
done:
|
||||
for {
|
||||
rb := rbNew
|
||||
nr, _, err := Recvfrom(s, rb, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if nr < NLMSG_HDRLEN {
|
||||
return nil, EINVAL
|
||||
}
|
||||
rb = rb[:nr]
|
||||
tab = append(tab, rb...)
|
||||
msgs, err := ParseNetlinkMessage(rb)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, m := range msgs {
|
||||
lsa, err := Getsockname(s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch v := lsa.(type) {
|
||||
case *SockaddrNetlink:
|
||||
if m.Header.Seq != 1 || m.Header.Pid != v.Pid {
|
||||
return nil, EINVAL
|
||||
}
|
||||
default:
|
||||
return nil, EINVAL
|
||||
}
|
||||
if m.Header.Type == NLMSG_DONE {
|
||||
break done
|
||||
}
|
||||
if m.Header.Type == NLMSG_ERROR {
|
||||
return nil, EINVAL
|
||||
}
|
||||
}
|
||||
}
|
||||
return tab, nil
|
||||
}
|
||||
|
||||
// NetlinkMessage represents a netlink message.
|
||||
type NetlinkMessage struct {
|
||||
Header NlMsghdr
|
||||
Data []byte
|
||||
}
|
||||
|
||||
// ParseNetlinkMessage parses b as an array of netlink messages and
|
||||
// returns the slice containing the NetlinkMessage structures.
|
||||
func ParseNetlinkMessage(b []byte) ([]NetlinkMessage, error) {
|
||||
var msgs []NetlinkMessage
|
||||
for len(b) >= NLMSG_HDRLEN {
|
||||
h, dbuf, dlen, err := netlinkMessageHeaderAndData(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m := NetlinkMessage{Header: *h, Data: dbuf[:int(h.Len)-NLMSG_HDRLEN]}
|
||||
msgs = append(msgs, m)
|
||||
b = b[dlen:]
|
||||
}
|
||||
return msgs, nil
|
||||
}
|
||||
|
||||
func netlinkMessageHeaderAndData(b []byte) (*NlMsghdr, []byte, int, error) {
|
||||
h := (*NlMsghdr)(unsafe.Pointer(&b[0]))
|
||||
if int(h.Len) < NLMSG_HDRLEN || int(h.Len) > len(b) {
|
||||
return nil, nil, 0, EINVAL
|
||||
}
|
||||
return h, b[NLMSG_HDRLEN:], nlmAlignOf(int(h.Len)), nil
|
||||
}
|
||||
|
||||
// NetlinkRouteAttr represents a netlink route attribute.
|
||||
type NetlinkRouteAttr struct {
|
||||
Attr RtAttr
|
||||
Value []byte
|
||||
}
|
||||
|
||||
// ParseNetlinkRouteAttr parses m's payload as an array of netlink
|
||||
// route attributes and returns the slice containing the
|
||||
// NetlinkRouteAttr structures.
|
||||
func ParseNetlinkRouteAttr(m *NetlinkMessage) ([]NetlinkRouteAttr, error) {
|
||||
var b []byte
|
||||
switch m.Header.Type {
|
||||
case RTM_NEWLINK, RTM_DELLINK:
|
||||
b = m.Data[SizeofIfInfomsg:]
|
||||
case RTM_NEWADDR, RTM_DELADDR:
|
||||
b = m.Data[SizeofIfAddrmsg:]
|
||||
case RTM_NEWROUTE, RTM_DELROUTE:
|
||||
b = m.Data[SizeofRtMsg:]
|
||||
default:
|
||||
return nil, EINVAL
|
||||
}
|
||||
var attrs []NetlinkRouteAttr
|
||||
for len(b) >= SizeofRtAttr {
|
||||
a, vbuf, alen, err := netlinkRouteAttrAndValue(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ra := NetlinkRouteAttr{Attr: *a, Value: vbuf[:int(a.Len)-SizeofRtAttr]}
|
||||
attrs = append(attrs, ra)
|
||||
b = b[alen:]
|
||||
}
|
||||
return attrs, nil
|
||||
}
|
||||
|
||||
func netlinkRouteAttrAndValue(b []byte) (*RtAttr, []byte, int, error) {
|
||||
a := (*RtAttr)(unsafe.Pointer(&b[0]))
|
||||
if int(a.Len) < SizeofRtAttr || int(a.Len) > len(b) {
|
||||
return nil, nil, 0, EINVAL
|
||||
}
|
||||
return a, b[SizeofRtAttr:], rtaAlignOf(int(a.Len)), nil
|
||||
}
|
|
@ -1,224 +0,0 @@
|
|||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd netbsd openbsd
|
||||
|
||||
// Routing sockets and messages
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// Round the length of a raw sockaddr up to align it properly.
|
||||
func rsaAlignOf(salen int) int {
|
||||
salign := sizeofPtr
|
||||
// NOTE: It seems like 64-bit Darwin kernel still requires
|
||||
// 32-bit aligned access to BSD subsystem. Also NetBSD 6
|
||||
// kernel and beyond require 64-bit aligned access to routing
|
||||
// facilities.
|
||||
if darwin64Bit {
|
||||
salign = 4
|
||||
} else if netbsd32Bit {
|
||||
salign = 8
|
||||
}
|
||||
if salen == 0 {
|
||||
return salign
|
||||
}
|
||||
return (salen + salign - 1) & ^(salign - 1)
|
||||
}
|
||||
|
||||
// RouteRIB returns routing information base, as known as RIB,
|
||||
// which consists of network facility information, states and
|
||||
// parameters.
|
||||
func RouteRIB(facility, param int) ([]byte, error) {
|
||||
mib := []_C_int{CTL_NET, AF_ROUTE, 0, 0, _C_int(facility), _C_int(param)}
|
||||
// Find size.
|
||||
n := uintptr(0)
|
||||
if err := sysctl(mib, nil, &n, nil, 0); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if n == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
tab := make([]byte, n)
|
||||
if err := sysctl(mib, &tab[0], &n, nil, 0); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return tab[:n], nil
|
||||
}
|
||||
|
||||
// RoutingMessage represents a routing message.
|
||||
type RoutingMessage interface {
|
||||
sockaddr() []Sockaddr
|
||||
}
|
||||
|
||||
const anyMessageLen = int(unsafe.Sizeof(anyMessage{}))
|
||||
|
||||
type anyMessage struct {
|
||||
Msglen uint16
|
||||
Version uint8
|
||||
Type uint8
|
||||
}
|
||||
|
||||
// RouteMessage represents a routing message containing routing
|
||||
// entries.
|
||||
type RouteMessage struct {
|
||||
Header RtMsghdr
|
||||
Data []byte
|
||||
}
|
||||
|
||||
const rtaRtMask = RTA_DST | RTA_GATEWAY | RTA_NETMASK | RTA_GENMASK
|
||||
|
||||
func (m *RouteMessage) sockaddr() []Sockaddr {
|
||||
var (
|
||||
af int
|
||||
sas [4]Sockaddr
|
||||
)
|
||||
b := m.Data[:]
|
||||
for i := uint(0); i < RTAX_MAX; i++ {
|
||||
if m.Header.Addrs&rtaRtMask&(1<<i) == 0 {
|
||||
continue
|
||||
}
|
||||
rsa := (*RawSockaddr)(unsafe.Pointer(&b[0]))
|
||||
switch i {
|
||||
case RTAX_DST, RTAX_GATEWAY:
|
||||
sa, err := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(rsa)))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
if i == RTAX_DST {
|
||||
af = int(rsa.Family)
|
||||
}
|
||||
sas[i] = sa
|
||||
case RTAX_NETMASK, RTAX_GENMASK:
|
||||
switch af {
|
||||
case AF_INET:
|
||||
rsa4 := (*RawSockaddrInet4)(unsafe.Pointer(&b[0]))
|
||||
sa := new(SockaddrInet4)
|
||||
for j := 0; rsa4.Len > 0 && j < int(rsa4.Len)-int(unsafe.Offsetof(rsa4.Addr)); j++ {
|
||||
sa.Addr[j] = rsa4.Addr[j]
|
||||
}
|
||||
sas[i] = sa
|
||||
case AF_INET6:
|
||||
rsa6 := (*RawSockaddrInet6)(unsafe.Pointer(&b[0]))
|
||||
sa := new(SockaddrInet6)
|
||||
for j := 0; rsa6.Len > 0 && j < int(rsa6.Len)-int(unsafe.Offsetof(rsa6.Addr)); j++ {
|
||||
sa.Addr[j] = rsa6.Addr[j]
|
||||
}
|
||||
sas[i] = sa
|
||||
}
|
||||
}
|
||||
b = b[rsaAlignOf(int(rsa.Len)):]
|
||||
}
|
||||
return sas[:]
|
||||
}
|
||||
|
||||
// InterfaceMessage represents a routing message containing
|
||||
// network interface entries.
|
||||
type InterfaceMessage struct {
|
||||
Header IfMsghdr
|
||||
Data []byte
|
||||
}
|
||||
|
||||
func (m *InterfaceMessage) sockaddr() (sas []Sockaddr) {
|
||||
if m.Header.Addrs&RTA_IFP == 0 {
|
||||
return nil
|
||||
}
|
||||
sa, err := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(&m.Data[0])))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return append(sas, sa)
|
||||
}
|
||||
|
||||
// InterfaceAddrMessage represents a routing message containing
|
||||
// network interface address entries.
|
||||
type InterfaceAddrMessage struct {
|
||||
Header IfaMsghdr
|
||||
Data []byte
|
||||
}
|
||||
|
||||
const rtaIfaMask = RTA_IFA | RTA_NETMASK | RTA_BRD
|
||||
|
||||
func (m *InterfaceAddrMessage) sockaddr() (sas []Sockaddr) {
|
||||
if m.Header.Addrs&rtaIfaMask == 0 {
|
||||
return nil
|
||||
}
|
||||
b := m.Data[:]
|
||||
// We still see AF_UNSPEC in socket addresses on some
|
||||
// platforms. To identify each address family correctly, we
|
||||
// will use the address family of RTAX_NETMASK as a preferred
|
||||
// one on the 32-bit NetBSD kernel, also use the length of
|
||||
// RTAX_NETMASK socket address on the FreeBSD kernel.
|
||||
preferredFamily := uint8(AF_UNSPEC)
|
||||
for i := uint(0); i < RTAX_MAX; i++ {
|
||||
if m.Header.Addrs&rtaIfaMask&(1<<i) == 0 {
|
||||
continue
|
||||
}
|
||||
rsa := (*RawSockaddr)(unsafe.Pointer(&b[0]))
|
||||
switch i {
|
||||
case RTAX_IFA:
|
||||
if rsa.Family == AF_UNSPEC {
|
||||
rsa.Family = preferredFamily
|
||||
}
|
||||
sa, err := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(rsa)))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
sas = append(sas, sa)
|
||||
case RTAX_NETMASK:
|
||||
switch rsa.Family {
|
||||
case AF_UNSPEC:
|
||||
switch rsa.Len {
|
||||
case SizeofSockaddrInet4:
|
||||
rsa.Family = AF_INET
|
||||
case SizeofSockaddrInet6:
|
||||
rsa.Family = AF_INET6
|
||||
default:
|
||||
rsa.Family = AF_INET // an old fashion, AF_UNSPEC means AF_INET
|
||||
}
|
||||
case AF_INET, AF_INET6:
|
||||
preferredFamily = rsa.Family
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
sa, err := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(rsa)))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
sas = append(sas, sa)
|
||||
case RTAX_BRD:
|
||||
// nothing to do
|
||||
}
|
||||
b = b[rsaAlignOf(int(rsa.Len)):]
|
||||
}
|
||||
return sas
|
||||
}
|
||||
|
||||
// ParseRoutingMessage parses b as routing messages and returns the
|
||||
// slice containing the RoutingMessage interfaces.
|
||||
func ParseRoutingMessage(b []byte) (msgs []RoutingMessage, err error) {
|
||||
msgCount := 0
|
||||
for len(b) >= anyMessageLen {
|
||||
msgCount++
|
||||
any := (*anyMessage)(unsafe.Pointer(&b[0]))
|
||||
if any.Version != RTM_VERSION {
|
||||
b = b[any.Msglen:]
|
||||
continue
|
||||
}
|
||||
msgs = append(msgs, any.toRoutingMessage(b))
|
||||
b = b[any.Msglen:]
|
||||
}
|
||||
// We failed to parse any of the messages - version mismatch?
|
||||
if msgCount > 0 && len(msgs) == 0 {
|
||||
return nil, EINVAL
|
||||
}
|
||||
return msgs, nil
|
||||
}
|
||||
|
||||
// ParseRoutingMessage parses msg's payload as raw sockaddrs and
|
||||
// returns the slice containing the Sockaddr interfaces.
|
||||
func ParseRoutingSockaddr(msg RoutingMessage) (sas []Sockaddr, err error) {
|
||||
return append(sas, msg.sockaddr()...), nil
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Routing sockets and messages for Darwin
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
func (any *anyMessage) toRoutingMessage(b []byte) RoutingMessage {
|
||||
switch any.Type {
|
||||
case RTM_ADD, RTM_DELETE, RTM_CHANGE, RTM_GET, RTM_LOSING, RTM_REDIRECT, RTM_MISS, RTM_LOCK, RTM_RESOLVE:
|
||||
p := (*RouteMessage)(unsafe.Pointer(any))
|
||||
return &RouteMessage{Header: p.Header, Data: b[SizeofRtMsghdr:any.Msglen]}
|
||||
case RTM_IFINFO:
|
||||
p := (*InterfaceMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]}
|
||||
case RTM_NEWADDR, RTM_DELADDR:
|
||||
p := (*InterfaceAddrMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceAddrMessage{Header: p.Header, Data: b[SizeofIfaMsghdr:any.Msglen]}
|
||||
case RTM_NEWMADDR2, RTM_DELMADDR:
|
||||
p := (*InterfaceMulticastAddrMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceMulticastAddrMessage{Header: p.Header, Data: b[SizeofIfmaMsghdr2:any.Msglen]}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// InterfaceMulticastAddrMessage represents a routing message
|
||||
// containing network interface address entries.
|
||||
type InterfaceMulticastAddrMessage struct {
|
||||
Header IfmaMsghdr2
|
||||
Data []byte
|
||||
}
|
||||
|
||||
const rtaIfmaMask = RTA_GATEWAY | RTA_IFP | RTA_IFA
|
||||
|
||||
func (m *InterfaceMulticastAddrMessage) sockaddr() (sas []Sockaddr) {
|
||||
if m.Header.Addrs&rtaIfmaMask == 0 {
|
||||
return nil
|
||||
}
|
||||
b := m.Data[:]
|
||||
for i := uint(0); i < RTAX_MAX; i++ {
|
||||
if m.Header.Addrs&rtaIfmaMask&(1<<i) == 0 {
|
||||
continue
|
||||
}
|
||||
rsa := (*RawSockaddr)(unsafe.Pointer(&b[0]))
|
||||
switch i {
|
||||
case RTAX_IFA:
|
||||
sa, e := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(rsa)))
|
||||
if e != nil {
|
||||
return nil
|
||||
}
|
||||
sas = append(sas, sa)
|
||||
case RTAX_GATEWAY, RTAX_IFP:
|
||||
// nothing to do
|
||||
}
|
||||
b = b[rsaAlignOf(int(rsa.Len)):]
|
||||
}
|
||||
return sas
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Routing sockets and messages for Dragonfly
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
func (any *anyMessage) toRoutingMessage(b []byte) RoutingMessage {
|
||||
switch any.Type {
|
||||
case RTM_ADD, RTM_DELETE, RTM_CHANGE, RTM_GET, RTM_LOSING, RTM_REDIRECT, RTM_MISS, RTM_LOCK, RTM_RESOLVE:
|
||||
p := (*RouteMessage)(unsafe.Pointer(any))
|
||||
return &RouteMessage{Header: p.Header, Data: b[SizeofRtMsghdr:any.Msglen]}
|
||||
case RTM_IFINFO:
|
||||
p := (*InterfaceMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]}
|
||||
case RTM_IFANNOUNCE:
|
||||
p := (*InterfaceAnnounceMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceAnnounceMessage{Header: p.Header}
|
||||
case RTM_NEWADDR, RTM_DELADDR:
|
||||
p := (*InterfaceAddrMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceAddrMessage{Header: p.Header, Data: b[SizeofIfaMsghdr:any.Msglen]}
|
||||
case RTM_NEWMADDR, RTM_DELMADDR:
|
||||
p := (*InterfaceMulticastAddrMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceMulticastAddrMessage{Header: p.Header, Data: b[SizeofIfmaMsghdr:any.Msglen]}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// InterfaceAnnounceMessage represents a routing message containing
|
||||
// network interface arrival and departure information.
|
||||
type InterfaceAnnounceMessage struct {
|
||||
Header IfAnnounceMsghdr
|
||||
}
|
||||
|
||||
func (m *InterfaceAnnounceMessage) sockaddr() (sas []Sockaddr) { return nil }
|
||||
|
||||
// InterfaceMulticastAddrMessage represents a routing message
|
||||
// containing network interface address entries.
|
||||
type InterfaceMulticastAddrMessage struct {
|
||||
Header IfmaMsghdr
|
||||
Data []byte
|
||||
}
|
||||
|
||||
const rtaIfmaMask = RTA_GATEWAY | RTA_IFP | RTA_IFA
|
||||
|
||||
func (m *InterfaceMulticastAddrMessage) sockaddr() (sas []Sockaddr) {
|
||||
if m.Header.Addrs&rtaIfmaMask == 0 {
|
||||
return nil
|
||||
}
|
||||
b := m.Data[:]
|
||||
for i := uint(0); i < RTAX_MAX; i++ {
|
||||
if m.Header.Addrs&rtaIfmaMask&(1<<i) == 0 {
|
||||
continue
|
||||
}
|
||||
rsa := (*RawSockaddr)(unsafe.Pointer(&b[0]))
|
||||
switch i {
|
||||
case RTAX_IFA:
|
||||
sa, e := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(rsa)))
|
||||
if e != nil {
|
||||
return nil
|
||||
}
|
||||
sas = append(sas, sa)
|
||||
case RTAX_GATEWAY, RTAX_IFP:
|
||||
// nothing to do
|
||||
}
|
||||
b = b[rsaAlignOf(int(rsa.Len)):]
|
||||
}
|
||||
return sas
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Routing sockets and messages for FreeBSD
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html.
|
||||
var freebsdVersion uint32
|
||||
|
||||
func init() {
|
||||
freebsdVersion, _ = SysctlUint32("kern.osreldate")
|
||||
}
|
||||
|
||||
func (any *anyMessage) toRoutingMessage(b []byte) RoutingMessage {
|
||||
switch any.Type {
|
||||
case RTM_ADD, RTM_DELETE, RTM_CHANGE, RTM_GET, RTM_LOSING, RTM_REDIRECT, RTM_MISS, RTM_LOCK, RTM_RESOLVE:
|
||||
p := (*RouteMessage)(unsafe.Pointer(any))
|
||||
return &RouteMessage{Header: p.Header, Data: b[SizeofRtMsghdr:any.Msglen]}
|
||||
case RTM_IFINFO:
|
||||
return any.parseInterfaceMessage(b)
|
||||
case RTM_IFANNOUNCE:
|
||||
p := (*InterfaceAnnounceMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceAnnounceMessage{Header: p.Header}
|
||||
case RTM_NEWADDR, RTM_DELADDR:
|
||||
p := (*InterfaceAddrMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceAddrMessage{Header: p.Header, Data: b[SizeofIfaMsghdr:any.Msglen]}
|
||||
case RTM_NEWMADDR, RTM_DELMADDR:
|
||||
p := (*InterfaceMulticastAddrMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceMulticastAddrMessage{Header: p.Header, Data: b[SizeofIfmaMsghdr:any.Msglen]}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// InterfaceAnnounceMessage represents a routing message containing
|
||||
// network interface arrival and departure information.
|
||||
type InterfaceAnnounceMessage struct {
|
||||
Header IfAnnounceMsghdr
|
||||
}
|
||||
|
||||
func (m *InterfaceAnnounceMessage) sockaddr() (sas []Sockaddr) { return nil }
|
||||
|
||||
// InterfaceMulticastAddrMessage represents a routing message
|
||||
// containing network interface address entries.
|
||||
type InterfaceMulticastAddrMessage struct {
|
||||
Header IfmaMsghdr
|
||||
Data []byte
|
||||
}
|
||||
|
||||
const rtaIfmaMask = RTA_GATEWAY | RTA_IFP | RTA_IFA
|
||||
|
||||
func (m *InterfaceMulticastAddrMessage) sockaddr() (sas []Sockaddr) {
|
||||
if m.Header.Addrs&rtaIfmaMask == 0 {
|
||||
return nil
|
||||
}
|
||||
b := m.Data[:]
|
||||
for i := uint(0); i < RTAX_MAX; i++ {
|
||||
if m.Header.Addrs&rtaIfmaMask&(1<<i) == 0 {
|
||||
continue
|
||||
}
|
||||
rsa := (*RawSockaddr)(unsafe.Pointer(&b[0]))
|
||||
switch i {
|
||||
case RTAX_IFA:
|
||||
sa, e := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(rsa)))
|
||||
if e != nil {
|
||||
return nil
|
||||
}
|
||||
sas = append(sas, sa)
|
||||
case RTAX_GATEWAY, RTAX_IFP:
|
||||
// nothing to do
|
||||
}
|
||||
b = b[rsaAlignOf(int(rsa.Len)):]
|
||||
}
|
||||
return sas
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build freebsd,386 freebsd,arm
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
func (any *anyMessage) parseInterfaceMessage(b []byte) *InterfaceMessage {
|
||||
p := (*InterfaceMessage)(unsafe.Pointer(any))
|
||||
// FreeBSD 10 and beyond have a restructured mbuf
|
||||
// packet header view.
|
||||
// See http://svnweb.freebsd.org/base?view=revision&revision=254804.
|
||||
if freebsdVersion >= 1000000 {
|
||||
m := (*ifMsghdr)(unsafe.Pointer(any))
|
||||
p.Header.Data.Hwassist = uint32(m.Data.Hwassist)
|
||||
p.Header.Data.Epoch = m.Data.Epoch
|
||||
p.Header.Data.Lastchange = m.Data.Lastchange
|
||||
return &InterfaceMessage{Header: p.Header, Data: b[sizeofIfMsghdr:any.Msglen]}
|
||||
}
|
||||
return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build freebsd,amd64
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
func (any *anyMessage) parseInterfaceMessage(b []byte) *InterfaceMessage {
|
||||
p := (*InterfaceMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Routing sockets and messages for NetBSD
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
func (any *anyMessage) toRoutingMessage(b []byte) RoutingMessage {
|
||||
switch any.Type {
|
||||
case RTM_ADD, RTM_DELETE, RTM_CHANGE, RTM_GET, RTM_LOSING, RTM_REDIRECT, RTM_MISS, RTM_LOCK, RTM_RESOLVE:
|
||||
p := (*RouteMessage)(unsafe.Pointer(any))
|
||||
return &RouteMessage{Header: p.Header, Data: b[SizeofRtMsghdr:any.Msglen]}
|
||||
case RTM_IFINFO:
|
||||
p := (*InterfaceMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]}
|
||||
case RTM_IFANNOUNCE:
|
||||
p := (*InterfaceAnnounceMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceAnnounceMessage{Header: p.Header}
|
||||
case RTM_NEWADDR, RTM_DELADDR:
|
||||
p := (*InterfaceAddrMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceAddrMessage{Header: p.Header, Data: b[SizeofIfaMsghdr:any.Msglen]}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// InterfaceAnnounceMessage represents a routing message containing
|
||||
// network interface arrival and departure information.
|
||||
type InterfaceAnnounceMessage struct {
|
||||
Header IfAnnounceMsghdr
|
||||
}
|
||||
|
||||
func (m *InterfaceAnnounceMessage) sockaddr() (sas []Sockaddr) { return nil }
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Routing sockets and messages for OpenBSD
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
func (any *anyMessage) toRoutingMessage(b []byte) RoutingMessage {
|
||||
switch any.Type {
|
||||
case RTM_ADD, RTM_DELETE, RTM_CHANGE, RTM_GET, RTM_LOSING, RTM_REDIRECT, RTM_MISS, RTM_LOCK, RTM_RESOLVE:
|
||||
p := (*RouteMessage)(unsafe.Pointer(any))
|
||||
return &RouteMessage{Header: p.Header, Data: b[SizeofRtMsghdr:any.Msglen]}
|
||||
case RTM_IFINFO:
|
||||
p := (*InterfaceMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]}
|
||||
case RTM_IFANNOUNCE:
|
||||
p := (*InterfaceAnnounceMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceAnnounceMessage{Header: p.Header}
|
||||
case RTM_NEWADDR, RTM_DELADDR:
|
||||
p := (*InterfaceAddrMessage)(unsafe.Pointer(any))
|
||||
return &InterfaceAddrMessage{Header: p.Header, Data: b[SizeofIfaMsghdr:any.Msglen]}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// InterfaceAnnounceMessage represents a routing message containing
|
||||
// network interface arrival and departure information.
|
||||
type InterfaceAnnounceMessage struct {
|
||||
Header IfAnnounceMsghdr
|
||||
}
|
||||
|
||||
func (m *InterfaceAnnounceMessage) sockaddr() (sas []Sockaddr) { return nil }
|
|
@ -1,261 +0,0 @@
|
|||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// soError describes reasons for shared library load failures.
|
||||
type soError struct {
|
||||
Err error
|
||||
ObjName string
|
||||
Msg string
|
||||
}
|
||||
|
||||
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 syscall.Errno)
|
||||
func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
func dlclose(handle uintptr) (err syscall.Errno)
|
||||
func dlopen(name *uint8, mode uintptr) (handle uintptr, err syscall.Errno)
|
||||
func dlsym(handle uintptr, name *uint8) (proc uintptr, err syscall.Errno)
|
||||
|
||||
// A so implements access to a single shared library object.
|
||||
type so struct {
|
||||
Name string
|
||||
Handle uintptr
|
||||
}
|
||||
|
||||
// loadSO loads shared library file into memory.
|
||||
func loadSO(name string) (*so, error) {
|
||||
namep, err := BytePtrFromString(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
h, e := dlopen(namep, 1) // RTLD_LAZY
|
||||
if e != 0 {
|
||||
return nil, &soError{
|
||||
Err: e,
|
||||
ObjName: name,
|
||||
Msg: "Failed to load " + name + ": " + e.Error(),
|
||||
}
|
||||
}
|
||||
d := &so{
|
||||
Name: name,
|
||||
Handle: uintptr(h),
|
||||
}
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// mustLoadSO is like loadSO but panics if load operation fails.
|
||||
func mustLoadSO(name string) *so {
|
||||
d, e := loadSO(name)
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// FindProc searches shared library d for procedure named name and returns
|
||||
// *proc if found. It returns an error if the search fails.
|
||||
func (d *so) FindProc(name string) (*proc, error) {
|
||||
namep, err := BytePtrFromString(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
a, _ := dlsym(uintptr(d.Handle), namep)
|
||||
if a == 0 {
|
||||
return nil, &soError{
|
||||
Err: ENOSYS,
|
||||
ObjName: name,
|
||||
Msg: "Failed to find " + name + " procedure in " + d.Name,
|
||||
}
|
||||
}
|
||||
p := &proc{
|
||||
SO: d,
|
||||
Name: name,
|
||||
addr: a,
|
||||
}
|
||||
return p, nil
|
||||
}
|
||||
|
||||
// MustFindProc is like FindProc but panics if search fails.
|
||||
func (d *so) MustFindProc(name string) *proc {
|
||||
p, e := d.FindProc(name)
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
// Release unloads shared library d from memory.
|
||||
func (d *so) Release() (err error) {
|
||||
return dlclose(d.Handle)
|
||||
}
|
||||
|
||||
// A proc implements access to a procedure inside a shared library.
|
||||
type proc struct {
|
||||
SO *so
|
||||
Name string
|
||||
addr uintptr
|
||||
}
|
||||
|
||||
// Addr returns the address of the procedure represented by p.
|
||||
// The return value can be passed to Syscall to run the procedure.
|
||||
func (p *proc) Addr() uintptr {
|
||||
return p.addr
|
||||
}
|
||||
|
||||
// Call executes procedure p with arguments a. It will panic, if more then
|
||||
// 6 arguments are supplied.
|
||||
//
|
||||
// The returned error is always non-nil, constructed from the result of
|
||||
// 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.
|
||||
func (p *proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
|
||||
switch len(a) {
|
||||
case 0:
|
||||
return sysvicall6(p.Addr(), uintptr(len(a)), 0, 0, 0, 0, 0, 0)
|
||||
case 1:
|
||||
return sysvicall6(p.Addr(), uintptr(len(a)), a[0], 0, 0, 0, 0, 0)
|
||||
case 2:
|
||||
return sysvicall6(p.Addr(), uintptr(len(a)), a[0], a[1], 0, 0, 0, 0)
|
||||
case 3:
|
||||
return sysvicall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], 0, 0, 0)
|
||||
case 4:
|
||||
return sysvicall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], 0, 0)
|
||||
case 5:
|
||||
return sysvicall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], 0)
|
||||
case 6:
|
||||
return sysvicall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5])
|
||||
default:
|
||||
panic("Call " + p.Name + " with too many arguments " + itoa(len(a)) + ".")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// A lazySO implements access to a single shared library. It will delay
|
||||
// the load of the shared library until the first call to its Handle method
|
||||
// or to one of its lazyProc's Addr method.
|
||||
type lazySO struct {
|
||||
mu sync.Mutex
|
||||
so *so // non nil once SO is loaded
|
||||
Name string
|
||||
}
|
||||
|
||||
// Load loads single shared file d.Name into memory. It returns an error if
|
||||
// fails. Load will not try to load SO, if it is already loaded into memory.
|
||||
func (d *lazySO) Load() error {
|
||||
// Non-racy version of:
|
||||
// if d.so == nil {
|
||||
if atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&d.so))) == nil {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
if d.so == nil {
|
||||
so, e := loadSO(d.Name)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
// Non-racy version of:
|
||||
// d.so = so
|
||||
atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&d.so)), unsafe.Pointer(so))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// mustLoad is like Load but panics if search fails.
|
||||
func (d *lazySO) mustLoad() {
|
||||
e := d.Load()
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
}
|
||||
|
||||
// Handle returns d's module handle.
|
||||
func (d *lazySO) Handle() uintptr {
|
||||
d.mustLoad()
|
||||
return uintptr(d.so.Handle)
|
||||
}
|
||||
|
||||
// NewProc returns a lazyProc for accessing the named procedure in the SO d.
|
||||
func (d *lazySO) NewProc(name string) *lazyProc {
|
||||
return &lazyProc{l: d, Name: name}
|
||||
}
|
||||
|
||||
// newLazySO creates new lazySO associated with SO file.
|
||||
func newLazySO(name string) *lazySO {
|
||||
return &lazySO{Name: name}
|
||||
}
|
||||
|
||||
// A lazyProc implements access to a procedure inside a lazySO.
|
||||
// It delays the lookup until the Addr method is called.
|
||||
type lazyProc struct {
|
||||
mu sync.Mutex
|
||||
Name string
|
||||
l *lazySO
|
||||
proc *proc
|
||||
}
|
||||
|
||||
// Find searches the shared library for procedure named p.Name. It returns an
|
||||
// error if search fails. Find will not search procedure, if it is already
|
||||
// found and loaded into memory.
|
||||
func (p *lazyProc) Find() error {
|
||||
// Non-racy version of:
|
||||
// if p.proc == nil {
|
||||
if atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&p.proc))) == nil {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
if p.proc == nil {
|
||||
e := p.l.Load()
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
proc, e := p.l.so.FindProc(p.Name)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
// Non-racy version of:
|
||||
// p.proc = proc
|
||||
atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&p.proc)), unsafe.Pointer(proc))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// mustFind is like Find but panics if search fails.
|
||||
func (p *lazyProc) mustFind() {
|
||||
e := p.Find()
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
}
|
||||
|
||||
// Addr returns the address of the procedure represented by p.
|
||||
// The return value can be passed to Syscall to run the procedure.
|
||||
func (p *lazyProc) Addr() uintptr {
|
||||
p.mustFind()
|
||||
return p.proc.Addr()
|
||||
}
|
||||
|
||||
// Call executes procedure p with arguments a. It will panic, if more then
|
||||
// 6 arguments are supplied.
|
||||
//
|
||||
// The returned error is always non-nil, constructed from the result of
|
||||
// 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.
|
||||
func (p *lazyProc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
|
||||
p.mustFind()
|
||||
return p.proc.Call(a...)
|
||||
}
|
|
@ -77,10 +77,10 @@ func UnixRights(fds ...int) []byte {
|
|||
h.Level = SOL_SOCKET
|
||||
h.Type = SCM_RIGHTS
|
||||
h.SetLen(CmsgLen(datalen))
|
||||
data := uintptr(cmsgData(h))
|
||||
data := cmsgData(h)
|
||||
for _, fd := range fds {
|
||||
*(*int32)(unsafe.Pointer(data)) = int32(fd)
|
||||
data += 4
|
||||
*(*int32)(data) = int32(fd)
|
||||
data = unsafe.Pointer(uintptr(data) + 4)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
|
|
@ -8,8 +8,12 @@ package unix
|
|||
|
||||
func itoa(val int) string { // do it here rather than with fmt to avoid dependency
|
||||
if val < 0 {
|
||||
return "-" + itoa(-val)
|
||||
return "-" + uitoa(uint(-val))
|
||||
}
|
||||
return uitoa(uint(val))
|
||||
}
|
||||
|
||||
func uitoa(val uint) string {
|
||||
var buf [32]byte // big enough for int64
|
||||
i := len(buf) - 1
|
||||
for val >= 10 {
|
||||
|
|
|
@ -450,16 +450,34 @@ func Kevent(kq int, changes, events []Kevent_t, timeout *Timespec) (n int, err e
|
|||
|
||||
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
||||
|
||||
func Sysctl(name string) (value string, err error) {
|
||||
// sysctlmib translates name to mib number and appends any additional args.
|
||||
func sysctlmib(name string, args ...int) ([]_C_int, error) {
|
||||
// Translate name to mib number.
|
||||
mib, err := nametomib(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, a := range args {
|
||||
mib = append(mib, _C_int(a))
|
||||
}
|
||||
|
||||
return mib, nil
|
||||
}
|
||||
|
||||
func Sysctl(name string) (string, error) {
|
||||
return SysctlArgs(name)
|
||||
}
|
||||
|
||||
func SysctlArgs(name string, args ...int) (string, error) {
|
||||
mib, err := sysctlmib(name, args...)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Find size.
|
||||
n := uintptr(0)
|
||||
if err = sysctl(mib, nil, &n, nil, 0); err != nil {
|
||||
if err := sysctl(mib, nil, &n, nil, 0); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if n == 0 {
|
||||
|
@ -468,7 +486,7 @@ func Sysctl(name string) (value string, err error) {
|
|||
|
||||
// Read into buffer of that size.
|
||||
buf := make([]byte, n)
|
||||
if err = sysctl(mib, &buf[0], &n, nil, 0); err != nil {
|
||||
if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
@ -479,17 +497,19 @@ func Sysctl(name string) (value string, err error) {
|
|||
return string(buf[0:n]), nil
|
||||
}
|
||||
|
||||
func SysctlUint32(name string) (value uint32, err error) {
|
||||
// Translate name to mib number.
|
||||
mib, err := nametomib(name)
|
||||
func SysctlUint32(name string) (uint32, error) {
|
||||
return SysctlUint32Args(name)
|
||||
}
|
||||
|
||||
func SysctlUint32Args(name string, args ...int) (uint32, error) {
|
||||
mib, err := sysctlmib(name, args...)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// Read into buffer of that size.
|
||||
n := uintptr(4)
|
||||
buf := make([]byte, 4)
|
||||
if err = sysctl(mib, &buf[0], &n, nil, 0); err != nil {
|
||||
if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if n != 4 {
|
||||
|
@ -498,9 +518,55 @@ func SysctlUint32(name string) (value uint32, err error) {
|
|||
return *(*uint32)(unsafe.Pointer(&buf[0])), nil
|
||||
}
|
||||
|
||||
func SysctlUint64(name string, args ...int) (uint64, error) {
|
||||
mib, err := sysctlmib(name, args...)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
n := uintptr(8)
|
||||
buf := make([]byte, 8)
|
||||
if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if n != 8 {
|
||||
return 0, EIO
|
||||
}
|
||||
return *(*uint64)(unsafe.Pointer(&buf[0])), nil
|
||||
}
|
||||
|
||||
func SysctlRaw(name string, args ...int) ([]byte, error) {
|
||||
mib, err := sysctlmib(name, args...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Find size.
|
||||
n := uintptr(0)
|
||||
if err := sysctl(mib, nil, &n, nil, 0); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if n == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Read into buffer of that size.
|
||||
buf := make([]byte, n)
|
||||
if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// The actual call may return less than the original reported required
|
||||
// size so ensure we deal with that.
|
||||
return buf[:n], nil
|
||||
}
|
||||
|
||||
//sys utimes(path string, timeval *[2]Timeval) (err error)
|
||||
|
||||
func Utimes(path string, tv []Timeval) (err error) {
|
||||
func Utimes(path string, tv []Timeval) error {
|
||||
if tv == nil {
|
||||
return utimes(path, nil)
|
||||
}
|
||||
if len(tv) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
|
@ -508,6 +574,9 @@ func Utimes(path string, tv []Timeval) (err error) {
|
|||
}
|
||||
|
||||
func UtimesNano(path string, ts []Timespec) error {
|
||||
if ts == nil {
|
||||
return utimes(path, nil)
|
||||
}
|
||||
// TODO: The BSDs can do utimensat with SYS_UTIMENSAT but it
|
||||
// isn't supported by darwin so this uses utimes instead
|
||||
if len(ts) != 2 {
|
||||
|
@ -524,7 +593,10 @@ func UtimesNano(path string, ts []Timespec) error {
|
|||
|
||||
//sys futimes(fd int, timeval *[2]Timeval) (err error)
|
||||
|
||||
func Futimes(fd int, tv []Timeval) (err error) {
|
||||
func Futimes(fd int, tv []Timeval) error {
|
||||
if tv == nil {
|
||||
return futimes(fd, nil)
|
||||
}
|
||||
if len(tv) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
|
|
|
@ -222,8 +222,8 @@ func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(sig
|
|||
//sys Chown(path string, uid int, gid int) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sysnb Dup(fd int) (nfd int, err error)
|
||||
//sysnb Dup2(from int, to int) (err error)
|
||||
//sys Dup(fd int) (nfd int, err error)
|
||||
//sys Dup2(from int, to int) (err error)
|
||||
//sys Exchangedata(path1 string, path2 string, options int) (err error)
|
||||
//sys Exit(code int)
|
||||
//sys Fchdir(fd int) (err error)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build 386,darwin
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
|
@ -71,3 +73,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of darwin/386 the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build amd64,darwin
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
|
@ -9,6 +11,8 @@ import (
|
|||
"unsafe"
|
||||
)
|
||||
|
||||
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
|
||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
||||
|
@ -71,3 +75,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of darwin/amd64 the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
|
||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
||||
|
||||
func NsecToTimespec(nsec int64) (ts Timespec) {
|
||||
ts.Sec = int32(nsec / 1e9)
|
||||
ts.Nsec = int32(nsec % 1e9)
|
||||
return
|
||||
}
|
||||
|
||||
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||
|
||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||
nsec += 999 // round up to microsecond
|
||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||
tv.Sec = int32(nsec / 1e9)
|
||||
return
|
||||
}
|
||||
|
||||
//sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error)
|
||||
func Gettimeofday(tv *Timeval) (err error) {
|
||||
// The tv passed to gettimeofday must be non-nil
|
||||
// but is otherwise unused. The answers come back
|
||||
// in the two registers.
|
||||
sec, usec, err := gettimeofday(tv)
|
||||
tv.Sec = int32(sec)
|
||||
tv.Usec = int32(usec)
|
||||
return err
|
||||
}
|
||||
|
||||
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
||||
k.Ident = uint32(fd)
|
||||
k.Filter = int16(mode)
|
||||
k.Flags = uint16(flags)
|
||||
}
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint32(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
var length = uint64(count)
|
||||
|
||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
|
||||
|
||||
written = int(length)
|
||||
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
|
|
@ -0,0 +1,79 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build arm64,darwin
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func Getpagesize() int { return 16384 }
|
||||
|
||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
||||
|
||||
func NsecToTimespec(nsec int64) (ts Timespec) {
|
||||
ts.Sec = nsec / 1e9
|
||||
ts.Nsec = nsec % 1e9
|
||||
return
|
||||
}
|
||||
|
||||
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||
|
||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||
nsec += 999 // round up to microsecond
|
||||
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||
tv.Sec = int64(nsec / 1e9)
|
||||
return
|
||||
}
|
||||
|
||||
//sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error)
|
||||
func Gettimeofday(tv *Timeval) (err error) {
|
||||
// The tv passed to gettimeofday must be non-nil
|
||||
// but is otherwise unused. The answers come back
|
||||
// in the two registers.
|
||||
sec, usec, err := gettimeofday(tv)
|
||||
tv.Sec = sec
|
||||
tv.Usec = usec
|
||||
return err
|
||||
}
|
||||
|
||||
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
||||
k.Ident = uint64(fd)
|
||||
k.Filter = int16(mode)
|
||||
k.Flags = uint16(flags)
|
||||
}
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
var length = uint64(count)
|
||||
|
||||
_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
|
||||
|
||||
written = int(length)
|
||||
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of darwin/arm64 the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
|
@ -127,8 +127,8 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
|||
//sys Chown(path string, uid int, gid int) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sysnb Dup(fd int) (nfd int, err error)
|
||||
//sysnb Dup2(from int, to int) (err error)
|
||||
//sys Dup(fd int) (nfd int, err error)
|
||||
//sys Dup2(from int, to int) (err error)
|
||||
//sys Exit(code int)
|
||||
//sys Fchdir(fd int) (err error)
|
||||
//sys Fchflags(fd int, flags int) (err error)
|
||||
|
@ -165,6 +165,11 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
|||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys Mlock(b []byte) (err error)
|
||||
//sys Mlockall(flags int) (err error)
|
||||
//sys Mprotect(b []byte, prot int) (err error)
|
||||
//sys Munlock(b []byte) (err error)
|
||||
//sys Munlockall() (err error)
|
||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Pathconf(path string, name int) (val int, err error)
|
||||
|
@ -238,8 +243,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
|||
// Kdebug_trace
|
||||
// Sigreturn
|
||||
// Mmap
|
||||
// Mlock
|
||||
// Munlock
|
||||
// Atsocket
|
||||
// Kqueue_from_portset_np
|
||||
// Kqueue_portset
|
||||
|
@ -332,8 +335,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
|||
// Lio_listio
|
||||
// __pthread_cond_wait
|
||||
// Iopolicysys
|
||||
// Mlockall
|
||||
// Munlockall
|
||||
// __pthread_kill
|
||||
// __pthread_sigmask
|
||||
// __sigwait
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build 386,dragonfly
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build amd64,dragonfly
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
|
|
|
@ -136,6 +136,238 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
// Derive extattr namespace and attribute name
|
||||
|
||||
func xattrnamespace(fullattr string) (ns int, attr string, err error) {
|
||||
s := -1
|
||||
for idx, val := range fullattr {
|
||||
if val == '.' {
|
||||
s = idx
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if s == -1 {
|
||||
return -1, "", ENOATTR
|
||||
}
|
||||
|
||||
namespace := fullattr[0:s]
|
||||
attr = fullattr[s+1:]
|
||||
|
||||
switch namespace {
|
||||
case "user":
|
||||
return EXTATTR_NAMESPACE_USER, attr, nil
|
||||
case "system":
|
||||
return EXTATTR_NAMESPACE_SYSTEM, attr, nil
|
||||
default:
|
||||
return -1, "", ENOATTR
|
||||
}
|
||||
}
|
||||
|
||||
func initxattrdest(dest []byte, idx int) (d unsafe.Pointer) {
|
||||
if len(dest) > idx {
|
||||
return unsafe.Pointer(&dest[idx])
|
||||
} else {
|
||||
return unsafe.Pointer(_zero)
|
||||
}
|
||||
}
|
||||
|
||||
// FreeBSD implements its own syscalls to handle extended attributes
|
||||
|
||||
func Getxattr(file string, attr string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsize := len(dest)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
return ExtattrGetFile(file, nsid, a, uintptr(d), destsize)
|
||||
}
|
||||
|
||||
func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsize := len(dest)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
return ExtattrGetFd(fd, nsid, a, uintptr(d), destsize)
|
||||
}
|
||||
|
||||
func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsize := len(dest)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
return ExtattrGetLink(link, nsid, a, uintptr(d), destsize)
|
||||
}
|
||||
|
||||
// flags are unused on FreeBSD
|
||||
|
||||
func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) {
|
||||
d := unsafe.Pointer(&data[0])
|
||||
datasiz := len(data)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = ExtattrSetFd(fd, nsid, a, uintptr(d), datasiz)
|
||||
return
|
||||
}
|
||||
|
||||
func Setxattr(file string, attr string, data []byte, flags int) (err error) {
|
||||
d := unsafe.Pointer(&data[0])
|
||||
datasiz := len(data)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = ExtattrSetFile(file, nsid, a, uintptr(d), datasiz)
|
||||
return
|
||||
}
|
||||
|
||||
func Lsetxattr(link string, attr string, data []byte, flags int) (err error) {
|
||||
d := unsafe.Pointer(&data[0])
|
||||
datasiz := len(data)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = ExtattrSetLink(link, nsid, a, uintptr(d), datasiz)
|
||||
return
|
||||
}
|
||||
|
||||
func Removexattr(file string, attr string) (err error) {
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = ExtattrDeleteFile(file, nsid, a)
|
||||
return
|
||||
}
|
||||
|
||||
func Fremovexattr(fd int, attr string) (err error) {
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = ExtattrDeleteFd(fd, nsid, a)
|
||||
return
|
||||
}
|
||||
|
||||
func Lremovexattr(link string, attr string) (err error) {
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = ExtattrDeleteLink(link, nsid, a)
|
||||
return
|
||||
}
|
||||
|
||||
func Listxattr(file string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsiz := len(dest)
|
||||
|
||||
// FreeBSD won't allow you to list xattrs from multiple namespaces
|
||||
s := 0
|
||||
var e error
|
||||
for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} {
|
||||
stmp, e := ExtattrListFile(file, nsid, uintptr(d), destsiz)
|
||||
|
||||
/* Errors accessing system attrs are ignored so that
|
||||
* we can implement the Linux-like behavior of omitting errors that
|
||||
* we don't have read permissions on
|
||||
*
|
||||
* Linux will still error if we ask for user attributes on a file that
|
||||
* we don't have read permissions on, so don't ignore those errors
|
||||
*/
|
||||
if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER {
|
||||
e = nil
|
||||
continue
|
||||
} else if e != nil {
|
||||
return s, e
|
||||
}
|
||||
|
||||
s += stmp
|
||||
destsiz -= s
|
||||
if destsiz < 0 {
|
||||
destsiz = 0
|
||||
}
|
||||
d = initxattrdest(dest, s)
|
||||
}
|
||||
|
||||
return s, e
|
||||
}
|
||||
|
||||
func Flistxattr(fd int, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsiz := len(dest)
|
||||
|
||||
s := 0
|
||||
var e error
|
||||
for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} {
|
||||
stmp, e := ExtattrListFd(fd, nsid, uintptr(d), destsiz)
|
||||
if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER {
|
||||
e = nil
|
||||
continue
|
||||
} else if e != nil {
|
||||
return s, e
|
||||
}
|
||||
|
||||
s += stmp
|
||||
destsiz -= s
|
||||
if destsiz < 0 {
|
||||
destsiz = 0
|
||||
}
|
||||
d = initxattrdest(dest, s)
|
||||
}
|
||||
|
||||
return s, e
|
||||
}
|
||||
|
||||
func Llistxattr(link string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsiz := len(dest)
|
||||
|
||||
s := 0
|
||||
var e error
|
||||
for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} {
|
||||
stmp, e := ExtattrListLink(link, nsid, uintptr(d), destsiz)
|
||||
if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER {
|
||||
e = nil
|
||||
continue
|
||||
} else if e != nil {
|
||||
return s, e
|
||||
}
|
||||
|
||||
s += stmp
|
||||
destsiz -= s
|
||||
if destsiz < 0 {
|
||||
destsiz = 0
|
||||
}
|
||||
d = initxattrdest(dest, s)
|
||||
}
|
||||
|
||||
return s, e
|
||||
}
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
|
@ -147,9 +379,22 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
|||
//sys Chown(path string, uid int, gid int) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sysnb Dup(fd int) (nfd int, err error)
|
||||
//sysnb Dup2(from int, to int) (err error)
|
||||
//sys Dup(fd int) (nfd int, err error)
|
||||
//sys Dup2(from int, to int) (err error)
|
||||
//sys Exit(code int)
|
||||
//sys ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error)
|
||||
//sys ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error)
|
||||
//sys ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error)
|
||||
//sys ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_POSIX_FADVISE
|
||||
//sys Fchdir(fd int) (err error)
|
||||
//sys Fchflags(fd int, flags int) (err error)
|
||||
//sys Fchmod(fd int, mode uint32) (err error)
|
||||
|
@ -185,6 +430,11 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
|||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys Mlock(b []byte) (err error)
|
||||
//sys Mlockall(flags int) (err error)
|
||||
//sys Mprotect(b []byte, prot int) (err error)
|
||||
//sys Munlock(b []byte) (err error)
|
||||
//sys Munlockall() (err error)
|
||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Pathconf(path string, name int) (val int, err error)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build 386,freebsd
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build amd64,freebsd
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build arm,freebsd
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
|
|
|
@ -20,10 +20,38 @@ import (
|
|||
* Wrapped
|
||||
*/
|
||||
|
||||
//sys open(path string, mode int, perm uint32) (fd int, err error)
|
||||
func Access(path string, mode uint32) (err error) {
|
||||
return Faccessat(AT_FDCWD, path, mode, 0)
|
||||
}
|
||||
|
||||
func Chmod(path string, mode uint32) (err error) {
|
||||
return Fchmodat(AT_FDCWD, path, mode, 0)
|
||||
}
|
||||
|
||||
func Chown(path string, uid int, gid int) (err error) {
|
||||
return Fchownat(AT_FDCWD, path, uid, gid, 0)
|
||||
}
|
||||
|
||||
func Creat(path string, mode uint32) (fd int, err error) {
|
||||
return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
|
||||
}
|
||||
|
||||
//sys linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
|
||||
|
||||
func Link(oldpath string, newpath string) (err error) {
|
||||
return linkat(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0)
|
||||
}
|
||||
|
||||
func Mkdir(path string, mode uint32) (err error) {
|
||||
return Mkdirat(AT_FDCWD, path, mode)
|
||||
}
|
||||
|
||||
func Mknod(path string, mode uint32, dev int) (err error) {
|
||||
return Mknodat(AT_FDCWD, path, mode, dev)
|
||||
}
|
||||
|
||||
func Open(path string, mode int, perm uint32) (fd int, err error) {
|
||||
return open(path, mode|O_LARGEFILE, perm)
|
||||
return openat(AT_FDCWD, path, mode|O_LARGEFILE, perm)
|
||||
}
|
||||
|
||||
//sys openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
|
||||
|
@ -32,48 +60,62 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
|
|||
return openat(dirfd, path, flags|O_LARGEFILE, mode)
|
||||
}
|
||||
|
||||
//sysnb pipe(p *[2]_C_int) (err error)
|
||||
//sys readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe(&pp)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return
|
||||
func Readlink(path string, buf []byte) (n int, err error) {
|
||||
return readlinkat(AT_FDCWD, path, buf)
|
||||
}
|
||||
|
||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||
func Rename(oldpath string, newpath string) (err error) {
|
||||
return Renameat(AT_FDCWD, oldpath, AT_FDCWD, newpath)
|
||||
}
|
||||
|
||||
func Pipe2(p []int, flags int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe2(&pp, flags)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return
|
||||
func Rmdir(path string) error {
|
||||
return unlinkat(AT_FDCWD, path, AT_REMOVEDIR)
|
||||
}
|
||||
|
||||
//sys symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||
|
||||
func Symlink(oldpath string, newpath string) (err error) {
|
||||
return symlinkat(oldpath, AT_FDCWD, newpath)
|
||||
}
|
||||
|
||||
func Unlink(path string) error {
|
||||
return unlinkat(AT_FDCWD, path, 0)
|
||||
}
|
||||
|
||||
//sys unlinkat(dirfd int, path string, flags int) (err error)
|
||||
|
||||
func Unlinkat(dirfd int, path string, flags int) error {
|
||||
return unlinkat(dirfd, path, flags)
|
||||
}
|
||||
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
|
||||
func Utimes(path string, tv []Timeval) (err error) {
|
||||
if tv == nil {
|
||||
return utimes(path, nil)
|
||||
}
|
||||
if len(tv) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||
}
|
||||
|
||||
//sys utimensat(dirfd int, path string, times *[2]Timespec) (err error)
|
||||
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
|
||||
|
||||
func UtimesNano(path string, ts []Timespec) (err error) {
|
||||
func UtimesNano(path string, ts []Timespec) error {
|
||||
if ts == nil {
|
||||
err := utimensat(AT_FDCWD, path, nil, 0)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
return utimes(path, nil)
|
||||
}
|
||||
if len(ts) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
err = utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])))
|
||||
err := utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
|
@ -87,16 +129,29 @@ func UtimesNano(path string, ts []Timespec) (err error) {
|
|||
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||
}
|
||||
|
||||
//sys futimesat(dirfd int, path *byte, times *[2]Timeval) (err error)
|
||||
|
||||
func Futimesat(dirfd int, path string, tv []Timeval) (err error) {
|
||||
if len(tv) != 2 {
|
||||
func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
|
||||
if ts == nil {
|
||||
return utimensat(dirfd, path, nil, flags)
|
||||
}
|
||||
if len(ts) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
|
||||
}
|
||||
|
||||
//sys futimesat(dirfd int, path *byte, times *[2]Timeval) (err error)
|
||||
|
||||
func Futimesat(dirfd int, path string, tv []Timeval) error {
|
||||
pathp, err := BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if tv == nil {
|
||||
return futimesat(dirfd, pathp, nil)
|
||||
}
|
||||
if len(tv) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
return futimesat(dirfd, pathp, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||
}
|
||||
|
||||
|
@ -782,17 +837,14 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
|||
/*
|
||||
* Direct access
|
||||
*/
|
||||
//sys Access(path string, mode uint32) (err error)
|
||||
//sys Acct(path string) (err error)
|
||||
//sys Adjtimex(buf *Timex) (state int, err error)
|
||||
//sys Chdir(path string) (err error)
|
||||
//sys Chmod(path string, mode uint32) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sys Creat(path string, mode uint32) (fd int, err error)
|
||||
//sysnb Dup(oldfd int) (fd int, err error)
|
||||
//sysnb Dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb Dup3(oldfd int, newfd int, flags int) (err error)
|
||||
//sys Dup(oldfd int) (fd int, err error)
|
||||
//sys Dup3(oldfd int, newfd int, flags int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sysnb EpollCreate1(flag int) (fd int, err error)
|
||||
//sysnb EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error)
|
||||
|
@ -810,7 +862,12 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
|||
//sys Fsync(fd int) (err error)
|
||||
//sys Getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64
|
||||
//sysnb Getpgid(pid int) (pgid int, err error)
|
||||
//sysnb Getpgrp() (pid int)
|
||||
|
||||
func Getpgrp() (pid int) {
|
||||
pid, _ = Getpgid(0)
|
||||
return
|
||||
}
|
||||
|
||||
//sysnb Getpid() (pid int)
|
||||
//sysnb Getppid() (ppid int)
|
||||
//sys Getpriority(which int, who int) (prio int, err error)
|
||||
|
@ -818,27 +875,21 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
|||
//sysnb Gettid() (tid int)
|
||||
//sys Getxattr(path string, attr string, dest []byte) (sz int, err error)
|
||||
//sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error)
|
||||
//sysnb InotifyInit() (fd int, err error)
|
||||
//sysnb InotifyInit1(flags int) (fd int, err error)
|
||||
//sysnb InotifyRmWatch(fd int, watchdesc uint32) (success int, err error)
|
||||
//sysnb Kill(pid int, sig syscall.Signal) (err error)
|
||||
//sys Klogctl(typ int, buf []byte) (n int, err error) = SYS_SYSLOG
|
||||
//sys Link(oldpath string, newpath string) (err error)
|
||||
//sys Listxattr(path string, dest []byte) (sz int, err error)
|
||||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
|
||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||
//sys Pause() (err error)
|
||||
//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
|
||||
//sysnb prlimit(pid int, resource int, old *Rlimit, newlimit *Rlimit) (err error) = SYS_PRLIMIT64
|
||||
//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)
|
||||
//sys read(fd int, p []byte) (n int, err error)
|
||||
//sys Readlink(path string, buf []byte) (n int, err error)
|
||||
//sys Removexattr(path string, attr string) (err error)
|
||||
//sys Rename(oldpath string, newpath string) (err error)
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Rmdir(path string) (err error)
|
||||
//sys Setdomainname(p []byte) (err error)
|
||||
//sys Sethostname(p []byte) (err error)
|
||||
//sysnb Setpgid(pid int, pgid int) (err error)
|
||||
|
@ -860,7 +911,6 @@ func Setgid(uid int) (err error) {
|
|||
|
||||
//sys Setpriority(which int, who int, prio int) (err error)
|
||||
//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
|
||||
//sys Symlink(oldpath string, newpath string) (err error)
|
||||
//sys Sync()
|
||||
//sysnb Sysinfo(info *Sysinfo_t) (err error)
|
||||
//sys Tee(rfd int, wfd int, len int, flags int) (n int64, err error)
|
||||
|
@ -868,8 +918,6 @@ func Setgid(uid int) (err error) {
|
|||
//sysnb Times(tms *Tms) (ticks uintptr, err error)
|
||||
//sysnb Umask(mask int) (oldmask int)
|
||||
//sysnb Uname(buf *Utsname) (err error)
|
||||
//sys Unlink(path string) (err error)
|
||||
//sys Unlinkat(dirfd int, path string) (err error)
|
||||
//sys Unmount(target string, flags int) (err error) = SYS_UMOUNT2
|
||||
//sys Unshare(flags int) (err error)
|
||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||
|
@ -914,7 +962,6 @@ func Munmap(b []byte) (err error) {
|
|||
// Capget
|
||||
// Capset
|
||||
// ClockGetres
|
||||
// ClockGettime
|
||||
// ClockNanosleep
|
||||
// ClockSettime
|
||||
// Clone
|
||||
|
@ -925,7 +972,6 @@ func Munmap(b []byte) (err error) {
|
|||
// EpollWaitOld
|
||||
// Eventfd
|
||||
// Execve
|
||||
// Fadvise64
|
||||
// Fgetxattr
|
||||
// Flistxattr
|
||||
// Fork
|
||||
|
@ -977,7 +1023,6 @@ func Munmap(b []byte) (err error) {
|
|||
// Personality
|
||||
// Poll
|
||||
// Ppoll
|
||||
// Prctl
|
||||
// Pselect6
|
||||
// Ptrace
|
||||
// Putpmsg
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
|
||||
// so that go vet can check that they are correct.
|
||||
|
||||
// +build 386,linux
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
|
@ -31,9 +33,36 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
|
|||
return
|
||||
}
|
||||
|
||||
//sysnb pipe(p *[2]_C_int) (err error)
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe(&pp)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return
|
||||
}
|
||||
|
||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||
|
||||
func Pipe2(p []int, flags int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe2(&pp, flags)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return
|
||||
}
|
||||
|
||||
// 64-bit file system and 32-bit uid calls
|
||||
// (386 default is 32-bit file system and 16-bit uid).
|
||||
//sys Chown(path string, uid int, gid int) (err error) = SYS_CHOWN32
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64_64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
||||
//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
|
||||
|
@ -41,6 +70,7 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
|
|||
//sysnb Geteuid() (euid int) = SYS_GETEUID32
|
||||
//sysnb Getgid() (gid int) = SYS_GETGID32
|
||||
//sysnb Getuid() (uid int) = SYS_GETUID32
|
||||
//sysnb InotifyInit() (fd int, err error)
|
||||
//sys Ioperm(from int, num int, on int) (err error)
|
||||
//sys Iopl(level int) (err error)
|
||||
//sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build amd64,linux
|
||||
|
||||
package unix
|
||||
|
||||
import "syscall"
|
||||
|
||||
//sys Chown(path string, uid int, gid int) (err error)
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
|
@ -16,6 +19,7 @@ import "syscall"
|
|||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
||||
//sysnb Getuid() (uid int)
|
||||
//sysnb InotifyInit() (fd int, err error)
|
||||
//sys Ioperm(from int, num int, on int) (err error)
|
||||
//sys Iopl(level int) (err error)
|
||||
//sys Lchown(path string, uid int, gid int) (err error)
|
||||
|
@ -57,8 +61,6 @@ import "syscall"
|
|||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
|
||||
//go:noescape
|
||||
func gettimeofday(tv *Timeval) (err syscall.Errno)
|
||||
|
||||
|
@ -70,6 +72,8 @@ func Gettimeofday(tv *Timeval) (err error) {
|
|||
return nil
|
||||
}
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
|
||||
func Time(t *Time_t) (tt Time_t, err error) {
|
||||
var tv Timeval
|
||||
errno := gettimeofday(&tv)
|
||||
|
@ -99,6 +103,32 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
|
|||
return
|
||||
}
|
||||
|
||||
//sysnb pipe(p *[2]_C_int) (err error)
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe(&pp)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return
|
||||
}
|
||||
|
||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||
|
||||
func Pipe2(p []int, flags int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe2(&pp, flags)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return
|
||||
}
|
||||
|
||||
func (r *PtraceRegs) PC() uint64 { return r.Rip }
|
||||
|
||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Rip = pc }
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build arm,linux
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
|
@ -26,6 +28,30 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
|
|||
return
|
||||
}
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe2(&pp, 0)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return
|
||||
}
|
||||
|
||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||
|
||||
func Pipe2(p []int, flags int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe2(&pp, flags)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return
|
||||
}
|
||||
|
||||
// Underlying system call writes to newoffset via pointer.
|
||||
// Implemented in assembly to avoid allocation.
|
||||
func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno)
|
||||
|
@ -57,13 +83,14 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
|||
|
||||
// 64-bit file system and 32-bit uid calls
|
||||
// (16-bit uid calls are not always supported in newer kernels)
|
||||
//sys Chown(path string, uid int, gid int) (err error) = SYS_CHOWN32
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
||||
//sysnb Getegid() (egid int) = SYS_GETEGID32
|
||||
//sysnb Geteuid() (euid int) = SYS_GETEUID32
|
||||
//sysnb Getgid() (gid int) = SYS_GETGID32
|
||||
//sysnb Getuid() (uid int) = SYS_GETUID32
|
||||
//sysnb InotifyInit() (fd int, err error)
|
||||
//sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32
|
||||
//sys Listen(s int, n int) (err error)
|
||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||
|
@ -88,6 +115,14 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
|||
//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
|
||||
//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
|
||||
|
||||
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_ARM_FADVISE64_64, uintptr(fd), uintptr(advice), uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)
|
||||
|
||||
func Fstatfs(fd int, buf *Statfs_t) (err error) {
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build arm64,linux
|
||||
|
||||
package unix
|
||||
|
||||
const _SYS_dup = SYS_DUP3
|
||||
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sysnb Getegid() (egid int)
|
||||
//sysnb Geteuid() (euid int)
|
||||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
||||
//sysnb Getuid() (uid int)
|
||||
//sys Listen(s int, n int) (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 Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS_PSELECT6
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||
//sys Setfsgid(gid int) (err error)
|
||||
//sys Setfsuid(uid int) (err error)
|
||||
//sysnb Setregid(rgid int, egid int) (err error)
|
||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
||||
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||
//sys Shutdown(fd int, how int) (err error)
|
||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||
|
||||
func Stat(path string, stat *Stat_t) (err error) {
|
||||
return Fstatat(AT_FDCWD, path, stat, 0)
|
||||
}
|
||||
|
||||
func Lchown(path string, uid int, gid int) (err error) {
|
||||
return Fchownat(AT_FDCWD, path, uid, gid, AT_SYMLINK_NOFOLLOW)
|
||||
}
|
||||
|
||||
func Lstat(path string, stat *Stat_t) (err error) {
|
||||
return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
|
||||
}
|
||||
|
||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
|
||||
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
|
||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
|
||||
//sysnb setgroups(n int, list *_Gid_t) (err error)
|
||||
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
|
||||
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
|
||||
//sysnb socket(domain int, typ int, proto int) (fd int, err error)
|
||||
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
|
||||
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
||||
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
||||
|
||||
func Getpagesize() int { return 65536 }
|
||||
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
||||
|
||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
||||
|
||||
func NsecToTimespec(nsec int64) (ts Timespec) {
|
||||
ts.Sec = nsec / 1e9
|
||||
ts.Nsec = nsec % 1e9
|
||||
return
|
||||
}
|
||||
|
||||
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||
|
||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||
nsec += 999 // round up to microsecond
|
||||
tv.Sec = nsec / 1e9
|
||||
tv.Usec = nsec % 1e9 / 1e3
|
||||
return
|
||||
}
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe2(&pp, 0)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return
|
||||
}
|
||||
|
||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||
|
||||
func Pipe2(p []int, flags int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe2(&pp, flags)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return
|
||||
}
|
||||
|
||||
func (r *PtraceRegs) PC() uint64 { return r.Pc }
|
||||
|
||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint64(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint64(length)
|
||||
}
|
||||
|
||||
func InotifyInit() (fd int, err error) {
|
||||
return InotifyInit1(0)
|
||||
}
|
||||
|
||||
// TODO(dfc): constants that should be in zsysnum_linux_arm64.go, remove
|
||||
// these when the deprecated syscalls that the syscall package relies on
|
||||
// are removed.
|
||||
const (
|
||||
SYS_GETPGRP = 1060
|
||||
SYS_UTIMES = 1037
|
||||
SYS_FUTIMESAT = 1066
|
||||
SYS_PAUSE = 1061
|
||||
SYS_USTAT = 1070
|
||||
SYS_UTIME = 1063
|
||||
SYS_LCHOWN = 1032
|
||||
SYS_TIME = 1062
|
||||
SYS_EPOLL_CREATE = 1042
|
||||
SYS_EPOLL_WAIT = 1069
|
||||
)
|
|
@ -0,0 +1,96 @@
|
|||
// Copyright 2009 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux
|
||||
// +build ppc64 ppc64le
|
||||
|
||||
package unix
|
||||
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sysnb Getegid() (egid int)
|
||||
//sysnb Geteuid() (euid int)
|
||||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT
|
||||
//sysnb Getuid() (uid int)
|
||||
//sys Ioperm(from int, num int, on int) (err error)
|
||||
//sys Iopl(level int) (err error)
|
||||
//sys Lchown(path string, uid int, gid int) (err error)
|
||||
//sys Listen(s int, n int) (err error)
|
||||
//sys Lstat(path string, stat *Stat_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 Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||
//sys Setfsgid(gid int) (err error)
|
||||
//sys Setfsuid(uid int) (err error)
|
||||
//sysnb Setregid(rgid int, egid int) (err error)
|
||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
||||
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||
//sys Shutdown(fd int, how int) (err error)
|
||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||
//sys Stat(path string, stat *Stat_t) (err error)
|
||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) = SYS_SYNC_FILE_RANGE2
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
|
||||
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
|
||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
|
||||
//sysnb setgroups(n int, list *_Gid_t) (err error)
|
||||
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
|
||||
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
|
||||
//sysnb socket(domain int, typ int, proto int) (fd int, err error)
|
||||
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
|
||||
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
||||
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
||||
|
||||
func Getpagesize() int { return 65536 }
|
||||
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
||||
|
||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
||||
|
||||
func NsecToTimespec(nsec int64) (ts Timespec) {
|
||||
ts.Sec = nsec / 1e9
|
||||
ts.Nsec = nsec % 1e9
|
||||
return
|
||||
}
|
||||
|
||||
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||
|
||||
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||
nsec += 999 // round up to microsecond
|
||||
tv.Sec = nsec / 1e9
|
||||
tv.Usec = nsec % 1e9 / 1e3
|
||||
return
|
||||
}
|
||||
|
||||
func (r *PtraceRegs) PC() uint64 { return r.Nip }
|
||||
|
||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Nip = pc }
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint64(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint64(length)
|
||||
}
|
|
@ -151,8 +151,8 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||
//sys Chown(path string, uid int, gid int) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sysnb Dup(fd int) (nfd int, err error)
|
||||
//sysnb Dup2(from int, to int) (err error)
|
||||
//sys Dup(fd int) (nfd int, err error)
|
||||
//sys Dup2(from int, to int) (err error)
|
||||
//sys Exit(code int)
|
||||
//sys Fchdir(fd int) (err error)
|
||||
//sys Fchflags(fd int, flags int) (err error)
|
||||
|
@ -186,6 +186,11 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys Mlock(b []byte) (err error)
|
||||
//sys Mlockall(flags int) (err error)
|
||||
//sys Mprotect(b []byte, prot int) (err error)
|
||||
//sys Munlock(b []byte) (err error)
|
||||
//sys Munlockall() (err error)
|
||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Pathconf(path string, name int) (val int, err error)
|
||||
|
@ -418,10 +423,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||
// madvise
|
||||
// mincore
|
||||
// minherit
|
||||
// mlock
|
||||
// mlockall
|
||||
// modctl
|
||||
// mprotect
|
||||
// mq_close
|
||||
// mq_getattr
|
||||
// mq_notify
|
||||
|
@ -436,8 +438,6 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||
// msgget
|
||||
// msgrcv
|
||||
// msgsnd
|
||||
// munlock
|
||||
// munlockall
|
||||
// nfssvc
|
||||
// ntp_adjtime
|
||||
// pmc_control
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build 386,netbsd
|
||||
|
||||
package unix
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build amd64,netbsd
|
||||
|
||||
package unix
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build arm,netbsd
|
||||
|
||||
package unix
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
|
|
|
@ -129,8 +129,8 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
|||
//sys Chown(path string, uid int, gid int) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sysnb Dup(fd int) (nfd int, err error)
|
||||
//sysnb Dup2(from int, to int) (err error)
|
||||
//sys Dup(fd int) (nfd int, err error)
|
||||
//sys Dup2(from int, to int) (err error)
|
||||
//sys Exit(code int)
|
||||
//sys Fchdir(fd int) (err error)
|
||||
//sys Fchflags(fd int, flags int) (err error)
|
||||
|
@ -165,6 +165,11 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
|||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys Mlock(b []byte) (err error)
|
||||
//sys Mlockall(flags int) (err error)
|
||||
//sys Mprotect(b []byte, prot int) (err error)
|
||||
//sys Munlock(b []byte) (err error)
|
||||
//sys Munlockall() (err error)
|
||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Pathconf(path string, name int) (val int, err error)
|
||||
|
@ -249,16 +254,12 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
|||
// mkdirat
|
||||
// mkfifoat
|
||||
// mknodat
|
||||
// mlock
|
||||
// mlockall
|
||||
// mount
|
||||
// mquery
|
||||
// msgctl
|
||||
// msgget
|
||||
// msgrcv
|
||||
// msgsnd
|
||||
// munlock
|
||||
// munlockall
|
||||
// nfssvc
|
||||
// nnpfspioctl
|
||||
// openat
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build 386,openbsd
|
||||
|
||||
package unix
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build amd64,openbsd
|
||||
|
||||
package unix
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
|
|
|
@ -13,10 +13,17 @@
|
|||
package unix
|
||||
|
||||
import (
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Implemented in runtime/syscall_solaris.go.
|
||||
type syscallFunc uintptr
|
||||
|
||||
func rawSysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
||||
type SockaddrDatalink struct {
|
||||
Family uint16
|
||||
Index uint16
|
||||
|
@ -132,6 +139,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
return unsafe.Pointer(&sa.raw), sl, nil
|
||||
}
|
||||
|
||||
//sys getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = libsocket.getsockname
|
||||
|
||||
func Getsockname(fd int) (sa Sockaddr, err error) {
|
||||
var rsa RawSockaddrAny
|
||||
var len _Socklen = SizeofSockaddrAny
|
||||
|
@ -141,12 +150,23 @@ func Getsockname(fd int) (sa Sockaddr, err error) {
|
|||
return anyToSockaddr(&rsa)
|
||||
}
|
||||
|
||||
// The const provides a compile-time constant so clients
|
||||
// can adjust to whether there is a working Getwd and avoid
|
||||
// even linking this function into the binary. See ../os/getwd.go.
|
||||
const ImplementsGetwd = false
|
||||
const ImplementsGetwd = true
|
||||
|
||||
func Getwd() (string, error) { return "", ENOTSUP }
|
||||
//sys Getcwd(buf []byte) (n int, err error)
|
||||
|
||||
func Getwd() (wd string, err error) {
|
||||
var buf [PathMax]byte
|
||||
// Getcwd will return an error if it failed for any reason.
|
||||
_, err = Getcwd(buf[0:])
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
n := clen(buf[:])
|
||||
if n < 1 {
|
||||
return "", EINVAL
|
||||
}
|
||||
return string(buf[:n]), nil
|
||||
}
|
||||
|
||||
/*
|
||||
* Wrapped
|
||||
|
@ -157,21 +177,20 @@ func Getwd() (string, error) { return "", ENOTSUP }
|
|||
|
||||
func Getgroups() (gids []int, err error) {
|
||||
n, err := getgroups(0, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if n == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Sanity check group count. Max is 16 on BSD.
|
||||
if n < 0 || n > 1000 {
|
||||
// Check for error and sanity check group count. Newer versions of
|
||||
// Solaris allow up to 1024 (NGROUPS_MAX).
|
||||
if n < 0 || n > 1024 {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, EINVAL
|
||||
} else if n == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
a := make([]_Gid_t, n)
|
||||
n, err = getgroups(n, &a[0])
|
||||
if err != nil {
|
||||
if n == -1 {
|
||||
return nil, err
|
||||
}
|
||||
gids = make([]int, n)
|
||||
|
@ -270,29 +289,80 @@ func Gethostname() (name string, err error) {
|
|||
return name, err
|
||||
}
|
||||
|
||||
func UtimesNano(path string, ts []Timespec) (err error) {
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
|
||||
func Utimes(path string, tv []Timeval) (err error) {
|
||||
if tv == nil {
|
||||
return utimes(path, nil)
|
||||
}
|
||||
if len(tv) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||
}
|
||||
|
||||
//sys utimensat(fd int, path string, times *[2]Timespec, flag int) (err error)
|
||||
|
||||
func UtimesNano(path string, ts []Timespec) error {
|
||||
if ts == nil {
|
||||
return utimensat(AT_FDCWD, path, nil, 0)
|
||||
}
|
||||
if len(ts) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var tv [2]Timeval
|
||||
for i := 0; i < 2; i++ {
|
||||
tv[i].Sec = ts[i].Sec
|
||||
tv[i].Usec = ts[i].Nsec / 1000
|
||||
return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
||||
}
|
||||
|
||||
func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
|
||||
if ts == nil {
|
||||
return utimensat(dirfd, path, nil, flags)
|
||||
}
|
||||
return Utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||
if len(ts) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
|
||||
}
|
||||
|
||||
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
||||
|
||||
// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
|
||||
func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
|
||||
_, _, e1 := sysvicall6(procfcntl.Addr(), 3, uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(lk)), 0, 0, 0)
|
||||
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfcntl)), 3, uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(lk)), 0, 0, 0)
|
||||
if e1 != 0 {
|
||||
return e1
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//sys futimesat(fildes int, path *byte, times *[2]Timeval) (err error)
|
||||
|
||||
func Futimesat(dirfd int, path string, tv []Timeval) error {
|
||||
pathp, err := BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if tv == nil {
|
||||
return futimesat(dirfd, pathp, nil)
|
||||
}
|
||||
if len(tv) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
return futimesat(dirfd, pathp, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||
}
|
||||
|
||||
// Solaris doesn't have an futimes function because it allows NULL to be
|
||||
// specified as the path for futimesat. However, Go doesn't like
|
||||
// NULL-style string interfaces, so this simple wrapper is provided.
|
||||
func Futimes(fd int, tv []Timeval) error {
|
||||
if tv == nil {
|
||||
return futimesat(fd, nil, nil)
|
||||
}
|
||||
if len(tv) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
return futimesat(fd, nil, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||
}
|
||||
|
||||
func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
switch rsa.Addr.Family {
|
||||
case AF_UNIX:
|
||||
|
@ -341,7 +411,7 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
|||
var rsa RawSockaddrAny
|
||||
var len _Socklen = SizeofSockaddrAny
|
||||
nfd, err = accept(fd, &rsa, &len)
|
||||
if err != nil {
|
||||
if nfd == -1 {
|
||||
return
|
||||
}
|
||||
sa, err = anyToSockaddr(&rsa)
|
||||
|
@ -352,6 +422,8 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.recvmsg
|
||||
|
||||
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
|
||||
var msg Msghdr
|
||||
var rsa RawSockaddrAny
|
||||
|
@ -373,7 +445,7 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
|
|||
}
|
||||
msg.Iov = &iov
|
||||
msg.Iovlen = 1
|
||||
if n, err = recvmsg(fd, &msg, flags); err != nil {
|
||||
if n, err = recvmsg(fd, &msg, flags); n == -1 {
|
||||
return
|
||||
}
|
||||
oobn = int(msg.Accrightslen)
|
||||
|
@ -428,6 +500,67 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
|
|||
return n, nil
|
||||
}
|
||||
|
||||
//sys acct(path *byte) (err error)
|
||||
|
||||
func Acct(path string) (err error) {
|
||||
if len(path) == 0 {
|
||||
// Assume caller wants to disable accounting.
|
||||
return acct(nil)
|
||||
}
|
||||
|
||||
pathp, err := BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return acct(pathp)
|
||||
}
|
||||
|
||||
/*
|
||||
* Expose the ioctl function
|
||||
*/
|
||||
|
||||
//sys ioctl(fd int, req int, arg uintptr) (err error)
|
||||
|
||||
func IoctlSetInt(fd int, req int, value int) (err error) {
|
||||
return ioctl(fd, req, uintptr(value))
|
||||
}
|
||||
|
||||
func IoctlSetWinsize(fd int, req int, value *Winsize) (err error) {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlSetTermios(fd int, req int, value *Termios) (err error) {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlSetTermio(fd int, req int, value *Termio) (err error) {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlGetInt(fd int, req int) (int, error) {
|
||||
var value int
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
return value, err
|
||||
}
|
||||
|
||||
func IoctlGetWinsize(fd int, req int) (*Winsize, error) {
|
||||
var value Winsize
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func IoctlGetTermios(fd int, req int) (*Termios, error) {
|
||||
var value Termios
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func IoctlGetTermio(fd int, req int) (*Termio, error) {
|
||||
var value Termio
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
|
@ -438,21 +571,29 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
|
|||
//sys Chown(path string, uid int, gid int) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sys Creat(path string, mode uint32) (fd int, err error)
|
||||
//sys Dup(fd int) (nfd int, err error)
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sys Exit(code int)
|
||||
//sys Fchdir(fd int) (err error)
|
||||
//sys Fchmod(fd int, mode uint32) (err error)
|
||||
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||
//sys Fdatasync(fd int) (err error)
|
||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Getdents(fd int, buf []byte, basep *uintptr) (n int, err error)
|
||||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getpid() (pid int)
|
||||
//sysnb Getpgid(pid int) (pgid int, err error)
|
||||
//sysnb Getpgrp() (pgid int, err error)
|
||||
//sys Geteuid() (euid int)
|
||||
//sys Getegid() (egid int)
|
||||
//sys Getppid() (ppid int)
|
||||
//sys Getpriority(which int, who int) (n int, err error)
|
||||
//sysnb Getrlimit(which int, lim *Rlimit) (err error)
|
||||
//sysnb Getrusage(who int, rusage *Rusage) (err error)
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
//sysnb Getuid() (uid int)
|
||||
//sys Kill(pid int, signum syscall.Signal) (err error)
|
||||
|
@ -460,21 +601,35 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
|
|||
//sys Link(path string, link string) (err error)
|
||||
//sys Listen(s int, backlog int) (err error) = libsocket.listen
|
||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||
//sys Madvise(b []byte, advice int) (err error)
|
||||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
//sys Mkfifoat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
|
||||
//sys Mlock(b []byte) (err error)
|
||||
//sys Mlockall(flags int) (err error)
|
||||
//sys Mprotect(b []byte, prot int) (err error)
|
||||
//sys Munlock(b []byte) (err error)
|
||||
//sys Munlockall() (err error)
|
||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
|
||||
//sys Pathconf(path string, name int) (val int, err error)
|
||||
//sys Pause() (err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
|
||||
//sys read(fd int, p []byte) (n int, err error)
|
||||
//sys Readlink(path string, buf []byte) (n int, err error)
|
||||
//sys Rename(from string, to string) (err error)
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Rmdir(path string) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = lseek
|
||||
//sysnb Setegid(egid int) (err error)
|
||||
//sysnb Seteuid(euid int) (err error)
|
||||
//sysnb Setgid(gid int) (err error)
|
||||
//sys Sethostname(p []byte) (err error)
|
||||
//sysnb Setpgid(pid int, pgid int) (err error)
|
||||
//sys Setpriority(which int, who int, prio int) (err error)
|
||||
//sysnb Setregid(rgid int, egid int) (err error)
|
||||
|
@ -486,12 +641,17 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
|
|||
//sys Stat(path string, stat *Stat_t) (err error)
|
||||
//sys Symlink(path string, link string) (err error)
|
||||
//sys Sync() (err error)
|
||||
//sysnb Times(tms *Tms) (ticks uintptr, err error)
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
//sys Fsync(fd int) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sys Umask(newmask int) (oldmask int)
|
||||
//sys Umask(mask int) (oldmask int)
|
||||
//sysnb Uname(buf *Utsname) (err error)
|
||||
//sys Unmount(target string, flags int) (err error) = libc.umount
|
||||
//sys Unlink(path string) (err error)
|
||||
//sys Utimes(path string, times *[2]Timeval) (err error)
|
||||
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.bind
|
||||
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.connect
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
||||
|
@ -502,13 +662,11 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
|
|||
//sys write(fd int, p []byte) (n int, err error)
|
||||
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) = libsocket.getsockopt
|
||||
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = libsocket.getpeername
|
||||
//sys getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = libsocket.getsockname
|
||||
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) = libsocket.setsockopt
|
||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) = libsocket.recvfrom
|
||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.recvmsg
|
||||
|
||||
func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
|
||||
r0, _, e1 := sysvicall6(procread.Addr(), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0)
|
||||
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procread)), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0)
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
|
@ -517,10 +675,39 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
|
|||
}
|
||||
|
||||
func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
|
||||
r0, _, e1 := sysvicall6(procwrite.Addr(), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0)
|
||||
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwrite)), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0)
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var mapper = &mmapper{
|
||||
active: make(map[*byte][]byte),
|
||||
mmap: mmap,
|
||||
munmap: munmap,
|
||||
}
|
||||
|
||||
func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
|
||||
return mapper.Mmap(fd, offset, length, prot, flags)
|
||||
}
|
||||
|
||||
func Munmap(b []byte) (err error) {
|
||||
return mapper.Munmap(b)
|
||||
}
|
||||
|
||||
//sys sysconf(name int) (n int64, err error)
|
||||
|
||||
// pageSize caches the value of Getpagesize, since it can't change
|
||||
// once the system is booted.
|
||||
var pageSize int64 // accessed atomically
|
||||
|
||||
func Getpagesize() int {
|
||||
n := atomic.LoadInt64(&pageSize)
|
||||
if n == 0 {
|
||||
n, _ = sysconf(_SC_PAGESIZE)
|
||||
atomic.StoreInt64(&pageSize, n)
|
||||
}
|
||||
return int(n)
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package unix
|
||||
// +build amd64,solaris
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
package unix
|
||||
|
||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
||||
|
||||
|
|
|
@ -25,6 +25,30 @@ const (
|
|||
netbsd32Bit = runtime.GOOS == "netbsd" && sizeofPtr == 4
|
||||
)
|
||||
|
||||
// Do the interface allocations only once for common
|
||||
// Errno values.
|
||||
var (
|
||||
errEAGAIN error = syscall.EAGAIN
|
||||
errEINVAL error = syscall.EINVAL
|
||||
errENOENT error = syscall.ENOENT
|
||||
)
|
||||
|
||||
// errnoErr returns common boxed Errno values, to prevent
|
||||
// allocations at runtime.
|
||||
func errnoErr(e syscall.Errno) error {
|
||||
switch e {
|
||||
case 0:
|
||||
return nil
|
||||
case EAGAIN:
|
||||
return errEAGAIN
|
||||
case EINVAL:
|
||||
return errEINVAL
|
||||
case ENOENT:
|
||||
return errENOENT
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
|
|
@ -241,3 +241,10 @@ type BpfHdr C.struct_bpf_hdr
|
|||
// Terminal handling
|
||||
|
||||
type Termios C.struct_termios
|
||||
|
||||
// fchmodat-like syscalls.
|
||||
|
||||
const (
|
||||
AT_FDCWD = C.AT_FDCWD
|
||||
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
|
||||
)
|
||||
|
|
|
@ -210,6 +210,17 @@ type Dirent C.struct_dirent
|
|||
|
||||
type Fsid C.struct_fsid
|
||||
|
||||
// Advice to Fadvise
|
||||
|
||||
const (
|
||||
FADV_NORMAL = C.POSIX_FADV_NORMAL
|
||||
FADV_RANDOM = C.POSIX_FADV_RANDOM
|
||||
FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL
|
||||
FADV_WILLNEED = C.POSIX_FADV_WILLNEED
|
||||
FADV_DONTNEED = C.POSIX_FADV_DONTNEED
|
||||
FADV_NOREUSE = C.POSIX_FADV_NOREUSE
|
||||
)
|
||||
|
||||
// Sockets
|
||||
|
||||
type RawSockaddrInet4 C.struct_sockaddr_in
|
||||
|
|
|
@ -50,12 +50,19 @@ package unix
|
|||
#include <linux/netlink.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/icmpv6.h>
|
||||
#include <termios.h>
|
||||
#include <asm/termbits.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <ustat.h>
|
||||
#include <utime.h>
|
||||
|
||||
#ifdef TCSETS2
|
||||
// On systems that have "struct termios2" use this as type Termios.
|
||||
typedef struct termios2 termios_t;
|
||||
#else
|
||||
typedef struct termios termios_t;
|
||||
#endif
|
||||
|
||||
enum {
|
||||
sizeofPtr = sizeof(void*),
|
||||
};
|
||||
|
@ -77,7 +84,7 @@ struct sockaddr_any {
|
|||
// copied from /usr/include/linux/un.h
|
||||
struct my_sockaddr_un {
|
||||
sa_family_t sun_family;
|
||||
#ifdef __ARM_EABI__
|
||||
#if defined(__ARM_EABI__) || defined(__powerpc64__)
|
||||
// on ARM char is by default unsigned
|
||||
signed char sun_path[108];
|
||||
#else
|
||||
|
@ -87,6 +94,10 @@ struct my_sockaddr_un {
|
|||
|
||||
#ifdef __ARM_EABI__
|
||||
typedef struct user_regs PtraceRegs;
|
||||
#elif defined(__aarch64__)
|
||||
typedef struct user_pt_regs PtraceRegs;
|
||||
#elif defined(__powerpc64__)
|
||||
typedef struct pt_regs PtraceRegs;
|
||||
#else
|
||||
typedef struct user_regs_struct PtraceRegs;
|
||||
#endif
|
||||
|
@ -160,6 +171,17 @@ type Fsid C.fsid_t
|
|||
|
||||
type Flock_t C.struct_flock
|
||||
|
||||
// Advice to Fadvise
|
||||
|
||||
const (
|
||||
FADV_NORMAL = C.POSIX_FADV_NORMAL
|
||||
FADV_RANDOM = C.POSIX_FADV_RANDOM
|
||||
FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL
|
||||
FADV_WILLNEED = C.POSIX_FADV_WILLNEED
|
||||
FADV_DONTNEED = C.POSIX_FADV_DONTNEED
|
||||
FADV_NOREUSE = C.POSIX_FADV_NOREUSE
|
||||
)
|
||||
|
||||
// Sockets
|
||||
|
||||
type RawSockaddrInet4 C.struct_sockaddr_in
|
||||
|
@ -374,111 +396,11 @@ type Ustat_t C.struct_ustat
|
|||
type EpollEvent C.struct_my_epoll_event
|
||||
|
||||
const (
|
||||
_AT_FDCWD = C.AT_FDCWD
|
||||
AT_FDCWD = C.AT_FDCWD
|
||||
AT_REMOVEDIR = C.AT_REMOVEDIR
|
||||
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
|
||||
)
|
||||
|
||||
// Terminal handling
|
||||
|
||||
type Termios C.struct_termios
|
||||
|
||||
const (
|
||||
VINTR = C.VINTR
|
||||
VQUIT = C.VQUIT
|
||||
VERASE = C.VERASE
|
||||
VKILL = C.VKILL
|
||||
VEOF = C.VEOF
|
||||
VTIME = C.VTIME
|
||||
VMIN = C.VMIN
|
||||
VSWTC = C.VSWTC
|
||||
VSTART = C.VSTART
|
||||
VSTOP = C.VSTOP
|
||||
VSUSP = C.VSUSP
|
||||
VEOL = C.VEOL
|
||||
VREPRINT = C.VREPRINT
|
||||
VDISCARD = C.VDISCARD
|
||||
VWERASE = C.VWERASE
|
||||
VLNEXT = C.VLNEXT
|
||||
VEOL2 = C.VEOL2
|
||||
IGNBRK = C.IGNBRK
|
||||
BRKINT = C.BRKINT
|
||||
IGNPAR = C.IGNPAR
|
||||
PARMRK = C.PARMRK
|
||||
INPCK = C.INPCK
|
||||
ISTRIP = C.ISTRIP
|
||||
INLCR = C.INLCR
|
||||
IGNCR = C.IGNCR
|
||||
ICRNL = C.ICRNL
|
||||
IUCLC = C.IUCLC
|
||||
IXON = C.IXON
|
||||
IXANY = C.IXANY
|
||||
IXOFF = C.IXOFF
|
||||
IMAXBEL = C.IMAXBEL
|
||||
IUTF8 = C.IUTF8
|
||||
OPOST = C.OPOST
|
||||
OLCUC = C.OLCUC
|
||||
ONLCR = C.ONLCR
|
||||
OCRNL = C.OCRNL
|
||||
ONOCR = C.ONOCR
|
||||
ONLRET = C.ONLRET
|
||||
OFILL = C.OFILL
|
||||
OFDEL = C.OFDEL
|
||||
B0 = C.B0
|
||||
B50 = C.B50
|
||||
B75 = C.B75
|
||||
B110 = C.B110
|
||||
B134 = C.B134
|
||||
B150 = C.B150
|
||||
B200 = C.B200
|
||||
B300 = C.B300
|
||||
B600 = C.B600
|
||||
B1200 = C.B1200
|
||||
B1800 = C.B1800
|
||||
B2400 = C.B2400
|
||||
B4800 = C.B4800
|
||||
B9600 = C.B9600
|
||||
B19200 = C.B19200
|
||||
B38400 = C.B38400
|
||||
CSIZE = C.CSIZE
|
||||
CS5 = C.CS5
|
||||
CS6 = C.CS6
|
||||
CS7 = C.CS7
|
||||
CS8 = C.CS8
|
||||
CSTOPB = C.CSTOPB
|
||||
CREAD = C.CREAD
|
||||
PARENB = C.PARENB
|
||||
PARODD = C.PARODD
|
||||
HUPCL = C.HUPCL
|
||||
CLOCAL = C.CLOCAL
|
||||
B57600 = C.B57600
|
||||
B115200 = C.B115200
|
||||
B230400 = C.B230400
|
||||
B460800 = C.B460800
|
||||
B500000 = C.B500000
|
||||
B576000 = C.B576000
|
||||
B921600 = C.B921600
|
||||
B1000000 = C.B1000000
|
||||
B1152000 = C.B1152000
|
||||
B1500000 = C.B1500000
|
||||
B2000000 = C.B2000000
|
||||
B2500000 = C.B2500000
|
||||
B3000000 = C.B3000000
|
||||
B3500000 = C.B3500000
|
||||
B4000000 = C.B4000000
|
||||
ISIG = C.ISIG
|
||||
ICANON = C.ICANON
|
||||
XCASE = C.XCASE
|
||||
ECHO = C.ECHO
|
||||
ECHOE = C.ECHOE
|
||||
ECHOK = C.ECHOK
|
||||
ECHONL = C.ECHONL
|
||||
NOFLSH = C.NOFLSH
|
||||
TOSTOP = C.TOSTOP
|
||||
ECHOCTL = C.ECHOCTL
|
||||
ECHOPRT = C.ECHOPRT
|
||||
ECHOKE = C.ECHOKE
|
||||
FLUSHO = C.FLUSHO
|
||||
PENDIN = C.PENDIN
|
||||
IEXTEN = C.IEXTEN
|
||||
TCGETS = C.TCGETS
|
||||
TCSETS = C.TCSETS
|
||||
)
|
||||
type Termios C.termios_t
|
||||
|
|
|
@ -15,10 +15,17 @@ package unix
|
|||
|
||||
/*
|
||||
#define KERNEL
|
||||
// These defines ensure that builds done on newer versions of Solaris are
|
||||
// backwards-compatible with older versions of Solaris and
|
||||
// OpenSolaris-based derivatives.
|
||||
#define __USE_SUNOS_SOCKETS__ // msghdr
|
||||
#define __USE_LEGACY_PROTOTYPES__ // iovec
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <termios.h>
|
||||
#include <termio.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
|
@ -30,7 +37,9 @@ package unix
|
|||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/wait.h>
|
||||
#include <net/bpf.h>
|
||||
|
@ -40,6 +49,8 @@ package unix
|
|||
#include <netinet/in.h>
|
||||
#include <netinet/icmp6.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <ustat.h>
|
||||
#include <utime.h>
|
||||
|
||||
enum {
|
||||
sizeofPtr = sizeof(void*),
|
||||
|
@ -69,6 +80,7 @@ const (
|
|||
sizeofInt = C.sizeof_int
|
||||
sizeofLong = C.sizeof_long
|
||||
sizeofLongLong = C.sizeof_longlong
|
||||
PathMax = C.PATH_MAX
|
||||
)
|
||||
|
||||
// Basic types
|
||||
|
@ -88,6 +100,10 @@ type Timeval C.struct_timeval
|
|||
|
||||
type Timeval32 C.struct_timeval32
|
||||
|
||||
type Tms C.struct_tms
|
||||
|
||||
type Utimbuf C.struct_utimbuf
|
||||
|
||||
// Processes
|
||||
|
||||
type Rusage C.struct_rusage
|
||||
|
@ -175,6 +191,20 @@ const (
|
|||
|
||||
type FdSet C.fd_set
|
||||
|
||||
// Misc
|
||||
|
||||
type Utsname C.struct_utsname
|
||||
|
||||
type Ustat_t C.struct_ustat
|
||||
|
||||
const (
|
||||
AT_FDCWD = C.AT_FDCWD
|
||||
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
|
||||
AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
|
||||
AT_REMOVEDIR = C.AT_REMOVEDIR
|
||||
AT_EACCESS = C.AT_EACCESS
|
||||
)
|
||||
|
||||
// Routing and interface messages
|
||||
|
||||
const (
|
||||
|
@ -217,6 +247,14 @@ type BpfTimeval C.struct_bpf_timeval
|
|||
|
||||
type BpfHdr C.struct_bpf_hdr
|
||||
|
||||
// sysconf information
|
||||
|
||||
const _SC_PAGESIZE = C._SC_PAGESIZE
|
||||
|
||||
// Terminal handling
|
||||
|
||||
type Termios C.struct_termios
|
||||
|
||||
type Termio C.struct_termio
|
||||
|
||||
type Winsize C.struct_winsize
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// mkerrors.sh -m32
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// +build 386,darwin
|
||||
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs -- -m32 _const.go
|
||||
|
||||
|
@ -30,7 +32,7 @@ const (
|
|||
AF_LAT = 0xe
|
||||
AF_LINK = 0x12
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x26
|
||||
AF_MAX = 0x28
|
||||
AF_NATM = 0x1f
|
||||
AF_NDRV = 0x1b
|
||||
AF_NETBIOS = 0x21
|
||||
|
@ -45,6 +47,7 @@ const (
|
|||
AF_SYSTEM = 0x20
|
||||
AF_UNIX = 0x1
|
||||
AF_UNSPEC = 0x0
|
||||
AF_UTUN = 0x26
|
||||
B0 = 0x0
|
||||
B110 = 0x6e
|
||||
B115200 = 0x1c200
|
||||
|
@ -83,6 +86,7 @@ const (
|
|||
BIOCSBLEN = 0xc0044266
|
||||
BIOCSDLT = 0x80044278
|
||||
BIOCSETF = 0x80084267
|
||||
BIOCSETFNR = 0x8008427e
|
||||
BIOCSETIF = 0x8020426c
|
||||
BIOCSHDRCMPLT = 0x80044275
|
||||
BIOCSRSIG = 0x80044273
|
||||
|
@ -149,33 +153,168 @@ const (
|
|||
CSUSP = 0x1a
|
||||
CTL_MAXNAME = 0xc
|
||||
CTL_NET = 0x4
|
||||
DLT_A429 = 0xb8
|
||||
DLT_A653_ICM = 0xb9
|
||||
DLT_AIRONET_HEADER = 0x78
|
||||
DLT_AOS = 0xde
|
||||
DLT_APPLE_IP_OVER_IEEE1394 = 0x8a
|
||||
DLT_ARCNET = 0x7
|
||||
DLT_ARCNET_LINUX = 0x81
|
||||
DLT_ATM_CLIP = 0x13
|
||||
DLT_ATM_RFC1483 = 0xb
|
||||
DLT_AURORA = 0x7e
|
||||
DLT_AX25 = 0x3
|
||||
DLT_AX25_KISS = 0xca
|
||||
DLT_BACNET_MS_TP = 0xa5
|
||||
DLT_BLUETOOTH_HCI_H4 = 0xbb
|
||||
DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9
|
||||
DLT_CAN20B = 0xbe
|
||||
DLT_CAN_SOCKETCAN = 0xe3
|
||||
DLT_CHAOS = 0x5
|
||||
DLT_CHDLC = 0x68
|
||||
DLT_CISCO_IOS = 0x76
|
||||
DLT_C_HDLC = 0x68
|
||||
DLT_C_HDLC_WITH_DIR = 0xcd
|
||||
DLT_DBUS = 0xe7
|
||||
DLT_DECT = 0xdd
|
||||
DLT_DOCSIS = 0x8f
|
||||
DLT_DVB_CI = 0xeb
|
||||
DLT_ECONET = 0x73
|
||||
DLT_EN10MB = 0x1
|
||||
DLT_EN3MB = 0x2
|
||||
DLT_ENC = 0x6d
|
||||
DLT_ERF = 0xc5
|
||||
DLT_ERF_ETH = 0xaf
|
||||
DLT_ERF_POS = 0xb0
|
||||
DLT_FC_2 = 0xe0
|
||||
DLT_FC_2_WITH_FRAME_DELIMS = 0xe1
|
||||
DLT_FDDI = 0xa
|
||||
DLT_FLEXRAY = 0xd2
|
||||
DLT_FRELAY = 0x6b
|
||||
DLT_FRELAY_WITH_DIR = 0xce
|
||||
DLT_GCOM_SERIAL = 0xad
|
||||
DLT_GCOM_T1E1 = 0xac
|
||||
DLT_GPF_F = 0xab
|
||||
DLT_GPF_T = 0xaa
|
||||
DLT_GPRS_LLC = 0xa9
|
||||
DLT_GSMTAP_ABIS = 0xda
|
||||
DLT_GSMTAP_UM = 0xd9
|
||||
DLT_HHDLC = 0x79
|
||||
DLT_IBM_SN = 0x92
|
||||
DLT_IBM_SP = 0x91
|
||||
DLT_IEEE802 = 0x6
|
||||
DLT_IEEE802_11 = 0x69
|
||||
DLT_IEEE802_11_RADIO = 0x7f
|
||||
DLT_IEEE802_11_RADIO_AVS = 0xa3
|
||||
DLT_IEEE802_15_4 = 0xc3
|
||||
DLT_IEEE802_15_4_LINUX = 0xbf
|
||||
DLT_IEEE802_15_4_NOFCS = 0xe6
|
||||
DLT_IEEE802_15_4_NONASK_PHY = 0xd7
|
||||
DLT_IEEE802_16_MAC_CPS = 0xbc
|
||||
DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1
|
||||
DLT_IPFILTER = 0x74
|
||||
DLT_IPMB = 0xc7
|
||||
DLT_IPMB_LINUX = 0xd1
|
||||
DLT_IPNET = 0xe2
|
||||
DLT_IPOIB = 0xf2
|
||||
DLT_IPV4 = 0xe4
|
||||
DLT_IPV6 = 0xe5
|
||||
DLT_IP_OVER_FC = 0x7a
|
||||
DLT_JUNIPER_ATM1 = 0x89
|
||||
DLT_JUNIPER_ATM2 = 0x87
|
||||
DLT_JUNIPER_ATM_CEMIC = 0xee
|
||||
DLT_JUNIPER_CHDLC = 0xb5
|
||||
DLT_JUNIPER_ES = 0x84
|
||||
DLT_JUNIPER_ETHER = 0xb2
|
||||
DLT_JUNIPER_FIBRECHANNEL = 0xea
|
||||
DLT_JUNIPER_FRELAY = 0xb4
|
||||
DLT_JUNIPER_GGSN = 0x85
|
||||
DLT_JUNIPER_ISM = 0xc2
|
||||
DLT_JUNIPER_MFR = 0x86
|
||||
DLT_JUNIPER_MLFR = 0x83
|
||||
DLT_JUNIPER_MLPPP = 0x82
|
||||
DLT_JUNIPER_MONITOR = 0xa4
|
||||
DLT_JUNIPER_PIC_PEER = 0xae
|
||||
DLT_JUNIPER_PPP = 0xb3
|
||||
DLT_JUNIPER_PPPOE = 0xa7
|
||||
DLT_JUNIPER_PPPOE_ATM = 0xa8
|
||||
DLT_JUNIPER_SERVICES = 0x88
|
||||
DLT_JUNIPER_SRX_E2E = 0xe9
|
||||
DLT_JUNIPER_ST = 0xc8
|
||||
DLT_JUNIPER_VP = 0xb7
|
||||
DLT_JUNIPER_VS = 0xe8
|
||||
DLT_LAPB_WITH_DIR = 0xcf
|
||||
DLT_LAPD = 0xcb
|
||||
DLT_LIN = 0xd4
|
||||
DLT_LINUX_EVDEV = 0xd8
|
||||
DLT_LINUX_IRDA = 0x90
|
||||
DLT_LINUX_LAPD = 0xb1
|
||||
DLT_LINUX_PPP_WITHDIRECTION = 0xa6
|
||||
DLT_LINUX_SLL = 0x71
|
||||
DLT_LOOP = 0x6c
|
||||
DLT_LTALK = 0x72
|
||||
DLT_MATCHING_MAX = 0xf5
|
||||
DLT_MATCHING_MIN = 0x68
|
||||
DLT_MFR = 0xb6
|
||||
DLT_MOST = 0xd3
|
||||
DLT_MPEG_2_TS = 0xf3
|
||||
DLT_MPLS = 0xdb
|
||||
DLT_MTP2 = 0x8c
|
||||
DLT_MTP2_WITH_PHDR = 0x8b
|
||||
DLT_MTP3 = 0x8d
|
||||
DLT_MUX27010 = 0xec
|
||||
DLT_NETANALYZER = 0xf0
|
||||
DLT_NETANALYZER_TRANSPARENT = 0xf1
|
||||
DLT_NFC_LLCP = 0xf5
|
||||
DLT_NFLOG = 0xef
|
||||
DLT_NG40 = 0xf4
|
||||
DLT_NULL = 0x0
|
||||
DLT_PCI_EXP = 0x7d
|
||||
DLT_PFLOG = 0x75
|
||||
DLT_PFSYNC = 0x12
|
||||
DLT_PPI = 0xc0
|
||||
DLT_PPP = 0x9
|
||||
DLT_PPP_BSDOS = 0x10
|
||||
DLT_PPP_ETHER = 0x33
|
||||
DLT_PPP_PPPD = 0xa6
|
||||
DLT_PPP_SERIAL = 0x32
|
||||
DLT_PPP_WITH_DIR = 0xcc
|
||||
DLT_PPP_WITH_DIRECTION = 0xa6
|
||||
DLT_PRISM_HEADER = 0x77
|
||||
DLT_PRONET = 0x4
|
||||
DLT_RAIF1 = 0xc6
|
||||
DLT_RAW = 0xc
|
||||
DLT_RIO = 0x7c
|
||||
DLT_SCCP = 0x8e
|
||||
DLT_SITA = 0xc4
|
||||
DLT_SLIP = 0x8
|
||||
DLT_SLIP_BSDOS = 0xf
|
||||
DLT_STANAG_5066_D_PDU = 0xed
|
||||
DLT_SUNATM = 0x7b
|
||||
DLT_SYMANTEC_FIREWALL = 0x63
|
||||
DLT_TZSP = 0x80
|
||||
DLT_USB = 0xba
|
||||
DLT_USB_LINUX = 0xbd
|
||||
DLT_USB_LINUX_MMAPPED = 0xdc
|
||||
DLT_USER0 = 0x93
|
||||
DLT_USER1 = 0x94
|
||||
DLT_USER10 = 0x9d
|
||||
DLT_USER11 = 0x9e
|
||||
DLT_USER12 = 0x9f
|
||||
DLT_USER13 = 0xa0
|
||||
DLT_USER14 = 0xa1
|
||||
DLT_USER15 = 0xa2
|
||||
DLT_USER2 = 0x95
|
||||
DLT_USER3 = 0x96
|
||||
DLT_USER4 = 0x97
|
||||
DLT_USER5 = 0x98
|
||||
DLT_USER6 = 0x99
|
||||
DLT_USER7 = 0x9a
|
||||
DLT_USER8 = 0x9b
|
||||
DLT_USER9 = 0x9c
|
||||
DLT_WIHART = 0xdf
|
||||
DLT_X2E_SERIAL = 0xd5
|
||||
DLT_X2E_XORAYA = 0xd6
|
||||
DT_BLK = 0x6
|
||||
DT_CHR = 0x2
|
||||
DT_DIR = 0x4
|
||||
|
@ -198,8 +337,8 @@ const (
|
|||
EVFILT_PROC = -0x5
|
||||
EVFILT_READ = -0x1
|
||||
EVFILT_SIGNAL = -0x6
|
||||
EVFILT_SYSCOUNT = 0xc
|
||||
EVFILT_THREADMARKER = 0xc
|
||||
EVFILT_SYSCOUNT = 0xe
|
||||
EVFILT_THREADMARKER = 0xe
|
||||
EVFILT_TIMER = -0x7
|
||||
EVFILT_USER = -0xa
|
||||
EVFILT_VM = -0xc
|
||||
|
@ -233,9 +372,11 @@ const (
|
|||
F_CHKCLEAN = 0x29
|
||||
F_DUPFD = 0x0
|
||||
F_DUPFD_CLOEXEC = 0x43
|
||||
F_FINDSIGS = 0x4e
|
||||
F_FLUSH_DATA = 0x28
|
||||
F_FREEZE_FS = 0x35
|
||||
F_FULLFSYNC = 0x33
|
||||
F_GETCODEDIR = 0x48
|
||||
F_GETFD = 0x1
|
||||
F_GETFL = 0x3
|
||||
F_GETLK = 0x7
|
||||
|
@ -245,10 +386,10 @@ const (
|
|||
F_GETPATH = 0x32
|
||||
F_GETPATH_MTMINFO = 0x47
|
||||
F_GETPROTECTIONCLASS = 0x3f
|
||||
F_GETPROTECTIONLEVEL = 0x4d
|
||||
F_GLOBAL_NOCACHE = 0x37
|
||||
F_LOG2PHYS = 0x31
|
||||
F_LOG2PHYS_EXT = 0x41
|
||||
F_MARKDEPENDENCY = 0x3c
|
||||
F_NOCACHE = 0x30
|
||||
F_NODIRECT = 0x3e
|
||||
F_OK = 0x0
|
||||
|
@ -258,20 +399,21 @@ const (
|
|||
F_RDADVISE = 0x2c
|
||||
F_RDAHEAD = 0x2d
|
||||
F_RDLCK = 0x1
|
||||
F_READBOOTSTRAP = 0x2e
|
||||
F_SETBACKINGSTORE = 0x46
|
||||
F_SETFD = 0x2
|
||||
F_SETFL = 0x4
|
||||
F_SETLK = 0x8
|
||||
F_SETLKW = 0x9
|
||||
F_SETLKWTIMEOUT = 0xa
|
||||
F_SETNOSIGPIPE = 0x49
|
||||
F_SETOWN = 0x6
|
||||
F_SETPROTECTIONCLASS = 0x40
|
||||
F_SETSIZE = 0x2b
|
||||
F_SINGLE_WRITER = 0x4c
|
||||
F_THAW_FS = 0x36
|
||||
F_TRANSCODEKEY = 0x4b
|
||||
F_UNLCK = 0x2
|
||||
F_VOLPOSMODE = 0x4
|
||||
F_WRITEBOOTSTRAP = 0x2f
|
||||
F_WRLCK = 0x3
|
||||
HUPCL = 0x4000
|
||||
ICANON = 0x100
|
||||
|
@ -341,6 +483,7 @@ const (
|
|||
IFT_PDP = 0xff
|
||||
IFT_PFLOG = 0xf5
|
||||
IFT_PFSYNC = 0xf6
|
||||
IFT_PKTAP = 0xfe
|
||||
IFT_PPP = 0x17
|
||||
IFT_PROPMUX = 0x36
|
||||
IFT_PROPVIRTUAL = 0x35
|
||||
|
@ -509,7 +652,7 @@ const (
|
|||
IPV6_FAITH = 0x1d
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
IPV6_FRAGTTL = 0x78
|
||||
IPV6_FRAGTTL = 0x3c
|
||||
IPV6_FW_ADD = 0x1e
|
||||
IPV6_FW_DEL = 0x1f
|
||||
IPV6_FW_FLUSH = 0x20
|
||||
|
@ -679,11 +822,19 @@ const (
|
|||
NOFLSH = 0x80000000
|
||||
NOTE_ABSOLUTE = 0x8
|
||||
NOTE_ATTRIB = 0x8
|
||||
NOTE_BACKGROUND = 0x40
|
||||
NOTE_CHILD = 0x4
|
||||
NOTE_CRITICAL = 0x20
|
||||
NOTE_DELETE = 0x1
|
||||
NOTE_EXEC = 0x20000000
|
||||
NOTE_EXIT = 0x80000000
|
||||
NOTE_EXITSTATUS = 0x4000000
|
||||
NOTE_EXIT_CSERROR = 0x40000
|
||||
NOTE_EXIT_DECRYPTFAIL = 0x10000
|
||||
NOTE_EXIT_DETAIL = 0x2000000
|
||||
NOTE_EXIT_DETAIL_MASK = 0x70000
|
||||
NOTE_EXIT_MEMORY = 0x20000
|
||||
NOTE_EXIT_REPARENTED = 0x80000
|
||||
NOTE_EXTEND = 0x4
|
||||
NOTE_FFAND = 0x40000000
|
||||
NOTE_FFCOPY = 0xc0000000
|
||||
|
@ -692,6 +843,7 @@ const (
|
|||
NOTE_FFNOP = 0x0
|
||||
NOTE_FFOR = 0x80000000
|
||||
NOTE_FORK = 0x40000000
|
||||
NOTE_LEEWAY = 0x10
|
||||
NOTE_LINK = 0x10
|
||||
NOTE_LOWAT = 0x1
|
||||
NOTE_NONE = 0x80
|
||||
|
@ -700,7 +852,6 @@ const (
|
|||
NOTE_PDATAMASK = 0xfffff
|
||||
NOTE_REAP = 0x10000000
|
||||
NOTE_RENAME = 0x20
|
||||
NOTE_RESOURCEEND = 0x2000000
|
||||
NOTE_REVOKE = 0x40
|
||||
NOTE_SECONDS = 0x1
|
||||
NOTE_SIGNAL = 0x8000000
|
||||
|
@ -728,6 +879,7 @@ const (
|
|||
O_CLOEXEC = 0x1000000
|
||||
O_CREAT = 0x200
|
||||
O_DIRECTORY = 0x100000
|
||||
O_DP_GETRAWENCRYPTED = 0x1
|
||||
O_DSYNC = 0x400000
|
||||
O_EVTONLY = 0x8000
|
||||
O_EXCL = 0x800
|
||||
|
@ -777,6 +929,7 @@ const (
|
|||
RLIMIT_AS = 0x5
|
||||
RLIMIT_CORE = 0x4
|
||||
RLIMIT_CPU = 0x0
|
||||
RLIMIT_CPU_USAGE_MONITOR = 0x2
|
||||
RLIMIT_DATA = 0x2
|
||||
RLIMIT_FSIZE = 0x1
|
||||
RLIMIT_NOFILE = 0x8
|
||||
|
@ -814,12 +967,15 @@ const (
|
|||
RTF_LOCAL = 0x200000
|
||||
RTF_MODIFIED = 0x20
|
||||
RTF_MULTICAST = 0x800000
|
||||
RTF_NOIFREF = 0x2000
|
||||
RTF_PINNED = 0x100000
|
||||
RTF_PRCLONING = 0x10000
|
||||
RTF_PROTO1 = 0x8000
|
||||
RTF_PROTO2 = 0x4000
|
||||
RTF_PROTO3 = 0x40000
|
||||
RTF_PROXY = 0x8000000
|
||||
RTF_REJECT = 0x8
|
||||
RTF_ROUTER = 0x10000000
|
||||
RTF_STATIC = 0x800
|
||||
RTF_UP = 0x1
|
||||
RTF_WASCLONED = 0x20000
|
||||
|
@ -864,7 +1020,6 @@ const (
|
|||
SHUT_WR = 0x1
|
||||
SIOCADDMULTI = 0x80206931
|
||||
SIOCAIFADDR = 0x8040691a
|
||||
SIOCALIFADDR = 0x8118691d
|
||||
SIOCARPIPLL = 0xc0206928
|
||||
SIOCATMARK = 0x40047307
|
||||
SIOCAUTOADDR = 0xc0206926
|
||||
|
@ -872,10 +1027,7 @@ const (
|
|||
SIOCDELMULTI = 0x80206932
|
||||
SIOCDIFADDR = 0x80206919
|
||||
SIOCDIFPHYADDR = 0x80206941
|
||||
SIOCDLIFADDR = 0x8118691f
|
||||
SIOCGDRVSPEC = 0xc01c697b
|
||||
SIOCGETSGCNT = 0xc014721c
|
||||
SIOCGETVIFCNT = 0xc014721b
|
||||
SIOCGETVLAN = 0xc020697f
|
||||
SIOCGHIWAT = 0x40047301
|
||||
SIOCGIFADDR = 0xc0206921
|
||||
|
@ -901,13 +1053,12 @@ const (
|
|||
SIOCGIFSTATUS = 0xc331693d
|
||||
SIOCGIFVLAN = 0xc020697f
|
||||
SIOCGIFWAKEFLAGS = 0xc0206988
|
||||
SIOCGLIFADDR = 0xc118691e
|
||||
SIOCGLIFPHYADDR = 0xc1186943
|
||||
SIOCGLOWAT = 0x40047303
|
||||
SIOCGPGRP = 0x40047309
|
||||
SIOCIFCREATE = 0xc0206978
|
||||
SIOCIFCREATE2 = 0xc020697a
|
||||
SIOCIFDESTROY = 0x80206979
|
||||
SIOCIFGCLONERS = 0xc00c6981
|
||||
SIOCRSLVMULTI = 0xc008693b
|
||||
SIOCSDRVSPEC = 0x801c697b
|
||||
SIOCSETVLAN = 0x8020697e
|
||||
|
@ -931,7 +1082,6 @@ const (
|
|||
SIOCSIFPHYADDR = 0x8040693e
|
||||
SIOCSIFPHYS = 0x80206936
|
||||
SIOCSIFVLAN = 0x8020697e
|
||||
SIOCSLIFPHYADDR = 0x81186942
|
||||
SIOCSLOWAT = 0x80047302
|
||||
SIOCSPGRP = 0x80047308
|
||||
SOCK_DGRAM = 0x2
|
||||
|
@ -958,6 +1108,7 @@ const (
|
|||
SO_NOTIFYCONFLICT = 0x1026
|
||||
SO_NP_EXTENSIONS = 0x1083
|
||||
SO_NREAD = 0x1020
|
||||
SO_NUMRCVPKT = 0x1112
|
||||
SO_NWRITE = 0x1024
|
||||
SO_OOBINLINE = 0x100
|
||||
SO_PEERLABEL = 0x1011
|
||||
|
@ -965,10 +1116,6 @@ const (
|
|||
SO_RCVBUF = 0x1002
|
||||
SO_RCVLOWAT = 0x1004
|
||||
SO_RCVTIMEO = 0x1006
|
||||
SO_RESTRICTIONS = 0x1081
|
||||
SO_RESTRICT_DENYIN = 0x1
|
||||
SO_RESTRICT_DENYOUT = 0x2
|
||||
SO_RESTRICT_DENYSET = 0x80000000
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_REUSESHAREUID = 0x1025
|
||||
|
@ -1014,21 +1161,25 @@ const (
|
|||
TCIOFLUSH = 0x3
|
||||
TCOFLUSH = 0x2
|
||||
TCP_CONNECTIONTIMEOUT = 0x20
|
||||
TCP_ENABLE_ECN = 0x104
|
||||
TCP_KEEPALIVE = 0x10
|
||||
TCP_KEEPCNT = 0x102
|
||||
TCP_KEEPINTVL = 0x101
|
||||
TCP_MAXHLEN = 0x3c
|
||||
TCP_MAXOLEN = 0x28
|
||||
TCP_MAXSEG = 0x2
|
||||
TCP_MAXWIN = 0xffff
|
||||
TCP_MAX_SACK = 0x3
|
||||
TCP_MAX_SACK = 0x4
|
||||
TCP_MAX_WINSHIFT = 0xe
|
||||
TCP_MINMSS = 0xd8
|
||||
TCP_MINMSSOVERLOAD = 0x3e8
|
||||
TCP_MSS = 0x200
|
||||
TCP_NODELAY = 0x1
|
||||
TCP_NOOPT = 0x8
|
||||
TCP_NOPUSH = 0x4
|
||||
TCP_NOTSENT_LOWAT = 0x201
|
||||
TCP_RXT_CONNDROPTIME = 0x80
|
||||
TCP_RXT_FINDROP = 0x100
|
||||
TCP_SENDMOREACKS = 0x103
|
||||
TCSAFLUSH = 0x2
|
||||
TIOCCBRK = 0x2000747a
|
||||
TIOCCDTR = 0x20007478
|
||||
|
@ -1172,7 +1323,7 @@ const (
|
|||
EIO = syscall.Errno(0x5)
|
||||
EISCONN = syscall.Errno(0x38)
|
||||
EISDIR = syscall.Errno(0x15)
|
||||
ELAST = syscall.Errno(0x69)
|
||||
ELAST = syscall.Errno(0x6a)
|
||||
ELOOP = syscall.Errno(0x3e)
|
||||
EMFILE = syscall.Errno(0x18)
|
||||
EMLINK = syscall.Errno(0x1f)
|
||||
|
@ -1223,6 +1374,7 @@ const (
|
|||
EPROTONOSUPPORT = syscall.Errno(0x2b)
|
||||
EPROTOTYPE = syscall.Errno(0x29)
|
||||
EPWROFF = syscall.Errno(0x52)
|
||||
EQFULL = syscall.Errno(0x6a)
|
||||
ERANGE = syscall.Errno(0x22)
|
||||
EREMOTE = syscall.Errno(0x47)
|
||||
EROFS = syscall.Errno(0x1e)
|
||||
|
@ -1385,6 +1537,7 @@ var errors = [...]string{
|
|||
103: "policy not found",
|
||||
104: "state not recoverable",
|
||||
105: "previous owner died",
|
||||
106: "interface output queue is full",
|
||||
}
|
||||
|
||||
// Signal table
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// mkerrors.sh -m64
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// +build amd64,darwin
|
||||
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs -- -m64 _const.go
|
||||
|
||||
|
@ -374,6 +376,7 @@ const (
|
|||
F_FLUSH_DATA = 0x28
|
||||
F_FREEZE_FS = 0x35
|
||||
F_FULLFSYNC = 0x33
|
||||
F_GETCODEDIR = 0x48
|
||||
F_GETFD = 0x1
|
||||
F_GETFL = 0x3
|
||||
F_GETLK = 0x7
|
||||
|
@ -1017,7 +1020,6 @@ const (
|
|||
SHUT_WR = 0x1
|
||||
SIOCADDMULTI = 0x80206931
|
||||
SIOCAIFADDR = 0x8040691a
|
||||
SIOCALIFADDR = 0x8118691d
|
||||
SIOCARPIPLL = 0xc0206928
|
||||
SIOCATMARK = 0x40047307
|
||||
SIOCAUTOADDR = 0xc0206926
|
||||
|
@ -1025,10 +1027,7 @@ const (
|
|||
SIOCDELMULTI = 0x80206932
|
||||
SIOCDIFADDR = 0x80206919
|
||||
SIOCDIFPHYADDR = 0x80206941
|
||||
SIOCDLIFADDR = 0x8118691f
|
||||
SIOCGDRVSPEC = 0xc028697b
|
||||
SIOCGETSGCNT = 0xc014721c
|
||||
SIOCGETVIFCNT = 0xc014721b
|
||||
SIOCGETVLAN = 0xc020697f
|
||||
SIOCGHIWAT = 0x40047301
|
||||
SIOCGIFADDR = 0xc0206921
|
||||
|
@ -1054,8 +1053,6 @@ const (
|
|||
SIOCGIFSTATUS = 0xc331693d
|
||||
SIOCGIFVLAN = 0xc020697f
|
||||
SIOCGIFWAKEFLAGS = 0xc0206988
|
||||
SIOCGLIFADDR = 0xc118691e
|
||||
SIOCGLIFPHYADDR = 0xc1186943
|
||||
SIOCGLOWAT = 0x40047303
|
||||
SIOCGPGRP = 0x40047309
|
||||
SIOCIFCREATE = 0xc0206978
|
||||
|
@ -1085,7 +1082,6 @@ const (
|
|||
SIOCSIFPHYADDR = 0x8040693e
|
||||
SIOCSIFPHYS = 0x80206936
|
||||
SIOCSIFVLAN = 0x8020697e
|
||||
SIOCSLIFPHYADDR = 0x81186942
|
||||
SIOCSLOWAT = 0x80047302
|
||||
SIOCSPGRP = 0x80047308
|
||||
SOCK_DGRAM = 0x2
|
||||
|
@ -1112,6 +1108,7 @@ const (
|
|||
SO_NOTIFYCONFLICT = 0x1026
|
||||
SO_NP_EXTENSIONS = 0x1083
|
||||
SO_NREAD = 0x1020
|
||||
SO_NUMRCVPKT = 0x1112
|
||||
SO_NWRITE = 0x1024
|
||||
SO_OOBINLINE = 0x100
|
||||
SO_PEERLABEL = 0x1011
|
||||
|
@ -1164,6 +1161,7 @@ const (
|
|||
TCIOFLUSH = 0x3
|
||||
TCOFLUSH = 0x2
|
||||
TCP_CONNECTIONTIMEOUT = 0x20
|
||||
TCP_ENABLE_ECN = 0x104
|
||||
TCP_KEEPALIVE = 0x10
|
||||
TCP_KEEPCNT = 0x102
|
||||
TCP_KEEPINTVL = 0x101
|
||||
|
@ -1171,13 +1169,14 @@ const (
|
|||
TCP_MAXOLEN = 0x28
|
||||
TCP_MAXSEG = 0x2
|
||||
TCP_MAXWIN = 0xffff
|
||||
TCP_MAX_SACK = 0x3
|
||||
TCP_MAX_SACK = 0x4
|
||||
TCP_MAX_WINSHIFT = 0xe
|
||||
TCP_MINMSS = 0xd8
|
||||
TCP_MSS = 0x200
|
||||
TCP_NODELAY = 0x1
|
||||
TCP_NOOPT = 0x8
|
||||
TCP_NOPUSH = 0x4
|
||||
TCP_NOTSENT_LOWAT = 0x201
|
||||
TCP_RXT_CONNDROPTIME = 0x80
|
||||
TCP_RXT_FINDROP = 0x100
|
||||
TCP_SENDMOREACKS = 0x103
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,8 @@
|
|||
// mkerrors.sh -m32
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// +build 386,dragonfly
|
||||
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs -- -m32 _const.go
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// mkerrors.sh -m64
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// +build amd64,dragonfly
|
||||
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs -- -m64 _const.go
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// mkerrors.sh -m32
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// +build 386,freebsd
|
||||
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs -- -m32 _const.go
|
||||
|
||||
|
@ -223,6 +225,20 @@ const (
|
|||
BRKINT = 0x2
|
||||
CFLUSH = 0xf
|
||||
CLOCAL = 0x8000
|
||||
CLOCK_MONOTONIC = 0x4
|
||||
CLOCK_MONOTONIC_FAST = 0xc
|
||||
CLOCK_MONOTONIC_PRECISE = 0xb
|
||||
CLOCK_PROCESS_CPUTIME_ID = 0xf
|
||||
CLOCK_PROF = 0x2
|
||||
CLOCK_REALTIME = 0x0
|
||||
CLOCK_REALTIME_FAST = 0xa
|
||||
CLOCK_REALTIME_PRECISE = 0x9
|
||||
CLOCK_SECOND = 0xd
|
||||
CLOCK_THREAD_CPUTIME_ID = 0xe
|
||||
CLOCK_UPTIME = 0x5
|
||||
CLOCK_UPTIME_FAST = 0x8
|
||||
CLOCK_UPTIME_PRECISE = 0x7
|
||||
CLOCK_VIRTUAL = 0x1
|
||||
CREAD = 0x800
|
||||
CS5 = 0x0
|
||||
CS6 = 0x100
|
||||
|
@ -439,6 +455,9 @@ const (
|
|||
EV_RECEIPT = 0x40
|
||||
EV_SYSFLAGS = 0xf000
|
||||
EXTA = 0x4b00
|
||||
EXTATTR_NAMESPACE_EMPTY = 0x0
|
||||
EXTATTR_NAMESPACE_SYSTEM = 0x2
|
||||
EXTATTR_NAMESPACE_USER = 0x1
|
||||
EXTB = 0x9600
|
||||
EXTPROC = 0x800
|
||||
FD_CLOEXEC = 0x1
|
||||
|
@ -764,6 +783,7 @@ const (
|
|||
IPPROTO_GMTP = 0x64
|
||||
IPPROTO_GRE = 0x2f
|
||||
IPPROTO_HELLO = 0x3f
|
||||
IPPROTO_HIP = 0x8b
|
||||
IPPROTO_HMP = 0x14
|
||||
IPPROTO_HOPOPTS = 0x0
|
||||
IPPROTO_ICMP = 0x1
|
||||
|
@ -817,6 +837,8 @@ const (
|
|||
IPPROTO_RAW = 0xff
|
||||
IPPROTO_RCCMON = 0xa
|
||||
IPPROTO_RDP = 0x1b
|
||||
IPPROTO_RESERVED_253 = 0xfd
|
||||
IPPROTO_RESERVED_254 = 0xfe
|
||||
IPPROTO_ROUTING = 0x2b
|
||||
IPPROTO_RSVP = 0x2e
|
||||
IPPROTO_RVD = 0x42
|
||||
|
@ -827,6 +849,7 @@ const (
|
|||
IPPROTO_SDRP = 0x2a
|
||||
IPPROTO_SEND = 0x103
|
||||
IPPROTO_SEP = 0x21
|
||||
IPPROTO_SHIM6 = 0x8c
|
||||
IPPROTO_SKIP = 0x39
|
||||
IPPROTO_SPACER = 0x7fff
|
||||
IPPROTO_SRPC = 0x5a
|
||||
|
@ -842,6 +865,7 @@ const (
|
|||
IPPROTO_TRUNK2 = 0x18
|
||||
IPPROTO_TTP = 0x54
|
||||
IPPROTO_UDP = 0x11
|
||||
IPPROTO_UDPLITE = 0x88
|
||||
IPPROTO_VINES = 0x53
|
||||
IPPROTO_VISA = 0x46
|
||||
IPPROTO_VMTP = 0x51
|
||||
|
@ -1011,6 +1035,7 @@ const (
|
|||
MAP_ANON = 0x1000
|
||||
MAP_ANONYMOUS = 0x1000
|
||||
MAP_COPY = 0x2
|
||||
MAP_EXCL = 0x4000
|
||||
MAP_FILE = 0x0
|
||||
MAP_FIXED = 0x10
|
||||
MAP_HASSEMAPHORE = 0x200
|
||||
|
@ -1191,6 +1216,7 @@ const (
|
|||
RTV_SPIPE = 0x10
|
||||
RTV_SSTHRESH = 0x20
|
||||
RTV_WEIGHT = 0x100
|
||||
RT_ALL_FIBS = -0x1
|
||||
RT_CACHING_CONTEXT = 0x1
|
||||
RT_DEFAULT_FIB = 0x0
|
||||
RT_NORTREF = 0x2
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// mkerrors.sh -m64
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// +build amd64,freebsd
|
||||
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs -- -m64 _const.go
|
||||
|
||||
|
@ -223,6 +225,20 @@ const (
|
|||
BRKINT = 0x2
|
||||
CFLUSH = 0xf
|
||||
CLOCAL = 0x8000
|
||||
CLOCK_MONOTONIC = 0x4
|
||||
CLOCK_MONOTONIC_FAST = 0xc
|
||||
CLOCK_MONOTONIC_PRECISE = 0xb
|
||||
CLOCK_PROCESS_CPUTIME_ID = 0xf
|
||||
CLOCK_PROF = 0x2
|
||||
CLOCK_REALTIME = 0x0
|
||||
CLOCK_REALTIME_FAST = 0xa
|
||||
CLOCK_REALTIME_PRECISE = 0x9
|
||||
CLOCK_SECOND = 0xd
|
||||
CLOCK_THREAD_CPUTIME_ID = 0xe
|
||||
CLOCK_UPTIME = 0x5
|
||||
CLOCK_UPTIME_FAST = 0x8
|
||||
CLOCK_UPTIME_PRECISE = 0x7
|
||||
CLOCK_VIRTUAL = 0x1
|
||||
CREAD = 0x800
|
||||
CS5 = 0x0
|
||||
CS6 = 0x100
|
||||
|
@ -439,6 +455,9 @@ const (
|
|||
EV_RECEIPT = 0x40
|
||||
EV_SYSFLAGS = 0xf000
|
||||
EXTA = 0x4b00
|
||||
EXTATTR_NAMESPACE_EMPTY = 0x0
|
||||
EXTATTR_NAMESPACE_SYSTEM = 0x2
|
||||
EXTATTR_NAMESPACE_USER = 0x1
|
||||
EXTB = 0x9600
|
||||
EXTPROC = 0x800
|
||||
FD_CLOEXEC = 0x1
|
||||
|
@ -764,6 +783,7 @@ const (
|
|||
IPPROTO_GMTP = 0x64
|
||||
IPPROTO_GRE = 0x2f
|
||||
IPPROTO_HELLO = 0x3f
|
||||
IPPROTO_HIP = 0x8b
|
||||
IPPROTO_HMP = 0x14
|
||||
IPPROTO_HOPOPTS = 0x0
|
||||
IPPROTO_ICMP = 0x1
|
||||
|
@ -817,6 +837,8 @@ const (
|
|||
IPPROTO_RAW = 0xff
|
||||
IPPROTO_RCCMON = 0xa
|
||||
IPPROTO_RDP = 0x1b
|
||||
IPPROTO_RESERVED_253 = 0xfd
|
||||
IPPROTO_RESERVED_254 = 0xfe
|
||||
IPPROTO_ROUTING = 0x2b
|
||||
IPPROTO_RSVP = 0x2e
|
||||
IPPROTO_RVD = 0x42
|
||||
|
@ -827,6 +849,7 @@ const (
|
|||
IPPROTO_SDRP = 0x2a
|
||||
IPPROTO_SEND = 0x103
|
||||
IPPROTO_SEP = 0x21
|
||||
IPPROTO_SHIM6 = 0x8c
|
||||
IPPROTO_SKIP = 0x39
|
||||
IPPROTO_SPACER = 0x7fff
|
||||
IPPROTO_SRPC = 0x5a
|
||||
|
@ -842,6 +865,7 @@ const (
|
|||
IPPROTO_TRUNK2 = 0x18
|
||||
IPPROTO_TTP = 0x54
|
||||
IPPROTO_UDP = 0x11
|
||||
IPPROTO_UDPLITE = 0x88
|
||||
IPPROTO_VINES = 0x53
|
||||
IPPROTO_VISA = 0x46
|
||||
IPPROTO_VMTP = 0x51
|
||||
|
@ -1012,6 +1036,7 @@ const (
|
|||
MAP_ANON = 0x1000
|
||||
MAP_ANONYMOUS = 0x1000
|
||||
MAP_COPY = 0x2
|
||||
MAP_EXCL = 0x4000
|
||||
MAP_FILE = 0x0
|
||||
MAP_FIXED = 0x10
|
||||
MAP_HASSEMAPHORE = 0x200
|
||||
|
@ -1067,13 +1092,17 @@ const (
|
|||
NOTE_FORK = 0x40000000
|
||||
NOTE_LINK = 0x10
|
||||
NOTE_LOWAT = 0x1
|
||||
NOTE_MSECONDS = 0x2
|
||||
NOTE_NSECONDS = 0x8
|
||||
NOTE_PCTRLMASK = 0xf0000000
|
||||
NOTE_PDATAMASK = 0xfffff
|
||||
NOTE_RENAME = 0x20
|
||||
NOTE_REVOKE = 0x40
|
||||
NOTE_SECONDS = 0x1
|
||||
NOTE_TRACK = 0x1
|
||||
NOTE_TRACKERR = 0x2
|
||||
NOTE_TRIGGER = 0x1000000
|
||||
NOTE_USECONDS = 0x4
|
||||
NOTE_WRITE = 0x2
|
||||
OCRNL = 0x10
|
||||
ONLCR = 0x2
|
||||
|
@ -1192,6 +1221,7 @@ const (
|
|||
RTV_SPIPE = 0x10
|
||||
RTV_SSTHRESH = 0x20
|
||||
RTV_WEIGHT = 0x100
|
||||
RT_ALL_FIBS = -0x1
|
||||
RT_CACHING_CONTEXT = 0x1
|
||||
RT_DEFAULT_FIB = 0x0
|
||||
RT_NORTREF = 0x2
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// mkerrors.sh
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// +build arm,freebsd
|
||||
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs -- _const.go
|
||||
|
||||
|
@ -132,7 +134,7 @@ const (
|
|||
BIOCGETZMAX = 0x4004427f
|
||||
BIOCGHDRCMPLT = 0x40044274
|
||||
BIOCGRSIG = 0x40044272
|
||||
BIOCGRTIMEOUT = 0x4010426e
|
||||
BIOCGRTIMEOUT = 0x4008426e
|
||||
BIOCGSEESENT = 0x40044276
|
||||
BIOCGSTATS = 0x4008426f
|
||||
BIOCGTSTAMP = 0x40044283
|
||||
|
@ -151,7 +153,7 @@ const (
|
|||
BIOCSETZBUF = 0x800c4281
|
||||
BIOCSHDRCMPLT = 0x80044275
|
||||
BIOCSRSIG = 0x80044273
|
||||
BIOCSRTIMEOUT = 0x8010426d
|
||||
BIOCSRTIMEOUT = 0x8008426d
|
||||
BIOCSSEESENT = 0x80044277
|
||||
BIOCSTSTAMP = 0x80044284
|
||||
BIOCVERSION = 0x40044271
|
||||
|
@ -439,6 +441,9 @@ const (
|
|||
EV_RECEIPT = 0x40
|
||||
EV_SYSFLAGS = 0xf000
|
||||
EXTA = 0x4b00
|
||||
EXTATTR_NAMESPACE_EMPTY = 0x0
|
||||
EXTATTR_NAMESPACE_SYSTEM = 0x2
|
||||
EXTATTR_NAMESPACE_USER = 0x1
|
||||
EXTB = 0x9600
|
||||
EXTPROC = 0x800
|
||||
FD_CLOEXEC = 0x1
|
||||
|
@ -764,6 +769,7 @@ const (
|
|||
IPPROTO_GMTP = 0x64
|
||||
IPPROTO_GRE = 0x2f
|
||||
IPPROTO_HELLO = 0x3f
|
||||
IPPROTO_HIP = 0x8b
|
||||
IPPROTO_HMP = 0x14
|
||||
IPPROTO_HOPOPTS = 0x0
|
||||
IPPROTO_ICMP = 0x1
|
||||
|
@ -817,6 +823,8 @@ const (
|
|||
IPPROTO_RAW = 0xff
|
||||
IPPROTO_RCCMON = 0xa
|
||||
IPPROTO_RDP = 0x1b
|
||||
IPPROTO_RESERVED_253 = 0xfd
|
||||
IPPROTO_RESERVED_254 = 0xfe
|
||||
IPPROTO_ROUTING = 0x2b
|
||||
IPPROTO_RSVP = 0x2e
|
||||
IPPROTO_RVD = 0x42
|
||||
|
@ -827,6 +835,7 @@ const (
|
|||
IPPROTO_SDRP = 0x2a
|
||||
IPPROTO_SEND = 0x103
|
||||
IPPROTO_SEP = 0x21
|
||||
IPPROTO_SHIM6 = 0x8c
|
||||
IPPROTO_SKIP = 0x39
|
||||
IPPROTO_SPACER = 0x7fff
|
||||
IPPROTO_SRPC = 0x5a
|
||||
|
@ -842,6 +851,7 @@ const (
|
|||
IPPROTO_TRUNK2 = 0x18
|
||||
IPPROTO_TTP = 0x54
|
||||
IPPROTO_UDP = 0x11
|
||||
IPPROTO_UDPLITE = 0x88
|
||||
IPPROTO_VINES = 0x53
|
||||
IPPROTO_VISA = 0x46
|
||||
IPPROTO_VMTP = 0x51
|
||||
|
@ -1011,6 +1021,7 @@ const (
|
|||
MAP_ANON = 0x1000
|
||||
MAP_ANONYMOUS = 0x1000
|
||||
MAP_COPY = 0x2
|
||||
MAP_EXCL = 0x4000
|
||||
MAP_FILE = 0x0
|
||||
MAP_FIXED = 0x10
|
||||
MAP_HASSEMAPHORE = 0x200
|
||||
|
@ -1191,6 +1202,7 @@ const (
|
|||
RTV_SPIPE = 0x10
|
||||
RTV_SSTHRESH = 0x20
|
||||
RTV_WEIGHT = 0x100
|
||||
RT_ALL_FIBS = -0x1
|
||||
RT_CACHING_CONTEXT = 0x1
|
||||
RT_DEFAULT_FIB = 0x0
|
||||
RT_NORTREF = 0x2
|
||||
|
@ -1404,7 +1416,7 @@ const (
|
|||
TIOCSTI = 0x80017472
|
||||
TIOCSTOP = 0x2000746f
|
||||
TIOCSWINSZ = 0x80087467
|
||||
TIOCTIMESTAMP = 0x40107459
|
||||
TIOCTIMESTAMP = 0x40087459
|
||||
TIOCUCNTL = 0x80047466
|
||||
TOSTOP = 0x400000
|
||||
VDISCARD = 0xf
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// mkerrors.sh -m32
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// +build 386,linux
|
||||
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs -- -m32 _const.go
|
||||
|
||||
|
@ -32,10 +34,11 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x27
|
||||
AF_MAX = 0x28
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
AF_NETROM = 0x6
|
||||
AF_NFC = 0x27
|
||||
AF_PACKET = 0x11
|
||||
AF_PHONET = 0x23
|
||||
AF_PPPOX = 0x18
|
||||
|
@ -57,6 +60,8 @@ const (
|
|||
ARPHRD_ATM = 0x13
|
||||
ARPHRD_AX25 = 0x3
|
||||
ARPHRD_BIF = 0x307
|
||||
ARPHRD_CAIF = 0x336
|
||||
ARPHRD_CAN = 0x118
|
||||
ARPHRD_CHAOS = 0x5
|
||||
ARPHRD_CISCO = 0x201
|
||||
ARPHRD_CSLIP = 0x101
|
||||
|
@ -82,7 +87,6 @@ const (
|
|||
ARPHRD_IEEE80211_PRISM = 0x322
|
||||
ARPHRD_IEEE80211_RADIOTAP = 0x323
|
||||
ARPHRD_IEEE802154 = 0x324
|
||||
ARPHRD_IEEE802154_PHY = 0x325
|
||||
ARPHRD_IEEE802_TR = 0x320
|
||||
ARPHRD_INFINIBAND = 0x20
|
||||
ARPHRD_IPDDP = 0x309
|
||||
|
@ -94,6 +98,8 @@ const (
|
|||
ARPHRD_METRICOM = 0x17
|
||||
ARPHRD_NETROM = 0x0
|
||||
ARPHRD_NONE = 0xfffe
|
||||
ARPHRD_PHONET = 0x334
|
||||
ARPHRD_PHONET_PIPE = 0x335
|
||||
ARPHRD_PIMREG = 0x30b
|
||||
ARPHRD_PPP = 0x200
|
||||
ARPHRD_PRONET = 0x4
|
||||
|
@ -108,6 +114,38 @@ const (
|
|||
ARPHRD_TUNNEL6 = 0x301
|
||||
ARPHRD_VOID = 0xffff
|
||||
ARPHRD_X25 = 0x10f
|
||||
B0 = 0x0
|
||||
B1000000 = 0x1008
|
||||
B110 = 0x3
|
||||
B115200 = 0x1002
|
||||
B1152000 = 0x1009
|
||||
B1200 = 0x9
|
||||
B134 = 0x4
|
||||
B150 = 0x5
|
||||
B1500000 = 0x100a
|
||||
B1800 = 0xa
|
||||
B19200 = 0xe
|
||||
B200 = 0x6
|
||||
B2000000 = 0x100b
|
||||
B230400 = 0x1003
|
||||
B2400 = 0xb
|
||||
B2500000 = 0x100c
|
||||
B300 = 0x7
|
||||
B3000000 = 0x100d
|
||||
B3500000 = 0x100e
|
||||
B38400 = 0xf
|
||||
B4000000 = 0x100f
|
||||
B460800 = 0x1004
|
||||
B4800 = 0xc
|
||||
B50 = 0x1
|
||||
B500000 = 0x1005
|
||||
B57600 = 0x1001
|
||||
B576000 = 0x1006
|
||||
B600 = 0x8
|
||||
B75 = 0x2
|
||||
B921600 = 0x1007
|
||||
B9600 = 0xd
|
||||
BOTHER = 0x1000
|
||||
BPF_A = 0x10
|
||||
BPF_ABS = 0x20
|
||||
BPF_ADD = 0x0
|
||||
|
@ -148,6 +186,30 @@ const (
|
|||
BPF_TXA = 0x80
|
||||
BPF_W = 0x0
|
||||
BPF_X = 0x8
|
||||
BRKINT = 0x2
|
||||
BS0 = 0x0
|
||||
BS1 = 0x2000
|
||||
BSDLY = 0x2000
|
||||
CBAUD = 0x100f
|
||||
CBAUDEX = 0x1000
|
||||
CFLUSH = 0xf
|
||||
CIBAUD = 0x100f0000
|
||||
CLOCAL = 0x800
|
||||
CLOCK_BOOTTIME = 0x7
|
||||
CLOCK_BOOTTIME_ALARM = 0x9
|
||||
CLOCK_DEFAULT = 0x0
|
||||
CLOCK_EXT = 0x1
|
||||
CLOCK_INT = 0x2
|
||||
CLOCK_MONOTONIC = 0x1
|
||||
CLOCK_MONOTONIC_COARSE = 0x6
|
||||
CLOCK_MONOTONIC_RAW = 0x4
|
||||
CLOCK_PROCESS_CPUTIME_ID = 0x2
|
||||
CLOCK_REALTIME = 0x0
|
||||
CLOCK_REALTIME_ALARM = 0x8
|
||||
CLOCK_REALTIME_COARSE = 0x5
|
||||
CLOCK_THREAD_CPUTIME_ID = 0x3
|
||||
CLOCK_TXFROMRX = 0x4
|
||||
CLOCK_TXINT = 0x3
|
||||
CLONE_CHILD_CLEARTID = 0x200000
|
||||
CLONE_CHILD_SETTID = 0x1000000
|
||||
CLONE_DETACHED = 0x400000
|
||||
|
@ -170,6 +232,25 @@ const (
|
|||
CLONE_UNTRACED = 0x800000
|
||||
CLONE_VFORK = 0x4000
|
||||
CLONE_VM = 0x100
|
||||
CMSPAR = 0x40000000
|
||||
CR0 = 0x0
|
||||
CR1 = 0x200
|
||||
CR2 = 0x400
|
||||
CR3 = 0x600
|
||||
CRDLY = 0x600
|
||||
CREAD = 0x80
|
||||
CRTSCTS = 0x80000000
|
||||
CS5 = 0x0
|
||||
CS6 = 0x10
|
||||
CS7 = 0x20
|
||||
CS8 = 0x30
|
||||
CSIGNAL = 0xff
|
||||
CSIZE = 0x30
|
||||
CSTART = 0x11
|
||||
CSTATUS = 0x0
|
||||
CSTOP = 0x13
|
||||
CSTOPB = 0x40
|
||||
CSUSP = 0x1a
|
||||
DT_BLK = 0x6
|
||||
DT_CHR = 0x2
|
||||
DT_DIR = 0x4
|
||||
|
@ -179,8 +260,21 @@ const (
|
|||
DT_SOCK = 0xc
|
||||
DT_UNKNOWN = 0x0
|
||||
DT_WHT = 0xe
|
||||
ECHO = 0x8
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
ECHOKE = 0x800
|
||||
ECHONL = 0x40
|
||||
ECHOPRT = 0x400
|
||||
ENCODING_DEFAULT = 0x0
|
||||
ENCODING_FM_MARK = 0x3
|
||||
ENCODING_FM_SPACE = 0x4
|
||||
ENCODING_MANCHESTER = 0x5
|
||||
ENCODING_NRZ = 0x1
|
||||
ENCODING_NRZI = 0x2
|
||||
EPOLLERR = 0x8
|
||||
EPOLLET = -0x80000000
|
||||
EPOLLET = 0x80000000
|
||||
EPOLLHUP = 0x10
|
||||
EPOLLIN = 0x1
|
||||
EPOLLMSG = 0x400
|
||||
|
@ -198,10 +292,13 @@ const (
|
|||
EPOLL_CTL_MOD = 0x3
|
||||
EPOLL_NONBLOCK = 0x800
|
||||
ETH_P_1588 = 0x88f7
|
||||
ETH_P_8021AD = 0x88a8
|
||||
ETH_P_8021AH = 0x88e7
|
||||
ETH_P_8021Q = 0x8100
|
||||
ETH_P_802_2 = 0x4
|
||||
ETH_P_802_3 = 0x1
|
||||
ETH_P_AARP = 0x80f3
|
||||
ETH_P_AF_IUCV = 0xfbfb
|
||||
ETH_P_ALL = 0x3
|
||||
ETH_P_AOE = 0x88a2
|
||||
ETH_P_ARCNET = 0x1a
|
||||
|
@ -250,10 +347,14 @@ const (
|
|||
ETH_P_PPP_SES = 0x8864
|
||||
ETH_P_PUP = 0x200
|
||||
ETH_P_PUPAT = 0x201
|
||||
ETH_P_QINQ1 = 0x9100
|
||||
ETH_P_QINQ2 = 0x9200
|
||||
ETH_P_QINQ3 = 0x9300
|
||||
ETH_P_RARP = 0x8035
|
||||
ETH_P_SCA = 0x6007
|
||||
ETH_P_SLOW = 0x8809
|
||||
ETH_P_SNAP = 0x5
|
||||
ETH_P_TDLS = 0x890d
|
||||
ETH_P_TEB = 0x6558
|
||||
ETH_P_TIPC = 0x88ca
|
||||
ETH_P_TRAILER = 0x1c
|
||||
|
@ -261,8 +362,15 @@ const (
|
|||
ETH_P_WAN_PPP = 0x7
|
||||
ETH_P_WCCP = 0x883e
|
||||
ETH_P_X25 = 0x805
|
||||
EXTA = 0xe
|
||||
EXTB = 0xf
|
||||
EXTPROC = 0x10000
|
||||
FD_CLOEXEC = 0x1
|
||||
FD_SETSIZE = 0x400
|
||||
FF0 = 0x0
|
||||
FF1 = 0x8000
|
||||
FFDLY = 0x8000
|
||||
FLUSHO = 0x1000
|
||||
F_DUPFD = 0x0
|
||||
F_DUPFD_CLOEXEC = 0x406
|
||||
F_EXLCK = 0x4
|
||||
|
@ -296,7 +404,12 @@ const (
|
|||
F_ULOCK = 0x0
|
||||
F_UNLCK = 0x2
|
||||
F_WRLCK = 0x1
|
||||
HUPCL = 0x400
|
||||
IBSHIFT = 0x10
|
||||
ICANON = 0x2
|
||||
ICMPV6_FILTER = 0x1
|
||||
ICRNL = 0x100
|
||||
IEXTEN = 0x8000
|
||||
IFA_F_DADFAILED = 0x8
|
||||
IFA_F_DEPRECATED = 0x20
|
||||
IFA_F_HOMEADDRESS = 0x10
|
||||
|
@ -307,29 +420,57 @@ const (
|
|||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x7
|
||||
IFF_802_1Q_VLAN = 0x1
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
IFF_BONDING = 0x20
|
||||
IFF_BRIDGE_PORT = 0x4000
|
||||
IFF_BROADCAST = 0x2
|
||||
IFF_DEBUG = 0x4
|
||||
IFF_DISABLE_NETPOLL = 0x1000
|
||||
IFF_DONT_BRIDGE = 0x800
|
||||
IFF_DORMANT = 0x20000
|
||||
IFF_DYNAMIC = 0x8000
|
||||
IFF_EBRIDGE = 0x2
|
||||
IFF_ECHO = 0x40000
|
||||
IFF_ISATAP = 0x80
|
||||
IFF_LOOPBACK = 0x8
|
||||
IFF_LOWER_UP = 0x10000
|
||||
IFF_MACVLAN_PORT = 0x2000
|
||||
IFF_MASTER = 0x400
|
||||
IFF_MASTER_8023AD = 0x8
|
||||
IFF_MASTER_ALB = 0x10
|
||||
IFF_MASTER_ARPMON = 0x100
|
||||
IFF_MULTICAST = 0x1000
|
||||
IFF_NOARP = 0x80
|
||||
IFF_NOTRAILERS = 0x20
|
||||
IFF_NO_PI = 0x1000
|
||||
IFF_ONE_QUEUE = 0x2000
|
||||
IFF_OVS_DATAPATH = 0x8000
|
||||
IFF_POINTOPOINT = 0x10
|
||||
IFF_PORTSEL = 0x2000
|
||||
IFF_PROMISC = 0x100
|
||||
IFF_RUNNING = 0x40
|
||||
IFF_SLAVE = 0x800
|
||||
IFF_SLAVE_INACTIVE = 0x4
|
||||
IFF_SLAVE_NEEDARP = 0x40
|
||||
IFF_TAP = 0x2
|
||||
IFF_TUN = 0x1
|
||||
IFF_TUN_EXCL = 0x8000
|
||||
IFF_TX_SKB_SHARING = 0x10000
|
||||
IFF_UNICAST_FLT = 0x20000
|
||||
IFF_UP = 0x1
|
||||
IFF_VNET_HDR = 0x4000
|
||||
IFF_VOLATILE = 0x70c5a
|
||||
IFF_WAN_HDLC = 0x200
|
||||
IFF_XMIT_DST_RELEASE = 0x400
|
||||
IFNAMSIZ = 0x10
|
||||
IGNBRK = 0x1
|
||||
IGNCR = 0x80
|
||||
IGNPAR = 0x4
|
||||
IMAXBEL = 0x2000
|
||||
INLCR = 0x40
|
||||
INPCK = 0x10
|
||||
IN_ACCESS = 0x1
|
||||
IN_ALL_EVENTS = 0xfff
|
||||
IN_ATTRIB = 0x4
|
||||
|
@ -465,6 +606,7 @@ const (
|
|||
IP_MSS = 0x240
|
||||
IP_MTU = 0xe
|
||||
IP_MTU_DISCOVER = 0xa
|
||||
IP_MULTICAST_ALL = 0x31
|
||||
IP_MULTICAST_IF = 0x20
|
||||
IP_MULTICAST_LOOP = 0x22
|
||||
IP_MULTICAST_TTL = 0x21
|
||||
|
@ -493,6 +635,13 @@ const (
|
|||
IP_TTL = 0x2
|
||||
IP_UNBLOCK_SOURCE = 0x25
|
||||
IP_XFRM_POLICY = 0x11
|
||||
ISIG = 0x1
|
||||
ISTRIP = 0x20
|
||||
IUCLC = 0x200
|
||||
IUTF8 = 0x4000
|
||||
IXANY = 0x800
|
||||
IXOFF = 0x1000
|
||||
IXON = 0x400
|
||||
LINUX_REBOOT_CMD_CAD_OFF = 0x0
|
||||
LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef
|
||||
LINUX_REBOOT_CMD_HALT = 0xcdef0123
|
||||
|
@ -598,6 +747,7 @@ const (
|
|||
NETLINK_AUDIT = 0x9
|
||||
NETLINK_BROADCAST_ERROR = 0x4
|
||||
NETLINK_CONNECTOR = 0xb
|
||||
NETLINK_CRYPTO = 0x15
|
||||
NETLINK_DNRTMSG = 0xe
|
||||
NETLINK_DROP_MEMBERSHIP = 0x2
|
||||
NETLINK_ECRYPTFS = 0x13
|
||||
|
@ -612,16 +762,20 @@ const (
|
|||
NETLINK_NFLOG = 0x5
|
||||
NETLINK_NO_ENOBUFS = 0x5
|
||||
NETLINK_PKTINFO = 0x3
|
||||
NETLINK_RDMA = 0x14
|
||||
NETLINK_ROUTE = 0x0
|
||||
NETLINK_SCSITRANSPORT = 0x12
|
||||
NETLINK_SELINUX = 0x7
|
||||
NETLINK_UNUSED = 0x1
|
||||
NETLINK_USERSOCK = 0x2
|
||||
NETLINK_XFRM = 0x6
|
||||
NL0 = 0x0
|
||||
NL1 = 0x100
|
||||
NLA_ALIGNTO = 0x4
|
||||
NLA_F_NESTED = 0x8000
|
||||
NLA_F_NET_BYTEORDER = 0x4000
|
||||
NLA_HDRLEN = 0x4
|
||||
NLDLY = 0x100
|
||||
NLMSG_ALIGNTO = 0x4
|
||||
NLMSG_DONE = 0x3
|
||||
NLMSG_ERROR = 0x2
|
||||
|
@ -634,6 +788,7 @@ const (
|
|||
NLM_F_ATOMIC = 0x400
|
||||
NLM_F_CREATE = 0x400
|
||||
NLM_F_DUMP = 0x300
|
||||
NLM_F_DUMP_INTR = 0x10
|
||||
NLM_F_ECHO = 0x8
|
||||
NLM_F_EXCL = 0x200
|
||||
NLM_F_MATCH = 0x200
|
||||
|
@ -641,6 +796,15 @@ const (
|
|||
NLM_F_REPLACE = 0x100
|
||||
NLM_F_REQUEST = 0x1
|
||||
NLM_F_ROOT = 0x100
|
||||
NOFLSH = 0x80
|
||||
OCRNL = 0x8
|
||||
OFDEL = 0x80
|
||||
OFILL = 0x40
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
ONLRET = 0x20
|
||||
ONOCR = 0x10
|
||||
OPOST = 0x1
|
||||
O_ACCMODE = 0x3
|
||||
O_APPEND = 0x400
|
||||
O_ASYNC = 0x2000
|
||||
|
@ -657,6 +821,7 @@ const (
|
|||
O_NOCTTY = 0x100
|
||||
O_NOFOLLOW = 0x20000
|
||||
O_NONBLOCK = 0x800
|
||||
O_PATH = 0x200000
|
||||
O_RDONLY = 0x0
|
||||
O_RDWR = 0x2
|
||||
O_RSYNC = 0x101000
|
||||
|
@ -664,20 +829,49 @@ const (
|
|||
O_TRUNC = 0x200
|
||||
O_WRONLY = 0x1
|
||||
PACKET_ADD_MEMBERSHIP = 0x1
|
||||
PACKET_AUXDATA = 0x8
|
||||
PACKET_BROADCAST = 0x1
|
||||
PACKET_COPY_THRESH = 0x7
|
||||
PACKET_DROP_MEMBERSHIP = 0x2
|
||||
PACKET_FANOUT = 0x12
|
||||
PACKET_FANOUT_CPU = 0x2
|
||||
PACKET_FANOUT_FLAG_DEFRAG = 0x8000
|
||||
PACKET_FANOUT_HASH = 0x0
|
||||
PACKET_FANOUT_LB = 0x1
|
||||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
PACKET_MR_ALLMULTI = 0x2
|
||||
PACKET_MR_MULTICAST = 0x0
|
||||
PACKET_MR_PROMISC = 0x1
|
||||
PACKET_MR_UNICAST = 0x3
|
||||
PACKET_MULTICAST = 0x2
|
||||
PACKET_ORIGDEV = 0x9
|
||||
PACKET_OTHERHOST = 0x3
|
||||
PACKET_OUTGOING = 0x4
|
||||
PACKET_RECV_OUTPUT = 0x3
|
||||
PACKET_RESERVE = 0xc
|
||||
PACKET_RX_RING = 0x5
|
||||
PACKET_STATISTICS = 0x6
|
||||
PACKET_TIMESTAMP = 0x11
|
||||
PACKET_TX_RING = 0xd
|
||||
PACKET_TX_TIMESTAMP = 0x10
|
||||
PACKET_VERSION = 0xa
|
||||
PACKET_VNET_HDR = 0xf
|
||||
PARENB = 0x100
|
||||
PARITY_CRC16_PR0 = 0x2
|
||||
PARITY_CRC16_PR0_CCITT = 0x4
|
||||
PARITY_CRC16_PR1 = 0x3
|
||||
PARITY_CRC16_PR1_CCITT = 0x5
|
||||
PARITY_CRC32_PR0_CCITT = 0x6
|
||||
PARITY_CRC32_PR1_CCITT = 0x7
|
||||
PARITY_DEFAULT = 0x0
|
||||
PARITY_NONE = 0x1
|
||||
PARMRK = 0x8
|
||||
PARODD = 0x200
|
||||
PENDIN = 0x4000
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -710,6 +904,7 @@ const (
|
|||
PR_GET_FPEXC = 0xb
|
||||
PR_GET_KEEPCAPS = 0x7
|
||||
PR_GET_NAME = 0x10
|
||||
PR_GET_NO_NEW_PRIVS = 0x27
|
||||
PR_GET_PDEATHSIG = 0x2
|
||||
PR_GET_SECCOMP = 0x15
|
||||
PR_GET_SECUREBITS = 0x1b
|
||||
|
@ -729,9 +924,19 @@ const (
|
|||
PR_SET_FPEMU = 0xa
|
||||
PR_SET_FPEXC = 0xc
|
||||
PR_SET_KEEPCAPS = 0x8
|
||||
PR_SET_MM = 0x23
|
||||
PR_SET_MM_BRK = 0x7
|
||||
PR_SET_MM_END_CODE = 0x2
|
||||
PR_SET_MM_END_DATA = 0x4
|
||||
PR_SET_MM_START_BRK = 0x6
|
||||
PR_SET_MM_START_CODE = 0x1
|
||||
PR_SET_MM_START_DATA = 0x3
|
||||
PR_SET_MM_START_STACK = 0x5
|
||||
PR_SET_NAME = 0xf
|
||||
PR_SET_NO_NEW_PRIVS = 0x26
|
||||
PR_SET_PDEATHSIG = 0x1
|
||||
PR_SET_PTRACER = 0x59616d61
|
||||
PR_SET_PTRACER_ANY = 0xffffffff
|
||||
PR_SET_SECCOMP = 0x16
|
||||
PR_SET_SECUREBITS = 0x1c
|
||||
PR_SET_TIMERSLACK = 0x1d
|
||||
|
@ -753,6 +958,8 @@ const (
|
|||
PTRACE_EVENT_EXEC = 0x4
|
||||
PTRACE_EVENT_EXIT = 0x6
|
||||
PTRACE_EVENT_FORK = 0x1
|
||||
PTRACE_EVENT_SECCOMP = 0x7
|
||||
PTRACE_EVENT_STOP = 0x80
|
||||
PTRACE_EVENT_VFORK = 0x2
|
||||
PTRACE_EVENT_VFORK_DONE = 0x5
|
||||
PTRACE_GETEVENTMSG = 0x4201
|
||||
|
@ -762,13 +969,16 @@ const (
|
|||
PTRACE_GETREGSET = 0x4204
|
||||
PTRACE_GETSIGINFO = 0x4202
|
||||
PTRACE_GET_THREAD_AREA = 0x19
|
||||
PTRACE_INTERRUPT = 0x4207
|
||||
PTRACE_KILL = 0x8
|
||||
PTRACE_LISTEN = 0x4208
|
||||
PTRACE_OLDSETOPTIONS = 0x15
|
||||
PTRACE_O_MASK = 0x7f
|
||||
PTRACE_O_MASK = 0xff
|
||||
PTRACE_O_TRACECLONE = 0x8
|
||||
PTRACE_O_TRACEEXEC = 0x10
|
||||
PTRACE_O_TRACEEXIT = 0x40
|
||||
PTRACE_O_TRACEFORK = 0x2
|
||||
PTRACE_O_TRACESECCOMP = 0x80
|
||||
PTRACE_O_TRACESYSGOOD = 0x1
|
||||
PTRACE_O_TRACEVFORK = 0x4
|
||||
PTRACE_O_TRACEVFORKDONE = 0x20
|
||||
|
@ -778,6 +988,8 @@ const (
|
|||
PTRACE_POKEDATA = 0x5
|
||||
PTRACE_POKETEXT = 0x4
|
||||
PTRACE_POKEUSR = 0x6
|
||||
PTRACE_SEIZE = 0x4206
|
||||
PTRACE_SEIZE_DEVEL = 0x80000000
|
||||
PTRACE_SETFPREGS = 0xf
|
||||
PTRACE_SETFPXREGS = 0x13
|
||||
PTRACE_SETOPTIONS = 0x4200
|
||||
|
@ -1086,9 +1298,23 @@ const (
|
|||
S_IXGRP = 0x8
|
||||
S_IXOTH = 0x1
|
||||
S_IXUSR = 0x40
|
||||
TAB0 = 0x0
|
||||
TAB1 = 0x800
|
||||
TAB2 = 0x1000
|
||||
TAB3 = 0x1800
|
||||
TABDLY = 0x1800
|
||||
TCFLSH = 0x540b
|
||||
TCGETA = 0x5405
|
||||
TCGETS = 0x5401
|
||||
TCGETS2 = 0x802c542a
|
||||
TCGETX = 0x5432
|
||||
TCIFLUSH = 0x0
|
||||
TCIOFF = 0x2
|
||||
TCIOFLUSH = 0x2
|
||||
TCION = 0x3
|
||||
TCOFLUSH = 0x1
|
||||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_CORK = 0x3
|
||||
TCP_DEFER_ACCEPT = 0x9
|
||||
|
@ -1107,14 +1333,33 @@ const (
|
|||
TCP_QUICKACK = 0xc
|
||||
TCP_SYNCNT = 0x7
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCSAFLUSH = 0x2
|
||||
TCSBRK = 0x5409
|
||||
TCSBRKP = 0x5425
|
||||
TCSETA = 0x5406
|
||||
TCSETAF = 0x5408
|
||||
TCSETAW = 0x5407
|
||||
TCSETS = 0x5402
|
||||
TCSETS2 = 0x402c542b
|
||||
TCSETSF = 0x5404
|
||||
TCSETSF2 = 0x402c542d
|
||||
TCSETSW = 0x5403
|
||||
TCSETSW2 = 0x402c542c
|
||||
TCSETX = 0x5433
|
||||
TCSETXF = 0x5434
|
||||
TCSETXW = 0x5435
|
||||
TCXONC = 0x540a
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x541d
|
||||
TIOCEXCL = 0x540c
|
||||
TIOCGDEV = 0x80045432
|
||||
TIOCGETD = 0x5424
|
||||
TIOCGEXCL = 0x80045440
|
||||
TIOCGICOUNT = 0x545d
|
||||
TIOCGLCKTRMIOS = 0x5456
|
||||
TIOCGPGRP = 0x540f
|
||||
TIOCGPKT = 0x80045438
|
||||
TIOCGPTLCK = 0x80045439
|
||||
TIOCGPTN = 0x80045430
|
||||
TIOCGRS485 = 0x542e
|
||||
TIOCGSERIAL = 0x541e
|
||||
|
@ -1171,6 +1416,8 @@ const (
|
|||
TIOCSSOFTCAR = 0x541a
|
||||
TIOCSTI = 0x5412
|
||||
TIOCSWINSZ = 0x5414
|
||||
TIOCVHANGUP = 0x5437
|
||||
TOSTOP = 0x100
|
||||
TUNATTACHFILTER = 0x400854d5
|
||||
TUNDETACHFILTER = 0x400854d6
|
||||
TUNGETFEATURES = 0x800454cf
|
||||
|
@ -1188,6 +1435,26 @@ const (
|
|||
TUNSETSNDBUF = 0x400454d4
|
||||
TUNSETTXFILTER = 0x400454d1
|
||||
TUNSETVNETHDRSZ = 0x400454d8
|
||||
VDISCARD = 0xd
|
||||
VEOF = 0x4
|
||||
VEOL = 0xb
|
||||
VEOL2 = 0x10
|
||||
VERASE = 0x2
|
||||
VINTR = 0x0
|
||||
VKILL = 0x3
|
||||
VLNEXT = 0xf
|
||||
VMIN = 0x6
|
||||
VQUIT = 0x1
|
||||
VREPRINT = 0xc
|
||||
VSTART = 0x8
|
||||
VSTOP = 0x9
|
||||
VSUSP = 0xa
|
||||
VSWTC = 0x7
|
||||
VT0 = 0x0
|
||||
VT1 = 0x4000
|
||||
VTDLY = 0x4000
|
||||
VTIME = 0x5
|
||||
VWERASE = 0xe
|
||||
WALL = 0x40000000
|
||||
WCLONE = 0x80000000
|
||||
WCONTINUED = 0x8
|
||||
|
@ -1198,6 +1465,8 @@ const (
|
|||
WORDSIZE = 0x20
|
||||
WSTOPPED = 0x2
|
||||
WUNTRACED = 0x2
|
||||
XCASE = 0x4
|
||||
XTABS = 0x1800
|
||||
)
|
||||
|
||||
// Errors
|
||||
|
@ -1237,6 +1506,7 @@ const (
|
|||
EFBIG = syscall.Errno(0x1b)
|
||||
EHOSTDOWN = syscall.Errno(0x70)
|
||||
EHOSTUNREACH = syscall.Errno(0x71)
|
||||
EHWPOISON = syscall.Errno(0x85)
|
||||
EIDRM = syscall.Errno(0x2b)
|
||||
EILSEQ = syscall.Errno(0x54)
|
||||
EINPROGRESS = syscall.Errno(0x73)
|
||||
|
@ -1508,6 +1778,7 @@ var errors = [...]string{
|
|||
130: "owner died",
|
||||
131: "state not recoverable",
|
||||
132: "operation not possible due to RF-kill",
|
||||
133: "unknown error 133",
|
||||
}
|
||||
|
||||
// Signal table
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// mkerrors.sh -m64
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// +build amd64,linux
|
||||
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs -- -m64 _const.go
|
||||
|
||||
|
@ -32,10 +34,11 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x27
|
||||
AF_MAX = 0x28
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
AF_NETROM = 0x6
|
||||
AF_NFC = 0x27
|
||||
AF_PACKET = 0x11
|
||||
AF_PHONET = 0x23
|
||||
AF_PPPOX = 0x18
|
||||
|
@ -57,6 +60,8 @@ const (
|
|||
ARPHRD_ATM = 0x13
|
||||
ARPHRD_AX25 = 0x3
|
||||
ARPHRD_BIF = 0x307
|
||||
ARPHRD_CAIF = 0x336
|
||||
ARPHRD_CAN = 0x118
|
||||
ARPHRD_CHAOS = 0x5
|
||||
ARPHRD_CISCO = 0x201
|
||||
ARPHRD_CSLIP = 0x101
|
||||
|
@ -82,7 +87,6 @@ const (
|
|||
ARPHRD_IEEE80211_PRISM = 0x322
|
||||
ARPHRD_IEEE80211_RADIOTAP = 0x323
|
||||
ARPHRD_IEEE802154 = 0x324
|
||||
ARPHRD_IEEE802154_PHY = 0x325
|
||||
ARPHRD_IEEE802_TR = 0x320
|
||||
ARPHRD_INFINIBAND = 0x20
|
||||
ARPHRD_IPDDP = 0x309
|
||||
|
@ -94,6 +98,8 @@ const (
|
|||
ARPHRD_METRICOM = 0x17
|
||||
ARPHRD_NETROM = 0x0
|
||||
ARPHRD_NONE = 0xfffe
|
||||
ARPHRD_PHONET = 0x334
|
||||
ARPHRD_PHONET_PIPE = 0x335
|
||||
ARPHRD_PIMREG = 0x30b
|
||||
ARPHRD_PPP = 0x200
|
||||
ARPHRD_PRONET = 0x4
|
||||
|
@ -108,6 +114,38 @@ const (
|
|||
ARPHRD_TUNNEL6 = 0x301
|
||||
ARPHRD_VOID = 0xffff
|
||||
ARPHRD_X25 = 0x10f
|
||||
B0 = 0x0
|
||||
B1000000 = 0x1008
|
||||
B110 = 0x3
|
||||
B115200 = 0x1002
|
||||
B1152000 = 0x1009
|
||||
B1200 = 0x9
|
||||
B134 = 0x4
|
||||
B150 = 0x5
|
||||
B1500000 = 0x100a
|
||||
B1800 = 0xa
|
||||
B19200 = 0xe
|
||||
B200 = 0x6
|
||||
B2000000 = 0x100b
|
||||
B230400 = 0x1003
|
||||
B2400 = 0xb
|
||||
B2500000 = 0x100c
|
||||
B300 = 0x7
|
||||
B3000000 = 0x100d
|
||||
B3500000 = 0x100e
|
||||
B38400 = 0xf
|
||||
B4000000 = 0x100f
|
||||
B460800 = 0x1004
|
||||
B4800 = 0xc
|
||||
B50 = 0x1
|
||||
B500000 = 0x1005
|
||||
B57600 = 0x1001
|
||||
B576000 = 0x1006
|
||||
B600 = 0x8
|
||||
B75 = 0x2
|
||||
B921600 = 0x1007
|
||||
B9600 = 0xd
|
||||
BOTHER = 0x1000
|
||||
BPF_A = 0x10
|
||||
BPF_ABS = 0x20
|
||||
BPF_ADD = 0x0
|
||||
|
@ -148,6 +186,30 @@ const (
|
|||
BPF_TXA = 0x80
|
||||
BPF_W = 0x0
|
||||
BPF_X = 0x8
|
||||
BRKINT = 0x2
|
||||
BS0 = 0x0
|
||||
BS1 = 0x2000
|
||||
BSDLY = 0x2000
|
||||
CBAUD = 0x100f
|
||||
CBAUDEX = 0x1000
|
||||
CFLUSH = 0xf
|
||||
CIBAUD = 0x100f0000
|
||||
CLOCAL = 0x800
|
||||
CLOCK_BOOTTIME = 0x7
|
||||
CLOCK_BOOTTIME_ALARM = 0x9
|
||||
CLOCK_DEFAULT = 0x0
|
||||
CLOCK_EXT = 0x1
|
||||
CLOCK_INT = 0x2
|
||||
CLOCK_MONOTONIC = 0x1
|
||||
CLOCK_MONOTONIC_COARSE = 0x6
|
||||
CLOCK_MONOTONIC_RAW = 0x4
|
||||
CLOCK_PROCESS_CPUTIME_ID = 0x2
|
||||
CLOCK_REALTIME = 0x0
|
||||
CLOCK_REALTIME_ALARM = 0x8
|
||||
CLOCK_REALTIME_COARSE = 0x5
|
||||
CLOCK_THREAD_CPUTIME_ID = 0x3
|
||||
CLOCK_TXFROMRX = 0x4
|
||||
CLOCK_TXINT = 0x3
|
||||
CLONE_CHILD_CLEARTID = 0x200000
|
||||
CLONE_CHILD_SETTID = 0x1000000
|
||||
CLONE_DETACHED = 0x400000
|
||||
|
@ -170,6 +232,25 @@ const (
|
|||
CLONE_UNTRACED = 0x800000
|
||||
CLONE_VFORK = 0x4000
|
||||
CLONE_VM = 0x100
|
||||
CMSPAR = 0x40000000
|
||||
CR0 = 0x0
|
||||
CR1 = 0x200
|
||||
CR2 = 0x400
|
||||
CR3 = 0x600
|
||||
CRDLY = 0x600
|
||||
CREAD = 0x80
|
||||
CRTSCTS = 0x80000000
|
||||
CS5 = 0x0
|
||||
CS6 = 0x10
|
||||
CS7 = 0x20
|
||||
CS8 = 0x30
|
||||
CSIGNAL = 0xff
|
||||
CSIZE = 0x30
|
||||
CSTART = 0x11
|
||||
CSTATUS = 0x0
|
||||
CSTOP = 0x13
|
||||
CSTOPB = 0x40
|
||||
CSUSP = 0x1a
|
||||
DT_BLK = 0x6
|
||||
DT_CHR = 0x2
|
||||
DT_DIR = 0x4
|
||||
|
@ -179,8 +260,21 @@ const (
|
|||
DT_SOCK = 0xc
|
||||
DT_UNKNOWN = 0x0
|
||||
DT_WHT = 0xe
|
||||
ECHO = 0x8
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
ECHOKE = 0x800
|
||||
ECHONL = 0x40
|
||||
ECHOPRT = 0x400
|
||||
ENCODING_DEFAULT = 0x0
|
||||
ENCODING_FM_MARK = 0x3
|
||||
ENCODING_FM_SPACE = 0x4
|
||||
ENCODING_MANCHESTER = 0x5
|
||||
ENCODING_NRZ = 0x1
|
||||
ENCODING_NRZI = 0x2
|
||||
EPOLLERR = 0x8
|
||||
EPOLLET = -0x80000000
|
||||
EPOLLET = 0x80000000
|
||||
EPOLLHUP = 0x10
|
||||
EPOLLIN = 0x1
|
||||
EPOLLMSG = 0x400
|
||||
|
@ -198,10 +292,13 @@ const (
|
|||
EPOLL_CTL_MOD = 0x3
|
||||
EPOLL_NONBLOCK = 0x800
|
||||
ETH_P_1588 = 0x88f7
|
||||
ETH_P_8021AD = 0x88a8
|
||||
ETH_P_8021AH = 0x88e7
|
||||
ETH_P_8021Q = 0x8100
|
||||
ETH_P_802_2 = 0x4
|
||||
ETH_P_802_3 = 0x1
|
||||
ETH_P_AARP = 0x80f3
|
||||
ETH_P_AF_IUCV = 0xfbfb
|
||||
ETH_P_ALL = 0x3
|
||||
ETH_P_AOE = 0x88a2
|
||||
ETH_P_ARCNET = 0x1a
|
||||
|
@ -250,10 +347,14 @@ const (
|
|||
ETH_P_PPP_SES = 0x8864
|
||||
ETH_P_PUP = 0x200
|
||||
ETH_P_PUPAT = 0x201
|
||||
ETH_P_QINQ1 = 0x9100
|
||||
ETH_P_QINQ2 = 0x9200
|
||||
ETH_P_QINQ3 = 0x9300
|
||||
ETH_P_RARP = 0x8035
|
||||
ETH_P_SCA = 0x6007
|
||||
ETH_P_SLOW = 0x8809
|
||||
ETH_P_SNAP = 0x5
|
||||
ETH_P_TDLS = 0x890d
|
||||
ETH_P_TEB = 0x6558
|
||||
ETH_P_TIPC = 0x88ca
|
||||
ETH_P_TRAILER = 0x1c
|
||||
|
@ -261,8 +362,15 @@ const (
|
|||
ETH_P_WAN_PPP = 0x7
|
||||
ETH_P_WCCP = 0x883e
|
||||
ETH_P_X25 = 0x805
|
||||
EXTA = 0xe
|
||||
EXTB = 0xf
|
||||
EXTPROC = 0x10000
|
||||
FD_CLOEXEC = 0x1
|
||||
FD_SETSIZE = 0x400
|
||||
FF0 = 0x0
|
||||
FF1 = 0x8000
|
||||
FFDLY = 0x8000
|
||||
FLUSHO = 0x1000
|
||||
F_DUPFD = 0x0
|
||||
F_DUPFD_CLOEXEC = 0x406
|
||||
F_EXLCK = 0x4
|
||||
|
@ -296,7 +404,12 @@ const (
|
|||
F_ULOCK = 0x0
|
||||
F_UNLCK = 0x2
|
||||
F_WRLCK = 0x1
|
||||
HUPCL = 0x400
|
||||
IBSHIFT = 0x10
|
||||
ICANON = 0x2
|
||||
ICMPV6_FILTER = 0x1
|
||||
ICRNL = 0x100
|
||||
IEXTEN = 0x8000
|
||||
IFA_F_DADFAILED = 0x8
|
||||
IFA_F_DEPRECATED = 0x20
|
||||
IFA_F_HOMEADDRESS = 0x10
|
||||
|
@ -307,29 +420,57 @@ const (
|
|||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x7
|
||||
IFF_802_1Q_VLAN = 0x1
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
IFF_BONDING = 0x20
|
||||
IFF_BRIDGE_PORT = 0x4000
|
||||
IFF_BROADCAST = 0x2
|
||||
IFF_DEBUG = 0x4
|
||||
IFF_DISABLE_NETPOLL = 0x1000
|
||||
IFF_DONT_BRIDGE = 0x800
|
||||
IFF_DORMANT = 0x20000
|
||||
IFF_DYNAMIC = 0x8000
|
||||
IFF_EBRIDGE = 0x2
|
||||
IFF_ECHO = 0x40000
|
||||
IFF_ISATAP = 0x80
|
||||
IFF_LOOPBACK = 0x8
|
||||
IFF_LOWER_UP = 0x10000
|
||||
IFF_MACVLAN_PORT = 0x2000
|
||||
IFF_MASTER = 0x400
|
||||
IFF_MASTER_8023AD = 0x8
|
||||
IFF_MASTER_ALB = 0x10
|
||||
IFF_MASTER_ARPMON = 0x100
|
||||
IFF_MULTICAST = 0x1000
|
||||
IFF_NOARP = 0x80
|
||||
IFF_NOTRAILERS = 0x20
|
||||
IFF_NO_PI = 0x1000
|
||||
IFF_ONE_QUEUE = 0x2000
|
||||
IFF_OVS_DATAPATH = 0x8000
|
||||
IFF_POINTOPOINT = 0x10
|
||||
IFF_PORTSEL = 0x2000
|
||||
IFF_PROMISC = 0x100
|
||||
IFF_RUNNING = 0x40
|
||||
IFF_SLAVE = 0x800
|
||||
IFF_SLAVE_INACTIVE = 0x4
|
||||
IFF_SLAVE_NEEDARP = 0x40
|
||||
IFF_TAP = 0x2
|
||||
IFF_TUN = 0x1
|
||||
IFF_TUN_EXCL = 0x8000
|
||||
IFF_TX_SKB_SHARING = 0x10000
|
||||
IFF_UNICAST_FLT = 0x20000
|
||||
IFF_UP = 0x1
|
||||
IFF_VNET_HDR = 0x4000
|
||||
IFF_VOLATILE = 0x70c5a
|
||||
IFF_WAN_HDLC = 0x200
|
||||
IFF_XMIT_DST_RELEASE = 0x400
|
||||
IFNAMSIZ = 0x10
|
||||
IGNBRK = 0x1
|
||||
IGNCR = 0x80
|
||||
IGNPAR = 0x4
|
||||
IMAXBEL = 0x2000
|
||||
INLCR = 0x40
|
||||
INPCK = 0x10
|
||||
IN_ACCESS = 0x1
|
||||
IN_ALL_EVENTS = 0xfff
|
||||
IN_ATTRIB = 0x4
|
||||
|
@ -465,6 +606,7 @@ const (
|
|||
IP_MSS = 0x240
|
||||
IP_MTU = 0xe
|
||||
IP_MTU_DISCOVER = 0xa
|
||||
IP_MULTICAST_ALL = 0x31
|
||||
IP_MULTICAST_IF = 0x20
|
||||
IP_MULTICAST_LOOP = 0x22
|
||||
IP_MULTICAST_TTL = 0x21
|
||||
|
@ -493,6 +635,13 @@ const (
|
|||
IP_TTL = 0x2
|
||||
IP_UNBLOCK_SOURCE = 0x25
|
||||
IP_XFRM_POLICY = 0x11
|
||||
ISIG = 0x1
|
||||
ISTRIP = 0x20
|
||||
IUCLC = 0x200
|
||||
IUTF8 = 0x4000
|
||||
IXANY = 0x800
|
||||
IXOFF = 0x1000
|
||||
IXON = 0x400
|
||||
LINUX_REBOOT_CMD_CAD_OFF = 0x0
|
||||
LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef
|
||||
LINUX_REBOOT_CMD_HALT = 0xcdef0123
|
||||
|
@ -598,6 +747,7 @@ const (
|
|||
NETLINK_AUDIT = 0x9
|
||||
NETLINK_BROADCAST_ERROR = 0x4
|
||||
NETLINK_CONNECTOR = 0xb
|
||||
NETLINK_CRYPTO = 0x15
|
||||
NETLINK_DNRTMSG = 0xe
|
||||
NETLINK_DROP_MEMBERSHIP = 0x2
|
||||
NETLINK_ECRYPTFS = 0x13
|
||||
|
@ -612,16 +762,20 @@ const (
|
|||
NETLINK_NFLOG = 0x5
|
||||
NETLINK_NO_ENOBUFS = 0x5
|
||||
NETLINK_PKTINFO = 0x3
|
||||
NETLINK_RDMA = 0x14
|
||||
NETLINK_ROUTE = 0x0
|
||||
NETLINK_SCSITRANSPORT = 0x12
|
||||
NETLINK_SELINUX = 0x7
|
||||
NETLINK_UNUSED = 0x1
|
||||
NETLINK_USERSOCK = 0x2
|
||||
NETLINK_XFRM = 0x6
|
||||
NL0 = 0x0
|
||||
NL1 = 0x100
|
||||
NLA_ALIGNTO = 0x4
|
||||
NLA_F_NESTED = 0x8000
|
||||
NLA_F_NET_BYTEORDER = 0x4000
|
||||
NLA_HDRLEN = 0x4
|
||||
NLDLY = 0x100
|
||||
NLMSG_ALIGNTO = 0x4
|
||||
NLMSG_DONE = 0x3
|
||||
NLMSG_ERROR = 0x2
|
||||
|
@ -634,6 +788,7 @@ const (
|
|||
NLM_F_ATOMIC = 0x400
|
||||
NLM_F_CREATE = 0x400
|
||||
NLM_F_DUMP = 0x300
|
||||
NLM_F_DUMP_INTR = 0x10
|
||||
NLM_F_ECHO = 0x8
|
||||
NLM_F_EXCL = 0x200
|
||||
NLM_F_MATCH = 0x200
|
||||
|
@ -641,6 +796,15 @@ const (
|
|||
NLM_F_REPLACE = 0x100
|
||||
NLM_F_REQUEST = 0x1
|
||||
NLM_F_ROOT = 0x100
|
||||
NOFLSH = 0x80
|
||||
OCRNL = 0x8
|
||||
OFDEL = 0x80
|
||||
OFILL = 0x40
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
ONLRET = 0x20
|
||||
ONOCR = 0x10
|
||||
OPOST = 0x1
|
||||
O_ACCMODE = 0x3
|
||||
O_APPEND = 0x400
|
||||
O_ASYNC = 0x2000
|
||||
|
@ -657,6 +821,7 @@ const (
|
|||
O_NOCTTY = 0x100
|
||||
O_NOFOLLOW = 0x20000
|
||||
O_NONBLOCK = 0x800
|
||||
O_PATH = 0x200000
|
||||
O_RDONLY = 0x0
|
||||
O_RDWR = 0x2
|
||||
O_RSYNC = 0x101000
|
||||
|
@ -664,20 +829,49 @@ const (
|
|||
O_TRUNC = 0x200
|
||||
O_WRONLY = 0x1
|
||||
PACKET_ADD_MEMBERSHIP = 0x1
|
||||
PACKET_AUXDATA = 0x8
|
||||
PACKET_BROADCAST = 0x1
|
||||
PACKET_COPY_THRESH = 0x7
|
||||
PACKET_DROP_MEMBERSHIP = 0x2
|
||||
PACKET_FANOUT = 0x12
|
||||
PACKET_FANOUT_CPU = 0x2
|
||||
PACKET_FANOUT_FLAG_DEFRAG = 0x8000
|
||||
PACKET_FANOUT_HASH = 0x0
|
||||
PACKET_FANOUT_LB = 0x1
|
||||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
PACKET_MR_ALLMULTI = 0x2
|
||||
PACKET_MR_MULTICAST = 0x0
|
||||
PACKET_MR_PROMISC = 0x1
|
||||
PACKET_MR_UNICAST = 0x3
|
||||
PACKET_MULTICAST = 0x2
|
||||
PACKET_ORIGDEV = 0x9
|
||||
PACKET_OTHERHOST = 0x3
|
||||
PACKET_OUTGOING = 0x4
|
||||
PACKET_RECV_OUTPUT = 0x3
|
||||
PACKET_RESERVE = 0xc
|
||||
PACKET_RX_RING = 0x5
|
||||
PACKET_STATISTICS = 0x6
|
||||
PACKET_TIMESTAMP = 0x11
|
||||
PACKET_TX_RING = 0xd
|
||||
PACKET_TX_TIMESTAMP = 0x10
|
||||
PACKET_VERSION = 0xa
|
||||
PACKET_VNET_HDR = 0xf
|
||||
PARENB = 0x100
|
||||
PARITY_CRC16_PR0 = 0x2
|
||||
PARITY_CRC16_PR0_CCITT = 0x4
|
||||
PARITY_CRC16_PR1 = 0x3
|
||||
PARITY_CRC16_PR1_CCITT = 0x5
|
||||
PARITY_CRC32_PR0_CCITT = 0x6
|
||||
PARITY_CRC32_PR1_CCITT = 0x7
|
||||
PARITY_DEFAULT = 0x0
|
||||
PARITY_NONE = 0x1
|
||||
PARMRK = 0x8
|
||||
PARODD = 0x200
|
||||
PENDIN = 0x4000
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -710,6 +904,7 @@ const (
|
|||
PR_GET_FPEXC = 0xb
|
||||
PR_GET_KEEPCAPS = 0x7
|
||||
PR_GET_NAME = 0x10
|
||||
PR_GET_NO_NEW_PRIVS = 0x27
|
||||
PR_GET_PDEATHSIG = 0x2
|
||||
PR_GET_SECCOMP = 0x15
|
||||
PR_GET_SECUREBITS = 0x1b
|
||||
|
@ -729,9 +924,19 @@ const (
|
|||
PR_SET_FPEMU = 0xa
|
||||
PR_SET_FPEXC = 0xc
|
||||
PR_SET_KEEPCAPS = 0x8
|
||||
PR_SET_MM = 0x23
|
||||
PR_SET_MM_BRK = 0x7
|
||||
PR_SET_MM_END_CODE = 0x2
|
||||
PR_SET_MM_END_DATA = 0x4
|
||||
PR_SET_MM_START_BRK = 0x6
|
||||
PR_SET_MM_START_CODE = 0x1
|
||||
PR_SET_MM_START_DATA = 0x3
|
||||
PR_SET_MM_START_STACK = 0x5
|
||||
PR_SET_NAME = 0xf
|
||||
PR_SET_NO_NEW_PRIVS = 0x26
|
||||
PR_SET_PDEATHSIG = 0x1
|
||||
PR_SET_PTRACER = 0x59616d61
|
||||
PR_SET_PTRACER_ANY = -0x1
|
||||
PR_SET_SECCOMP = 0x16
|
||||
PR_SET_SECUREBITS = 0x1c
|
||||
PR_SET_TIMERSLACK = 0x1d
|
||||
|
@ -754,6 +959,8 @@ const (
|
|||
PTRACE_EVENT_EXEC = 0x4
|
||||
PTRACE_EVENT_EXIT = 0x6
|
||||
PTRACE_EVENT_FORK = 0x1
|
||||
PTRACE_EVENT_SECCOMP = 0x7
|
||||
PTRACE_EVENT_STOP = 0x80
|
||||
PTRACE_EVENT_VFORK = 0x2
|
||||
PTRACE_EVENT_VFORK_DONE = 0x5
|
||||
PTRACE_GETEVENTMSG = 0x4201
|
||||
|
@ -763,13 +970,16 @@ const (
|
|||
PTRACE_GETREGSET = 0x4204
|
||||
PTRACE_GETSIGINFO = 0x4202
|
||||
PTRACE_GET_THREAD_AREA = 0x19
|
||||
PTRACE_INTERRUPT = 0x4207
|
||||
PTRACE_KILL = 0x8
|
||||
PTRACE_LISTEN = 0x4208
|
||||
PTRACE_OLDSETOPTIONS = 0x15
|
||||
PTRACE_O_MASK = 0x7f
|
||||
PTRACE_O_MASK = 0xff
|
||||
PTRACE_O_TRACECLONE = 0x8
|
||||
PTRACE_O_TRACEEXEC = 0x10
|
||||
PTRACE_O_TRACEEXIT = 0x40
|
||||
PTRACE_O_TRACEFORK = 0x2
|
||||
PTRACE_O_TRACESECCOMP = 0x80
|
||||
PTRACE_O_TRACESYSGOOD = 0x1
|
||||
PTRACE_O_TRACEVFORK = 0x4
|
||||
PTRACE_O_TRACEVFORKDONE = 0x20
|
||||
|
@ -779,6 +989,8 @@ const (
|
|||
PTRACE_POKEDATA = 0x5
|
||||
PTRACE_POKETEXT = 0x4
|
||||
PTRACE_POKEUSR = 0x6
|
||||
PTRACE_SEIZE = 0x4206
|
||||
PTRACE_SEIZE_DEVEL = 0x80000000
|
||||
PTRACE_SETFPREGS = 0xf
|
||||
PTRACE_SETFPXREGS = 0x13
|
||||
PTRACE_SETOPTIONS = 0x4200
|
||||
|
@ -1087,9 +1299,23 @@ const (
|
|||
S_IXGRP = 0x8
|
||||
S_IXOTH = 0x1
|
||||
S_IXUSR = 0x40
|
||||
TAB0 = 0x0
|
||||
TAB1 = 0x800
|
||||
TAB2 = 0x1000
|
||||
TAB3 = 0x1800
|
||||
TABDLY = 0x1800
|
||||
TCFLSH = 0x540b
|
||||
TCGETA = 0x5405
|
||||
TCGETS = 0x5401
|
||||
TCGETS2 = 0x802c542a
|
||||
TCGETX = 0x5432
|
||||
TCIFLUSH = 0x0
|
||||
TCIOFF = 0x2
|
||||
TCIOFLUSH = 0x2
|
||||
TCION = 0x3
|
||||
TCOFLUSH = 0x1
|
||||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_CORK = 0x3
|
||||
TCP_DEFER_ACCEPT = 0x9
|
||||
|
@ -1108,14 +1334,33 @@ const (
|
|||
TCP_QUICKACK = 0xc
|
||||
TCP_SYNCNT = 0x7
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCSAFLUSH = 0x2
|
||||
TCSBRK = 0x5409
|
||||
TCSBRKP = 0x5425
|
||||
TCSETA = 0x5406
|
||||
TCSETAF = 0x5408
|
||||
TCSETAW = 0x5407
|
||||
TCSETS = 0x5402
|
||||
TCSETS2 = 0x402c542b
|
||||
TCSETSF = 0x5404
|
||||
TCSETSF2 = 0x402c542d
|
||||
TCSETSW = 0x5403
|
||||
TCSETSW2 = 0x402c542c
|
||||
TCSETX = 0x5433
|
||||
TCSETXF = 0x5434
|
||||
TCSETXW = 0x5435
|
||||
TCXONC = 0x540a
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x541d
|
||||
TIOCEXCL = 0x540c
|
||||
TIOCGDEV = 0x80045432
|
||||
TIOCGETD = 0x5424
|
||||
TIOCGEXCL = 0x80045440
|
||||
TIOCGICOUNT = 0x545d
|
||||
TIOCGLCKTRMIOS = 0x5456
|
||||
TIOCGPGRP = 0x540f
|
||||
TIOCGPKT = 0x80045438
|
||||
TIOCGPTLCK = 0x80045439
|
||||
TIOCGPTN = 0x80045430
|
||||
TIOCGRS485 = 0x542e
|
||||
TIOCGSERIAL = 0x541e
|
||||
|
@ -1172,6 +1417,8 @@ const (
|
|||
TIOCSSOFTCAR = 0x541a
|
||||
TIOCSTI = 0x5412
|
||||
TIOCSWINSZ = 0x5414
|
||||
TIOCVHANGUP = 0x5437
|
||||
TOSTOP = 0x100
|
||||
TUNATTACHFILTER = 0x401054d5
|
||||
TUNDETACHFILTER = 0x401054d6
|
||||
TUNGETFEATURES = 0x800454cf
|
||||
|
@ -1189,6 +1436,26 @@ const (
|
|||
TUNSETSNDBUF = 0x400454d4
|
||||
TUNSETTXFILTER = 0x400454d1
|
||||
TUNSETVNETHDRSZ = 0x400454d8
|
||||
VDISCARD = 0xd
|
||||
VEOF = 0x4
|
||||
VEOL = 0xb
|
||||
VEOL2 = 0x10
|
||||
VERASE = 0x2
|
||||
VINTR = 0x0
|
||||
VKILL = 0x3
|
||||
VLNEXT = 0xf
|
||||
VMIN = 0x6
|
||||
VQUIT = 0x1
|
||||
VREPRINT = 0xc
|
||||
VSTART = 0x8
|
||||
VSTOP = 0x9
|
||||
VSUSP = 0xa
|
||||
VSWTC = 0x7
|
||||
VT0 = 0x0
|
||||
VT1 = 0x4000
|
||||
VTDLY = 0x4000
|
||||
VTIME = 0x5
|
||||
VWERASE = 0xe
|
||||
WALL = 0x40000000
|
||||
WCLONE = 0x80000000
|
||||
WCONTINUED = 0x8
|
||||
|
@ -1199,6 +1466,8 @@ const (
|
|||
WORDSIZE = 0x40
|
||||
WSTOPPED = 0x2
|
||||
WUNTRACED = 0x2
|
||||
XCASE = 0x4
|
||||
XTABS = 0x1800
|
||||
)
|
||||
|
||||
// Errors
|
||||
|
@ -1238,6 +1507,7 @@ const (
|
|||
EFBIG = syscall.Errno(0x1b)
|
||||
EHOSTDOWN = syscall.Errno(0x70)
|
||||
EHOSTUNREACH = syscall.Errno(0x71)
|
||||
EHWPOISON = syscall.Errno(0x85)
|
||||
EIDRM = syscall.Errno(0x2b)
|
||||
EILSEQ = syscall.Errno(0x54)
|
||||
EINPROGRESS = syscall.Errno(0x73)
|
||||
|
@ -1509,6 +1779,7 @@ var errors = [...]string{
|
|||
130: "owner died",
|
||||
131: "state not recoverable",
|
||||
132: "operation not possible due to RF-kill",
|
||||
133: "unknown error 133",
|
||||
}
|
||||
|
||||
// Signal table
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// mkerrors.sh
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// +build arm,linux
|
||||
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs -- _const.go
|
||||
|
||||
|
@ -108,6 +110,38 @@ const (
|
|||
ARPHRD_TUNNEL6 = 0x301
|
||||
ARPHRD_VOID = 0xffff
|
||||
ARPHRD_X25 = 0x10f
|
||||
B0 = 0x0
|
||||
B1000000 = 0x1008
|
||||
B110 = 0x3
|
||||
B115200 = 0x1002
|
||||
B1152000 = 0x1009
|
||||
B1200 = 0x9
|
||||
B134 = 0x4
|
||||
B150 = 0x5
|
||||
B1500000 = 0x100a
|
||||
B1800 = 0xa
|
||||
B19200 = 0xe
|
||||
B200 = 0x6
|
||||
B2000000 = 0x100b
|
||||
B230400 = 0x1003
|
||||
B2400 = 0xb
|
||||
B2500000 = 0x100c
|
||||
B300 = 0x7
|
||||
B3000000 = 0x100d
|
||||
B3500000 = 0x100e
|
||||
B38400 = 0xf
|
||||
B4000000 = 0x100f
|
||||
B460800 = 0x1004
|
||||
B4800 = 0xc
|
||||
B50 = 0x1
|
||||
B500000 = 0x1005
|
||||
B57600 = 0x1001
|
||||
B576000 = 0x1006
|
||||
B600 = 0x8
|
||||
B75 = 0x2
|
||||
B921600 = 0x1007
|
||||
B9600 = 0xd
|
||||
BOTHER = 0x1000
|
||||
BPF_A = 0x10
|
||||
BPF_ABS = 0x20
|
||||
BPF_ADD = 0x0
|
||||
|
@ -148,6 +182,30 @@ const (
|
|||
BPF_TXA = 0x80
|
||||
BPF_W = 0x0
|
||||
BPF_X = 0x8
|
||||
BRKINT = 0x2
|
||||
BS0 = 0x0
|
||||
BS1 = 0x2000
|
||||
BSDLY = 0x2000
|
||||
CBAUD = 0x100f
|
||||
CBAUDEX = 0x1000
|
||||
CFLUSH = 0xf
|
||||
CIBAUD = 0x100f0000
|
||||
CLOCAL = 0x800
|
||||
CLOCK_BOOTTIME = 0x7
|
||||
CLOCK_BOOTTIME_ALARM = 0x9
|
||||
CLOCK_DEFAULT = 0x0
|
||||
CLOCK_EXT = 0x1
|
||||
CLOCK_INT = 0x2
|
||||
CLOCK_MONOTONIC = 0x1
|
||||
CLOCK_MONOTONIC_COARSE = 0x6
|
||||
CLOCK_MONOTONIC_RAW = 0x4
|
||||
CLOCK_PROCESS_CPUTIME_ID = 0x2
|
||||
CLOCK_REALTIME = 0x0
|
||||
CLOCK_REALTIME_ALARM = 0x8
|
||||
CLOCK_REALTIME_COARSE = 0x5
|
||||
CLOCK_THREAD_CPUTIME_ID = 0x3
|
||||
CLOCK_TXFROMRX = 0x4
|
||||
CLOCK_TXINT = 0x3
|
||||
CLONE_CHILD_CLEARTID = 0x200000
|
||||
CLONE_CHILD_SETTID = 0x1000000
|
||||
CLONE_DETACHED = 0x400000
|
||||
|
@ -170,6 +228,25 @@ const (
|
|||
CLONE_UNTRACED = 0x800000
|
||||
CLONE_VFORK = 0x4000
|
||||
CLONE_VM = 0x100
|
||||
CMSPAR = 0x40000000
|
||||
CR0 = 0x0
|
||||
CR1 = 0x200
|
||||
CR2 = 0x400
|
||||
CR3 = 0x600
|
||||
CRDLY = 0x600
|
||||
CREAD = 0x80
|
||||
CRTSCTS = 0x80000000
|
||||
CS5 = 0x0
|
||||
CS6 = 0x10
|
||||
CS7 = 0x20
|
||||
CS8 = 0x30
|
||||
CSIGNAL = 0xff
|
||||
CSIZE = 0x30
|
||||
CSTART = 0x11
|
||||
CSTATUS = 0x0
|
||||
CSTOP = 0x13
|
||||
CSTOPB = 0x40
|
||||
CSUSP = 0x1a
|
||||
DT_BLK = 0x6
|
||||
DT_CHR = 0x2
|
||||
DT_DIR = 0x4
|
||||
|
@ -181,6 +258,13 @@ const (
|
|||
DT_WHT = 0xe
|
||||
ELF_NGREG = 0x12
|
||||
ELF_PRARGSZ = 0x50
|
||||
ECHO = 0x8
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
ECHOKE = 0x800
|
||||
ECHONL = 0x40
|
||||
ECHOPRT = 0x400
|
||||
EPOLLERR = 0x8
|
||||
EPOLLET = -0x80000000
|
||||
EPOLLHUP = 0x10
|
||||
|
@ -263,8 +347,15 @@ const (
|
|||
ETH_P_WAN_PPP = 0x7
|
||||
ETH_P_WCCP = 0x883e
|
||||
ETH_P_X25 = 0x805
|
||||
EXTA = 0xe
|
||||
EXTB = 0xf
|
||||
EXTPROC = 0x10000
|
||||
FD_CLOEXEC = 0x1
|
||||
FD_SETSIZE = 0x400
|
||||
FF0 = 0x0
|
||||
FF1 = 0x8000
|
||||
FFDLY = 0x8000
|
||||
FLUSHO = 0x1000
|
||||
F_DUPFD = 0x0
|
||||
F_DUPFD_CLOEXEC = 0x406
|
||||
F_EXLCK = 0x4
|
||||
|
@ -298,7 +389,12 @@ const (
|
|||
F_ULOCK = 0x0
|
||||
F_UNLCK = 0x2
|
||||
F_WRLCK = 0x1
|
||||
HUPCL = 0x400
|
||||
IBSHIFT = 0x10
|
||||
ICANON = 0x2
|
||||
ICMPV6_FILTER = 0x1
|
||||
ICRNL = 0x100
|
||||
IEXTEN = 0x8000
|
||||
IFA_F_DADFAILED = 0x8
|
||||
IFA_F_DEPRECATED = 0x20
|
||||
IFA_F_HOMEADDRESS = 0x10
|
||||
|
@ -332,6 +428,12 @@ const (
|
|||
IFF_UP = 0x1
|
||||
IFF_VNET_HDR = 0x4000
|
||||
IFNAMSIZ = 0x10
|
||||
IGNBRK = 0x1
|
||||
IGNCR = 0x80
|
||||
IGNPAR = 0x4
|
||||
IMAXBEL = 0x2000
|
||||
INLCR = 0x40
|
||||
INPCK = 0x10
|
||||
IN_ACCESS = 0x1
|
||||
IN_ALL_EVENTS = 0xfff
|
||||
IN_ATTRIB = 0x4
|
||||
|
@ -495,6 +597,13 @@ const (
|
|||
IP_TTL = 0x2
|
||||
IP_UNBLOCK_SOURCE = 0x25
|
||||
IP_XFRM_POLICY = 0x11
|
||||
ISIG = 0x1
|
||||
ISTRIP = 0x20
|
||||
IUCLC = 0x200
|
||||
IUTF8 = 0x4000
|
||||
IXANY = 0x800
|
||||
IXOFF = 0x1000
|
||||
IXON = 0x400
|
||||
LINUX_REBOOT_CMD_CAD_OFF = 0x0
|
||||
LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef
|
||||
LINUX_REBOOT_CMD_HALT = 0xcdef0123
|
||||
|
@ -618,10 +727,13 @@ const (
|
|||
NETLINK_UNUSED = 0x1
|
||||
NETLINK_USERSOCK = 0x2
|
||||
NETLINK_XFRM = 0x6
|
||||
NL0 = 0x0
|
||||
NL1 = 0x100
|
||||
NLA_ALIGNTO = 0x4
|
||||
NLA_F_NESTED = 0x8000
|
||||
NLA_F_NET_BYTEORDER = 0x4000
|
||||
NLA_HDRLEN = 0x4
|
||||
NLDLY = 0x100
|
||||
NLMSG_ALIGNTO = 0x4
|
||||
NLMSG_DONE = 0x3
|
||||
NLMSG_ERROR = 0x2
|
||||
|
@ -641,6 +753,15 @@ const (
|
|||
NLM_F_REPLACE = 0x100
|
||||
NLM_F_REQUEST = 0x1
|
||||
NLM_F_ROOT = 0x100
|
||||
NOFLSH = 0x80
|
||||
OCRNL = 0x8
|
||||
OFDEL = 0x80
|
||||
OFILL = 0x40
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
ONLRET = 0x20
|
||||
ONOCR = 0x10
|
||||
OPOST = 0x1
|
||||
O_ACCMODE = 0x3
|
||||
O_APPEND = 0x400
|
||||
O_ASYNC = 0x2000
|
||||
|
@ -657,6 +778,7 @@ const (
|
|||
O_NOCTTY = 0x100
|
||||
O_NOFOLLOW = 0x8000
|
||||
O_NONBLOCK = 0x800
|
||||
O_PATH = 0x200000
|
||||
O_RDONLY = 0x0
|
||||
O_RDWR = 0x2
|
||||
O_RSYNC = 0x1000
|
||||
|
@ -678,6 +800,10 @@ const (
|
|||
PACKET_RECV_OUTPUT = 0x3
|
||||
PACKET_RX_RING = 0x5
|
||||
PACKET_STATISTICS = 0x6
|
||||
PARENB = 0x100
|
||||
PARMRK = 0x8
|
||||
PARODD = 0x200
|
||||
PENDIN = 0x4000
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -1097,9 +1223,23 @@ const (
|
|||
S_IXGRP = 0x8
|
||||
S_IXOTH = 0x1
|
||||
S_IXUSR = 0x40
|
||||
TAB0 = 0x0
|
||||
TAB1 = 0x800
|
||||
TAB2 = 0x1000
|
||||
TAB3 = 0x1800
|
||||
TABDLY = 0x1800
|
||||
TCFLSH = 0x540b
|
||||
TCGETA = 0x5405
|
||||
TCGETS = 0x5401
|
||||
TCGETS2 = 0x802c542a
|
||||
TCGETX = 0x5432
|
||||
TCIFLUSH = 0x0
|
||||
TCIOFF = 0x2
|
||||
TCIOFLUSH = 0x2
|
||||
TCION = 0x3
|
||||
TCOFLUSH = 0x1
|
||||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_CORK = 0x3
|
||||
TCP_DEFER_ACCEPT = 0x9
|
||||
|
@ -1118,14 +1258,33 @@ const (
|
|||
TCP_QUICKACK = 0xc
|
||||
TCP_SYNCNT = 0x7
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCSAFLUSH = 0x2
|
||||
TCSBRK = 0x5409
|
||||
TCSBRKP = 0x5425
|
||||
TCSETA = 0x5406
|
||||
TCSETAF = 0x5408
|
||||
TCSETAW = 0x5407
|
||||
TCSETS = 0x5402
|
||||
TCSETS2 = 0x402c542b
|
||||
TCSETSF = 0x5404
|
||||
TCSETSF2 = 0x402c542d
|
||||
TCSETSW = 0x5403
|
||||
TCSETSW2 = 0x402c542c
|
||||
TCSETX = 0x5433
|
||||
TCSETXF = 0x5434
|
||||
TCSETXW = 0x5435
|
||||
TCXONC = 0x540a
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x541d
|
||||
TIOCEXCL = 0x540c
|
||||
TIOCGDEV = 0x80045432
|
||||
TIOCGETD = 0x5424
|
||||
TIOCGEXCL = 0x80045440
|
||||
TIOCGICOUNT = 0x545d
|
||||
TIOCGLCKTRMIOS = 0x5456
|
||||
TIOCGPGRP = 0x540f
|
||||
TIOCGPKT = 0x80045438
|
||||
TIOCGPTLCK = 0x80045439
|
||||
TIOCGPTN = 0x80045430
|
||||
TIOCGRS485 = 0x542e
|
||||
TIOCGSERIAL = 0x541e
|
||||
|
@ -1183,6 +1342,7 @@ const (
|
|||
TIOCSTI = 0x5412
|
||||
TIOCSWINSZ = 0x5414
|
||||
TIOCVHANGUP = 0x5437
|
||||
TOSTOP = 0x100
|
||||
TUNATTACHFILTER = 0x400854d5
|
||||
TUNDETACHFILTER = 0x400854d6
|
||||
TUNGETFEATURES = 0x800454cf
|
||||
|
@ -1200,6 +1360,26 @@ const (
|
|||
TUNSETSNDBUF = 0x400454d4
|
||||
TUNSETTXFILTER = 0x400454d1
|
||||
TUNSETVNETHDRSZ = 0x400454d8
|
||||
VDISCARD = 0xd
|
||||
VEOF = 0x4
|
||||
VEOL = 0xb
|
||||
VEOL2 = 0x10
|
||||
VERASE = 0x2
|
||||
VINTR = 0x0
|
||||
VKILL = 0x3
|
||||
VLNEXT = 0xf
|
||||
VMIN = 0x6
|
||||
VQUIT = 0x1
|
||||
VREPRINT = 0xc
|
||||
VSTART = 0x8
|
||||
VSTOP = 0x9
|
||||
VSUSP = 0xa
|
||||
VSWTC = 0x7
|
||||
VT0 = 0x0
|
||||
VT1 = 0x4000
|
||||
VTDLY = 0x4000
|
||||
VTIME = 0x5
|
||||
VWERASE = 0xe
|
||||
WALL = 0x40000000
|
||||
WCLONE = 0x80000000
|
||||
WCONTINUED = 0x8
|
||||
|
@ -1210,6 +1390,8 @@ const (
|
|||
WORDSIZE = 0x20
|
||||
WSTOPPED = 0x2
|
||||
WUNTRACED = 0x2
|
||||
XCASE = 0x4
|
||||
XTABS = 0x1800
|
||||
)
|
||||
|
||||
// Errors
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue