parent
9cb1141012
commit
b303f88a39
|
@ -0,0 +1,171 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// This subpackage while adapted, is orignally from code from Google's Seesaw
|
||||
// Github link here: https://github.com/google/seesaw
|
||||
// see original copyright notice below:
|
||||
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Author: jsing@google.com (Joel Sing)
|
||||
|
||||
// Gratuitous encapsulates a request to send a gratuitous ARP message.
|
||||
type Gratuitous struct {
|
||||
IfaceName string
|
||||
IP net.IP
|
||||
}
|
||||
|
||||
const (
|
||||
opARPRequest = 1
|
||||
opARPReply = 2
|
||||
hwLen = 6
|
||||
)
|
||||
|
||||
var (
|
||||
ethernetBroadcast = net.HardwareAddr{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
|
||||
)
|
||||
|
||||
func htons(p uint16) uint16 {
|
||||
var b [2]byte
|
||||
binary.BigEndian.PutUint16(b[:], p)
|
||||
return *(*uint16)(unsafe.Pointer(&b))
|
||||
}
|
||||
|
||||
// arpHeader specifies the header for an ARP message.
|
||||
type arpHeader struct {
|
||||
hardwareType uint16
|
||||
protocolType uint16
|
||||
hardwareAddressLength uint8
|
||||
protocolAddressLength uint8
|
||||
opcode uint16
|
||||
}
|
||||
|
||||
// arpMessage represents an ARP message.
|
||||
type arpMessage struct {
|
||||
arpHeader
|
||||
senderHardwareAddress []byte
|
||||
senderProtocolAddress []byte
|
||||
targetHardwareAddress []byte
|
||||
targetProtocolAddress []byte
|
||||
}
|
||||
|
||||
// bytes returns the wire representation of the ARP message.
|
||||
func (m *arpMessage) bytes() ([]byte, error) {
|
||||
buf := new(bytes.Buffer)
|
||||
|
||||
if err := binary.Write(buf, binary.BigEndian, m.arpHeader); err != nil {
|
||||
return nil, fmt.Errorf("binary write failed: %v", err)
|
||||
}
|
||||
buf.Write(m.senderHardwareAddress)
|
||||
buf.Write(m.senderProtocolAddress)
|
||||
buf.Write(m.targetHardwareAddress)
|
||||
buf.Write(m.targetProtocolAddress)
|
||||
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
// gratuitousARPReply returns an ARP message that contains a gratuitous ARP
|
||||
// reply from the specified sender.
|
||||
func gratuitousARPReply(ip net.IP, mac net.HardwareAddr) (*arpMessage, error) {
|
||||
if ip.To4() == nil {
|
||||
return nil, fmt.Errorf("%q is not an IPv4 address", ip)
|
||||
}
|
||||
if len(mac) != hwLen {
|
||||
return nil, fmt.Errorf("%q is not an Ethernet MAC address", mac)
|
||||
}
|
||||
|
||||
m := &arpMessage{
|
||||
arpHeader{
|
||||
1, // Ethernet
|
||||
0x0800, // IPv4
|
||||
hwLen, // 48-bit MAC Address
|
||||
net.IPv4len, // 32-bit IPv4 Address
|
||||
opARPReply, // ARP Reply
|
||||
},
|
||||
mac,
|
||||
ip.To4(),
|
||||
ethernetBroadcast,
|
||||
net.IPv4bcast,
|
||||
}
|
||||
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// sendARP sends the given ARP message via the specified interface.
|
||||
func sendARP(iface *net.Interface, m *arpMessage) error {
|
||||
fd, err := syscall.Socket(syscall.AF_PACKET, syscall.SOCK_DGRAM, int(htons(syscall.ETH_P_ARP)))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get raw socket: %v", err)
|
||||
}
|
||||
defer syscall.Close(fd)
|
||||
|
||||
if err := syscall.BindToDevice(fd, iface.Name); err != nil {
|
||||
return fmt.Errorf("failed to bind to device: %v", err)
|
||||
}
|
||||
|
||||
ll := syscall.SockaddrLinklayer{
|
||||
Protocol: htons(syscall.ETH_P_ARP),
|
||||
Ifindex: iface.Index,
|
||||
Pkttype: 0, // syscall.PACKET_HOST
|
||||
Hatype: m.hardwareType,
|
||||
Halen: m.hardwareAddressLength,
|
||||
}
|
||||
target := ethernetBroadcast
|
||||
if m.opcode == opARPReply {
|
||||
target = m.targetHardwareAddress
|
||||
}
|
||||
// for i := 0; i < len(target); i++ {
|
||||
// ll.Addr[i] = target[i]
|
||||
// }
|
||||
|
||||
log.Println("Copied ARP: ", copy(ll.Addr[:], target))
|
||||
|
||||
b, err := m.bytes()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to convert ARP message: %v", err)
|
||||
}
|
||||
|
||||
if err := syscall.Bind(fd, &ll); err != nil {
|
||||
return fmt.Errorf("failed to bind: %v", err)
|
||||
}
|
||||
if err := syscall.Sendto(fd, b, 0, &ll); err != nil {
|
||||
return fmt.Errorf("failed to send: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SendGratuitous sends a gratuitous ARP message via the specified interface.
|
||||
func SendGratuitous(arp *Gratuitous) error { //, out *int) error {
|
||||
iface, err := net.InterfaceByName(arp.IfaceName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get interface %q: %v", arp.IfaceName, err)
|
||||
}
|
||||
log.Printf("Sending gratuitous ARP for %s (%s) via %s\n", arp.IP, iface.HardwareAddr, iface.Name)
|
||||
m, err := gratuitousARPReply(arp.IP, iface.HardwareAddr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return sendARP(iface, m)
|
||||
}
|
14
conf.go
14
conf.go
|
@ -7,19 +7,6 @@ import (
|
|||
"os"
|
||||
)
|
||||
|
||||
type AbstractConfig struct {
|
||||
MulticastConfig struct {
|
||||
MIPAddr string `json:"MIpAddr"`
|
||||
MPort string `json:"MPort"`
|
||||
MaxDatagramSize int `json:"MaxDatagramSize"`
|
||||
} `json:"MulticastConfig"`
|
||||
InterfaceConfig struct {
|
||||
ExistingInterface string `json:"ExistingInterface"`
|
||||
BridgeIPCIDR string `json:"BridgeIpCIDR"`
|
||||
} `json:"InterfaceConfig"`
|
||||
Debug bool `json:"debug"`
|
||||
}
|
||||
|
||||
var a AbstractConfig
|
||||
|
||||
func init() {
|
||||
|
@ -45,7 +32,6 @@ func init() {
|
|||
|
||||
ZoreideBridge.BridgeIpCIDR = a.InterfaceConfig.BridgeIPCIDR
|
||||
ZoreideBridge.ExistingInterface = a.InterfaceConfig.ExistingInterface
|
||||
ZoreideBridge.IsActive = false
|
||||
|
||||
if !a.Debug {
|
||||
log.SetOutput(io.Discard)
|
||||
|
|
2
go.mod
2
go.mod
|
@ -12,5 +12,5 @@ require (
|
|||
github.com/google/uuid v1.2.0 // indirect
|
||||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 // indirect
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
||||
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005 // indirect
|
||||
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
|
||||
)
|
||||
|
|
3
go.sum
3
go.sum
|
@ -11,8 +11,9 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd
|
|||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005 h1:pDMpM2zh2MT0kHy037cKlSby2nEhD50SYqwQk76Nm40=
|
||||
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 h1:rm+CHSpPEEW2IsXUib1ThaHIjuBVZjxNgSKmBLFfD4c=
|
||||
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
|
|
35
interface.go
35
interface.go
|
@ -9,22 +9,41 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/go-ping/ping"
|
||||
|
||||
"github.com/milosgajdos/tenus"
|
||||
)
|
||||
|
||||
type AbstractBridge struct {
|
||||
ExistingInterface string
|
||||
BridgeIpCIDR string
|
||||
IsActive bool
|
||||
hIerarchyNumber int64
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
ZoreideBridge.initializeHierarchy()
|
||||
|
||||
}
|
||||
|
||||
func (b *AbstractBridge) RefreshArp() {
|
||||
|
||||
// we want the program to recover in case of issues
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
|
||||
fmt.Println("An error happened in <RefreshARP()>, but Zoreide recovered. ")
|
||||
fmt.Println("Error was: ", r)
|
||||
}
|
||||
}()
|
||||
|
||||
b.GArp = new(Gratuitous)
|
||||
|
||||
var err error
|
||||
b.GArp.IP, _, err = net.ParseCIDR(b.BridgeIpCIDR)
|
||||
if err != nil {
|
||||
log.Println("Error parsing CIDR: ", err.Error())
|
||||
}
|
||||
b.GArp.IfaceName = b.ExistingInterface
|
||||
log.Println("ARP Interface name: ", b.GArp.IfaceName)
|
||||
|
||||
SendGratuitous(b.GArp)
|
||||
|
||||
}
|
||||
|
||||
func (b *AbstractBridge) initializeHierarchy() {
|
||||
|
||||
var letterRunes = []rune("123456789")
|
||||
|
@ -75,6 +94,8 @@ func (b *AbstractBridge) configureIpAndBridgeUp() {
|
|||
log.Printf("%s configured with %s\n", b.ExistingInterface, brIp.String())
|
||||
}
|
||||
|
||||
// refresh ARP , should not be necessary, but we know, Cisco FA
|
||||
b.RefreshArp()
|
||||
}
|
||||
|
||||
func (b *AbstractBridge) removeIPandBridgeInt() {
|
||||
|
|
11
multicast.go
11
multicast.go
|
@ -5,17 +5,6 @@ import (
|
|||
"net"
|
||||
)
|
||||
|
||||
type AbstractMulticast struct {
|
||||
MIpAddr string
|
||||
MPort string
|
||||
MaxDatagramSize int
|
||||
MWaddr *net.UDPAddr
|
||||
MRaddr *net.UDPAddr
|
||||
Wconn *net.UDPConn
|
||||
Rconn *net.UDPConn
|
||||
HierarchyArray []int64
|
||||
}
|
||||
|
||||
func (mip *AbstractMulticast) CreateUdpAddr() {
|
||||
|
||||
// This Will create the local UDP Address
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package main
|
||||
|
||||
import "net"
|
||||
|
||||
type AbstractBridge struct {
|
||||
ExistingInterface string
|
||||
BridgeIpCIDR string
|
||||
hIerarchyNumber int64
|
||||
GArp *Gratuitous
|
||||
}
|
||||
|
||||
type AbstractMulticast struct {
|
||||
MIpAddr string
|
||||
MPort string
|
||||
MaxDatagramSize int
|
||||
MWaddr *net.UDPAddr
|
||||
MRaddr *net.UDPAddr
|
||||
Wconn *net.UDPConn
|
||||
Rconn *net.UDPConn
|
||||
HierarchyArray []int64
|
||||
}
|
||||
|
||||
type AbstractConfig struct {
|
||||
MulticastConfig struct {
|
||||
MIPAddr string `json:"MIpAddr"`
|
||||
MPort string `json:"MPort"`
|
||||
MaxDatagramSize int `json:"MaxDatagramSize"`
|
||||
} `json:"MulticastConfig"`
|
||||
InterfaceConfig struct {
|
||||
ExistingInterface string `json:"ExistingInterface"`
|
||||
BridgeIPCIDR string `json:"BridgeIpCIDR"`
|
||||
} `json:"InterfaceConfig"`
|
||||
Debug bool `json:"debug"`
|
||||
}
|
|
@ -76,7 +76,7 @@ arguments can be passed to the kernel. The third is for low-level use by the
|
|||
ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
|
||||
let it know that a system call is running.
|
||||
|
||||
When porting Go to an new architecture/OS, this file must be implemented for
|
||||
When porting Go to a new architecture/OS, this file must be implemented for
|
||||
each GOOS/GOARCH pair.
|
||||
|
||||
### mksysnum
|
||||
|
@ -107,7 +107,7 @@ prototype can be exported (capitalized) or not.
|
|||
Adding a new syscall often just requires adding a new `//sys` function prototype
|
||||
with the desired arguments and a capitalized name so it is exported. However, if
|
||||
you want the interface to the syscall to be different, often one will make an
|
||||
unexported `//sys` prototype, an then write a custom wrapper in
|
||||
unexported `//sys` prototype, and then write a custom wrapper in
|
||||
`syscall_${GOOS}.go`.
|
||||
|
||||
### types files
|
||||
|
@ -137,7 +137,7 @@ some `#if/#elif` macros in your include statements.
|
|||
|
||||
This script is used to generate the system's various constants. This doesn't
|
||||
just include the error numbers and error strings, but also the signal numbers
|
||||
an a wide variety of miscellaneous constants. The constants come from the list
|
||||
and a wide variety of miscellaneous constants. The constants come from the list
|
||||
of include files in the `includes_${uname}` variable. A regex then picks out
|
||||
the desired `#define` statements, and generates the corresponding Go constants.
|
||||
The error numbers and strings are generated from `#include <errno.h>`, and the
|
||||
|
@ -149,7 +149,7 @@ To add a constant, add the header that includes it to the appropriate variable.
|
|||
Then, edit the regex (if necessary) to match the desired constant. Avoid making
|
||||
the regex too broad to avoid matching unintended constants.
|
||||
|
||||
### mkmerge.go
|
||||
### internal/mkmerge
|
||||
|
||||
This program is used to extract duplicate const, func, and type declarations
|
||||
from the generated architecture-specific files listed below, and merge these
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build gc
|
||||
// +build gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// Copyright 2009 The Go Authors. All rights reserved.
|
||||
// Copyright 2021 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.
|
||||
|
||||
//go:build (freebsd || netbsd || openbsd) && gc
|
||||
// +build freebsd netbsd openbsd
|
||||
// +build gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for 386, Darwin
|
||||
//
|
||||
// System call support for 386 BSD
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
|
@ -1,14 +1,14 @@
|
|||
// Copyright 2009 The Go Authors. All rights reserved.
|
||||
// Copyright 2021 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.
|
||||
|
||||
//go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc
|
||||
// +build darwin dragonfly freebsd netbsd openbsd
|
||||
// +build gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for AMD64, Darwin
|
||||
//
|
||||
// System call support for AMD64 BSD
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
|
@ -1,14 +1,14 @@
|
|||
// Copyright 2013 The Go Authors. All rights reserved.
|
||||
// Copyright 2021 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.
|
||||
|
||||
//go:build (freebsd || netbsd || openbsd) && gc
|
||||
// +build freebsd netbsd openbsd
|
||||
// +build gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for ARM, NetBSD
|
||||
//
|
||||
// System call support for ARM BSD
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
|
@ -1,14 +1,14 @@
|
|||
// Copyright 2009 The Go Authors. All rights reserved.
|
||||
// Copyright 2021 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.
|
||||
|
||||
//go:build (darwin || freebsd || netbsd || openbsd) && gc
|
||||
// +build darwin freebsd netbsd openbsd
|
||||
// +build gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for AMD64, NetBSD
|
||||
//
|
||||
// System call support for ARM64 BSD
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
|
@ -1,30 +0,0 @@
|
|||
// 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 gc
|
||||
// +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)
|
|
@ -1,30 +0,0 @@
|
|||
// 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 gc
|
||||
// +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)
|
|
@ -1,29 +0,0 @@
|
|||
// 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 gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for AMD64, DragonFly
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
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
|
||||
JMP syscall·RawSyscall6(SB)
|
|
@ -1,29 +0,0 @@
|
|||
// 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 gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for 386, FreeBSD
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
||||
JMP syscall·Syscall9(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
||||
JMP syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
||||
JMP syscall·RawSyscall6(SB)
|
|
@ -1,29 +0,0 @@
|
|||
// 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 gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for AMD64, FreeBSD
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
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
|
||||
JMP syscall·RawSyscall6(SB)
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright 2012 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 gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for ARM, FreeBSD
|
||||
//
|
||||
|
||||
// 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)
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright 2018 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 gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for ARM64, FreeBSD
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
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
|
||||
JMP syscall·RawSyscall6(SB)
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build gc
|
||||
// +build gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build gc
|
||||
// +build gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build gc
|
||||
// +build gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux && arm64 && gc
|
||||
// +build linux
|
||||
// +build arm64
|
||||
// +build gc
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux && (mips64 || mips64le) && gc
|
||||
// +build linux
|
||||
// +build mips64 mips64le
|
||||
// +build gc
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux && (mips || mipsle) && gc
|
||||
// +build linux
|
||||
// +build mips mipsle
|
||||
// +build gc
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux && (ppc64 || ppc64le) && gc
|
||||
// +build linux
|
||||
// +build ppc64 ppc64le
|
||||
// +build gc
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build riscv64,gc
|
||||
//go:build riscv64 && gc
|
||||
// +build riscv64
|
||||
// +build gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build s390x
|
||||
//go:build linux && s390x && gc
|
||||
// +build linux
|
||||
// +build s390x
|
||||
// +build gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
// 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 gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for 386, NetBSD
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
||||
JMP syscall·Syscall9(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
||||
JMP syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
||||
JMP syscall·RawSyscall6(SB)
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright 2019 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 gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for ARM64, NetBSD
|
||||
//
|
||||
|
||||
// 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)
|
|
@ -1,29 +0,0 @@
|
|||
// 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 gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for 386, OpenBSD
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
||||
JMP syscall·Syscall9(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
||||
JMP syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
||||
JMP syscall·RawSyscall6(SB)
|
|
@ -1,29 +0,0 @@
|
|||
// 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 gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for AMD64, OpenBSD
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
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
|
||||
JMP syscall·RawSyscall6(SB)
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright 2017 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 gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for ARM, OpenBSD
|
||||
//
|
||||
|
||||
// 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)
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright 2019 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 gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for arm64, OpenBSD
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
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
|
||||
JMP syscall·RawSyscall6(SB)
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build gc
|
||||
// +build gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build gc
|
||||
// +build gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle)
|
||||
// +build linux,386 linux,arm linux,mips linux,mipsle
|
||||
//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc)
|
||||
// +build linux,386 linux,arm linux,mips linux,mipsle linux,ppc
|
||||
|
||||
package unix
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
||||
|
||||
package unix
|
||||
|
||||
|
|
|
@ -0,0 +1,149 @@
|
|||
// Copyright 2021 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.
|
||||
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Helpers for dealing with ifreq since it contains a union and thus requires a
|
||||
// lot of unsafe.Pointer casts to use properly.
|
||||
|
||||
// An Ifreq is a type-safe wrapper around the raw ifreq struct. An Ifreq
|
||||
// contains an interface name and a union of arbitrary data which can be
|
||||
// accessed using the Ifreq's methods. To create an Ifreq, use the NewIfreq
|
||||
// function.
|
||||
//
|
||||
// Use the Name method to access the stored interface name. The union data
|
||||
// fields can be get and set using the following methods:
|
||||
// - Uint16/SetUint16: flags
|
||||
// - Uint32/SetUint32: ifindex, metric, mtu
|
||||
type Ifreq struct{ raw ifreq }
|
||||
|
||||
// NewIfreq creates an Ifreq with the input network interface name after
|
||||
// validating the name does not exceed IFNAMSIZ-1 (trailing NULL required)
|
||||
// bytes.
|
||||
func NewIfreq(name string) (*Ifreq, error) {
|
||||
// Leave room for terminating NULL byte.
|
||||
if len(name) >= IFNAMSIZ {
|
||||
return nil, EINVAL
|
||||
}
|
||||
|
||||
var ifr ifreq
|
||||
copy(ifr.Ifrn[:], name)
|
||||
|
||||
return &Ifreq{raw: ifr}, nil
|
||||
}
|
||||
|
||||
// TODO(mdlayher): get/set methods for hardware address sockaddr, char array, etc.
|
||||
|
||||
// Name returns the interface name associated with the Ifreq.
|
||||
func (ifr *Ifreq) Name() string {
|
||||
// BytePtrToString requires a NULL terminator or the program may crash. If
|
||||
// one is not present, just return the empty string.
|
||||
if !bytes.Contains(ifr.raw.Ifrn[:], []byte{0x00}) {
|
||||
return ""
|
||||
}
|
||||
|
||||
return BytePtrToString(&ifr.raw.Ifrn[0])
|
||||
}
|
||||
|
||||
// According to netdevice(7), only AF_INET addresses are returned for numerous
|
||||
// sockaddr ioctls. For convenience, we expose these as Inet4Addr since the Port
|
||||
// field and other data is always empty.
|
||||
|
||||
// Inet4Addr returns the Ifreq union data from an embedded sockaddr as a C
|
||||
// in_addr/Go []byte (4-byte IPv4 address) value. If the sockaddr family is not
|
||||
// AF_INET, an error is returned.
|
||||
func (ifr *Ifreq) Inet4Addr() ([]byte, error) {
|
||||
raw := *(*RawSockaddrInet4)(unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0]))
|
||||
if raw.Family != AF_INET {
|
||||
// Cannot safely interpret raw.Addr bytes as an IPv4 address.
|
||||
return nil, EINVAL
|
||||
}
|
||||
|
||||
return raw.Addr[:], nil
|
||||
}
|
||||
|
||||
// SetInet4Addr sets a C in_addr/Go []byte (4-byte IPv4 address) value in an
|
||||
// embedded sockaddr within the Ifreq's union data. v must be 4 bytes in length
|
||||
// or an error will be returned.
|
||||
func (ifr *Ifreq) SetInet4Addr(v []byte) error {
|
||||
if len(v) != 4 {
|
||||
return EINVAL
|
||||
}
|
||||
|
||||
var addr [4]byte
|
||||
copy(addr[:], v)
|
||||
|
||||
ifr.clear()
|
||||
*(*RawSockaddrInet4)(
|
||||
unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0]),
|
||||
) = RawSockaddrInet4{
|
||||
// Always set IP family as ioctls would require it anyway.
|
||||
Family: AF_INET,
|
||||
Addr: addr,
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Uint16 returns the Ifreq union data as a C short/Go uint16 value.
|
||||
func (ifr *Ifreq) Uint16() uint16 {
|
||||
return *(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0]))
|
||||
}
|
||||
|
||||
// SetUint16 sets a C short/Go uint16 value as the Ifreq's union data.
|
||||
func (ifr *Ifreq) SetUint16(v uint16) {
|
||||
ifr.clear()
|
||||
*(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0])) = v
|
||||
}
|
||||
|
||||
// Uint32 returns the Ifreq union data as a C int/Go uint32 value.
|
||||
func (ifr *Ifreq) Uint32() uint32 {
|
||||
return *(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0]))
|
||||
}
|
||||
|
||||
// SetUint32 sets a C int/Go uint32 value as the Ifreq's union data.
|
||||
func (ifr *Ifreq) SetUint32(v uint32) {
|
||||
ifr.clear()
|
||||
*(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0])) = v
|
||||
}
|
||||
|
||||
// clear zeroes the ifreq's union field to prevent trailing garbage data from
|
||||
// being sent to the kernel if an ifreq is reused.
|
||||
func (ifr *Ifreq) clear() {
|
||||
for i := range ifr.raw.Ifru {
|
||||
ifr.raw.Ifru[i] = 0
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(mdlayher): export as IfreqData? For now we can provide helpers such as
|
||||
// IoctlGetEthtoolDrvinfo which use these APIs under the hood.
|
||||
|
||||
// An ifreqData is an Ifreq which carries pointer data. To produce an ifreqData,
|
||||
// use the Ifreq.withData method.
|
||||
type ifreqData struct {
|
||||
name [IFNAMSIZ]byte
|
||||
// A type separate from ifreq is required in order to comply with the
|
||||
// unsafe.Pointer rules since the "pointer-ness" of data would not be
|
||||
// preserved if it were cast into the byte array of a raw ifreq.
|
||||
data unsafe.Pointer
|
||||
// Pad to the same size as ifreq.
|
||||
_ [len(ifreq{}.Ifru) - SizeofPtr]byte
|
||||
}
|
||||
|
||||
// withData produces an ifreqData with the pointer p set for ioctls which require
|
||||
// arbitrary pointer data.
|
||||
func (ifr Ifreq) withData(p unsafe.Pointer) ifreqData {
|
||||
return ifreqData{
|
||||
name: ifr.raw.Ifrn,
|
||||
data: p,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
// Copyright 2021 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 (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// IoctlRetInt performs an ioctl operation specified by req on a device
|
||||
// associated with opened file descriptor fd, and returns a non-negative
|
||||
// integer that is returned by the ioctl syscall.
|
||||
func IoctlRetInt(fd int, req uint) (int, error) {
|
||||
ret, _, err := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), 0)
|
||||
if err != 0 {
|
||||
return 0, err
|
||||
}
|
||||
return int(ret), nil
|
||||
}
|
||||
|
||||
func IoctlGetUint32(fd int, req uint) (uint32, error) {
|
||||
var value uint32
|
||||
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||
return value, err
|
||||
}
|
||||
|
||||
func IoctlGetRTCTime(fd int) (*RTCTime, error) {
|
||||
var value RTCTime
|
||||
err := ioctlPtr(fd, RTC_RD_TIME, unsafe.Pointer(&value))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func IoctlSetRTCTime(fd int, value *RTCTime) error {
|
||||
return ioctlPtr(fd, RTC_SET_TIME, unsafe.Pointer(value))
|
||||
}
|
||||
|
||||
func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) {
|
||||
var value RTCWkAlrm
|
||||
err := ioctlPtr(fd, RTC_WKALM_RD, unsafe.Pointer(&value))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func IoctlSetRTCWkAlrm(fd int, value *RTCWkAlrm) error {
|
||||
return ioctlPtr(fd, RTC_WKALM_SET, unsafe.Pointer(value))
|
||||
}
|
||||
|
||||
// IoctlGetEthtoolDrvinfo fetches ethtool driver information for the network
|
||||
// device specified by ifname.
|
||||
func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) {
|
||||
ifr, err := NewIfreq(ifname)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
value := EthtoolDrvinfo{Cmd: ETHTOOL_GDRVINFO}
|
||||
ifrd := ifr.withData(unsafe.Pointer(&value))
|
||||
|
||||
err = ioctlIfreqData(fd, SIOCETHTOOL, &ifrd)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
// IoctlGetWatchdogInfo fetches information about a watchdog device from the
|
||||
// Linux watchdog API. For more information, see:
|
||||
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
||||
func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) {
|
||||
var value WatchdogInfo
|
||||
err := ioctlPtr(fd, WDIOC_GETSUPPORT, unsafe.Pointer(&value))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
// IoctlWatchdogKeepalive issues a keepalive ioctl to a watchdog device. For
|
||||
// more information, see:
|
||||
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
||||
func IoctlWatchdogKeepalive(fd int) error {
|
||||
// arg is ignored and not a pointer, so ioctl is fine instead of ioctlPtr.
|
||||
return ioctl(fd, WDIOC_KEEPALIVE, 0)
|
||||
}
|
||||
|
||||
// IoctlFileCloneRange performs an FICLONERANGE ioctl operation to clone the
|
||||
// range of data conveyed in value to the file associated with the file
|
||||
// descriptor destFd. See the ioctl_ficlonerange(2) man page for details.
|
||||
func IoctlFileCloneRange(destFd int, value *FileCloneRange) error {
|
||||
return ioctlPtr(destFd, FICLONERANGE, unsafe.Pointer(value))
|
||||
}
|
||||
|
||||
// IoctlFileClone performs an FICLONE ioctl operation to clone the entire file
|
||||
// associated with the file description srcFd to the file associated with the
|
||||
// file descriptor destFd. See the ioctl_ficlone(2) man page for details.
|
||||
func IoctlFileClone(destFd, srcFd int) error {
|
||||
return ioctl(destFd, FICLONE, uintptr(srcFd))
|
||||
}
|
||||
|
||||
type FileDedupeRange struct {
|
||||
Src_offset uint64
|
||||
Src_length uint64
|
||||
Reserved1 uint16
|
||||
Reserved2 uint32
|
||||
Info []FileDedupeRangeInfo
|
||||
}
|
||||
|
||||
type FileDedupeRangeInfo struct {
|
||||
Dest_fd int64
|
||||
Dest_offset uint64
|
||||
Bytes_deduped uint64
|
||||
Status int32
|
||||
Reserved uint32
|
||||
}
|
||||
|
||||
// IoctlFileDedupeRange performs an FIDEDUPERANGE ioctl operation to share the
|
||||
// range of data conveyed in value from the file associated with the file
|
||||
// descriptor srcFd to the value.Info destinations. See the
|
||||
// ioctl_fideduperange(2) man page for details.
|
||||
func IoctlFileDedupeRange(srcFd int, value *FileDedupeRange) error {
|
||||
buf := make([]byte, SizeofRawFileDedupeRange+
|
||||
len(value.Info)*SizeofRawFileDedupeRangeInfo)
|
||||
rawrange := (*RawFileDedupeRange)(unsafe.Pointer(&buf[0]))
|
||||
rawrange.Src_offset = value.Src_offset
|
||||
rawrange.Src_length = value.Src_length
|
||||
rawrange.Dest_count = uint16(len(value.Info))
|
||||
rawrange.Reserved1 = value.Reserved1
|
||||
rawrange.Reserved2 = value.Reserved2
|
||||
|
||||
for i := range value.Info {
|
||||
rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer(
|
||||
uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) +
|
||||
uintptr(i*SizeofRawFileDedupeRangeInfo)))
|
||||
rawinfo.Dest_fd = value.Info[i].Dest_fd
|
||||
rawinfo.Dest_offset = value.Info[i].Dest_offset
|
||||
rawinfo.Bytes_deduped = value.Info[i].Bytes_deduped
|
||||
rawinfo.Status = value.Info[i].Status
|
||||
rawinfo.Reserved = value.Info[i].Reserved
|
||||
}
|
||||
|
||||
err := ioctlPtr(srcFd, FIDEDUPERANGE, unsafe.Pointer(&buf[0]))
|
||||
|
||||
// Output
|
||||
for i := range value.Info {
|
||||
rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer(
|
||||
uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) +
|
||||
uintptr(i*SizeofRawFileDedupeRangeInfo)))
|
||||
value.Info[i].Dest_fd = rawinfo.Dest_fd
|
||||
value.Info[i].Dest_offset = rawinfo.Dest_offset
|
||||
value.Info[i].Bytes_deduped = rawinfo.Bytes_deduped
|
||||
value.Info[i].Status = rawinfo.Status
|
||||
value.Info[i].Reserved = rawinfo.Reserved
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func IoctlHIDGetDesc(fd int, value *HIDRawReportDescriptor) error {
|
||||
return ioctlPtr(fd, HIDIOCGRDESC, unsafe.Pointer(value))
|
||||
}
|
||||
|
||||
func IoctlHIDGetRawInfo(fd int) (*HIDRawDevInfo, error) {
|
||||
var value HIDRawDevInfo
|
||||
err := ioctlPtr(fd, HIDIOCGRAWINFO, unsafe.Pointer(&value))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func IoctlHIDGetRawName(fd int) (string, error) {
|
||||
var value [_HIDIOCGRAWNAME_LEN]byte
|
||||
err := ioctlPtr(fd, _HIDIOCGRAWNAME, unsafe.Pointer(&value[0]))
|
||||
return ByteSliceToString(value[:]), err
|
||||
}
|
||||
|
||||
func IoctlHIDGetRawPhys(fd int) (string, error) {
|
||||
var value [_HIDIOCGRAWPHYS_LEN]byte
|
||||
err := ioctlPtr(fd, _HIDIOCGRAWPHYS, unsafe.Pointer(&value[0]))
|
||||
return ByteSliceToString(value[:]), err
|
||||
}
|
||||
|
||||
func IoctlHIDGetRawUniq(fd int) (string, error) {
|
||||
var value [_HIDIOCGRAWUNIQ_LEN]byte
|
||||
err := ioctlPtr(fd, _HIDIOCGRAWUNIQ, unsafe.Pointer(&value[0]))
|
||||
return ByteSliceToString(value[:]), err
|
||||
}
|
||||
|
||||
// IoctlIfreq performs an ioctl using an Ifreq structure for input and/or
|
||||
// output. See the netdevice(7) man page for details.
|
||||
func IoctlIfreq(fd int, req uint, value *Ifreq) error {
|
||||
// It is possible we will add more fields to *Ifreq itself later to prevent
|
||||
// misuse, so pass the raw *ifreq directly.
|
||||
return ioctlPtr(fd, req, unsafe.Pointer(&value.raw))
|
||||
}
|
||||
|
||||
// TODO(mdlayher): export if and when IfreqData is exported.
|
||||
|
||||
// ioctlIfreqData performs an ioctl using an ifreqData structure for input
|
||||
// and/or output. See the netdevice(7) man page for details.
|
||||
func ioctlIfreqData(fd int, req uint, value *ifreqData) error {
|
||||
// The memory layout of IfreqData (type-safe) and ifreq (not type-safe) are
|
||||
// identical so pass *IfreqData directly.
|
||||
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||
}
|
|
@ -50,7 +50,7 @@ if [[ "$GOOS" = "linux" ]]; then
|
|||
# Use the Docker-based build system
|
||||
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
|
||||
$cmd docker build --tag generate:$GOOS $GOOS
|
||||
$cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")" && /bin/pwd):/build generate:$GOOS
|
||||
$cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && /bin/pwd):/build generate:$GOOS
|
||||
exit
|
||||
fi
|
||||
|
||||
|
@ -70,23 +70,11 @@ aix_ppc64)
|
|||
mksyscall="go run mksyscall_aix_ppc64.go -aix"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
darwin_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="go run mksyscall.go -l32"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
mkasm="go run mkasm_darwin.go"
|
||||
;;
|
||||
darwin_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
mkasm="go run mkasm_darwin.go"
|
||||
;;
|
||||
darwin_arm)
|
||||
mkerrors="$mkerrors"
|
||||
mksyscall="go run mksyscall.go -l32"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
mkasm="go run mkasm_darwin.go"
|
||||
;;
|
||||
darwin_arm64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
|
@ -199,7 +187,7 @@ illumos_amd64)
|
|||
mksyscall="go run mksyscall_solaris.go"
|
||||
mkerrors=
|
||||
mksysnum=
|
||||
mktypes=
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
*)
|
||||
echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
|
||||
|
|
|
@ -54,8 +54,9 @@ includes_AIX='
|
|||
|
||||
includes_Darwin='
|
||||
#define _DARWIN_C_SOURCE
|
||||
#define KERNEL
|
||||
#define KERNEL 1
|
||||
#define _DARWIN_USE_64_BIT_INODE
|
||||
#define __APPLE_USE_RFC_3542
|
||||
#include <stdint.h>
|
||||
#include <sys/attr.h>
|
||||
#include <sys/clonefile.h>
|
||||
|
@ -74,6 +75,7 @@ includes_Darwin='
|
|||
#include <sys/utsname.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/xattr.h>
|
||||
#include <sys/vsock.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_types.h>
|
||||
|
@ -81,6 +83,9 @@ includes_Darwin='
|
|||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <termios.h>
|
||||
|
||||
// for backwards compatibility because moved TIOCREMOTE to Kernel.framework after MacOSX12.0.sdk.
|
||||
#define TIOCREMOTE 0x80047469
|
||||
'
|
||||
|
||||
includes_DragonFly='
|
||||
|
@ -216,7 +221,6 @@ struct ltchars {
|
|||
#include <linux/genetlink.h>
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/hidraw.h>
|
||||
#include <linux/icmpv6.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_addr.h>
|
||||
#include <linux/if_alg.h>
|
||||
|
@ -229,14 +233,17 @@ struct ltchars {
|
|||
#include <linux/input.h>
|
||||
#include <linux/kexec.h>
|
||||
#include <linux/keyctl.h>
|
||||
#include <linux/landlock.h>
|
||||
#include <linux/loop.h>
|
||||
#include <linux/lwtunnel.h>
|
||||
#include <linux/magic.h>
|
||||
#include <linux/memfd.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mount.h>
|
||||
#include <linux/netfilter/nfnetlink.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/net_namespace.h>
|
||||
#include <linux/nfc.h>
|
||||
#include <linux/nsfs.h>
|
||||
#include <linux/perf_event.h>
|
||||
#include <linux/pps.h>
|
||||
|
@ -254,8 +261,10 @@ struct ltchars {
|
|||
#include <linux/vm_sockets.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/watchdog.h>
|
||||
#include <linux/wireguard.h>
|
||||
|
||||
#include <mtd/ubi-user.h>
|
||||
#include <mtd/mtd-user.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#if defined(__sparc__)
|
||||
|
@ -403,10 +412,11 @@ includes_SunOS='
|
|||
#include <net/if_arp.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/route.h>
|
||||
#include <netinet/icmp6.h>
|
||||
#include <netinet/in.h>
|
||||
#include <termios.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_mroute.h>
|
||||
#include <termios.h>
|
||||
'
|
||||
|
||||
|
||||
|
@ -462,7 +472,6 @@ ccflags="$@"
|
|||
$2 !~ /^EQUIV_/ &&
|
||||
$2 !~ /^EXPR_/ &&
|
||||
$2 !~ /^EVIOC/ &&
|
||||
$2 !~ /^EV_/ &&
|
||||
$2 ~ /^E[A-Z0-9_]+$/ ||
|
||||
$2 ~ /^B[0-9_]+$/ ||
|
||||
$2 ~ /^(OLD|NEW)DEV$/ ||
|
||||
|
@ -494,13 +503,17 @@ ccflags="$@"
|
|||
$2 ~ /^O?XTABS$/ ||
|
||||
$2 ~ /^TC[IO](ON|OFF)$/ ||
|
||||
$2 ~ /^IN_/ ||
|
||||
$2 ~ /^LANDLOCK_/ ||
|
||||
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
|
||||
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
|
||||
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
|
||||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL)_/ ||
|
||||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT)_/ ||
|
||||
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
||||
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
||||
$2 ~ /^RAW_PAYLOAD_/ ||
|
||||
$2 ~ /^TP_STATUS_/ ||
|
||||
$2 ~ /^FALLOC_/ ||
|
||||
$2 == "ICMPV6_FILTER" ||
|
||||
$2 ~ /^ICMPV?6?_(FILTER|SEC)/ ||
|
||||
$2 == "SOMAXCONN" ||
|
||||
$2 == "NAME_MAX" ||
|
||||
$2 == "IFNAMSIZ" ||
|
||||
|
@ -509,7 +522,7 @@ ccflags="$@"
|
|||
$2 ~ /^HW_MACHINE$/ ||
|
||||
$2 ~ /^SYSCTL_VERS/ ||
|
||||
$2 !~ "MNT_BITS" &&
|
||||
$2 ~ /^(MS|MNT|UMOUNT)_/ ||
|
||||
$2 ~ /^(MS|MNT|MOUNT|UMOUNT)_/ ||
|
||||
$2 ~ /^NS_GET_/ ||
|
||||
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
|
||||
$2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT|TFD)_/ ||
|
||||
|
@ -555,6 +568,7 @@ ccflags="$@"
|
|||
$2 ~ /^KEYCTL_/ ||
|
||||
$2 ~ /^PERF_/ ||
|
||||
$2 ~ /^SECCOMP_MODE_/ ||
|
||||
$2 ~ /^SEEK_/ ||
|
||||
$2 ~ /^SPLICE_/ ||
|
||||
$2 ~ /^SYNC_FILE_RANGE_/ ||
|
||||
$2 !~ /^AUDIT_RECORD_MAGIC/ &&
|
||||
|
@ -583,6 +597,7 @@ ccflags="$@"
|
|||
$2 ~ /^DEVLINK_/ ||
|
||||
$2 ~ /^ETHTOOL_/ ||
|
||||
$2 ~ /^LWTUNNEL_IP/ ||
|
||||
$2 ~ /^ITIMER_/ ||
|
||||
$2 !~ "WMESGLEN" &&
|
||||
$2 ~ /^W[A-Z0-9]+$/ ||
|
||||
$2 ~/^PPPIOC/ ||
|
||||
|
@ -590,6 +605,10 @@ ccflags="$@"
|
|||
$2 == "HID_MAX_DESCRIPTOR_SIZE" ||
|
||||
$2 ~ /^_?HIDIOC/ ||
|
||||
$2 ~ /^BUS_(USB|HIL|BLUETOOTH|VIRTUAL)$/ ||
|
||||
$2 ~ /^MTD/ ||
|
||||
$2 ~ /^OTP/ ||
|
||||
$2 ~ /^MEM/ ||
|
||||
$2 ~ /^WG/ ||
|
||||
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
|
||||
$2 ~ /^__WCOREFLAG$/ {next}
|
||||
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
||||
|
|
|
@ -34,3 +34,52 @@ func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) {
|
|||
ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0]))
|
||||
return &ucred, nil
|
||||
}
|
||||
|
||||
// PktInfo4 encodes Inet4Pktinfo into a socket control message of type IP_PKTINFO.
|
||||
func PktInfo4(info *Inet4Pktinfo) []byte {
|
||||
b := make([]byte, CmsgSpace(SizeofInet4Pktinfo))
|
||||
h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
|
||||
h.Level = SOL_IP
|
||||
h.Type = IP_PKTINFO
|
||||
h.SetLen(CmsgLen(SizeofInet4Pktinfo))
|
||||
*(*Inet4Pktinfo)(h.data(0)) = *info
|
||||
return b
|
||||
}
|
||||
|
||||
// PktInfo6 encodes Inet6Pktinfo into a socket control message of type IPV6_PKTINFO.
|
||||
func PktInfo6(info *Inet6Pktinfo) []byte {
|
||||
b := make([]byte, CmsgSpace(SizeofInet6Pktinfo))
|
||||
h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
|
||||
h.Level = SOL_IPV6
|
||||
h.Type = IPV6_PKTINFO
|
||||
h.SetLen(CmsgLen(SizeofInet6Pktinfo))
|
||||
*(*Inet6Pktinfo)(h.data(0)) = *info
|
||||
return b
|
||||
}
|
||||
|
||||
// ParseOrigDstAddr decodes a socket control message containing the original
|
||||
// destination address. To receive such a message the IP_RECVORIGDSTADDR or
|
||||
// IPV6_RECVORIGDSTADDR option must be enabled on the socket.
|
||||
func ParseOrigDstAddr(m *SocketControlMessage) (Sockaddr, error) {
|
||||
switch {
|
||||
case m.Header.Level == SOL_IP && m.Header.Type == IP_ORIGDSTADDR:
|
||||
pp := (*RawSockaddrInet4)(unsafe.Pointer(&m.Data[0]))
|
||||
sa := new(SockaddrInet4)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
|
||||
case m.Header.Level == SOL_IPV6 && m.Header.Type == IPV6_ORIGDSTADDR:
|
||||
pp := (*RawSockaddrInet6)(unsafe.Pointer(&m.Data[0]))
|
||||
sa := new(SockaddrInet6)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
sa.ZoneId = pp.Scope_id
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
|
||||
default:
|
||||
return nil, EINVAL
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,9 +70,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
|
||||
p[0] = byte(sa.Port >> 8)
|
||||
p[1] = byte(sa.Port)
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
sa.raw.Addr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil
|
||||
}
|
||||
|
||||
|
@ -85,9 +83,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
p[0] = byte(sa.Port >> 8)
|
||||
p[1] = byte(sa.Port)
|
||||
sa.raw.Scope_id = sa.ZoneId
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
sa.raw.Addr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil
|
||||
}
|
||||
|
||||
|
@ -261,9 +257,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
sa := new(SockaddrInet4)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
|
||||
case AF_INET6:
|
||||
|
@ -272,9 +266,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
sa.ZoneId = pp.Scope_id
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
}
|
||||
return nil, EAFNOSUPPORT
|
||||
|
@ -385,6 +377,11 @@ func (w WaitStatus) TrapCause() int { return -1 }
|
|||
|
||||
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
||||
|
||||
//sys fsyncRange(fd int, how int, start int64, length int64) (err error) = fsync_range
|
||||
func Fsync(fd int) error {
|
||||
return fsyncRange(fd, O_SYNC, 0, 0)
|
||||
}
|
||||
|
||||
/*
|
||||
* Direct access
|
||||
*/
|
||||
|
@ -401,7 +398,6 @@ func (w WaitStatus) TrapCause() int { return -1 }
|
|||
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||
//sys Fdatasync(fd int) (err error)
|
||||
//sys Fsync(fd int) (err error)
|
||||
// readdir_r
|
||||
//sysnb Getpgid(pid int) (pgid int, err error)
|
||||
|
||||
|
@ -523,8 +519,10 @@ func Pipe(p []int) (err error) {
|
|||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe(&pp)
|
||||
if err == nil {
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -163,9 +163,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
|
||||
p[0] = byte(sa.Port >> 8)
|
||||
p[1] = byte(sa.Port)
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
sa.raw.Addr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
|
||||
}
|
||||
|
||||
|
@ -179,9 +177,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
p[0] = byte(sa.Port >> 8)
|
||||
p[1] = byte(sa.Port)
|
||||
sa.raw.Scope_id = sa.ZoneId
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
sa.raw.Addr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
|
||||
}
|
||||
|
||||
|
@ -210,9 +206,7 @@ func (sa *SockaddrDatalink) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
sa.raw.Nlen = sa.Nlen
|
||||
sa.raw.Alen = sa.Alen
|
||||
sa.raw.Slen = sa.Slen
|
||||
for i := 0; i < len(sa.raw.Data); i++ {
|
||||
sa.raw.Data[i] = sa.Data[i]
|
||||
}
|
||||
sa.raw.Data = sa.Data
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrDatalink, nil
|
||||
}
|
||||
|
||||
|
@ -228,9 +222,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
sa.Nlen = pp.Nlen
|
||||
sa.Alen = pp.Alen
|
||||
sa.Slen = pp.Slen
|
||||
for i := 0; i < len(sa.Data); i++ {
|
||||
sa.Data[i] = pp.Data[i]
|
||||
}
|
||||
sa.Data = pp.Data
|
||||
return sa, nil
|
||||
|
||||
case AF_UNIX:
|
||||
|
@ -262,9 +254,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
sa := new(SockaddrInet4)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
|
||||
case AF_INET6:
|
||||
|
@ -273,9 +263,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
sa.ZoneId = pp.Scope_id
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
}
|
||||
return anyToSockaddrGOOS(fd, rsa)
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
//sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno)
|
||||
|
||||
func fdopendir(fd int) (dir uintptr, err error) {
|
||||
r0, _, e1 := syscall_syscallPtr(funcPC(libc_fdopendir_trampoline), uintptr(fd), 0, 0)
|
||||
r0, _, e1 := syscall_syscallPtr(libc_fdopendir_trampoline_addr, uintptr(fd), 0, 0)
|
||||
dir = uintptr(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
|
@ -25,7 +25,7 @@ func fdopendir(fd int) (dir uintptr, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func libc_fdopendir_trampoline()
|
||||
var libc_fdopendir_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
package unix
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
@ -47,6 +48,30 @@ func (sa *SockaddrCtl) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
return unsafe.Pointer(&sa.raw), SizeofSockaddrCtl, nil
|
||||
}
|
||||
|
||||
// SockaddrVM implements the Sockaddr interface for AF_VSOCK type sockets.
|
||||
// SockaddrVM provides access to Darwin VM sockets: a mechanism that enables
|
||||
// bidirectional communication between a hypervisor and its guest virtual
|
||||
// machines.
|
||||
type SockaddrVM struct {
|
||||
// CID and Port specify a context ID and port address for a VM socket.
|
||||
// Guests have a unique CID, and hosts may have a well-known CID of:
|
||||
// - VMADDR_CID_HYPERVISOR: refers to the hypervisor process.
|
||||
// - VMADDR_CID_LOCAL: refers to local communication (loopback).
|
||||
// - VMADDR_CID_HOST: refers to other processes on the host.
|
||||
CID uint32
|
||||
Port uint32
|
||||
raw RawSockaddrVM
|
||||
}
|
||||
|
||||
func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
sa.raw.Len = SizeofSockaddrVM
|
||||
sa.raw.Family = AF_VSOCK
|
||||
sa.raw.Port = sa.Port
|
||||
sa.raw.Cid = sa.CID
|
||||
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
|
||||
}
|
||||
|
||||
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
switch rsa.Addr.Family {
|
||||
case AF_SYSTEM:
|
||||
|
@ -57,6 +82,13 @@ func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
sa.Unit = pp.Sc_unit
|
||||
return sa, nil
|
||||
}
|
||||
case AF_VSOCK:
|
||||
pp := (*RawSockaddrVM)(unsafe.Pointer(rsa))
|
||||
sa := &SockaddrVM{
|
||||
CID: pp.Cid,
|
||||
Port: pp.Port,
|
||||
}
|
||||
return sa, nil
|
||||
}
|
||||
return nil, EAFNOSUPPORT
|
||||
}
|
||||
|
@ -127,8 +159,10 @@ func Pipe(p []int) (err error) {
|
|||
}
|
||||
var x [2]int32
|
||||
err = pipe(&x)
|
||||
if err == nil {
|
||||
p[0] = int(x[0])
|
||||
p[1] = int(x[1])
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -378,6 +412,17 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||
return
|
||||
}
|
||||
|
||||
func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
|
||||
var value IPMreqn
|
||||
vallen := _Socklen(SizeofIPMreqn)
|
||||
errno := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||
return &value, errno
|
||||
}
|
||||
|
||||
func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
|
||||
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
|
||||
}
|
||||
|
||||
// GetsockoptXucred is a getsockopt wrapper that returns an Xucred struct.
|
||||
// The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively.
|
||||
func GetsockoptXucred(fd, level, opt int) (*Xucred, error) {
|
||||
|
@ -387,8 +432,62 @@ func GetsockoptXucred(fd, level, opt int) (*Xucred, error) {
|
|||
return x, err
|
||||
}
|
||||
|
||||
func SysctlKinfoProc(name string, args ...int) (*KinfoProc, error) {
|
||||
mib, err := sysctlmib(name, args...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var kinfo KinfoProc
|
||||
n := uintptr(SizeofKinfoProc)
|
||||
if err := sysctl(mib, (*byte)(unsafe.Pointer(&kinfo)), &n, nil, 0); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if n != SizeofKinfoProc {
|
||||
return nil, EIO
|
||||
}
|
||||
return &kinfo, nil
|
||||
}
|
||||
|
||||
func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, 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
|
||||
}
|
||||
if n%SizeofKinfoProc != 0 {
|
||||
return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc)
|
||||
}
|
||||
|
||||
// Read into buffer of that size.
|
||||
buf := make([]KinfoProc, n/SizeofKinfoProc)
|
||||
if err := sysctl(mib, (*byte)(unsafe.Pointer(&buf[0])), &n, nil, 0); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if n%SizeofKinfoProc != 0 {
|
||||
return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc)
|
||||
}
|
||||
|
||||
// The actual call may return less than the original reported required
|
||||
// size so ensure we deal with that.
|
||||
return buf[:n/SizeofKinfoProc], nil
|
||||
}
|
||||
|
||||
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
|
||||
|
||||
//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)
|
||||
//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error)
|
||||
//sys shmdt(addr uintptr) (err error)
|
||||
//sys shmget(key int, size int, flag int) (id int, err error)
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
|
@ -546,10 +645,6 @@ func GetsockoptXucred(fd, level, opt int) (*Xucred, error) {
|
|||
// Msgget
|
||||
// Msgsnd
|
||||
// Msgrcv
|
||||
// Shmat
|
||||
// Shmctl
|
||||
// Shmdt
|
||||
// Shmget
|
||||
// Shm_open
|
||||
// Shm_unlink
|
||||
// Sem_open
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
// 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.
|
||||
|
||||
//go:build 386 && darwin
|
||||
// +build 386,darwin
|
||||
|
||||
package unix
|
||||
|
||||
import "syscall"
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
|
||||
}
|
||||
|
||||
func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
||||
}
|
||||
|
||||
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 (msghdr *Msghdr) SetIovlen(length int) {
|
||||
msghdr.Iovlen = int32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
||||
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
|
||||
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
|
||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||
//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
|
||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
|
@ -1,51 +0,0 @@
|
|||
// 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"
|
||||
|
||||
func ptrace1(request int, pid int, addr uintptr, data uintptr) error {
|
||||
return ENOTSUP
|
||||
}
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
|
||||
}
|
||||
|
||||
func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
||||
}
|
||||
|
||||
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 (msghdr *Msghdr) SetIovlen(length int) {
|
||||
msghdr.Iovlen = int32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
|
||||
|
||||
//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, stat *Statfs_t) (err error)
|
||||
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
|
||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||
//sys Stat(path string, stat *Stat_t) (err error)
|
||||
//sys Statfs(path string, stat *Statfs_t) (err error)
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
import _ "unsafe"
|
||||
|
||||
// Implemented in the runtime package (runtime/sys_darwin.go)
|
||||
func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
||||
|
@ -25,10 +25,3 @@ func syscall_syscallPtr(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
|||
//go:linkname syscall_rawSyscall syscall.rawSyscall
|
||||
//go:linkname syscall_rawSyscall6 syscall.rawSyscall6
|
||||
//go:linkname syscall_syscallPtr syscall.syscallPtr
|
||||
|
||||
// Find the entry point for f. See comments in runtime/proc.go for the
|
||||
// function of the same name.
|
||||
//go:nosplit
|
||||
func funcPC(f func()) uintptr {
|
||||
return **(**uintptr)(unsafe.Pointer(&f))
|
||||
}
|
||||
|
|
|
@ -101,7 +101,10 @@ func Pipe(p []int) (err error) {
|
|||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
p[0], p[1], err = pipe()
|
||||
r, w, err := pipe()
|
||||
if err == nil {
|
||||
p[0], p[1] = r, w
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -114,7 +117,10 @@ func Pipe2(p []int, flags int) (err error) {
|
|||
var pp [2]_C_int
|
||||
// pipe2 on dragonfly takes an fds array as an argument, but still
|
||||
// returns the file descriptors.
|
||||
p[0], p[1], err = pipe2(&pp, flags)
|
||||
r, w, err := pipe2(&pp, flags)
|
||||
if err == nil {
|
||||
p[0], p[1] = r, w
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -110,8 +110,10 @@ func Pipe2(p []int, flags int) error {
|
|||
}
|
||||
var pp [2]_C_int
|
||||
err := pipe2(&pp, flags)
|
||||
if err == nil {
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2009 The Go Authors. All rights reserved.
|
||||
// Copyright 2021 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.
|
||||
|
||||
|
@ -9,7 +9,11 @@
|
|||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func bytes2iovec(bs [][]byte) []Iovec {
|
||||
iovecs := make([]Iovec, len(bs))
|
||||
|
@ -76,3 +80,107 @@ func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) {
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
//sys putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error)
|
||||
|
||||
func Putmsg(fd int, cl []byte, data []byte, flags int) (err error) {
|
||||
var clp, datap *strbuf
|
||||
if len(cl) > 0 {
|
||||
clp = &strbuf{
|
||||
Len: int32(len(cl)),
|
||||
Buf: (*int8)(unsafe.Pointer(&cl[0])),
|
||||
}
|
||||
}
|
||||
if len(data) > 0 {
|
||||
datap = &strbuf{
|
||||
Len: int32(len(data)),
|
||||
Buf: (*int8)(unsafe.Pointer(&data[0])),
|
||||
}
|
||||
}
|
||||
return putmsg(fd, clp, datap, flags)
|
||||
}
|
||||
|
||||
//sys getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error)
|
||||
|
||||
func Getmsg(fd int, cl []byte, data []byte) (retCl []byte, retData []byte, flags int, err error) {
|
||||
var clp, datap *strbuf
|
||||
if len(cl) > 0 {
|
||||
clp = &strbuf{
|
||||
Maxlen: int32(len(cl)),
|
||||
Buf: (*int8)(unsafe.Pointer(&cl[0])),
|
||||
}
|
||||
}
|
||||
if len(data) > 0 {
|
||||
datap = &strbuf{
|
||||
Maxlen: int32(len(data)),
|
||||
Buf: (*int8)(unsafe.Pointer(&data[0])),
|
||||
}
|
||||
}
|
||||
|
||||
if err = getmsg(fd, clp, datap, &flags); err != nil {
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
||||
if len(cl) > 0 {
|
||||
retCl = cl[:clp.Len]
|
||||
}
|
||||
if len(data) > 0 {
|
||||
retData = data[:datap.Len]
|
||||
}
|
||||
return retCl, retData, flags, nil
|
||||
}
|
||||
|
||||
func IoctlSetIntRetInt(fd int, req uint, arg int) (int, error) {
|
||||
return ioctlRet(fd, req, uintptr(arg))
|
||||
}
|
||||
|
||||
func IoctlSetString(fd int, req uint, val string) error {
|
||||
bs := make([]byte, len(val)+1)
|
||||
copy(bs[:len(bs)-1], val)
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&bs[0])))
|
||||
runtime.KeepAlive(&bs[0])
|
||||
return err
|
||||
}
|
||||
|
||||
// Lifreq Helpers
|
||||
|
||||
func (l *Lifreq) SetName(name string) error {
|
||||
if len(name) >= len(l.Name) {
|
||||
return fmt.Errorf("name cannot be more than %d characters", len(l.Name)-1)
|
||||
}
|
||||
for i := range name {
|
||||
l.Name[i] = int8(name[i])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *Lifreq) SetLifruInt(d int) {
|
||||
*(*int)(unsafe.Pointer(&l.Lifru[0])) = d
|
||||
}
|
||||
|
||||
func (l *Lifreq) GetLifruInt() int {
|
||||
return *(*int)(unsafe.Pointer(&l.Lifru[0]))
|
||||
}
|
||||
|
||||
func (l *Lifreq) SetLifruUint(d uint) {
|
||||
*(*uint)(unsafe.Pointer(&l.Lifru[0])) = d
|
||||
}
|
||||
|
||||
func (l *Lifreq) GetLifruUint() uint {
|
||||
return *(*uint)(unsafe.Pointer(&l.Lifru[0]))
|
||||
}
|
||||
|
||||
func IoctlLifreq(fd int, req uint, l *Lifreq) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(l)))
|
||||
}
|
||||
|
||||
// Strioctl Helpers
|
||||
|
||||
func (s *Strioctl) SetInt(i int) {
|
||||
s.Len = int32(unsafe.Sizeof(i))
|
||||
s.Dp = (*int8)(unsafe.Pointer(&i))
|
||||
}
|
||||
|
||||
func IoctlSetStrioctlRetInt(fd int, req uint, s *Strioctl) (int, error) {
|
||||
return ioctlRet(fd, req, uintptr(unsafe.Pointer(s)))
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ package unix
|
|||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"time"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
|
@ -38,6 +38,13 @@ func Creat(path string, mode uint32) (fd int, err error) {
|
|||
return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
|
||||
}
|
||||
|
||||
func EpollCreate(size int) (fd int, err error) {
|
||||
if size <= 0 {
|
||||
return -1, EINVAL
|
||||
}
|
||||
return EpollCreate1(0)
|
||||
}
|
||||
|
||||
//sys FanotifyInit(flags uint, event_f_flags uint) (fd int, err error)
|
||||
//sys fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error)
|
||||
|
||||
|
@ -66,171 +73,22 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
|
|||
return fchmodat(dirfd, path, mode)
|
||||
}
|
||||
|
||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||
|
||||
// ioctl itself should not be exposed directly, but additional get/set
|
||||
// functions for specific types are permissible.
|
||||
|
||||
// IoctlRetInt performs an ioctl operation specified by req on a device
|
||||
// associated with opened file descriptor fd, and returns a non-negative
|
||||
// integer that is returned by the ioctl syscall.
|
||||
func IoctlRetInt(fd int, req uint) (int, error) {
|
||||
ret, _, err := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), 0)
|
||||
if err != 0 {
|
||||
return 0, err
|
||||
}
|
||||
return int(ret), nil
|
||||
func InotifyInit() (fd int, err error) {
|
||||
return InotifyInit1(0)
|
||||
}
|
||||
|
||||
func IoctlSetRTCTime(fd int, value *RTCTime) error {
|
||||
err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value)))
|
||||
runtime.KeepAlive(value)
|
||||
return err
|
||||
}
|
||||
//sys ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL
|
||||
//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL
|
||||
|
||||
func IoctlSetRTCWkAlrm(fd int, value *RTCWkAlrm) error {
|
||||
err := ioctl(fd, RTC_WKALM_SET, uintptr(unsafe.Pointer(value)))
|
||||
runtime.KeepAlive(value)
|
||||
return err
|
||||
}
|
||||
|
||||
func IoctlGetUint32(fd int, req uint) (uint32, error) {
|
||||
var value uint32
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
return value, err
|
||||
}
|
||||
|
||||
func IoctlGetRTCTime(fd int) (*RTCTime, error) {
|
||||
var value RTCTime
|
||||
err := ioctl(fd, RTC_RD_TIME, uintptr(unsafe.Pointer(&value)))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
// IoctlGetWatchdogInfo fetches information about a watchdog device from the
|
||||
// Linux watchdog API. For more information, see:
|
||||
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
||||
func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) {
|
||||
var value WatchdogInfo
|
||||
err := ioctl(fd, WDIOC_GETSUPPORT, uintptr(unsafe.Pointer(&value)))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) {
|
||||
var value RTCWkAlrm
|
||||
err := ioctl(fd, RTC_WKALM_RD, uintptr(unsafe.Pointer(&value)))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
// IoctlFileCloneRange performs an FICLONERANGE ioctl operation to clone the
|
||||
// range of data conveyed in value to the file associated with the file
|
||||
// descriptor destFd. See the ioctl_ficlonerange(2) man page for details.
|
||||
func IoctlFileCloneRange(destFd int, value *FileCloneRange) error {
|
||||
err := ioctl(destFd, FICLONERANGE, uintptr(unsafe.Pointer(value)))
|
||||
runtime.KeepAlive(value)
|
||||
return err
|
||||
}
|
||||
|
||||
// IoctlFileClone performs an FICLONE ioctl operation to clone the entire file
|
||||
// associated with the file description srcFd to the file associated with the
|
||||
// file descriptor destFd. See the ioctl_ficlone(2) man page for details.
|
||||
func IoctlFileClone(destFd, srcFd int) error {
|
||||
return ioctl(destFd, FICLONE, uintptr(srcFd))
|
||||
}
|
||||
|
||||
type FileDedupeRange struct {
|
||||
Src_offset uint64
|
||||
Src_length uint64
|
||||
Reserved1 uint16
|
||||
Reserved2 uint32
|
||||
Info []FileDedupeRangeInfo
|
||||
}
|
||||
|
||||
type FileDedupeRangeInfo struct {
|
||||
Dest_fd int64
|
||||
Dest_offset uint64
|
||||
Bytes_deduped uint64
|
||||
Status int32
|
||||
Reserved uint32
|
||||
}
|
||||
|
||||
// IoctlFileDedupeRange performs an FIDEDUPERANGE ioctl operation to share the
|
||||
// range of data conveyed in value from the file associated with the file
|
||||
// descriptor srcFd to the value.Info destinations. See the
|
||||
// ioctl_fideduperange(2) man page for details.
|
||||
func IoctlFileDedupeRange(srcFd int, value *FileDedupeRange) error {
|
||||
buf := make([]byte, SizeofRawFileDedupeRange+
|
||||
len(value.Info)*SizeofRawFileDedupeRangeInfo)
|
||||
rawrange := (*RawFileDedupeRange)(unsafe.Pointer(&buf[0]))
|
||||
rawrange.Src_offset = value.Src_offset
|
||||
rawrange.Src_length = value.Src_length
|
||||
rawrange.Dest_count = uint16(len(value.Info))
|
||||
rawrange.Reserved1 = value.Reserved1
|
||||
rawrange.Reserved2 = value.Reserved2
|
||||
|
||||
for i := range value.Info {
|
||||
rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer(
|
||||
uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) +
|
||||
uintptr(i*SizeofRawFileDedupeRangeInfo)))
|
||||
rawinfo.Dest_fd = value.Info[i].Dest_fd
|
||||
rawinfo.Dest_offset = value.Info[i].Dest_offset
|
||||
rawinfo.Bytes_deduped = value.Info[i].Bytes_deduped
|
||||
rawinfo.Status = value.Info[i].Status
|
||||
rawinfo.Reserved = value.Info[i].Reserved
|
||||
}
|
||||
|
||||
err := ioctl(srcFd, FIDEDUPERANGE, uintptr(unsafe.Pointer(&buf[0])))
|
||||
|
||||
// Output
|
||||
for i := range value.Info {
|
||||
rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer(
|
||||
uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) +
|
||||
uintptr(i*SizeofRawFileDedupeRangeInfo)))
|
||||
value.Info[i].Dest_fd = rawinfo.Dest_fd
|
||||
value.Info[i].Dest_offset = rawinfo.Dest_offset
|
||||
value.Info[i].Bytes_deduped = rawinfo.Bytes_deduped
|
||||
value.Info[i].Status = rawinfo.Status
|
||||
value.Info[i].Reserved = rawinfo.Reserved
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// IoctlWatchdogKeepalive issues a keepalive ioctl to a watchdog device. For
|
||||
// more information, see:
|
||||
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
||||
func IoctlWatchdogKeepalive(fd int) error {
|
||||
return ioctl(fd, WDIOC_KEEPALIVE, 0)
|
||||
}
|
||||
|
||||
func IoctlHIDGetDesc(fd int, value *HIDRawReportDescriptor) error {
|
||||
err := ioctl(fd, HIDIOCGRDESC, uintptr(unsafe.Pointer(value)))
|
||||
runtime.KeepAlive(value)
|
||||
return err
|
||||
}
|
||||
|
||||
func IoctlHIDGetRawInfo(fd int) (*HIDRawDevInfo, error) {
|
||||
var value HIDRawDevInfo
|
||||
err := ioctl(fd, HIDIOCGRAWINFO, uintptr(unsafe.Pointer(&value)))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func IoctlHIDGetRawName(fd int) (string, error) {
|
||||
var value [_HIDIOCGRAWNAME_LEN]byte
|
||||
err := ioctl(fd, _HIDIOCGRAWNAME, uintptr(unsafe.Pointer(&value[0])))
|
||||
return ByteSliceToString(value[:]), err
|
||||
}
|
||||
|
||||
func IoctlHIDGetRawPhys(fd int) (string, error) {
|
||||
var value [_HIDIOCGRAWPHYS_LEN]byte
|
||||
err := ioctl(fd, _HIDIOCGRAWPHYS, uintptr(unsafe.Pointer(&value[0])))
|
||||
return ByteSliceToString(value[:]), err
|
||||
}
|
||||
|
||||
func IoctlHIDGetRawUniq(fd int) (string, error) {
|
||||
var value [_HIDIOCGRAWUNIQ_LEN]byte
|
||||
err := ioctl(fd, _HIDIOCGRAWUNIQ, uintptr(unsafe.Pointer(&value[0])))
|
||||
return ByteSliceToString(value[:]), err
|
||||
}
|
||||
// ioctl itself should not be exposed directly, but additional get/set functions
|
||||
// for specific types are permissible. These are defined in ioctl.go and
|
||||
// ioctl_linux.go.
|
||||
//
|
||||
// The third argument to ioctl is often a pointer but sometimes an integer.
|
||||
// Callers should use ioctlPtr when the third argument is a pointer and ioctl
|
||||
// when the third argument is an integer.
|
||||
//
|
||||
// TODO: some existing code incorrectly uses ioctl when it should use ioctlPtr.
|
||||
|
||||
//sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
|
||||
|
||||
|
@ -262,6 +120,25 @@ func Openat2(dirfd int, path string, how *OpenHow) (fd int, err error) {
|
|||
return openat2(dirfd, path, how, SizeofOpenHow)
|
||||
}
|
||||
|
||||
func Pipe(p []int) error {
|
||||
return Pipe2(p, 0)
|
||||
}
|
||||
|
||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||
|
||||
func Pipe2(p []int, flags int) error {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err := pipe2(&pp, flags)
|
||||
if err == nil {
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
|
||||
|
||||
func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
||||
|
@ -271,6 +148,15 @@ func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error
|
|||
return ppoll(&fds[0], len(fds), timeout, sigmask)
|
||||
}
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
var ts *Timespec
|
||||
if timeout >= 0 {
|
||||
ts = new(Timespec)
|
||||
*ts = NsecToTimespec(int64(timeout) * 1e6)
|
||||
}
|
||||
return Ppoll(fds, ts, nil)
|
||||
}
|
||||
|
||||
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
||||
|
||||
func Readlink(path string, buf []byte) (n int, err error) {
|
||||
|
@ -321,27 +207,7 @@ func Utimes(path string, tv []Timeval) error {
|
|||
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (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])), 0)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
// If the utimensat syscall isn't available (utimensat was added to Linux
|
||||
// in 2.6.22, Released, 8 July 2007) then fall back to utimes
|
||||
var tv [2]Timeval
|
||||
for i := 0; i < 2; i++ {
|
||||
tv[i] = NsecToTimeval(TimespecToNsec(ts[i]))
|
||||
}
|
||||
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||
return UtimesNanoAt(AT_FDCWD, path, ts, 0)
|
||||
}
|
||||
|
||||
func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
|
||||
|
@ -509,9 +375,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
|
||||
p[0] = byte(sa.Port >> 8)
|
||||
p[1] = byte(sa.Port)
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
sa.raw.Addr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil
|
||||
}
|
||||
|
||||
|
@ -524,9 +388,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
p[0] = byte(sa.Port >> 8)
|
||||
p[1] = byte(sa.Port)
|
||||
sa.raw.Scope_id = sa.ZoneId
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
sa.raw.Addr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil
|
||||
}
|
||||
|
||||
|
@ -575,9 +437,7 @@ func (sa *SockaddrLinklayer) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
sa.raw.Hatype = sa.Hatype
|
||||
sa.raw.Pkttype = sa.Pkttype
|
||||
sa.raw.Halen = sa.Halen
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
sa.raw.Addr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrLinklayer, nil
|
||||
}
|
||||
|
||||
|
@ -857,9 +717,11 @@ type SockaddrVM struct {
|
|||
// CID and Port specify a context ID and port address for a VM socket.
|
||||
// Guests have a unique CID, and hosts may have a well-known CID of:
|
||||
// - VMADDR_CID_HYPERVISOR: refers to the hypervisor process.
|
||||
// - VMADDR_CID_LOCAL: refers to local communication (loopback).
|
||||
// - VMADDR_CID_HOST: refers to other processes on the host.
|
||||
CID uint32
|
||||
Port uint32
|
||||
Flags uint8
|
||||
raw RawSockaddrVM
|
||||
}
|
||||
|
||||
|
@ -867,6 +729,7 @@ func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
sa.raw.Family = AF_VSOCK
|
||||
sa.raw.Port = sa.Port
|
||||
sa.raw.Cid = sa.CID
|
||||
sa.raw.Flags = sa.Flags
|
||||
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
|
||||
}
|
||||
|
@ -989,12 +852,10 @@ func (sa *SockaddrTIPC) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
if sa.Addr == nil {
|
||||
return nil, 0, EINVAL
|
||||
}
|
||||
|
||||
sa.raw.Family = AF_TIPC
|
||||
sa.raw.Scope = int8(sa.Scope)
|
||||
sa.raw.Addrtype = sa.Addr.tipcAddrtype()
|
||||
sa.raw.Addr = sa.Addr.tipcAddr()
|
||||
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrTIPC, nil
|
||||
}
|
||||
|
||||
|
@ -1008,9 +869,7 @@ type SockaddrL2TPIP struct {
|
|||
func (sa *SockaddrL2TPIP) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
sa.raw.Family = AF_INET
|
||||
sa.raw.Conn_id = sa.ConnId
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
sa.raw.Addr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrL2TPIP, nil
|
||||
}
|
||||
|
||||
|
@ -1026,9 +885,7 @@ func (sa *SockaddrL2TPIP6) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
sa.raw.Family = AF_INET6
|
||||
sa.raw.Conn_id = sa.ConnId
|
||||
sa.raw.Scope_id = sa.ZoneId
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
sa.raw.Addr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrL2TPIP6, nil
|
||||
}
|
||||
|
||||
|
@ -1061,6 +918,46 @@ func (sa *SockaddrIUCV) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
return unsafe.Pointer(&sa.raw), SizeofSockaddrIUCV, nil
|
||||
}
|
||||
|
||||
type SockaddrNFC struct {
|
||||
DeviceIdx uint32
|
||||
TargetIdx uint32
|
||||
NFCProtocol uint32
|
||||
raw RawSockaddrNFC
|
||||
}
|
||||
|
||||
func (sa *SockaddrNFC) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
sa.raw.Sa_family = AF_NFC
|
||||
sa.raw.Dev_idx = sa.DeviceIdx
|
||||
sa.raw.Target_idx = sa.TargetIdx
|
||||
sa.raw.Nfc_protocol = sa.NFCProtocol
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrNFC, nil
|
||||
}
|
||||
|
||||
type SockaddrNFCLLCP struct {
|
||||
DeviceIdx uint32
|
||||
TargetIdx uint32
|
||||
NFCProtocol uint32
|
||||
DestinationSAP uint8
|
||||
SourceSAP uint8
|
||||
ServiceName string
|
||||
raw RawSockaddrNFCLLCP
|
||||
}
|
||||
|
||||
func (sa *SockaddrNFCLLCP) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
sa.raw.Sa_family = AF_NFC
|
||||
sa.raw.Dev_idx = sa.DeviceIdx
|
||||
sa.raw.Target_idx = sa.TargetIdx
|
||||
sa.raw.Nfc_protocol = sa.NFCProtocol
|
||||
sa.raw.Dsap = sa.DestinationSAP
|
||||
sa.raw.Ssap = sa.SourceSAP
|
||||
if len(sa.ServiceName) > len(sa.raw.Service_name) {
|
||||
return nil, 0, EINVAL
|
||||
}
|
||||
copy(sa.raw.Service_name[:], sa.ServiceName)
|
||||
sa.raw.SetServiceNameLen(len(sa.ServiceName))
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrNFCLLCP, nil
|
||||
}
|
||||
|
||||
var socketProtocol = func(fd int) (int, error) {
|
||||
return GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
|
||||
}
|
||||
|
@ -1084,9 +981,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
sa.Hatype = pp.Hatype
|
||||
sa.Pkttype = pp.Pkttype
|
||||
sa.Halen = pp.Halen
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
|
||||
case AF_UNIX:
|
||||
|
@ -1125,18 +1020,14 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
pp := (*RawSockaddrL2TPIP)(unsafe.Pointer(rsa))
|
||||
sa := new(SockaddrL2TPIP)
|
||||
sa.ConnId = pp.Conn_id
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
default:
|
||||
pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
|
||||
sa := new(SockaddrInet4)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
}
|
||||
|
||||
|
@ -1152,9 +1043,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
sa := new(SockaddrL2TPIP6)
|
||||
sa.ConnId = pp.Conn_id
|
||||
sa.ZoneId = pp.Scope_id
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
default:
|
||||
pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa))
|
||||
|
@ -1162,9 +1051,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
sa.ZoneId = pp.Scope_id
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
}
|
||||
|
||||
|
@ -1173,6 +1060,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
sa := &SockaddrVM{
|
||||
CID: pp.Cid,
|
||||
Port: pp.Port,
|
||||
Flags: pp.Flags,
|
||||
}
|
||||
return sa, nil
|
||||
case AF_BLUETOOTH:
|
||||
|
@ -1300,6 +1188,37 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
}
|
||||
return sa, nil
|
||||
}
|
||||
case AF_NFC:
|
||||
proto, err := socketProtocol(fd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch proto {
|
||||
case NFC_SOCKPROTO_RAW:
|
||||
pp := (*RawSockaddrNFC)(unsafe.Pointer(rsa))
|
||||
sa := &SockaddrNFC{
|
||||
DeviceIdx: pp.Dev_idx,
|
||||
TargetIdx: pp.Target_idx,
|
||||
NFCProtocol: pp.Nfc_protocol,
|
||||
}
|
||||
return sa, nil
|
||||
case NFC_SOCKPROTO_LLCP:
|
||||
pp := (*RawSockaddrNFCLLCP)(unsafe.Pointer(rsa))
|
||||
if uint64(pp.Service_name_len) > uint64(len(pp.Service_name)) {
|
||||
return nil, EINVAL
|
||||
}
|
||||
sa := &SockaddrNFCLLCP{
|
||||
DeviceIdx: pp.Dev_idx,
|
||||
TargetIdx: pp.Target_idx,
|
||||
NFCProtocol: pp.Nfc_protocol,
|
||||
DestinationSAP: pp.Dsap,
|
||||
SourceSAP: pp.Ssap,
|
||||
ServiceName: string(pp.Service_name[:pp.Service_name_len]),
|
||||
}
|
||||
return sa, nil
|
||||
default:
|
||||
return nil, EINVAL
|
||||
}
|
||||
}
|
||||
return nil, EAFNOSUPPORT
|
||||
}
|
||||
|
@ -1307,7 +1226,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
||||
var rsa RawSockaddrAny
|
||||
var len _Socklen = SizeofSockaddrAny
|
||||
nfd, err = accept(fd, &rsa, &len)
|
||||
nfd, err = accept4(fd, &rsa, &len, 0)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -1429,6 +1348,13 @@ func SetsockoptTpacketReq3(fd, level, opt int, tp *TpacketReq3) error {
|
|||
return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp))
|
||||
}
|
||||
|
||||
func SetsockoptTCPRepairOpt(fd, level, opt int, o []TCPRepairOpt) (err error) {
|
||||
if len(o) == 0 {
|
||||
return EINVAL
|
||||
}
|
||||
return setsockopt(fd, level, opt, unsafe.Pointer(&o[0]), uintptr(SizeofTCPRepairOpt*len(o)))
|
||||
}
|
||||
|
||||
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
|
||||
|
||||
// KeyctlInt calls keyctl commands in which each argument is an int.
|
||||
|
@ -1852,6 +1778,16 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
|||
return mount(source, target, fstype, flags, datap)
|
||||
}
|
||||
|
||||
//sys mountSetattr(dirfd int, pathname string, flags uint, attr *MountAttr, size uintptr) (err error) = SYS_MOUNT_SETATTR
|
||||
|
||||
// MountSetattr is a wrapper for mount_setattr(2).
|
||||
// https://man7.org/linux/man-pages/man2/mount_setattr.2.html
|
||||
//
|
||||
// Requires kernel >= 5.12.
|
||||
func MountSetattr(dirfd int, pathname string, flags uint, attr *MountAttr) error {
|
||||
return mountSetattr(dirfd, pathname, flags, attr, unsafe.Sizeof(*attr))
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
|
@ -1883,12 +1819,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||
//sys Dup(oldfd int) (fd int, err error)
|
||||
|
||||
func Dup2(oldfd, newfd int) error {
|
||||
// Android O and newer blocks dup2; riscv and arm64 don't implement dup2.
|
||||
if runtime.GOOS == "android" || runtime.GOARCH == "riscv64" || runtime.GOARCH == "arm64" {
|
||||
return Dup3(oldfd, newfd, 0)
|
||||
}
|
||||
return dup2(oldfd, newfd)
|
||||
}
|
||||
|
||||
//sys Dup3(oldfd int, newfd int, flags int) (err error)
|
||||
//sysnb EpollCreate1(flag int) (fd int, err error)
|
||||
|
@ -1940,7 +1872,7 @@ func Getpgrp() (pid int) {
|
|||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||
//sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error)
|
||||
//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
|
||||
//sysnb prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64
|
||||
//sysnb Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64
|
||||
//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)
|
||||
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6
|
||||
//sys read(fd int, p []byte) (n int, err error)
|
||||
|
@ -2375,11 +2307,64 @@ type RemoteIovec struct {
|
|||
//sys ProcessVMReadv(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_READV
|
||||
//sys ProcessVMWritev(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_WRITEV
|
||||
|
||||
//sys PidfdOpen(pid int, flags int) (fd int, err error) = SYS_PIDFD_OPEN
|
||||
//sys PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) = SYS_PIDFD_GETFD
|
||||
|
||||
//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)
|
||||
//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error)
|
||||
//sys shmdt(addr uintptr) (err error)
|
||||
//sys shmget(key int, size int, flag int) (id int, err error)
|
||||
|
||||
//sys getitimer(which int, currValue *Itimerval) (err error)
|
||||
//sys setitimer(which int, newValue *Itimerval, oldValue *Itimerval) (err error)
|
||||
|
||||
// MakeItimerval creates an Itimerval from interval and value durations.
|
||||
func MakeItimerval(interval, value time.Duration) Itimerval {
|
||||
return Itimerval{
|
||||
Interval: NsecToTimeval(interval.Nanoseconds()),
|
||||
Value: NsecToTimeval(value.Nanoseconds()),
|
||||
}
|
||||
}
|
||||
|
||||
// A value which may be passed to the which parameter for Getitimer and
|
||||
// Setitimer.
|
||||
type ItimerWhich int
|
||||
|
||||
// Possible which values for Getitimer and Setitimer.
|
||||
const (
|
||||
ItimerReal ItimerWhich = ITIMER_REAL
|
||||
ItimerVirtual ItimerWhich = ITIMER_VIRTUAL
|
||||
ItimerProf ItimerWhich = ITIMER_PROF
|
||||
)
|
||||
|
||||
// Getitimer wraps getitimer(2) to return the current value of the timer
|
||||
// specified by which.
|
||||
func Getitimer(which ItimerWhich) (Itimerval, error) {
|
||||
var it Itimerval
|
||||
if err := getitimer(int(which), &it); err != nil {
|
||||
return Itimerval{}, err
|
||||
}
|
||||
|
||||
return it, nil
|
||||
}
|
||||
|
||||
// Setitimer wraps setitimer(2) to arm or disarm the timer specified by which.
|
||||
// It returns the previous value of the timer.
|
||||
//
|
||||
// If the Itimerval argument is the zero value, the timer will be disarmed.
|
||||
func Setitimer(which ItimerWhich, it Itimerval) (Itimerval, error) {
|
||||
var prev Itimerval
|
||||
if err := setitimer(int(which), &it, &prev); err != nil {
|
||||
return Itimerval{}, err
|
||||
}
|
||||
|
||||
return prev, nil
|
||||
}
|
||||
|
||||
/*
|
||||
* Unimplemented
|
||||
*/
|
||||
// AfsSyscall
|
||||
// Alarm
|
||||
// ArchPrctl
|
||||
// Brk
|
||||
// ClockNanosleep
|
||||
|
@ -2395,7 +2380,6 @@ type RemoteIovec struct {
|
|||
// GetMempolicy
|
||||
// GetRobustList
|
||||
// GetThreadArea
|
||||
// Getitimer
|
||||
// Getpmsg
|
||||
// IoCancel
|
||||
// IoDestroy
|
||||
|
@ -2456,10 +2440,6 @@ type RemoteIovec struct {
|
|||
// SetRobustList
|
||||
// SetThreadArea
|
||||
// SetTidAddress
|
||||
// Shmat
|
||||
// Shmctl
|
||||
// Shmdt
|
||||
// Shmget
|
||||
// Sigaltstack
|
||||
// Swapoff
|
||||
// Swapon
|
||||
|
|
|
@ -19,36 +19,8 @@ func setTimeval(sec, usec int64) Timeval {
|
|||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
||||
}
|
||||
|
||||
//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 dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n 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
|
||||
|
@ -59,7 +31,6 @@ func Pipe2(p []int, flags int) (err error) {
|
|||
//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
|
||||
|
@ -105,7 +76,7 @@ const rlimInf32 = ^uint32(0)
|
|||
const rlimInf64 = ^uint64(0)
|
||||
|
||||
func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||
err = prlimit(0, resource, nil, rlim)
|
||||
err = Prlimit(0, resource, nil, rlim)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
|
@ -133,7 +104,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
|||
//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
|
||||
|
||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
||||
err = prlimit(0, resource, rlim, nil)
|
||||
err = Prlimit(0, resource, rlim, nil)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
|
@ -378,11 +349,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
if len(fds) == 0 {
|
||||
return poll(nil, 0, timeout)
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
|
||||
rsa.Service_name_len = uint32(length)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2022 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.
|
||||
|
||||
//go:build linux && (386 || amd64 || mips || mipsle || mips64 || mipsle || ppc64 || ppc64le || ppc || s390x || sparc64)
|
||||
// +build linux
|
||||
// +build 386 amd64 mips mipsle mips64 mipsle ppc64 ppc64le ppc s390x sparc64
|
||||
|
||||
package unix
|
||||
|
||||
// SYS_ALARM is not defined on arm or riscv, but is available for other GOARCH
|
||||
// values.
|
||||
|
||||
//sys Alarm(seconds uint) (remaining uint, err error)
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
package unix
|
||||
|
||||
//sys dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n 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)
|
||||
|
@ -21,17 +19,6 @@ package unix
|
|||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
||||
//sysnb Getuid() (uid int)
|
||||
//sysnb inotifyInit() (fd int, err error)
|
||||
|
||||
func InotifyInit() (fd int, err error) {
|
||||
// First try inotify_init1, because Android's seccomp policy blocks the latter.
|
||||
fd, err = InotifyInit1(0)
|
||||
if err == ENOSYS {
|
||||
fd, err = inotifyInit()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//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)
|
||||
|
@ -126,32 +113,6 @@ func setTimeval(sec, usec int64) Timeval {
|
|||
return Timeval{Sec: sec, Usec: usec}
|
||||
}
|
||||
|
||||
//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 }
|
||||
|
@ -172,13 +133,8 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint64(length)
|
||||
}
|
||||
|
||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
if len(fds) == 0 {
|
||||
return poll(nil, 0, timeout)
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
|
||||
rsa.Service_name_len = uint64(length)
|
||||
}
|
||||
|
||||
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||
|
|
|
@ -19,36 +19,6 @@ func setTimeval(sec, usec int64) Timeval {
|
|||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
||||
}
|
||||
|
||||
//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
|
||||
// Try pipe2 first for Android O, then try pipe for kernel 2.6.23.
|
||||
err = pipe2(&pp, 0)
|
||||
if err == ENOSYS {
|
||||
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 Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
||||
newoffset, errno := seek(fd, offset, whence)
|
||||
if errno != 0 {
|
||||
|
@ -76,8 +46,6 @@ 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 dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n 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
|
||||
|
@ -86,7 +54,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
|||
//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
|
||||
|
@ -184,7 +151,7 @@ const rlimInf32 = ^uint32(0)
|
|||
const rlimInf64 = ^uint64(0)
|
||||
|
||||
func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||
err = prlimit(0, resource, nil, rlim)
|
||||
err = Prlimit(0, resource, nil, rlim)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
|
@ -212,7 +179,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
|||
//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
|
||||
|
||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
||||
err = prlimit(0, resource, rlim, nil)
|
||||
err = Prlimit(0, resource, rlim, nil)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
|
@ -256,13 +223,8 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
if len(fds) == 0 {
|
||||
return poll(nil, 0, timeout)
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
|
||||
rsa.Service_name_len = uint32(length)
|
||||
}
|
||||
|
||||
//sys armSyncFileRange(fd int, flags int, off int64, n int64) (err error) = SYS_ARM_SYNC_FILE_RANGE
|
||||
|
|
|
@ -9,13 +9,6 @@ package unix
|
|||
|
||||
import "unsafe"
|
||||
|
||||
func EpollCreate(size int) (fd int, err error) {
|
||||
if size <= 0 {
|
||||
return -1, EINVAL
|
||||
}
|
||||
return EpollCreate1(0)
|
||||
}
|
||||
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
|
@ -145,33 +138,9 @@ func utimes(path string, tv *[2]Timeval) (err error) {
|
|||
return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
// Getrlimit prefers the prlimit64 system call. See issue 38604.
|
||||
func Getrlimit(resource int, rlim *Rlimit) error {
|
||||
err := prlimit(0, resource, nil, rlim)
|
||||
err := Prlimit(0, resource, nil, rlim)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
|
@ -180,7 +149,7 @@ func Getrlimit(resource int, rlim *Rlimit) error {
|
|||
|
||||
// Setrlimit prefers the prlimit64 system call. See issue 38604.
|
||||
func Setrlimit(resource int, rlim *Rlimit) error {
|
||||
err := prlimit(0, resource, rlim, nil)
|
||||
err := Prlimit(0, resource, rlim, nil)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
|
@ -207,31 +176,15 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint64(length)
|
||||
}
|
||||
|
||||
func InotifyInit() (fd int, err error) {
|
||||
return InotifyInit1(0)
|
||||
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
|
||||
rsa.Service_name_len = uint64(length)
|
||||
}
|
||||
|
||||
// dup2 exists because func Dup3 in syscall_linux.go references
|
||||
// it in an unreachable path. dup2 isn't available on arm64.
|
||||
func dup2(oldfd int, newfd int) error
|
||||
|
||||
func Pause() error {
|
||||
_, err := ppoll(nil, 0, nil, nil)
|
||||
return err
|
||||
}
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
var ts *Timespec
|
||||
if timeout >= 0 {
|
||||
ts = new(Timespec)
|
||||
*ts = NsecToTimespec(int64(timeout) * 1e6)
|
||||
}
|
||||
if len(fds) == 0 {
|
||||
return ppoll(nil, 0, ts, nil)
|
||||
}
|
||||
return ppoll(&fds[0], len(fds), ts, nil)
|
||||
}
|
||||
|
||||
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||
|
||||
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
package unix
|
||||
|
||||
//sys dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n 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)
|
||||
|
@ -94,30 +92,6 @@ func setTimeval(sec, usec int64) Timeval {
|
|||
return Timeval{Sec: sec, Usec: usec}
|
||||
}
|
||||
|
||||
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 Ioperm(from int, num int, on int) (err error) {
|
||||
return ENOSYS
|
||||
}
|
||||
|
@ -217,15 +191,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint64(length)
|
||||
}
|
||||
|
||||
func InotifyInit() (fd int, err error) {
|
||||
return InotifyInit1(0)
|
||||
}
|
||||
|
||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
if len(fds) == 0 {
|
||||
return poll(nil, 0, timeout)
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
|
||||
rsa.Service_name_len = uint64(length)
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@ import (
|
|||
|
||||
func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
||||
//sys dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n 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)
|
||||
|
@ -60,7 +58,6 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
|
|||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
|
||||
//sysnb InotifyInit() (fd int, err error)
|
||||
//sys Ioperm(from int, num int, on int) (err error)
|
||||
//sys Iopl(level int) (err error)
|
||||
|
||||
|
@ -113,29 +110,6 @@ func setTimeval(sec, usec int64) Timeval {
|
|||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
||||
}
|
||||
|
||||
//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
|
||||
}
|
||||
|
||||
//sysnb pipe() (p1 int, p2 int, err error)
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
p[0], p[1], err = pipe()
|
||||
return
|
||||
}
|
||||
|
||||
//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)
|
||||
|
||||
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
|
||||
|
@ -157,7 +131,7 @@ type rlimit32 struct {
|
|||
//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
|
||||
|
||||
func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||
err = prlimit(0, resource, nil, rlim)
|
||||
err = Prlimit(0, resource, nil, rlim)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
|
@ -185,7 +159,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
|||
//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
|
||||
|
||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
||||
err = prlimit(0, resource, rlim, nil)
|
||||
err = Prlimit(0, resource, rlim, nil)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
|
@ -229,11 +203,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
if len(fds) == 0 {
|
||||
return poll(nil, 0, timeout)
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
|
||||
rsa.Service_name_len = uint32(length)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,237 @@
|
|||
// Copyright 2021 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.
|
||||
|
||||
//go:build linux && ppc
|
||||
// +build linux,ppc
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
||||
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
||||
//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
|
||||
//sysnb Getegid() (egid int)
|
||||
//sysnb Geteuid() (euid int)
|
||||
//sysnb Getgid() (gid int)
|
||||
//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_LSTAT64
|
||||
//sys Pause() (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 Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
||||
//sys setfsgid(gid int) (prev int, err error)
|
||||
//sys setfsuid(uid int) (prev 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 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 int, err error)
|
||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||
//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
|
||||
//sys Ustat(dev int, ubuf *Ustat_t) (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 futimesat(dirfd int, path string, times *[2]Timeval) (err error)
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
|
||||
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_FADVISE64_64, uintptr(fd), uintptr(advice), uintptr(offset>>32), uintptr(offset), uintptr(length>>32), uintptr(length))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func seek(fd int, offset int64, whence int) (int64, syscall.Errno) {
|
||||
var newoffset int64
|
||||
offsetLow := uint32(offset & 0xffffffff)
|
||||
offsetHigh := uint32((offset >> 32) & 0xffffffff)
|
||||
_, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0)
|
||||
return newoffset, err
|
||||
}
|
||||
|
||||
func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
||||
newoffset, errno := seek(fd, offset, whence)
|
||||
if errno != 0 {
|
||||
return 0, errno
|
||||
}
|
||||
return newoffset, nil
|
||||
}
|
||||
|
||||
func Fstatfs(fd int, buf *Statfs_t) (err error) {
|
||||
_, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
|
||||
if e != 0 {
|
||||
err = e
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Statfs(path string, buf *Statfs_t) (err error) {
|
||||
pathp, err := BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(pathp)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
|
||||
if e != 0 {
|
||||
err = e
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)
|
||||
|
||||
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
|
||||
page := uintptr(offset / 4096)
|
||||
if offset != int64(page)*4096 {
|
||||
return 0, EINVAL
|
||||
}
|
||||
return mmap2(addr, length, prot, flags, fd, page)
|
||||
}
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
|
||||
}
|
||||
|
||||
func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
||||
}
|
||||
|
||||
type rlimit32 struct {
|
||||
Cur uint32
|
||||
Max uint32
|
||||
}
|
||||
|
||||
//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_UGETRLIMIT
|
||||
|
||||
const rlimInf32 = ^uint32(0)
|
||||
const rlimInf64 = ^uint64(0)
|
||||
|
||||
func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||
err = Prlimit(0, resource, nil, rlim)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
|
||||
rl := rlimit32{}
|
||||
err = getrlimit(resource, &rl)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if rl.Cur == rlimInf32 {
|
||||
rlim.Cur = rlimInf64
|
||||
} else {
|
||||
rlim.Cur = uint64(rl.Cur)
|
||||
}
|
||||
|
||||
if rl.Max == rlimInf32 {
|
||||
rlim.Max = rlimInf64
|
||||
} else {
|
||||
rlim.Max = uint64(rl.Max)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
|
||||
|
||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
||||
err = Prlimit(0, resource, rlim, nil)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
|
||||
rl := rlimit32{}
|
||||
if rlim.Cur == rlimInf64 {
|
||||
rl.Cur = rlimInf32
|
||||
} else if rlim.Cur < uint64(rlimInf32) {
|
||||
rl.Cur = uint32(rlim.Cur)
|
||||
} else {
|
||||
return EINVAL
|
||||
}
|
||||
if rlim.Max == rlimInf64 {
|
||||
rl.Max = rlimInf32
|
||||
} else if rlim.Max < uint64(rlimInf32) {
|
||||
rl.Max = uint32(rlim.Max)
|
||||
} else {
|
||||
return EINVAL
|
||||
}
|
||||
|
||||
return setrlimit(resource, &rl)
|
||||
}
|
||||
|
||||
func (r *PtraceRegs) PC() uint32 { return r.Nip }
|
||||
|
||||
func (r *PtraceRegs) SetPC(pc uint32) { r.Nip = pc }
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint32(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint32(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetIovlen(length int) {
|
||||
msghdr.Iovlen = uint32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
|
||||
rsa.Service_name_len = uint32(length)
|
||||
}
|
||||
|
||||
//sys syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2
|
||||
|
||||
func SyncFileRange(fd int, off int64, n int64, flags int) error {
|
||||
// The sync_file_range and sync_file_range2 syscalls differ only in the
|
||||
// order of their arguments.
|
||||
return syncFileRange2(fd, flags, off, n)
|
||||
}
|
||||
|
||||
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||
|
||||
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||
cmdlineLen := len(cmdline)
|
||||
if cmdlineLen > 0 {
|
||||
// Account for the additional NULL byte added by
|
||||
// BytePtrFromString in kexecFileLoad. The kexec_file_load
|
||||
// syscall expects a NULL-terminated string.
|
||||
cmdlineLen++
|
||||
}
|
||||
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||
}
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
package unix
|
||||
|
||||
//sys dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n 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)
|
||||
|
@ -22,7 +20,6 @@ package unix
|
|||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT
|
||||
//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)
|
||||
|
@ -100,39 +97,8 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint64(length)
|
||||
}
|
||||
|
||||
//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
|
||||
}
|
||||
|
||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
if len(fds) == 0 {
|
||||
return poll(nil, 0, timeout)
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
|
||||
rsa.Service_name_len = uint64(length)
|
||||
}
|
||||
|
||||
//sys syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2
|
||||
|
|
|
@ -9,13 +9,6 @@ package unix
|
|||
|
||||
import "unsafe"
|
||||
|
||||
func EpollCreate(size int) (fd int, err error) {
|
||||
if size <= 0 {
|
||||
return -1, EINVAL
|
||||
}
|
||||
return EpollCreate1(0)
|
||||
}
|
||||
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
|
@ -144,30 +137,6 @@ func utimes(path string, tv *[2]Timeval) (err error) {
|
|||
return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
||||
}
|
||||
|
||||
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 }
|
||||
|
@ -188,8 +157,8 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint64(length)
|
||||
}
|
||||
|
||||
func InotifyInit() (fd int, err error) {
|
||||
return InotifyInit1(0)
|
||||
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
|
||||
rsa.Service_name_len = uint64(length)
|
||||
}
|
||||
|
||||
func Pause() error {
|
||||
|
@ -197,18 +166,6 @@ func Pause() error {
|
|||
return err
|
||||
}
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
var ts *Timespec
|
||||
if timeout >= 0 {
|
||||
ts = new(Timespec)
|
||||
*ts = NsecToTimespec(int64(timeout) * 1e6)
|
||||
}
|
||||
if len(fds) == 0 {
|
||||
return ppoll(nil, 0, ts, nil)
|
||||
}
|
||||
return ppoll(&fds[0], len(fds), ts, nil)
|
||||
}
|
||||
|
||||
func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) {
|
||||
return Renameat2(olddirfd, oldpath, newdirfd, newpath, 0)
|
||||
}
|
||||
|
@ -225,7 +182,3 @@ func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error
|
|||
}
|
||||
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||
}
|
||||
|
||||
// dup2 exists because func Dup3 in syscall_linux.go references
|
||||
// it in an unreachable path. dup2 isn't available on arm64.
|
||||
func dup2(oldfd int, newfd int) error
|
||||
|
|
|
@ -11,8 +11,6 @@ import (
|
|||
"unsafe"
|
||||
)
|
||||
|
||||
//sys dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n 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)
|
||||
|
@ -25,7 +23,6 @@ import (
|
|||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
||||
//sysnb Getuid() (uid int)
|
||||
//sysnb InotifyInit() (fd int, err error)
|
||||
//sys Lchown(path string, uid int, gid int) (err error)
|
||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||
//sys Pause() (err error)
|
||||
|
@ -77,30 +74,6 @@ func setTimeval(sec, usec int64) Timeval {
|
|||
return Timeval{Sec: sec, Usec: usec}
|
||||
}
|
||||
|
||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe2(&pp, 0) // pipe2 is the same as pipe when flags are set to 0.
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return
|
||||
}
|
||||
|
||||
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 Ioperm(from int, num int, on int) (err error) {
|
||||
return ENOSYS
|
||||
}
|
||||
|
@ -129,6 +102,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
|
||||
rsa.Service_name_len = uint64(length)
|
||||
}
|
||||
|
||||
// Linux on s390x uses the old mmap interface, which requires arguments to be passed in a struct.
|
||||
// mmap2 also requires arguments to be passed in a struct; it is currently not exposed in <asm/unistd.h>.
|
||||
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
|
||||
|
@ -250,7 +227,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen
|
|||
}
|
||||
|
||||
func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) error {
|
||||
args := [4]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val)}
|
||||
args := [5]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen}
|
||||
_, _, err := Syscall(SYS_SOCKETCALL, netSetSockOpt, uintptr(unsafe.Pointer(&args)), 0)
|
||||
if err != 0 {
|
||||
return err
|
||||
|
@ -320,15 +297,6 @@ func Shutdown(s, how int) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
if len(fds) == 0 {
|
||||
return poll(nil, 0, timeout)
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
}
|
||||
|
||||
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||
|
||||
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||
|
|
|
@ -9,7 +9,6 @@ package unix
|
|||
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||
//sys dup2(oldfd int, newfd int) (err error)
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
||||
|
@ -20,7 +19,6 @@ package unix
|
|||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
||||
//sysnb Getuid() (uid int)
|
||||
//sysnb InotifyInit() (fd 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)
|
||||
|
@ -116,37 +114,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint64(length)
|
||||
}
|
||||
|
||||
//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
|
||||
}
|
||||
|
||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
if len(fds) == 0 {
|
||||
return poll(nil, 0, timeout)
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
|
||||
rsa.Service_name_len = uint64(length)
|
||||
}
|
||||
|
|
|
@ -110,14 +110,8 @@ func direntNamlen(buf []byte) (uint64, bool) {
|
|||
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
|
||||
}
|
||||
|
||||
//sysnb pipe() (fd1 int, fd2 int, err error)
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
p[0], p[1], err = pipe()
|
||||
return
|
||||
return Pipe2(p, 0)
|
||||
}
|
||||
|
||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||
|
@ -128,8 +122,10 @@ func Pipe2(p []int, flags int) error {
|
|||
}
|
||||
var pp [2]_C_int
|
||||
err := pipe2(&pp, flags)
|
||||
if err == nil {
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -87,8 +87,10 @@ func Pipe2(p []int, flags int) error {
|
|||
}
|
||||
var pp [2]_C_int
|
||||
err := pipe2(&pp, flags)
|
||||
if err == nil {
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,10 @@
|
|||
package unix
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
@ -63,8 +66,10 @@ func Pipe(p []int) (err error) {
|
|||
if n != 0 {
|
||||
return err
|
||||
}
|
||||
if err == nil {
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -76,8 +81,10 @@ func Pipe2(p []int, flags int) error {
|
|||
}
|
||||
var pp [2]_C_int
|
||||
err := pipe2(&pp, flags)
|
||||
if err == nil {
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -89,9 +96,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
|
||||
p[0] = byte(sa.Port >> 8)
|
||||
p[1] = byte(sa.Port)
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
sa.raw.Addr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil
|
||||
}
|
||||
|
||||
|
@ -104,9 +109,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
p[0] = byte(sa.Port >> 8)
|
||||
p[1] = byte(sa.Port)
|
||||
sa.raw.Scope_id = sa.ZoneId
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
sa.raw.Addr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil
|
||||
}
|
||||
|
||||
|
@ -414,9 +417,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
sa := new(SockaddrInet4)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
|
||||
case AF_INET6:
|
||||
|
@ -425,9 +426,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
sa.ZoneId = pp.Scope_id
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
}
|
||||
return nil, EAFNOSUPPORT
|
||||
|
@ -565,7 +564,12 @@ func Minor(dev uint64) uint32 {
|
|||
* Expose the ioctl function
|
||||
*/
|
||||
|
||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||
//sys ioctlRet(fd int, req uint, arg uintptr) (ret int, err error) = libc.ioctl
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
_, err = ioctlRet(fd, req, arg)
|
||||
return err
|
||||
}
|
||||
|
||||
func IoctlSetTermio(fd int, req uint, value *Termio) error {
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
|
@ -739,3 +743,240 @@ func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, e
|
|||
func Munmap(b []byte) (err error) {
|
||||
return mapper.Munmap(b)
|
||||
}
|
||||
|
||||
// Event Ports
|
||||
|
||||
type fileObjCookie struct {
|
||||
fobj *fileObj
|
||||
cookie interface{}
|
||||
}
|
||||
|
||||
// EventPort provides a safe abstraction on top of Solaris/illumos Event Ports.
|
||||
type EventPort struct {
|
||||
port int
|
||||
mu sync.Mutex
|
||||
fds map[uintptr]interface{}
|
||||
paths map[string]*fileObjCookie
|
||||
}
|
||||
|
||||
// PortEvent is an abstraction of the port_event C struct.
|
||||
// Compare Source against PORT_SOURCE_FILE or PORT_SOURCE_FD
|
||||
// to see if Path or Fd was the event source. The other will be
|
||||
// uninitialized.
|
||||
type PortEvent struct {
|
||||
Cookie interface{}
|
||||
Events int32
|
||||
Fd uintptr
|
||||
Path string
|
||||
Source uint16
|
||||
fobj *fileObj
|
||||
}
|
||||
|
||||
// NewEventPort creates a new EventPort including the
|
||||
// underlying call to port_create(3c).
|
||||
func NewEventPort() (*EventPort, error) {
|
||||
port, err := port_create()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
e := &EventPort{
|
||||
port: port,
|
||||
fds: make(map[uintptr]interface{}),
|
||||
paths: make(map[string]*fileObjCookie),
|
||||
}
|
||||
return e, nil
|
||||
}
|
||||
|
||||
//sys port_create() (n int, err error)
|
||||
//sys port_associate(port int, source int, object uintptr, events int, user *byte) (n int, err error)
|
||||
//sys port_dissociate(port int, source int, object uintptr) (n int, err error)
|
||||
//sys port_get(port int, pe *portEvent, timeout *Timespec) (n int, err error)
|
||||
//sys port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Timespec) (n int, err error)
|
||||
|
||||
// Close closes the event port.
|
||||
func (e *EventPort) Close() error {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
e.fds = nil
|
||||
e.paths = nil
|
||||
return Close(e.port)
|
||||
}
|
||||
|
||||
// PathIsWatched checks to see if path is associated with this EventPort.
|
||||
func (e *EventPort) PathIsWatched(path string) bool {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
_, found := e.paths[path]
|
||||
return found
|
||||
}
|
||||
|
||||
// FdIsWatched checks to see if fd is associated with this EventPort.
|
||||
func (e *EventPort) FdIsWatched(fd uintptr) bool {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
_, found := e.fds[fd]
|
||||
return found
|
||||
}
|
||||
|
||||
// AssociatePath wraps port_associate(3c) for a filesystem path including
|
||||
// creating the necessary file_obj from the provided stat information.
|
||||
func (e *EventPort) AssociatePath(path string, stat os.FileInfo, events int, cookie interface{}) error {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
if _, found := e.paths[path]; found {
|
||||
return fmt.Errorf("%v is already associated with this Event Port", path)
|
||||
}
|
||||
fobj, err := createFileObj(path, stat)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fCookie := &fileObjCookie{fobj, cookie}
|
||||
_, err = port_associate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(fobj)), events, (*byte)(unsafe.Pointer(&fCookie.cookie)))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.paths[path] = fCookie
|
||||
return nil
|
||||
}
|
||||
|
||||
// DissociatePath wraps port_dissociate(3c) for a filesystem path.
|
||||
func (e *EventPort) DissociatePath(path string) error {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
f, ok := e.paths[path]
|
||||
if !ok {
|
||||
return fmt.Errorf("%v is not associated with this Event Port", path)
|
||||
}
|
||||
_, err := port_dissociate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(f.fobj)))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
delete(e.paths, path)
|
||||
return nil
|
||||
}
|
||||
|
||||
// AssociateFd wraps calls to port_associate(3c) on file descriptors.
|
||||
func (e *EventPort) AssociateFd(fd uintptr, events int, cookie interface{}) error {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
if _, found := e.fds[fd]; found {
|
||||
return fmt.Errorf("%v is already associated with this Event Port", fd)
|
||||
}
|
||||
pcookie := &cookie
|
||||
_, err := port_associate(e.port, PORT_SOURCE_FD, fd, events, (*byte)(unsafe.Pointer(pcookie)))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.fds[fd] = pcookie
|
||||
return nil
|
||||
}
|
||||
|
||||
// DissociateFd wraps calls to port_dissociate(3c) on file descriptors.
|
||||
func (e *EventPort) DissociateFd(fd uintptr) error {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
_, ok := e.fds[fd]
|
||||
if !ok {
|
||||
return fmt.Errorf("%v is not associated with this Event Port", fd)
|
||||
}
|
||||
_, err := port_dissociate(e.port, PORT_SOURCE_FD, fd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
delete(e.fds, fd)
|
||||
return nil
|
||||
}
|
||||
|
||||
func createFileObj(name string, stat os.FileInfo) (*fileObj, error) {
|
||||
fobj := new(fileObj)
|
||||
bs, err := ByteSliceFromString(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fobj.Name = (*int8)(unsafe.Pointer(&bs[0]))
|
||||
s := stat.Sys().(*syscall.Stat_t)
|
||||
fobj.Atim.Sec = s.Atim.Sec
|
||||
fobj.Atim.Nsec = s.Atim.Nsec
|
||||
fobj.Mtim.Sec = s.Mtim.Sec
|
||||
fobj.Mtim.Nsec = s.Mtim.Nsec
|
||||
fobj.Ctim.Sec = s.Ctim.Sec
|
||||
fobj.Ctim.Nsec = s.Ctim.Nsec
|
||||
return fobj, nil
|
||||
}
|
||||
|
||||
// GetOne wraps port_get(3c) and returns a single PortEvent.
|
||||
func (e *EventPort) GetOne(t *Timespec) (*PortEvent, error) {
|
||||
pe := new(portEvent)
|
||||
_, err := port_get(e.port, pe, t)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p := new(PortEvent)
|
||||
p.Events = pe.Events
|
||||
p.Source = pe.Source
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
switch pe.Source {
|
||||
case PORT_SOURCE_FD:
|
||||
p.Fd = uintptr(pe.Object)
|
||||
cookie := (*interface{})(unsafe.Pointer(pe.User))
|
||||
p.Cookie = *cookie
|
||||
delete(e.fds, p.Fd)
|
||||
case PORT_SOURCE_FILE:
|
||||
p.fobj = (*fileObj)(unsafe.Pointer(uintptr(pe.Object)))
|
||||
p.Path = BytePtrToString((*byte)(unsafe.Pointer(p.fobj.Name)))
|
||||
cookie := (*interface{})(unsafe.Pointer(pe.User))
|
||||
p.Cookie = *cookie
|
||||
delete(e.paths, p.Path)
|
||||
}
|
||||
return p, nil
|
||||
}
|
||||
|
||||
// Pending wraps port_getn(3c) and returns how many events are pending.
|
||||
func (e *EventPort) Pending() (int, error) {
|
||||
var n uint32 = 0
|
||||
_, err := port_getn(e.port, nil, 0, &n, nil)
|
||||
return int(n), err
|
||||
}
|
||||
|
||||
// Get wraps port_getn(3c) and fills a slice of PortEvent.
|
||||
// It will block until either min events have been received
|
||||
// or the timeout has been exceeded. It will return how many
|
||||
// events were actually received along with any error information.
|
||||
func (e *EventPort) Get(s []PortEvent, min int, timeout *Timespec) (int, error) {
|
||||
if min == 0 {
|
||||
return 0, fmt.Errorf("need to request at least one event or use Pending() instead")
|
||||
}
|
||||
if len(s) < min {
|
||||
return 0, fmt.Errorf("len(s) (%d) is less than min events requested (%d)", len(s), min)
|
||||
}
|
||||
got := uint32(min)
|
||||
max := uint32(len(s))
|
||||
var err error
|
||||
ps := make([]portEvent, max, max)
|
||||
_, err = port_getn(e.port, &ps[0], max, &got, timeout)
|
||||
// got will be trustworthy with ETIME, but not any other error.
|
||||
if err != nil && err != ETIME {
|
||||
return 0, err
|
||||
}
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
for i := 0; i < int(got); i++ {
|
||||
s[i].Events = ps[i].Events
|
||||
s[i].Source = ps[i].Source
|
||||
switch ps[i].Source {
|
||||
case PORT_SOURCE_FD:
|
||||
s[i].Fd = uintptr(ps[i].Object)
|
||||
cookie := (*interface{})(unsafe.Pointer(ps[i].User))
|
||||
s[i].Cookie = *cookie
|
||||
delete(e.fds, s[i].Fd)
|
||||
case PORT_SOURCE_FILE:
|
||||
s[i].fobj = (*fileObj)(unsafe.Pointer(uintptr(ps[i].Object)))
|
||||
s[i].Path = BytePtrToString((*byte)(unsafe.Pointer(s[i].fobj.Name)))
|
||||
cookie := (*interface{})(unsafe.Pointer(ps[i].User))
|
||||
s[i].Cookie = *cookie
|
||||
delete(e.paths, s[i].Path)
|
||||
}
|
||||
}
|
||||
return int(got), err
|
||||
}
|
||||
|
|
|
@ -313,6 +313,10 @@ func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func Send(s int, buf []byte, flags int) (err error) {
|
||||
return sendto(s, buf, flags, nil, 0)
|
||||
}
|
||||
|
||||
func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) {
|
||||
ptr, n, err := to.sockaddr()
|
||||
if err != nil {
|
||||
|
|
|
@ -67,9 +67,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
|
||||
p[0] = byte(sa.Port >> 8)
|
||||
p[1] = byte(sa.Port)
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
sa.raw.Addr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
|
||||
}
|
||||
|
||||
|
@ -83,9 +81,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
p[0] = byte(sa.Port >> 8)
|
||||
p[1] = byte(sa.Port)
|
||||
sa.raw.Scope_id = sa.ZoneId
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
sa.raw.Addr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
|
||||
}
|
||||
|
||||
|
@ -144,9 +140,7 @@ func anyToSockaddr(_ int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
sa := new(SockaddrInet4)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
|
||||
case AF_INET6:
|
||||
|
@ -155,9 +149,7 @@ func anyToSockaddr(_ int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
sa.ZoneId = pp.Scope_id
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
sa.Addr = pp.Addr
|
||||
return sa, nil
|
||||
}
|
||||
return nil, EAFNOSUPPORT
|
||||
|
@ -222,6 +214,8 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
//sys Creat(path string, mode uint32) (fd int, err error) = SYS___CREAT_A
|
||||
//sys Dup(oldfd int) (fd int, err error)
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sys Errno2() (er2 int) = SYS___ERRNO2
|
||||
//sys Err2ad() (eadd *int) = SYS___ERR2AD
|
||||
//sys Exit(code int)
|
||||
//sys Fchdir(fd int) (err error)
|
||||
//sys Fchmod(fd int, mode uint32) (err error)
|
||||
|
@ -245,10 +239,12 @@ func Fstat(fd int, stat *Stat_t) (err error) {
|
|||
//sys Poll(fds []PollFd, timeout int) (n int, err error) = SYS_POLL
|
||||
//sys Times(tms *Tms) (ticks uintptr, err error) = SYS_TIMES
|
||||
//sys W_Getmntent(buff *byte, size int) (lastsys int, err error) = SYS_W_GETMNTENT
|
||||
//sys W_Getmntent_A(buff *byte, size int) (lastsys int, err error) = SYS___W_GETMNTENT_A
|
||||
|
||||
//sys Mount(path string, filesystem string, fstype string, mtm uint32, parmlen int32, parm string) (err error) = SYS___MOUNT_A
|
||||
//sys Unmount(filesystem string, mtm int) (err error) = SYS___UMOUNT_A
|
||||
//sys mount_LE(path string, filesystem string, fstype string, mtm uint32, parmlen int32, parm string) (err error) = SYS___MOUNT_A
|
||||
//sys unmount(filesystem string, mtm int) (err error) = SYS___UMOUNT_A
|
||||
//sys Chroot(path string) (err error) = SYS___CHROOT_A
|
||||
//sys Select(nmsgsfds int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (ret int, err error) = SYS_SELECT
|
||||
//sysnb Uname(buf *Utsname) (err error) = SYS___UNAME_A
|
||||
|
||||
func Ptsname(fd int) (name string, err error) {
|
||||
|
@ -583,8 +579,10 @@ func Pipe(p []int) (err error) {
|
|||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe(&pp)
|
||||
if err == nil {
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1779,3 +1777,47 @@ func SetNonblock(fd int, nonblocking bool) (err error) {
|
|||
func Exec(argv0 string, argv []string, envv []string) error {
|
||||
return syscall.Exec(argv0, argv, envv)
|
||||
}
|
||||
|
||||
func Mount(source string, target string, fstype string, flags uintptr, data string) (err error) {
|
||||
if needspace := 8 - len(fstype); needspace <= 0 {
|
||||
fstype = fstype[:8]
|
||||
} else {
|
||||
fstype += " "[:needspace]
|
||||
}
|
||||
return mount_LE(target, source, fstype, uint32(flags), int32(len(data)), data)
|
||||
}
|
||||
|
||||
func Unmount(name string, mtm int) (err error) {
|
||||
// mountpoint is always a full path and starts with a '/'
|
||||
// check if input string is not a mountpoint but a filesystem name
|
||||
if name[0] != '/' {
|
||||
return unmount(name, mtm)
|
||||
}
|
||||
// treat name as mountpoint
|
||||
b2s := func(arr []byte) string {
|
||||
nulli := bytes.IndexByte(arr, 0)
|
||||
if nulli == -1 {
|
||||
return string(arr)
|
||||
} else {
|
||||
return string(arr[:nulli])
|
||||
}
|
||||
}
|
||||
var buffer struct {
|
||||
header W_Mnth
|
||||
fsinfo [64]W_Mntent
|
||||
}
|
||||
fsCount, err := W_Getmntent_A((*byte)(unsafe.Pointer(&buffer)), int(unsafe.Sizeof(buffer)))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if fsCount == 0 {
|
||||
return EINVAL
|
||||
}
|
||||
for i := 0; i < fsCount; i++ {
|
||||
if b2s(buffer.fsinfo[i].Mountpoint[:]) == name {
|
||||
err = unmount(b2s(buffer.fsinfo[i].Fsname[:]), mtm)
|
||||
break
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2021 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.
|
||||
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package unix
|
||||
|
||||
import "runtime"
|
||||
|
||||
// SysvShmCtl performs control operations on the shared memory segment
|
||||
// specified by id.
|
||||
func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) {
|
||||
if runtime.GOARCH == "arm" ||
|
||||
runtime.GOARCH == "mips64" || runtime.GOARCH == "mips64le" {
|
||||
cmd |= ipc_64
|
||||
}
|
||||
|
||||
return shmctl(id, cmd, desc)
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
// Copyright 2021 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.
|
||||
|
||||
//go:build (darwin && !ios) || linux
|
||||
// +build darwin,!ios linux
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/internal/unsafeheader"
|
||||
)
|
||||
|
||||
// SysvShmAttach attaches the Sysv shared memory segment associated with the
|
||||
// shared memory identifier id.
|
||||
func SysvShmAttach(id int, addr uintptr, flag int) ([]byte, error) {
|
||||
addr, errno := shmat(id, addr, flag)
|
||||
if errno != nil {
|
||||
return nil, errno
|
||||
}
|
||||
|
||||
// Retrieve the size of the shared memory to enable slice creation
|
||||
var info SysvShmDesc
|
||||
|
||||
_, err := SysvShmCtl(id, IPC_STAT, &info)
|
||||
if err != nil {
|
||||
// release the shared memory if we can't find the size
|
||||
|
||||
// ignoring error from shmdt as there's nothing sensible to return here
|
||||
shmdt(addr)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Use unsafe to convert addr into a []byte.
|
||||
// TODO: convert to unsafe.Slice once we can assume Go 1.17
|
||||
var b []byte
|
||||
hdr := (*unsafeheader.Slice)(unsafe.Pointer(&b))
|
||||
hdr.Data = unsafe.Pointer(addr)
|
||||
hdr.Cap = int(info.Segsz)
|
||||
hdr.Len = int(info.Segsz)
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// SysvShmDetach unmaps the shared memory slice returned from SysvShmAttach.
|
||||
//
|
||||
// It is not safe to use the slice after calling this function.
|
||||
func SysvShmDetach(data []byte) error {
|
||||
if len(data) == 0 {
|
||||
return EINVAL
|
||||
}
|
||||
|
||||
return shmdt(uintptr(unsafe.Pointer(&data[0])))
|
||||
}
|
||||
|
||||
// SysvShmGet returns the Sysv shared memory identifier associated with key.
|
||||
// If the IPC_CREAT flag is specified a new segment is created.
|
||||
func SysvShmGet(key, size, flag int) (id int, err error) {
|
||||
return shmget(key, size, flag)
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2021 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.
|
||||
|
||||
//go:build darwin && !ios
|
||||
// +build darwin,!ios
|
||||
|
||||
package unix
|
||||
|
||||
// SysvShmCtl performs control operations on the shared memory segment
|
||||
// specified by id.
|
||||
func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) {
|
||||
return shmctl(id, cmd, desc)
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -130,8 +130,9 @@ const (
|
|||
ATTR_VOL_SIZE = 0x4
|
||||
ATTR_VOL_SPACEAVAIL = 0x10
|
||||
ATTR_VOL_SPACEFREE = 0x8
|
||||
ATTR_VOL_SPACEUSED = 0x800000
|
||||
ATTR_VOL_UUID = 0x40000
|
||||
ATTR_VOL_VALIDMASK = 0xf007ffff
|
||||
ATTR_VOL_VALIDMASK = 0xf087ffff
|
||||
B0 = 0x0
|
||||
B110 = 0x6e
|
||||
B115200 = 0x1c200
|
||||
|
@ -661,6 +662,7 @@ const (
|
|||
IN_CLASSD_NSHIFT = 0x1c
|
||||
IN_LINKLOCALNETNUM = 0xa9fe0000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x400473d1
|
||||
IPPROTO_3PC = 0x22
|
||||
IPPROTO_ADFS = 0x44
|
||||
IPPROTO_AH = 0x33
|
||||
|
@ -776,15 +778,24 @@ const (
|
|||
IPV6_2292PKTINFO = 0x13
|
||||
IPV6_2292PKTOPTIONS = 0x19
|
||||
IPV6_2292RTHDR = 0x18
|
||||
IPV6_3542DSTOPTS = 0x32
|
||||
IPV6_3542HOPLIMIT = 0x2f
|
||||
IPV6_3542HOPOPTS = 0x31
|
||||
IPV6_3542NEXTHOP = 0x30
|
||||
IPV6_3542PKTINFO = 0x2e
|
||||
IPV6_3542RTHDR = 0x33
|
||||
IPV6_ADDR_MC_FLAGS_PREFIX = 0x20
|
||||
IPV6_ADDR_MC_FLAGS_TRANSIENT = 0x10
|
||||
IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 0x30
|
||||
IPV6_AUTOFLOWLABEL = 0x3b
|
||||
IPV6_BINDV6ONLY = 0x1b
|
||||
IPV6_BOUND_IF = 0x7d
|
||||
IPV6_CHECKSUM = 0x1a
|
||||
IPV6_DEFAULT_MULTICAST_HOPS = 0x1
|
||||
IPV6_DEFAULT_MULTICAST_LOOP = 0x1
|
||||
IPV6_DEFHLIM = 0x40
|
||||
IPV6_DONTFRAG = 0x3e
|
||||
IPV6_DSTOPTS = 0x32
|
||||
IPV6_FAITH = 0x1d
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
|
@ -796,6 +807,8 @@ const (
|
|||
IPV6_FW_GET = 0x22
|
||||
IPV6_FW_ZERO = 0x21
|
||||
IPV6_HLIMDEC = 0x1
|
||||
IPV6_HOPLIMIT = 0x2f
|
||||
IPV6_HOPOPTS = 0x31
|
||||
IPV6_IPSEC_POLICY = 0x1c
|
||||
IPV6_JOIN_GROUP = 0xc
|
||||
IPV6_LEAVE_GROUP = 0xd
|
||||
|
@ -807,20 +820,34 @@ const (
|
|||
IPV6_MAX_SOCK_SRC_FILTER = 0x80
|
||||
IPV6_MIN_MEMBERSHIPS = 0x1f
|
||||
IPV6_MMTU = 0x500
|
||||
IPV6_MSFILTER = 0x4a
|
||||
IPV6_MULTICAST_HOPS = 0xa
|
||||
IPV6_MULTICAST_IF = 0x9
|
||||
IPV6_MULTICAST_LOOP = 0xb
|
||||
IPV6_NEXTHOP = 0x30
|
||||
IPV6_PATHMTU = 0x2c
|
||||
IPV6_PKTINFO = 0x2e
|
||||
IPV6_PORTRANGE = 0xe
|
||||
IPV6_PORTRANGE_DEFAULT = 0x0
|
||||
IPV6_PORTRANGE_HIGH = 0x1
|
||||
IPV6_PORTRANGE_LOW = 0x2
|
||||
IPV6_PREFER_TEMPADDR = 0x3f
|
||||
IPV6_RECVDSTOPTS = 0x28
|
||||
IPV6_RECVHOPLIMIT = 0x25
|
||||
IPV6_RECVHOPOPTS = 0x27
|
||||
IPV6_RECVPATHMTU = 0x2b
|
||||
IPV6_RECVPKTINFO = 0x3d
|
||||
IPV6_RECVRTHDR = 0x26
|
||||
IPV6_RECVTCLASS = 0x23
|
||||
IPV6_RTHDR = 0x33
|
||||
IPV6_RTHDRDSTOPTS = 0x39
|
||||
IPV6_RTHDR_LOOSE = 0x0
|
||||
IPV6_RTHDR_STRICT = 0x1
|
||||
IPV6_RTHDR_TYPE_0 = 0x0
|
||||
IPV6_SOCKOPT_RESERVED1 = 0x3
|
||||
IPV6_TCLASS = 0x24
|
||||
IPV6_UNICAST_HOPS = 0x4
|
||||
IPV6_USE_MIN_MTU = 0x2a
|
||||
IPV6_V6ONLY = 0x1b
|
||||
IPV6_VERSION = 0x60
|
||||
IPV6_VERSION_MASK = 0xf0
|
||||
|
@ -1181,6 +1208,7 @@ const (
|
|||
RTF_DONE = 0x40
|
||||
RTF_DYNAMIC = 0x10
|
||||
RTF_GATEWAY = 0x2
|
||||
RTF_GLOBAL = 0x40000000
|
||||
RTF_HOST = 0x4
|
||||
RTF_IFREF = 0x4000000
|
||||
RTF_IFSCOPE = 0x1000000
|
||||
|
@ -1237,6 +1265,11 @@ const (
|
|||
SCM_RIGHTS = 0x1
|
||||
SCM_TIMESTAMP = 0x2
|
||||
SCM_TIMESTAMP_MONOTONIC = 0x4
|
||||
SEEK_CUR = 0x1
|
||||
SEEK_DATA = 0x4
|
||||
SEEK_END = 0x2
|
||||
SEEK_HOLE = 0x3
|
||||
SEEK_SET = 0x0
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1353,6 +1386,10 @@ const (
|
|||
SO_SNDTIMEO = 0x1005
|
||||
SO_TIMESTAMP = 0x400
|
||||
SO_TIMESTAMP_MONOTONIC = 0x800
|
||||
SO_TRACKER_ATTRIBUTE_FLAGS_APP_APPROVED = 0x1
|
||||
SO_TRACKER_ATTRIBUTE_FLAGS_DOMAIN_SHORT = 0x4
|
||||
SO_TRACKER_ATTRIBUTE_FLAGS_TRACKER = 0x2
|
||||
SO_TRACKER_TRANSPARENCY_VERSION = 0x3
|
||||
SO_TYPE = 0x1008
|
||||
SO_UPCALLCLOSEWAIT = 0x1027
|
||||
SO_USELOOPBACK = 0x40
|
||||
|
@ -1398,6 +1435,21 @@ const (
|
|||
TCOFLUSH = 0x2
|
||||
TCOOFF = 0x1
|
||||
TCOON = 0x2
|
||||
TCPOPT_CC = 0xb
|
||||
TCPOPT_CCECHO = 0xd
|
||||
TCPOPT_CCNEW = 0xc
|
||||
TCPOPT_EOL = 0x0
|
||||
TCPOPT_FASTOPEN = 0x22
|
||||
TCPOPT_MAXSEG = 0x2
|
||||
TCPOPT_NOP = 0x1
|
||||
TCPOPT_SACK = 0x5
|
||||
TCPOPT_SACK_HDR = 0x1010500
|
||||
TCPOPT_SACK_PERMITTED = 0x4
|
||||
TCPOPT_SACK_PERMIT_HDR = 0x1010402
|
||||
TCPOPT_SIGNATURE = 0x13
|
||||
TCPOPT_TIMESTAMP = 0x8
|
||||
TCPOPT_TSTAMP_HDR = 0x101080a
|
||||
TCPOPT_WINDOW = 0x3
|
||||
TCP_CONNECTIONTIMEOUT = 0x20
|
||||
TCP_CONNECTION_INFO = 0x106
|
||||
TCP_ENABLE_ECN = 0x104
|
||||
|
@ -1500,6 +1552,11 @@ const (
|
|||
VINTR = 0x8
|
||||
VKILL = 0x5
|
||||
VLNEXT = 0xe
|
||||
VMADDR_CID_ANY = 0xffffffff
|
||||
VMADDR_CID_HOST = 0x2
|
||||
VMADDR_CID_HYPERVISOR = 0x0
|
||||
VMADDR_CID_RESERVED = 0x1
|
||||
VMADDR_PORT_ANY = 0xffffffff
|
||||
VMIN = 0x10
|
||||
VM_LOADAVG = 0x2
|
||||
VM_MACHFACTOR = 0x4
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -130,8 +130,9 @@ const (
|
|||
ATTR_VOL_SIZE = 0x4
|
||||
ATTR_VOL_SPACEAVAIL = 0x10
|
||||
ATTR_VOL_SPACEFREE = 0x8
|
||||
ATTR_VOL_SPACEUSED = 0x800000
|
||||
ATTR_VOL_UUID = 0x40000
|
||||
ATTR_VOL_VALIDMASK = 0xf007ffff
|
||||
ATTR_VOL_VALIDMASK = 0xf087ffff
|
||||
B0 = 0x0
|
||||
B110 = 0x6e
|
||||
B115200 = 0x1c200
|
||||
|
@ -661,6 +662,7 @@ const (
|
|||
IN_CLASSD_NSHIFT = 0x1c
|
||||
IN_LINKLOCALNETNUM = 0xa9fe0000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x400473d1
|
||||
IPPROTO_3PC = 0x22
|
||||
IPPROTO_ADFS = 0x44
|
||||
IPPROTO_AH = 0x33
|
||||
|
@ -776,15 +778,24 @@ const (
|
|||
IPV6_2292PKTINFO = 0x13
|
||||
IPV6_2292PKTOPTIONS = 0x19
|
||||
IPV6_2292RTHDR = 0x18
|
||||
IPV6_3542DSTOPTS = 0x32
|
||||
IPV6_3542HOPLIMIT = 0x2f
|
||||
IPV6_3542HOPOPTS = 0x31
|
||||
IPV6_3542NEXTHOP = 0x30
|
||||
IPV6_3542PKTINFO = 0x2e
|
||||
IPV6_3542RTHDR = 0x33
|
||||
IPV6_ADDR_MC_FLAGS_PREFIX = 0x20
|
||||
IPV6_ADDR_MC_FLAGS_TRANSIENT = 0x10
|
||||
IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 0x30
|
||||
IPV6_AUTOFLOWLABEL = 0x3b
|
||||
IPV6_BINDV6ONLY = 0x1b
|
||||
IPV6_BOUND_IF = 0x7d
|
||||
IPV6_CHECKSUM = 0x1a
|
||||
IPV6_DEFAULT_MULTICAST_HOPS = 0x1
|
||||
IPV6_DEFAULT_MULTICAST_LOOP = 0x1
|
||||
IPV6_DEFHLIM = 0x40
|
||||
IPV6_DONTFRAG = 0x3e
|
||||
IPV6_DSTOPTS = 0x32
|
||||
IPV6_FAITH = 0x1d
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
|
@ -796,6 +807,8 @@ const (
|
|||
IPV6_FW_GET = 0x22
|
||||
IPV6_FW_ZERO = 0x21
|
||||
IPV6_HLIMDEC = 0x1
|
||||
IPV6_HOPLIMIT = 0x2f
|
||||
IPV6_HOPOPTS = 0x31
|
||||
IPV6_IPSEC_POLICY = 0x1c
|
||||
IPV6_JOIN_GROUP = 0xc
|
||||
IPV6_LEAVE_GROUP = 0xd
|
||||
|
@ -807,20 +820,34 @@ const (
|
|||
IPV6_MAX_SOCK_SRC_FILTER = 0x80
|
||||
IPV6_MIN_MEMBERSHIPS = 0x1f
|
||||
IPV6_MMTU = 0x500
|
||||
IPV6_MSFILTER = 0x4a
|
||||
IPV6_MULTICAST_HOPS = 0xa
|
||||
IPV6_MULTICAST_IF = 0x9
|
||||
IPV6_MULTICAST_LOOP = 0xb
|
||||
IPV6_NEXTHOP = 0x30
|
||||
IPV6_PATHMTU = 0x2c
|
||||
IPV6_PKTINFO = 0x2e
|
||||
IPV6_PORTRANGE = 0xe
|
||||
IPV6_PORTRANGE_DEFAULT = 0x0
|
||||
IPV6_PORTRANGE_HIGH = 0x1
|
||||
IPV6_PORTRANGE_LOW = 0x2
|
||||
IPV6_PREFER_TEMPADDR = 0x3f
|
||||
IPV6_RECVDSTOPTS = 0x28
|
||||
IPV6_RECVHOPLIMIT = 0x25
|
||||
IPV6_RECVHOPOPTS = 0x27
|
||||
IPV6_RECVPATHMTU = 0x2b
|
||||
IPV6_RECVPKTINFO = 0x3d
|
||||
IPV6_RECVRTHDR = 0x26
|
||||
IPV6_RECVTCLASS = 0x23
|
||||
IPV6_RTHDR = 0x33
|
||||
IPV6_RTHDRDSTOPTS = 0x39
|
||||
IPV6_RTHDR_LOOSE = 0x0
|
||||
IPV6_RTHDR_STRICT = 0x1
|
||||
IPV6_RTHDR_TYPE_0 = 0x0
|
||||
IPV6_SOCKOPT_RESERVED1 = 0x3
|
||||
IPV6_TCLASS = 0x24
|
||||
IPV6_UNICAST_HOPS = 0x4
|
||||
IPV6_USE_MIN_MTU = 0x2a
|
||||
IPV6_V6ONLY = 0x1b
|
||||
IPV6_VERSION = 0x60
|
||||
IPV6_VERSION_MASK = 0xf0
|
||||
|
@ -1181,6 +1208,7 @@ const (
|
|||
RTF_DONE = 0x40
|
||||
RTF_DYNAMIC = 0x10
|
||||
RTF_GATEWAY = 0x2
|
||||
RTF_GLOBAL = 0x40000000
|
||||
RTF_HOST = 0x4
|
||||
RTF_IFREF = 0x4000000
|
||||
RTF_IFSCOPE = 0x1000000
|
||||
|
@ -1237,6 +1265,11 @@ const (
|
|||
SCM_RIGHTS = 0x1
|
||||
SCM_TIMESTAMP = 0x2
|
||||
SCM_TIMESTAMP_MONOTONIC = 0x4
|
||||
SEEK_CUR = 0x1
|
||||
SEEK_DATA = 0x4
|
||||
SEEK_END = 0x2
|
||||
SEEK_HOLE = 0x3
|
||||
SEEK_SET = 0x0
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1353,6 +1386,10 @@ const (
|
|||
SO_SNDTIMEO = 0x1005
|
||||
SO_TIMESTAMP = 0x400
|
||||
SO_TIMESTAMP_MONOTONIC = 0x800
|
||||
SO_TRACKER_ATTRIBUTE_FLAGS_APP_APPROVED = 0x1
|
||||
SO_TRACKER_ATTRIBUTE_FLAGS_DOMAIN_SHORT = 0x4
|
||||
SO_TRACKER_ATTRIBUTE_FLAGS_TRACKER = 0x2
|
||||
SO_TRACKER_TRANSPARENCY_VERSION = 0x3
|
||||
SO_TYPE = 0x1008
|
||||
SO_UPCALLCLOSEWAIT = 0x1027
|
||||
SO_USELOOPBACK = 0x40
|
||||
|
@ -1398,6 +1435,21 @@ const (
|
|||
TCOFLUSH = 0x2
|
||||
TCOOFF = 0x1
|
||||
TCOON = 0x2
|
||||
TCPOPT_CC = 0xb
|
||||
TCPOPT_CCECHO = 0xd
|
||||
TCPOPT_CCNEW = 0xc
|
||||
TCPOPT_EOL = 0x0
|
||||
TCPOPT_FASTOPEN = 0x22
|
||||
TCPOPT_MAXSEG = 0x2
|
||||
TCPOPT_NOP = 0x1
|
||||
TCPOPT_SACK = 0x5
|
||||
TCPOPT_SACK_HDR = 0x1010500
|
||||
TCPOPT_SACK_PERMITTED = 0x4
|
||||
TCPOPT_SACK_PERMIT_HDR = 0x1010402
|
||||
TCPOPT_SIGNATURE = 0x13
|
||||
TCPOPT_TIMESTAMP = 0x8
|
||||
TCPOPT_TSTAMP_HDR = 0x101080a
|
||||
TCPOPT_WINDOW = 0x3
|
||||
TCP_CONNECTIONTIMEOUT = 0x20
|
||||
TCP_CONNECTION_INFO = 0x106
|
||||
TCP_ENABLE_ECN = 0x104
|
||||
|
@ -1500,6 +1552,11 @@ const (
|
|||
VINTR = 0x8
|
||||
VKILL = 0x5
|
||||
VLNEXT = 0xe
|
||||
VMADDR_CID_ANY = 0xffffffff
|
||||
VMADDR_CID_HOST = 0x2
|
||||
VMADDR_CID_HYPERVISOR = 0x0
|
||||
VMADDR_CID_RESERVED = 0x1
|
||||
VMADDR_PORT_ANY = 0xffffffff
|
||||
VMIN = 0x10
|
||||
VM_LOADAVG = 0x2
|
||||
VM_MACHFACTOR = 0x4
|
||||
|
|
|
@ -1297,6 +1297,11 @@ const (
|
|||
SCM_RIGHTS = 0x1
|
||||
SCM_TIMESTAMP = 0x2
|
||||
SCM_TIME_INFO = 0x7
|
||||
SEEK_CUR = 0x1
|
||||
SEEK_DATA = 0x3
|
||||
SEEK_END = 0x2
|
||||
SEEK_HOLE = 0x4
|
||||
SEEK_SET = 0x0
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
|
|
@ -1298,6 +1298,11 @@ const (
|
|||
SCM_RIGHTS = 0x1
|
||||
SCM_TIMESTAMP = 0x2
|
||||
SCM_TIME_INFO = 0x7
|
||||
SEEK_CUR = 0x1
|
||||
SEEK_DATA = 0x3
|
||||
SEEK_END = 0x2
|
||||
SEEK_HOLE = 0x4
|
||||
SEEK_SET = 0x0
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
|
|
@ -1022,6 +1022,15 @@ const (
|
|||
MAP_RESERVED0100 = 0x100
|
||||
MAP_SHARED = 0x1
|
||||
MAP_STACK = 0x400
|
||||
MCAST_BLOCK_SOURCE = 0x54
|
||||
MCAST_EXCLUDE = 0x2
|
||||
MCAST_INCLUDE = 0x1
|
||||
MCAST_JOIN_GROUP = 0x50
|
||||
MCAST_JOIN_SOURCE_GROUP = 0x52
|
||||
MCAST_LEAVE_GROUP = 0x51
|
||||
MCAST_LEAVE_SOURCE_GROUP = 0x53
|
||||
MCAST_UNBLOCK_SOURCE = 0x55
|
||||
MCAST_UNDEFINED = 0x0
|
||||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MNT_ACLS = 0x8000000
|
||||
|
@ -1267,6 +1276,11 @@ const (
|
|||
SCM_CREDS = 0x3
|
||||
SCM_RIGHTS = 0x1
|
||||
SCM_TIMESTAMP = 0x2
|
||||
SEEK_CUR = 0x1
|
||||
SEEK_DATA = 0x3
|
||||
SEEK_END = 0x2
|
||||
SEEK_HOLE = 0x4
|
||||
SEEK_SET = 0x0
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
|
|
@ -1298,6 +1298,11 @@ const (
|
|||
SCM_RIGHTS = 0x1
|
||||
SCM_TIMESTAMP = 0x2
|
||||
SCM_TIME_INFO = 0x7
|
||||
SEEK_CUR = 0x1
|
||||
SEEK_DATA = 0x3
|
||||
SEEK_END = 0x2
|
||||
SEEK_HOLE = 0x4
|
||||
SEEK_SET = 0x0
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Code generated by mkmerge.go; DO NOT EDIT.
|
||||
// Code generated by mkmerge; DO NOT EDIT.
|
||||
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
@ -38,7 +38,8 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x2d
|
||||
AF_MAX = 0x2e
|
||||
AF_MCTP = 0x2d
|
||||
AF_MPLS = 0x1c
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
|
@ -116,6 +117,7 @@ const (
|
|||
ARPHRD_LAPB = 0x204
|
||||
ARPHRD_LOCALTLK = 0x305
|
||||
ARPHRD_LOOPBACK = 0x304
|
||||
ARPHRD_MCTP = 0x122
|
||||
ARPHRD_METRICOM = 0x17
|
||||
ARPHRD_NETLINK = 0x338
|
||||
ARPHRD_NETROM = 0x0
|
||||
|
@ -166,13 +168,16 @@ const (
|
|||
BPF_ALU64 = 0x7
|
||||
BPF_AND = 0x50
|
||||
BPF_ARSH = 0xc0
|
||||
BPF_ATOMIC = 0xc0
|
||||
BPF_B = 0x10
|
||||
BPF_BUILD_ID_SIZE = 0x14
|
||||
BPF_CALL = 0x80
|
||||
BPF_CMPXCHG = 0xf1
|
||||
BPF_DIV = 0x30
|
||||
BPF_DW = 0x18
|
||||
BPF_END = 0xd0
|
||||
BPF_EXIT = 0x90
|
||||
BPF_FETCH = 0x1
|
||||
BPF_FROM_BE = 0x8
|
||||
BPF_FROM_LE = 0x0
|
||||
BPF_FS_MAGIC = 0xcafe4a11
|
||||
|
@ -225,7 +230,11 @@ const (
|
|||
BPF_OR = 0x40
|
||||
BPF_PSEUDO_BTF_ID = 0x3
|
||||
BPF_PSEUDO_CALL = 0x1
|
||||
BPF_PSEUDO_FUNC = 0x4
|
||||
BPF_PSEUDO_KFUNC_CALL = 0x2
|
||||
BPF_PSEUDO_MAP_FD = 0x1
|
||||
BPF_PSEUDO_MAP_IDX = 0x5
|
||||
BPF_PSEUDO_MAP_IDX_VALUE = 0x6
|
||||
BPF_PSEUDO_MAP_VALUE = 0x2
|
||||
BPF_RET = 0x6
|
||||
BPF_RSH = 0x70
|
||||
|
@ -240,6 +249,7 @@ const (
|
|||
BPF_W = 0x0
|
||||
BPF_X = 0x8
|
||||
BPF_XADD = 0xc0
|
||||
BPF_XCHG = 0xe1
|
||||
BPF_XOR = 0xa0
|
||||
BRKINT = 0x2
|
||||
BS0 = 0x0
|
||||
|
@ -464,6 +474,7 @@ const (
|
|||
DM_DEV_WAIT = 0xc138fd08
|
||||
DM_DIR = "mapper"
|
||||
DM_GET_TARGET_VERSION = 0xc138fd11
|
||||
DM_IMA_MEASUREMENT_FLAG = 0x80000
|
||||
DM_INACTIVE_PRESENT_FLAG = 0x40
|
||||
DM_INTERNAL_SUSPEND_FLAG = 0x40000
|
||||
DM_IOCTL = 0xfd
|
||||
|
@ -471,6 +482,8 @@ const (
|
|||
DM_LIST_VERSIONS = 0xc138fd0d
|
||||
DM_MAX_TYPE_NAME = 0x10
|
||||
DM_NAME_LEN = 0x80
|
||||
DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID = 0x2
|
||||
DM_NAME_LIST_FLAG_HAS_UUID = 0x1
|
||||
DM_NOFLUSH_FLAG = 0x800
|
||||
DM_PERSISTENT_DEV_FLAG = 0x8
|
||||
DM_QUERY_INACTIVE_TABLE_FLAG = 0x1000
|
||||
|
@ -490,9 +503,9 @@ const (
|
|||
DM_UUID_FLAG = 0x4000
|
||||
DM_UUID_LEN = 0x81
|
||||
DM_VERSION = 0xc138fd00
|
||||
DM_VERSION_EXTRA = "-ioctl (2020-10-01)"
|
||||
DM_VERSION_EXTRA = "-ioctl (2021-03-22)"
|
||||
DM_VERSION_MAJOR = 0x4
|
||||
DM_VERSION_MINOR = 0x2b
|
||||
DM_VERSION_MINOR = 0x2d
|
||||
DM_VERSION_PATCHLEVEL = 0x0
|
||||
DT_BLK = 0x6
|
||||
DT_CHR = 0x2
|
||||
|
@ -706,6 +719,7 @@ const (
|
|||
ETH_P_LOOPBACK = 0x9000
|
||||
ETH_P_MACSEC = 0x88e5
|
||||
ETH_P_MAP = 0xf9
|
||||
ETH_P_MCTP = 0xfa
|
||||
ETH_P_MOBITEX = 0x15
|
||||
ETH_P_MPLS_MC = 0x8848
|
||||
ETH_P_MPLS_UC = 0x8847
|
||||
|
@ -728,6 +742,7 @@ const (
|
|||
ETH_P_QINQ2 = 0x9200
|
||||
ETH_P_QINQ3 = 0x9300
|
||||
ETH_P_RARP = 0x8035
|
||||
ETH_P_REALTEK = 0x8899
|
||||
ETH_P_SCA = 0x6007
|
||||
ETH_P_SLOW = 0x8809
|
||||
ETH_P_SNAP = 0x5
|
||||
|
@ -741,6 +756,21 @@ const (
|
|||
ETH_P_WCCP = 0x883e
|
||||
ETH_P_X25 = 0x805
|
||||
ETH_P_XDSA = 0xf8
|
||||
EV_ABS = 0x3
|
||||
EV_CNT = 0x20
|
||||
EV_FF = 0x15
|
||||
EV_FF_STATUS = 0x17
|
||||
EV_KEY = 0x1
|
||||
EV_LED = 0x11
|
||||
EV_MAX = 0x1f
|
||||
EV_MSC = 0x4
|
||||
EV_PWR = 0x16
|
||||
EV_REL = 0x2
|
||||
EV_REP = 0x14
|
||||
EV_SND = 0x12
|
||||
EV_SW = 0x5
|
||||
EV_SYN = 0x0
|
||||
EV_VERSION = 0x10001
|
||||
EXABYTE_ENABLE_NEST = 0xf0
|
||||
EXT2_SUPER_MAGIC = 0xef53
|
||||
EXT3_SUPER_MAGIC = 0xef53
|
||||
|
@ -779,11 +809,15 @@ const (
|
|||
FAN_DELETE_SELF = 0x400
|
||||
FAN_DENY = 0x2
|
||||
FAN_ENABLE_AUDIT = 0x40
|
||||
FAN_EPIDFD = -0x2
|
||||
FAN_EVENT_INFO_TYPE_DFID = 0x3
|
||||
FAN_EVENT_INFO_TYPE_DFID_NAME = 0x2
|
||||
FAN_EVENT_INFO_TYPE_ERROR = 0x5
|
||||
FAN_EVENT_INFO_TYPE_FID = 0x1
|
||||
FAN_EVENT_INFO_TYPE_PIDFD = 0x4
|
||||
FAN_EVENT_METADATA_LEN = 0x18
|
||||
FAN_EVENT_ON_CHILD = 0x8000000
|
||||
FAN_FS_ERROR = 0x8000
|
||||
FAN_MARK_ADD = 0x1
|
||||
FAN_MARK_DONT_FOLLOW = 0x4
|
||||
FAN_MARK_FILESYSTEM = 0x100
|
||||
|
@ -801,6 +835,7 @@ const (
|
|||
FAN_MOVE_SELF = 0x800
|
||||
FAN_NOFD = -0x1
|
||||
FAN_NONBLOCK = 0x2
|
||||
FAN_NOPIDFD = -0x1
|
||||
FAN_ONDIR = 0x40000000
|
||||
FAN_OPEN = 0x20
|
||||
FAN_OPEN_EXEC = 0x1000
|
||||
|
@ -811,6 +846,7 @@ const (
|
|||
FAN_REPORT_DIR_FID = 0x400
|
||||
FAN_REPORT_FID = 0x200
|
||||
FAN_REPORT_NAME = 0x800
|
||||
FAN_REPORT_PIDFD = 0x80
|
||||
FAN_REPORT_TID = 0x100
|
||||
FAN_UNLIMITED_MARKS = 0x20
|
||||
FAN_UNLIMITED_QUEUE = 0x10
|
||||
|
@ -860,6 +896,7 @@ const (
|
|||
FS_IOC_GET_ENCRYPTION_KEY_STATUS = 0xc080661a
|
||||
FS_IOC_GET_ENCRYPTION_POLICY_EX = 0xc0096616
|
||||
FS_IOC_MEASURE_VERITY = 0xc0046686
|
||||
FS_IOC_READ_VERITY_METADATA = 0xc0286687
|
||||
FS_IOC_REMOVE_ENCRYPTION_KEY = 0xc0406618
|
||||
FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS = 0xc0406619
|
||||
FS_KEY_DESCRIPTOR_SIZE = 0x8
|
||||
|
@ -875,6 +912,9 @@ const (
|
|||
FS_VERITY_FL = 0x100000
|
||||
FS_VERITY_HASH_ALG_SHA256 = 0x1
|
||||
FS_VERITY_HASH_ALG_SHA512 = 0x2
|
||||
FS_VERITY_METADATA_TYPE_DESCRIPTOR = 0x2
|
||||
FS_VERITY_METADATA_TYPE_MERKLE_TREE = 0x1
|
||||
FS_VERITY_METADATA_TYPE_SIGNATURE = 0x3
|
||||
FUTEXFS_SUPER_MAGIC = 0xbad1dea
|
||||
F_ADD_SEALS = 0x409
|
||||
F_DUPFD = 0x0
|
||||
|
@ -973,7 +1013,6 @@ const (
|
|||
HPFS_SUPER_MAGIC = 0xf995e849
|
||||
HUGETLBFS_MAGIC = 0x958458f6
|
||||
IBSHIFT = 0x10
|
||||
ICMPV6_FILTER = 0x1
|
||||
ICRNL = 0x100
|
||||
IFA_F_DADFAILED = 0x8
|
||||
IFA_F_DEPRECATED = 0x20
|
||||
|
@ -1229,6 +1268,9 @@ const (
|
|||
IP_XFRM_POLICY = 0x11
|
||||
ISOFS_SUPER_MAGIC = 0x9660
|
||||
ISTRIP = 0x20
|
||||
ITIMER_PROF = 0x2
|
||||
ITIMER_REAL = 0x0
|
||||
ITIMER_VIRTUAL = 0x1
|
||||
IUTF8 = 0x4000
|
||||
IXANY = 0x800
|
||||
JFFS2_SUPER_MAGIC = 0x72b6
|
||||
|
@ -1244,6 +1286,7 @@ const (
|
|||
KEXEC_ARCH_PARISC = 0xf0000
|
||||
KEXEC_ARCH_PPC = 0x140000
|
||||
KEXEC_ARCH_PPC64 = 0x150000
|
||||
KEXEC_ARCH_RISCV = 0xf30000
|
||||
KEXEC_ARCH_S390 = 0x160000
|
||||
KEXEC_ARCH_SH = 0x2a0000
|
||||
KEXEC_ARCH_X86_64 = 0x3e0000
|
||||
|
@ -1319,6 +1362,20 @@ const (
|
|||
KEY_SPEC_THREAD_KEYRING = -0x1
|
||||
KEY_SPEC_USER_KEYRING = -0x4
|
||||
KEY_SPEC_USER_SESSION_KEYRING = -0x5
|
||||
LANDLOCK_ACCESS_FS_EXECUTE = 0x1
|
||||
LANDLOCK_ACCESS_FS_MAKE_BLOCK = 0x800
|
||||
LANDLOCK_ACCESS_FS_MAKE_CHAR = 0x40
|
||||
LANDLOCK_ACCESS_FS_MAKE_DIR = 0x80
|
||||
LANDLOCK_ACCESS_FS_MAKE_FIFO = 0x400
|
||||
LANDLOCK_ACCESS_FS_MAKE_REG = 0x100
|
||||
LANDLOCK_ACCESS_FS_MAKE_SOCK = 0x200
|
||||
LANDLOCK_ACCESS_FS_MAKE_SYM = 0x1000
|
||||
LANDLOCK_ACCESS_FS_READ_DIR = 0x8
|
||||
LANDLOCK_ACCESS_FS_READ_FILE = 0x4
|
||||
LANDLOCK_ACCESS_FS_REMOVE_DIR = 0x10
|
||||
LANDLOCK_ACCESS_FS_REMOVE_FILE = 0x20
|
||||
LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2
|
||||
LANDLOCK_CREATE_RULESET_VERSION = 0x1
|
||||
LINUX_REBOOT_CMD_CAD_OFF = 0x0
|
||||
LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef
|
||||
LINUX_REBOOT_CMD_HALT = 0xcdef0123
|
||||
|
@ -1369,6 +1426,8 @@ const (
|
|||
MADV_NOHUGEPAGE = 0xf
|
||||
MADV_NORMAL = 0x0
|
||||
MADV_PAGEOUT = 0x15
|
||||
MADV_POPULATE_READ = 0x16
|
||||
MADV_POPULATE_WRITE = 0x17
|
||||
MADV_RANDOM = 0x1
|
||||
MADV_REMOVE = 0x9
|
||||
MADV_SEQUENTIAL = 0x2
|
||||
|
@ -1393,6 +1452,10 @@ const (
|
|||
MCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||
MCAST_MSFILTER = 0x30
|
||||
MCAST_UNBLOCK_SOURCE = 0x2c
|
||||
MEMGETREGIONINFO = 0xc0104d08
|
||||
MEMREADOOB64 = 0xc0184d16
|
||||
MEMWRITE = 0xc0304d18
|
||||
MEMWRITEOOB64 = 0xc0184d15
|
||||
MFD_ALLOW_SEALING = 0x2
|
||||
MFD_CLOEXEC = 0x1
|
||||
MFD_HUGETLB = 0x4
|
||||
|
@ -1420,6 +1483,18 @@ const (
|
|||
MNT_FORCE = 0x1
|
||||
MODULE_INIT_IGNORE_MODVERSIONS = 0x1
|
||||
MODULE_INIT_IGNORE_VERMAGIC = 0x2
|
||||
MOUNT_ATTR_IDMAP = 0x100000
|
||||
MOUNT_ATTR_NOATIME = 0x10
|
||||
MOUNT_ATTR_NODEV = 0x4
|
||||
MOUNT_ATTR_NODIRATIME = 0x80
|
||||
MOUNT_ATTR_NOEXEC = 0x8
|
||||
MOUNT_ATTR_NOSUID = 0x2
|
||||
MOUNT_ATTR_NOSYMFOLLOW = 0x200000
|
||||
MOUNT_ATTR_RDONLY = 0x1
|
||||
MOUNT_ATTR_RELATIME = 0x0
|
||||
MOUNT_ATTR_SIZE_VER0 = 0x20
|
||||
MOUNT_ATTR_STRICTATIME = 0x20
|
||||
MOUNT_ATTR__ATIME = 0x70
|
||||
MSDOS_SUPER_MAGIC = 0x4d44
|
||||
MSG_BATCH = 0x40000
|
||||
MSG_CMSG_CLOEXEC = 0x40000000
|
||||
|
@ -1481,7 +1556,35 @@ const (
|
|||
MS_SYNCHRONOUS = 0x10
|
||||
MS_UNBINDABLE = 0x20000
|
||||
MS_VERBOSE = 0x8000
|
||||
MTD_ABSENT = 0x0
|
||||
MTD_BIT_WRITEABLE = 0x800
|
||||
MTD_CAP_NANDFLASH = 0x400
|
||||
MTD_CAP_NORFLASH = 0xc00
|
||||
MTD_CAP_NVRAM = 0x1c00
|
||||
MTD_CAP_RAM = 0x1c00
|
||||
MTD_CAP_ROM = 0x0
|
||||
MTD_DATAFLASH = 0x6
|
||||
MTD_INODE_FS_MAGIC = 0x11307854
|
||||
MTD_MAX_ECCPOS_ENTRIES = 0x40
|
||||
MTD_MAX_OOBFREE_ENTRIES = 0x8
|
||||
MTD_MLCNANDFLASH = 0x8
|
||||
MTD_NANDECC_AUTOPLACE = 0x2
|
||||
MTD_NANDECC_AUTOPL_USR = 0x4
|
||||
MTD_NANDECC_OFF = 0x0
|
||||
MTD_NANDECC_PLACE = 0x1
|
||||
MTD_NANDECC_PLACEONLY = 0x3
|
||||
MTD_NANDFLASH = 0x4
|
||||
MTD_NORFLASH = 0x3
|
||||
MTD_NO_ERASE = 0x1000
|
||||
MTD_OTP_FACTORY = 0x1
|
||||
MTD_OTP_OFF = 0x0
|
||||
MTD_OTP_USER = 0x2
|
||||
MTD_POWERUP_LOCK = 0x2000
|
||||
MTD_RAM = 0x1
|
||||
MTD_ROM = 0x2
|
||||
MTD_SLC_ON_MLC_EMULATION = 0x4000
|
||||
MTD_UBIVOLUME = 0x7
|
||||
MTD_WRITEABLE = 0x400
|
||||
NAME_MAX = 0xff
|
||||
NCP_SUPER_MAGIC = 0x564c
|
||||
NETLINK_ADD_MEMBERSHIP = 0x1
|
||||
|
@ -1521,6 +1624,59 @@ const (
|
|||
NETLINK_XFRM = 0x6
|
||||
NETNSA_MAX = 0x5
|
||||
NETNSA_NSID_NOT_ASSIGNED = -0x1
|
||||
NFC_ATR_REQ_GB_MAXSIZE = 0x30
|
||||
NFC_ATR_REQ_MAXSIZE = 0x40
|
||||
NFC_ATR_RES_GB_MAXSIZE = 0x2f
|
||||
NFC_ATR_RES_MAXSIZE = 0x40
|
||||
NFC_COMM_ACTIVE = 0x0
|
||||
NFC_COMM_PASSIVE = 0x1
|
||||
NFC_DEVICE_NAME_MAXSIZE = 0x8
|
||||
NFC_DIRECTION_RX = 0x0
|
||||
NFC_DIRECTION_TX = 0x1
|
||||
NFC_FIRMWARE_NAME_MAXSIZE = 0x20
|
||||
NFC_GB_MAXSIZE = 0x30
|
||||
NFC_GENL_MCAST_EVENT_NAME = "events"
|
||||
NFC_GENL_NAME = "nfc"
|
||||
NFC_GENL_VERSION = 0x1
|
||||
NFC_HEADER_SIZE = 0x1
|
||||
NFC_ISO15693_UID_MAXSIZE = 0x8
|
||||
NFC_LLCP_MAX_SERVICE_NAME = 0x3f
|
||||
NFC_LLCP_MIUX = 0x1
|
||||
NFC_LLCP_REMOTE_LTO = 0x3
|
||||
NFC_LLCP_REMOTE_MIU = 0x2
|
||||
NFC_LLCP_REMOTE_RW = 0x4
|
||||
NFC_LLCP_RW = 0x0
|
||||
NFC_NFCID1_MAXSIZE = 0xa
|
||||
NFC_NFCID2_MAXSIZE = 0x8
|
||||
NFC_NFCID3_MAXSIZE = 0xa
|
||||
NFC_PROTO_FELICA = 0x3
|
||||
NFC_PROTO_FELICA_MASK = 0x8
|
||||
NFC_PROTO_ISO14443 = 0x4
|
||||
NFC_PROTO_ISO14443_B = 0x6
|
||||
NFC_PROTO_ISO14443_B_MASK = 0x40
|
||||
NFC_PROTO_ISO14443_MASK = 0x10
|
||||
NFC_PROTO_ISO15693 = 0x7
|
||||
NFC_PROTO_ISO15693_MASK = 0x80
|
||||
NFC_PROTO_JEWEL = 0x1
|
||||
NFC_PROTO_JEWEL_MASK = 0x2
|
||||
NFC_PROTO_MAX = 0x8
|
||||
NFC_PROTO_MIFARE = 0x2
|
||||
NFC_PROTO_MIFARE_MASK = 0x4
|
||||
NFC_PROTO_NFC_DEP = 0x5
|
||||
NFC_PROTO_NFC_DEP_MASK = 0x20
|
||||
NFC_RAW_HEADER_SIZE = 0x2
|
||||
NFC_RF_INITIATOR = 0x0
|
||||
NFC_RF_NONE = 0x2
|
||||
NFC_RF_TARGET = 0x1
|
||||
NFC_SENSB_RES_MAXSIZE = 0xc
|
||||
NFC_SENSF_RES_MAXSIZE = 0x12
|
||||
NFC_SE_DISABLED = 0x0
|
||||
NFC_SE_EMBEDDED = 0x2
|
||||
NFC_SE_ENABLED = 0x1
|
||||
NFC_SE_UICC = 0x1
|
||||
NFC_SOCKPROTO_LLCP = 0x1
|
||||
NFC_SOCKPROTO_MAX = 0x2
|
||||
NFC_SOCKPROTO_RAW = 0x0
|
||||
NFNETLINK_V0 = 0x0
|
||||
NFNLGRP_ACCT_QUOTA = 0x8
|
||||
NFNLGRP_CONNTRACK_DESTROY = 0x3
|
||||
|
@ -1538,11 +1694,12 @@ const (
|
|||
NFNL_MSG_BATCH_END = 0x11
|
||||
NFNL_NFA_NEST = 0x8000
|
||||
NFNL_SUBSYS_ACCT = 0x7
|
||||
NFNL_SUBSYS_COUNT = 0xc
|
||||
NFNL_SUBSYS_COUNT = 0xd
|
||||
NFNL_SUBSYS_CTHELPER = 0x9
|
||||
NFNL_SUBSYS_CTNETLINK = 0x1
|
||||
NFNL_SUBSYS_CTNETLINK_EXP = 0x2
|
||||
NFNL_SUBSYS_CTNETLINK_TIMEOUT = 0x8
|
||||
NFNL_SUBSYS_HOOK = 0xc
|
||||
NFNL_SUBSYS_IPSET = 0x6
|
||||
NFNL_SUBSYS_NFTABLES = 0xa
|
||||
NFNL_SUBSYS_NFT_COMPAT = 0xb
|
||||
|
@ -1658,16 +1815,27 @@ const (
|
|||
PERF_ATTR_SIZE_VER4 = 0x68
|
||||
PERF_ATTR_SIZE_VER5 = 0x70
|
||||
PERF_ATTR_SIZE_VER6 = 0x78
|
||||
PERF_ATTR_SIZE_VER7 = 0x80
|
||||
PERF_AUX_FLAG_COLLISION = 0x8
|
||||
PERF_AUX_FLAG_CORESIGHT_FORMAT_CORESIGHT = 0x0
|
||||
PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW = 0x100
|
||||
PERF_AUX_FLAG_OVERWRITE = 0x2
|
||||
PERF_AUX_FLAG_PARTIAL = 0x4
|
||||
PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK = 0xff00
|
||||
PERF_AUX_FLAG_TRUNCATED = 0x1
|
||||
PERF_FLAG_FD_CLOEXEC = 0x8
|
||||
PERF_FLAG_FD_NO_GROUP = 0x1
|
||||
PERF_FLAG_FD_OUTPUT = 0x2
|
||||
PERF_FLAG_PID_CGROUP = 0x4
|
||||
PERF_HW_EVENT_MASK = 0xffffffff
|
||||
PERF_MAX_CONTEXTS_PER_STACK = 0x8
|
||||
PERF_MAX_STACK_DEPTH = 0x7f
|
||||
PERF_MEM_BLK_ADDR = 0x4
|
||||
PERF_MEM_BLK_DATA = 0x2
|
||||
PERF_MEM_BLK_NA = 0x1
|
||||
PERF_MEM_BLK_SHIFT = 0x28
|
||||
PERF_MEM_HOPS_0 = 0x1
|
||||
PERF_MEM_HOPS_SHIFT = 0x2b
|
||||
PERF_MEM_LOCK_LOCKED = 0x2
|
||||
PERF_MEM_LOCK_NA = 0x1
|
||||
PERF_MEM_LOCK_SHIFT = 0x18
|
||||
|
@ -1720,6 +1888,7 @@ const (
|
|||
PERF_MEM_TLB_OS = 0x40
|
||||
PERF_MEM_TLB_SHIFT = 0x1a
|
||||
PERF_MEM_TLB_WK = 0x20
|
||||
PERF_PMU_TYPE_SHIFT = 0x20
|
||||
PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER = 0x1
|
||||
PERF_RECORD_MISC_COMM_EXEC = 0x2000
|
||||
PERF_RECORD_MISC_CPUMODE_MASK = 0x7
|
||||
|
@ -1731,12 +1900,14 @@ const (
|
|||
PERF_RECORD_MISC_GUEST_USER = 0x5
|
||||
PERF_RECORD_MISC_HYPERVISOR = 0x3
|
||||
PERF_RECORD_MISC_KERNEL = 0x1
|
||||
PERF_RECORD_MISC_MMAP_BUILD_ID = 0x4000
|
||||
PERF_RECORD_MISC_MMAP_DATA = 0x2000
|
||||
PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT = 0x1000
|
||||
PERF_RECORD_MISC_SWITCH_OUT = 0x2000
|
||||
PERF_RECORD_MISC_SWITCH_OUT_PREEMPT = 0x4000
|
||||
PERF_RECORD_MISC_USER = 0x2
|
||||
PERF_SAMPLE_BRANCH_PLM_ALL = 0x7
|
||||
PERF_SAMPLE_WEIGHT_TYPE = 0x1004000
|
||||
PIPEFS_MAGIC = 0x50495045
|
||||
PPC_CMM_MAGIC = 0xc7571590
|
||||
PPPIOCGNPMODE = 0xc008744c
|
||||
|
@ -1817,7 +1988,18 @@ const (
|
|||
PR_PAC_APGAKEY = 0x10
|
||||
PR_PAC_APIAKEY = 0x1
|
||||
PR_PAC_APIBKEY = 0x2
|
||||
PR_PAC_GET_ENABLED_KEYS = 0x3d
|
||||
PR_PAC_RESET_KEYS = 0x36
|
||||
PR_PAC_SET_ENABLED_KEYS = 0x3c
|
||||
PR_SCHED_CORE = 0x3e
|
||||
PR_SCHED_CORE_CREATE = 0x1
|
||||
PR_SCHED_CORE_GET = 0x0
|
||||
PR_SCHED_CORE_MAX = 0x4
|
||||
PR_SCHED_CORE_SCOPE_PROCESS_GROUP = 0x2
|
||||
PR_SCHED_CORE_SCOPE_THREAD = 0x0
|
||||
PR_SCHED_CORE_SCOPE_THREAD_GROUP = 0x1
|
||||
PR_SCHED_CORE_SHARE_FROM = 0x3
|
||||
PR_SCHED_CORE_SHARE_TO = 0x2
|
||||
PR_SET_CHILD_SUBREAPER = 0x24
|
||||
PR_SET_DUMPABLE = 0x4
|
||||
PR_SET_ENDIAN = 0x14
|
||||
|
@ -1861,6 +2043,7 @@ const (
|
|||
PR_SPEC_ENABLE = 0x2
|
||||
PR_SPEC_FORCE_DISABLE = 0x8
|
||||
PR_SPEC_INDIRECT_BRANCH = 0x1
|
||||
PR_SPEC_L1D_FLUSH = 0x2
|
||||
PR_SPEC_NOT_AFFECTED = 0x0
|
||||
PR_SPEC_PRCTL = 0x1
|
||||
PR_SPEC_STORE_BYPASS = 0x0
|
||||
|
@ -1899,6 +2082,7 @@ const (
|
|||
PTRACE_GETREGSET = 0x4204
|
||||
PTRACE_GETSIGINFO = 0x4202
|
||||
PTRACE_GETSIGMASK = 0x420a
|
||||
PTRACE_GET_RSEQ_CONFIGURATION = 0x420f
|
||||
PTRACE_GET_SYSCALL_INFO = 0x420e
|
||||
PTRACE_INTERRUPT = 0x4207
|
||||
PTRACE_KILL = 0x8
|
||||
|
@ -1940,6 +2124,11 @@ const (
|
|||
QNX4_SUPER_MAGIC = 0x2f
|
||||
QNX6_SUPER_MAGIC = 0x68191122
|
||||
RAMFS_MAGIC = 0x858458f6
|
||||
RAW_PAYLOAD_DIGITAL = 0x3
|
||||
RAW_PAYLOAD_HCI = 0x2
|
||||
RAW_PAYLOAD_LLCP = 0x0
|
||||
RAW_PAYLOAD_NCI = 0x1
|
||||
RAW_PAYLOAD_PROPRIETARY = 0x4
|
||||
RDTGROUP_SUPER_MAGIC = 0x7655821
|
||||
REISERFS_SUPER_MAGIC = 0x52654973
|
||||
RENAME_EXCHANGE = 0x2
|
||||
|
@ -1990,8 +2179,23 @@ const (
|
|||
RTCF_NAT = 0x800000
|
||||
RTCF_VALVE = 0x200000
|
||||
RTC_AF = 0x20
|
||||
RTC_BSM_DIRECT = 0x1
|
||||
RTC_BSM_DISABLED = 0x0
|
||||
RTC_BSM_LEVEL = 0x2
|
||||
RTC_BSM_STANDBY = 0x3
|
||||
RTC_FEATURE_ALARM = 0x0
|
||||
RTC_FEATURE_ALARM_RES_2S = 0x3
|
||||
RTC_FEATURE_ALARM_RES_MINUTE = 0x1
|
||||
RTC_FEATURE_BACKUP_SWITCH_MODE = 0x6
|
||||
RTC_FEATURE_CNT = 0x7
|
||||
RTC_FEATURE_CORRECTION = 0x5
|
||||
RTC_FEATURE_NEED_WEEK_DAY = 0x2
|
||||
RTC_FEATURE_UPDATE_INTERRUPT = 0x4
|
||||
RTC_IRQF = 0x80
|
||||
RTC_MAX_FREQ = 0x2000
|
||||
RTC_PARAM_BACKUP_SWITCH_MODE = 0x2
|
||||
RTC_PARAM_CORRECTION = 0x1
|
||||
RTC_PARAM_FEATURES = 0x0
|
||||
RTC_PF = 0x40
|
||||
RTC_UF = 0x10
|
||||
RTF_ADDRCLASSMASK = 0xf8000000
|
||||
|
@ -2050,6 +2254,7 @@ const (
|
|||
RTM_DELNEIGH = 0x1d
|
||||
RTM_DELNETCONF = 0x51
|
||||
RTM_DELNEXTHOP = 0x69
|
||||
RTM_DELNEXTHOPBUCKET = 0x75
|
||||
RTM_DELNSID = 0x59
|
||||
RTM_DELQDISC = 0x25
|
||||
RTM_DELROUTE = 0x19
|
||||
|
@ -2063,6 +2268,7 @@ const (
|
|||
RTM_F_LOOKUP_TABLE = 0x1000
|
||||
RTM_F_NOTIFY = 0x100
|
||||
RTM_F_OFFLOAD = 0x4000
|
||||
RTM_F_OFFLOAD_FAILED = 0x20000000
|
||||
RTM_F_PREFIX = 0x800
|
||||
RTM_F_TRAP = 0x8000
|
||||
RTM_GETACTION = 0x32
|
||||
|
@ -2079,6 +2285,7 @@ const (
|
|||
RTM_GETNEIGHTBL = 0x42
|
||||
RTM_GETNETCONF = 0x52
|
||||
RTM_GETNEXTHOP = 0x6a
|
||||
RTM_GETNEXTHOPBUCKET = 0x76
|
||||
RTM_GETNSID = 0x5a
|
||||
RTM_GETQDISC = 0x26
|
||||
RTM_GETROUTE = 0x1a
|
||||
|
@ -2087,7 +2294,7 @@ const (
|
|||
RTM_GETTCLASS = 0x2a
|
||||
RTM_GETTFILTER = 0x2e
|
||||
RTM_GETVLAN = 0x72
|
||||
RTM_MAX = 0x73
|
||||
RTM_MAX = 0x77
|
||||
RTM_NEWACTION = 0x30
|
||||
RTM_NEWADDR = 0x14
|
||||
RTM_NEWADDRLABEL = 0x48
|
||||
|
@ -2101,6 +2308,7 @@ const (
|
|||
RTM_NEWNEIGHTBL = 0x40
|
||||
RTM_NEWNETCONF = 0x50
|
||||
RTM_NEWNEXTHOP = 0x68
|
||||
RTM_NEWNEXTHOPBUCKET = 0x74
|
||||
RTM_NEWNSID = 0x58
|
||||
RTM_NEWNVLAN = 0x70
|
||||
RTM_NEWPREFIX = 0x34
|
||||
|
@ -2110,8 +2318,8 @@ const (
|
|||
RTM_NEWSTATS = 0x5c
|
||||
RTM_NEWTCLASS = 0x28
|
||||
RTM_NEWTFILTER = 0x2c
|
||||
RTM_NR_FAMILIES = 0x19
|
||||
RTM_NR_MSGTYPES = 0x64
|
||||
RTM_NR_FAMILIES = 0x1a
|
||||
RTM_NR_MSGTYPES = 0x68
|
||||
RTM_SETDCB = 0x4f
|
||||
RTM_SETLINK = 0x13
|
||||
RTM_SETNEIGHTBL = 0x43
|
||||
|
@ -2139,6 +2347,7 @@ const (
|
|||
RTPROT_MROUTED = 0x11
|
||||
RTPROT_MRT = 0xa
|
||||
RTPROT_NTK = 0xf
|
||||
RTPROT_OPENR = 0x63
|
||||
RTPROT_OSPF = 0xbc
|
||||
RTPROT_RA = 0x9
|
||||
RTPROT_REDIRECT = 0x1
|
||||
|
@ -2169,7 +2378,14 @@ const (
|
|||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECRETMEM_MAGIC = 0x5345434d
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SEEK_CUR = 0x1
|
||||
SEEK_DATA = 0x3
|
||||
SEEK_END = 0x2
|
||||
SEEK_HOLE = 0x4
|
||||
SEEK_MAX = 0x4
|
||||
SEEK_SET = 0x0
|
||||
SELINUX_MAGIC = 0xf97cff8c
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
|
@ -2274,12 +2490,15 @@ const (
|
|||
SMART_WRITE_THRESHOLDS = 0xd7
|
||||
SMB_SUPER_MAGIC = 0x517b
|
||||
SOCKFS_MAGIC = 0x534f434b
|
||||
SOCK_BUF_LOCK_MASK = 0x3
|
||||
SOCK_DCCP = 0x6
|
||||
SOCK_IOC_TYPE = 0x89
|
||||
SOCK_PACKET = 0xa
|
||||
SOCK_RAW = 0x3
|
||||
SOCK_RCVBUF_LOCK = 0x2
|
||||
SOCK_RDM = 0x4
|
||||
SOCK_SEQPACKET = 0x5
|
||||
SOCK_SNDBUF_LOCK = 0x1
|
||||
SOL_AAL = 0x109
|
||||
SOL_ALG = 0x117
|
||||
SOL_ATM = 0x108
|
||||
|
@ -2336,6 +2555,8 @@ const (
|
|||
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
|
||||
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
|
||||
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
|
||||
SO_VM_SOCKETS_CONNECT_TIMEOUT_NEW = 0x8
|
||||
SO_VM_SOCKETS_CONNECT_TIMEOUT_OLD = 0x6
|
||||
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
|
||||
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
|
||||
SO_VM_SOCKETS_TRUSTED = 0x5
|
||||
|
@ -2416,6 +2637,14 @@ const (
|
|||
TCOFLUSH = 0x1
|
||||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCPOPT_EOL = 0x0
|
||||
TCPOPT_MAXSEG = 0x2
|
||||
TCPOPT_NOP = 0x1
|
||||
TCPOPT_SACK = 0x5
|
||||
TCPOPT_SACK_PERMITTED = 0x4
|
||||
TCPOPT_TIMESTAMP = 0x8
|
||||
TCPOPT_TSTAMP_HDR = 0x101080a
|
||||
TCPOPT_WINDOW = 0x3
|
||||
TCP_CC_INFO = 0x1a
|
||||
TCP_CM_INQ = 0x24
|
||||
TCP_CONGESTION = 0xd
|
||||
|
@ -2622,6 +2851,13 @@ const (
|
|||
WDIOS_TEMPPANIC = 0x4
|
||||
WDIOS_UNKNOWN = -0x1
|
||||
WEXITED = 0x4
|
||||
WGALLOWEDIP_A_MAX = 0x3
|
||||
WGDEVICE_A_MAX = 0x8
|
||||
WGPEER_A_MAX = 0xa
|
||||
WG_CMD_MAX = 0x1
|
||||
WG_GENL_NAME = "wireguard"
|
||||
WG_GENL_VERSION = 0x1
|
||||
WG_KEY_LEN = 0x20
|
||||
WIN_ACKMEDIACHANGE = 0xdb
|
||||
WIN_CHECKPOWERMODE1 = 0xe5
|
||||
WIN_CHECKPOWERMODE2 = 0x98
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// +build 386,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
@ -60,6 +60,8 @@ const (
|
|||
CS8 = 0x30
|
||||
CSIZE = 0x30
|
||||
CSTOPB = 0x40
|
||||
ECCGETLAYOUT = 0x81484d11
|
||||
ECCGETSTATS = 0x80104d12
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
|
@ -123,6 +125,19 @@ const (
|
|||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MCL_ONFAULT = 0x4
|
||||
MEMERASE = 0x40084d02
|
||||
MEMERASE64 = 0x40104d14
|
||||
MEMGETBADBLOCK = 0x40084d0b
|
||||
MEMGETINFO = 0x80204d01
|
||||
MEMGETOOBSEL = 0x80c84d0a
|
||||
MEMGETREGIONCOUNT = 0x80044d07
|
||||
MEMISLOCKED = 0x80084d17
|
||||
MEMLOCK = 0x40084d05
|
||||
MEMREADOOB = 0xc00c4d04
|
||||
MEMSETBADBLOCK = 0x40084d0c
|
||||
MEMUNLOCK = 0x40084d06
|
||||
MEMWRITEOOB = 0xc00c4d03
|
||||
MTDFILEMODE = 0x4d13
|
||||
NFDBITS = 0x20
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
|
@ -132,6 +147,11 @@ const (
|
|||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
OTPERASE = 0x400c4d19
|
||||
OTPGETREGIONCOUNT = 0x40044d0e
|
||||
OTPGETREGIONINFO = 0x400c4d0f
|
||||
OTPLOCK = 0x800c4d10
|
||||
OTPSELECT = 0x80044d0d
|
||||
O_APPEND = 0x400
|
||||
O_ASYNC = 0x2000
|
||||
O_CLOEXEC = 0x80000
|
||||
|
@ -230,6 +250,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x4004700e
|
||||
RTC_IRQP_READ = 0x8004700b
|
||||
RTC_IRQP_SET = 0x4004700c
|
||||
RTC_PARAM_GET = 0x40187013
|
||||
RTC_PARAM_SET = 0x40187014
|
||||
RTC_PIE_OFF = 0x7006
|
||||
RTC_PIE_ON = 0x7005
|
||||
RTC_PLL_GET = 0x801c7011
|
||||
|
@ -273,6 +295,7 @@ const (
|
|||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x6
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
|
@ -289,6 +312,7 @@ const (
|
|||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0xa
|
||||
SO_PASSCRED = 0x10
|
||||
|
@ -305,6 +329,7 @@ const (
|
|||
SO_RCVTIMEO = 0x14
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x14
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// +build amd64,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
@ -60,6 +60,8 @@ const (
|
|||
CS8 = 0x30
|
||||
CSIZE = 0x30
|
||||
CSTOPB = 0x40
|
||||
ECCGETLAYOUT = 0x81484d11
|
||||
ECCGETSTATS = 0x80104d12
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
|
@ -123,6 +125,19 @@ const (
|
|||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MCL_ONFAULT = 0x4
|
||||
MEMERASE = 0x40084d02
|
||||
MEMERASE64 = 0x40104d14
|
||||
MEMGETBADBLOCK = 0x40084d0b
|
||||
MEMGETINFO = 0x80204d01
|
||||
MEMGETOOBSEL = 0x80c84d0a
|
||||
MEMGETREGIONCOUNT = 0x80044d07
|
||||
MEMISLOCKED = 0x80084d17
|
||||
MEMLOCK = 0x40084d05
|
||||
MEMREADOOB = 0xc0104d04
|
||||
MEMSETBADBLOCK = 0x40084d0c
|
||||
MEMUNLOCK = 0x40084d06
|
||||
MEMWRITEOOB = 0xc0104d03
|
||||
MTDFILEMODE = 0x4d13
|
||||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
|
@ -132,6 +147,11 @@ const (
|
|||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
OTPERASE = 0x400c4d19
|
||||
OTPGETREGIONCOUNT = 0x40044d0e
|
||||
OTPGETREGIONINFO = 0x400c4d0f
|
||||
OTPLOCK = 0x800c4d10
|
||||
OTPSELECT = 0x80044d0d
|
||||
O_APPEND = 0x400
|
||||
O_ASYNC = 0x2000
|
||||
O_CLOEXEC = 0x80000
|
||||
|
@ -231,6 +251,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x4008700e
|
||||
RTC_IRQP_READ = 0x8008700b
|
||||
RTC_IRQP_SET = 0x4008700c
|
||||
RTC_PARAM_GET = 0x40187013
|
||||
RTC_PARAM_SET = 0x40187014
|
||||
RTC_PIE_OFF = 0x7006
|
||||
RTC_PIE_ON = 0x7005
|
||||
RTC_PLL_GET = 0x80207011
|
||||
|
@ -274,6 +296,7 @@ const (
|
|||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x6
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
|
@ -290,6 +313,7 @@ const (
|
|||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0xa
|
||||
SO_PASSCRED = 0x10
|
||||
|
@ -306,6 +330,7 @@ const (
|
|||
SO_RCVTIMEO = 0x14
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x14
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// +build arm,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
@ -60,6 +60,8 @@ const (
|
|||
CS8 = 0x30
|
||||
CSIZE = 0x30
|
||||
CSTOPB = 0x40
|
||||
ECCGETLAYOUT = 0x81484d11
|
||||
ECCGETSTATS = 0x80104d12
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
|
@ -121,6 +123,19 @@ const (
|
|||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MCL_ONFAULT = 0x4
|
||||
MEMERASE = 0x40084d02
|
||||
MEMERASE64 = 0x40104d14
|
||||
MEMGETBADBLOCK = 0x40084d0b
|
||||
MEMGETINFO = 0x80204d01
|
||||
MEMGETOOBSEL = 0x80c84d0a
|
||||
MEMGETREGIONCOUNT = 0x80044d07
|
||||
MEMISLOCKED = 0x80084d17
|
||||
MEMLOCK = 0x40084d05
|
||||
MEMREADOOB = 0xc00c4d04
|
||||
MEMSETBADBLOCK = 0x40084d0c
|
||||
MEMUNLOCK = 0x40084d06
|
||||
MEMWRITEOOB = 0xc00c4d03
|
||||
MTDFILEMODE = 0x4d13
|
||||
NFDBITS = 0x20
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
|
@ -130,6 +145,11 @@ const (
|
|||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
OTPERASE = 0x400c4d19
|
||||
OTPGETREGIONCOUNT = 0x40044d0e
|
||||
OTPGETREGIONINFO = 0x400c4d0f
|
||||
OTPLOCK = 0x800c4d10
|
||||
OTPSELECT = 0x80044d0d
|
||||
O_APPEND = 0x400
|
||||
O_ASYNC = 0x2000
|
||||
O_CLOEXEC = 0x80000
|
||||
|
@ -237,6 +257,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x4004700e
|
||||
RTC_IRQP_READ = 0x8004700b
|
||||
RTC_IRQP_SET = 0x4004700c
|
||||
RTC_PARAM_GET = 0x40187013
|
||||
RTC_PARAM_SET = 0x40187014
|
||||
RTC_PIE_OFF = 0x7006
|
||||
RTC_PIE_ON = 0x7005
|
||||
RTC_PLL_GET = 0x801c7011
|
||||
|
@ -280,6 +302,7 @@ const (
|
|||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x6
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
|
@ -296,6 +319,7 @@ const (
|
|||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0xa
|
||||
SO_PASSCRED = 0x10
|
||||
|
@ -312,6 +336,7 @@ const (
|
|||
SO_RCVTIMEO = 0x14
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x14
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// +build arm64,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
@ -60,6 +60,8 @@ const (
|
|||
CS8 = 0x30
|
||||
CSIZE = 0x30
|
||||
CSTOPB = 0x40
|
||||
ECCGETLAYOUT = 0x81484d11
|
||||
ECCGETSTATS = 0x80104d12
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
|
@ -124,6 +126,19 @@ const (
|
|||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MCL_ONFAULT = 0x4
|
||||
MEMERASE = 0x40084d02
|
||||
MEMERASE64 = 0x40104d14
|
||||
MEMGETBADBLOCK = 0x40084d0b
|
||||
MEMGETINFO = 0x80204d01
|
||||
MEMGETOOBSEL = 0x80c84d0a
|
||||
MEMGETREGIONCOUNT = 0x80044d07
|
||||
MEMISLOCKED = 0x80084d17
|
||||
MEMLOCK = 0x40084d05
|
||||
MEMREADOOB = 0xc0104d04
|
||||
MEMSETBADBLOCK = 0x40084d0c
|
||||
MEMUNLOCK = 0x40084d06
|
||||
MEMWRITEOOB = 0xc0104d03
|
||||
MTDFILEMODE = 0x4d13
|
||||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
|
@ -133,6 +148,11 @@ const (
|
|||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
OTPERASE = 0x400c4d19
|
||||
OTPGETREGIONCOUNT = 0x40044d0e
|
||||
OTPGETREGIONINFO = 0x400c4d0f
|
||||
OTPLOCK = 0x800c4d10
|
||||
OTPSELECT = 0x80044d0d
|
||||
O_APPEND = 0x400
|
||||
O_ASYNC = 0x2000
|
||||
O_CLOEXEC = 0x80000
|
||||
|
@ -227,6 +247,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x4008700e
|
||||
RTC_IRQP_READ = 0x8008700b
|
||||
RTC_IRQP_SET = 0x4008700c
|
||||
RTC_PARAM_GET = 0x40187013
|
||||
RTC_PARAM_SET = 0x40187014
|
||||
RTC_PIE_OFF = 0x7006
|
||||
RTC_PIE_ON = 0x7005
|
||||
RTC_PLL_GET = 0x80207011
|
||||
|
@ -270,6 +292,7 @@ const (
|
|||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x6
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
|
@ -286,6 +309,7 @@ const (
|
|||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0xa
|
||||
SO_PASSCRED = 0x10
|
||||
|
@ -302,6 +326,7 @@ const (
|
|||
SO_RCVTIMEO = 0x14
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x14
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// +build mips,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
@ -60,6 +60,8 @@ const (
|
|||
CS8 = 0x30
|
||||
CSIZE = 0x30
|
||||
CSTOPB = 0x40
|
||||
ECCGETLAYOUT = 0x41484d11
|
||||
ECCGETSTATS = 0x40104d12
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
|
@ -121,6 +123,19 @@ const (
|
|||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MCL_ONFAULT = 0x4
|
||||
MEMERASE = 0x80084d02
|
||||
MEMERASE64 = 0x80104d14
|
||||
MEMGETBADBLOCK = 0x80084d0b
|
||||
MEMGETINFO = 0x40204d01
|
||||
MEMGETOOBSEL = 0x40c84d0a
|
||||
MEMGETREGIONCOUNT = 0x40044d07
|
||||
MEMISLOCKED = 0x40084d17
|
||||
MEMLOCK = 0x80084d05
|
||||
MEMREADOOB = 0xc00c4d04
|
||||
MEMSETBADBLOCK = 0x80084d0c
|
||||
MEMUNLOCK = 0x80084d06
|
||||
MEMWRITEOOB = 0xc00c4d03
|
||||
MTDFILEMODE = 0x20004d13
|
||||
NFDBITS = 0x20
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
|
@ -130,6 +145,11 @@ const (
|
|||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
OTPERASE = 0x800c4d19
|
||||
OTPGETREGIONCOUNT = 0x80044d0e
|
||||
OTPGETREGIONINFO = 0x800c4d0f
|
||||
OTPLOCK = 0x400c4d10
|
||||
OTPSELECT = 0x40044d0d
|
||||
O_APPEND = 0x8
|
||||
O_ASYNC = 0x1000
|
||||
O_CLOEXEC = 0x80000
|
||||
|
@ -230,6 +250,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8004700e
|
||||
RTC_IRQP_READ = 0x4004700b
|
||||
RTC_IRQP_SET = 0x8004700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x401c7011
|
||||
|
@ -273,6 +295,7 @@ const (
|
|||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x20
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
|
@ -289,6 +312,7 @@ const (
|
|||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0x100
|
||||
SO_PASSCRED = 0x11
|
||||
|
@ -305,6 +329,7 @@ const (
|
|||
SO_RCVTIMEO = 0x1006
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x1006
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// +build mips64,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
@ -60,6 +60,8 @@ const (
|
|||
CS8 = 0x30
|
||||
CSIZE = 0x30
|
||||
CSTOPB = 0x40
|
||||
ECCGETLAYOUT = 0x41484d11
|
||||
ECCGETSTATS = 0x40104d12
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
|
@ -121,6 +123,19 @@ const (
|
|||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MCL_ONFAULT = 0x4
|
||||
MEMERASE = 0x80084d02
|
||||
MEMERASE64 = 0x80104d14
|
||||
MEMGETBADBLOCK = 0x80084d0b
|
||||
MEMGETINFO = 0x40204d01
|
||||
MEMGETOOBSEL = 0x40c84d0a
|
||||
MEMGETREGIONCOUNT = 0x40044d07
|
||||
MEMISLOCKED = 0x40084d17
|
||||
MEMLOCK = 0x80084d05
|
||||
MEMREADOOB = 0xc0104d04
|
||||
MEMSETBADBLOCK = 0x80084d0c
|
||||
MEMUNLOCK = 0x80084d06
|
||||
MEMWRITEOOB = 0xc0104d03
|
||||
MTDFILEMODE = 0x20004d13
|
||||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
|
@ -130,6 +145,11 @@ const (
|
|||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
OTPERASE = 0x800c4d19
|
||||
OTPGETREGIONCOUNT = 0x80044d0e
|
||||
OTPGETREGIONINFO = 0x800c4d0f
|
||||
OTPLOCK = 0x400c4d10
|
||||
OTPSELECT = 0x40044d0d
|
||||
O_APPEND = 0x8
|
||||
O_ASYNC = 0x1000
|
||||
O_CLOEXEC = 0x80000
|
||||
|
@ -230,6 +250,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8008700e
|
||||
RTC_IRQP_READ = 0x4008700b
|
||||
RTC_IRQP_SET = 0x8008700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x40207011
|
||||
|
@ -273,6 +295,7 @@ const (
|
|||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x20
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
|
@ -289,6 +312,7 @@ const (
|
|||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0x100
|
||||
SO_PASSCRED = 0x11
|
||||
|
@ -305,6 +329,7 @@ const (
|
|||
SO_RCVTIMEO = 0x1006
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x1006
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// +build mips64le,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
@ -60,6 +60,8 @@ const (
|
|||
CS8 = 0x30
|
||||
CSIZE = 0x30
|
||||
CSTOPB = 0x40
|
||||
ECCGETLAYOUT = 0x41484d11
|
||||
ECCGETSTATS = 0x40104d12
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
|
@ -121,6 +123,19 @@ const (
|
|||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MCL_ONFAULT = 0x4
|
||||
MEMERASE = 0x80084d02
|
||||
MEMERASE64 = 0x80104d14
|
||||
MEMGETBADBLOCK = 0x80084d0b
|
||||
MEMGETINFO = 0x40204d01
|
||||
MEMGETOOBSEL = 0x40c84d0a
|
||||
MEMGETREGIONCOUNT = 0x40044d07
|
||||
MEMISLOCKED = 0x40084d17
|
||||
MEMLOCK = 0x80084d05
|
||||
MEMREADOOB = 0xc0104d04
|
||||
MEMSETBADBLOCK = 0x80084d0c
|
||||
MEMUNLOCK = 0x80084d06
|
||||
MEMWRITEOOB = 0xc0104d03
|
||||
MTDFILEMODE = 0x20004d13
|
||||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
|
@ -130,6 +145,11 @@ const (
|
|||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
OTPERASE = 0x800c4d19
|
||||
OTPGETREGIONCOUNT = 0x80044d0e
|
||||
OTPGETREGIONINFO = 0x800c4d0f
|
||||
OTPLOCK = 0x400c4d10
|
||||
OTPSELECT = 0x40044d0d
|
||||
O_APPEND = 0x8
|
||||
O_ASYNC = 0x1000
|
||||
O_CLOEXEC = 0x80000
|
||||
|
@ -230,6 +250,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8008700e
|
||||
RTC_IRQP_READ = 0x4008700b
|
||||
RTC_IRQP_SET = 0x8008700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x40207011
|
||||
|
@ -273,6 +295,7 @@ const (
|
|||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x20
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
|
@ -289,6 +312,7 @@ const (
|
|||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0x100
|
||||
SO_PASSCRED = 0x11
|
||||
|
@ -305,6 +329,7 @@ const (
|
|||
SO_RCVTIMEO = 0x1006
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x1006
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// +build mipsle,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
@ -60,6 +60,8 @@ const (
|
|||
CS8 = 0x30
|
||||
CSIZE = 0x30
|
||||
CSTOPB = 0x40
|
||||
ECCGETLAYOUT = 0x41484d11
|
||||
ECCGETSTATS = 0x40104d12
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
|
@ -121,6 +123,19 @@ const (
|
|||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MCL_ONFAULT = 0x4
|
||||
MEMERASE = 0x80084d02
|
||||
MEMERASE64 = 0x80104d14
|
||||
MEMGETBADBLOCK = 0x80084d0b
|
||||
MEMGETINFO = 0x40204d01
|
||||
MEMGETOOBSEL = 0x40c84d0a
|
||||
MEMGETREGIONCOUNT = 0x40044d07
|
||||
MEMISLOCKED = 0x40084d17
|
||||
MEMLOCK = 0x80084d05
|
||||
MEMREADOOB = 0xc00c4d04
|
||||
MEMSETBADBLOCK = 0x80084d0c
|
||||
MEMUNLOCK = 0x80084d06
|
||||
MEMWRITEOOB = 0xc00c4d03
|
||||
MTDFILEMODE = 0x20004d13
|
||||
NFDBITS = 0x20
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
|
@ -130,6 +145,11 @@ const (
|
|||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
OTPERASE = 0x800c4d19
|
||||
OTPGETREGIONCOUNT = 0x80044d0e
|
||||
OTPGETREGIONINFO = 0x800c4d0f
|
||||
OTPLOCK = 0x400c4d10
|
||||
OTPSELECT = 0x40044d0d
|
||||
O_APPEND = 0x8
|
||||
O_ASYNC = 0x1000
|
||||
O_CLOEXEC = 0x80000
|
||||
|
@ -230,6 +250,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8004700e
|
||||
RTC_IRQP_READ = 0x4004700b
|
||||
RTC_IRQP_SET = 0x8004700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x401c7011
|
||||
|
@ -273,6 +295,7 @@ const (
|
|||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x20
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
|
@ -289,6 +312,7 @@ const (
|
|||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0x100
|
||||
SO_PASSCRED = 0x11
|
||||
|
@ -305,6 +329,7 @@ const (
|
|||
SO_RCVTIMEO = 0x1006
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x1006
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -0,0 +1,885 @@
|
|||
// mkerrors.sh -Wall -Werror -static -I/tmp/include
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
//go:build ppc && linux
|
||||
// +build ppc,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
import "syscall"
|
||||
|
||||
const (
|
||||
B1000000 = 0x17
|
||||
B115200 = 0x11
|
||||
B1152000 = 0x18
|
||||
B1500000 = 0x19
|
||||
B2000000 = 0x1a
|
||||
B230400 = 0x12
|
||||
B2500000 = 0x1b
|
||||
B3000000 = 0x1c
|
||||
B3500000 = 0x1d
|
||||
B4000000 = 0x1e
|
||||
B460800 = 0x13
|
||||
B500000 = 0x14
|
||||
B57600 = 0x10
|
||||
B576000 = 0x15
|
||||
B921600 = 0x16
|
||||
BLKBSZGET = 0x40041270
|
||||
BLKBSZSET = 0x80041271
|
||||
BLKFLSBUF = 0x20001261
|
||||
BLKFRAGET = 0x20001265
|
||||
BLKFRASET = 0x20001264
|
||||
BLKGETSIZE = 0x20001260
|
||||
BLKGETSIZE64 = 0x40041272
|
||||
BLKPBSZGET = 0x2000127b
|
||||
BLKRAGET = 0x20001263
|
||||
BLKRASET = 0x20001262
|
||||
BLKROGET = 0x2000125e
|
||||
BLKROSET = 0x2000125d
|
||||
BLKRRPART = 0x2000125f
|
||||
BLKSECTGET = 0x20001267
|
||||
BLKSECTSET = 0x20001266
|
||||
BLKSSZGET = 0x20001268
|
||||
BOTHER = 0x1f
|
||||
BS1 = 0x8000
|
||||
BSDLY = 0x8000
|
||||
CBAUD = 0xff
|
||||
CBAUDEX = 0x0
|
||||
CIBAUD = 0xff0000
|
||||
CLOCAL = 0x8000
|
||||
CR1 = 0x1000
|
||||
CR2 = 0x2000
|
||||
CR3 = 0x3000
|
||||
CRDLY = 0x3000
|
||||
CREAD = 0x800
|
||||
CS6 = 0x100
|
||||
CS7 = 0x200
|
||||
CS8 = 0x300
|
||||
CSIZE = 0x300
|
||||
CSTOPB = 0x400
|
||||
ECCGETLAYOUT = 0x41484d11
|
||||
ECCGETSTATS = 0x40104d12
|
||||
ECHOCTL = 0x40
|
||||
ECHOE = 0x2
|
||||
ECHOK = 0x4
|
||||
ECHOKE = 0x1
|
||||
ECHONL = 0x10
|
||||
ECHOPRT = 0x20
|
||||
EFD_CLOEXEC = 0x80000
|
||||
EFD_NONBLOCK = 0x800
|
||||
EPOLL_CLOEXEC = 0x80000
|
||||
EXTPROC = 0x10000000
|
||||
FF1 = 0x4000
|
||||
FFDLY = 0x4000
|
||||
FICLONE = 0x80049409
|
||||
FICLONERANGE = 0x8020940d
|
||||
FLUSHO = 0x800000
|
||||
FS_IOC_ENABLE_VERITY = 0x80806685
|
||||
FS_IOC_GETFLAGS = 0x40046601
|
||||
FS_IOC_GET_ENCRYPTION_NONCE = 0x4010661b
|
||||
FS_IOC_GET_ENCRYPTION_POLICY = 0x800c6615
|
||||
FS_IOC_GET_ENCRYPTION_PWSALT = 0x80106614
|
||||
FS_IOC_SETFLAGS = 0x80046602
|
||||
FS_IOC_SET_ENCRYPTION_POLICY = 0x400c6613
|
||||
F_GETLK = 0xc
|
||||
F_GETLK64 = 0xc
|
||||
F_GETOWN = 0x9
|
||||
F_RDLCK = 0x0
|
||||
F_SETLK = 0xd
|
||||
F_SETLK64 = 0xd
|
||||
F_SETLKW = 0xe
|
||||
F_SETLKW64 = 0xe
|
||||
F_SETOWN = 0x8
|
||||
F_UNLCK = 0x2
|
||||
F_WRLCK = 0x1
|
||||
HIDIOCGRAWINFO = 0x40084803
|
||||
HIDIOCGRDESC = 0x50044802
|
||||
HIDIOCGRDESCSIZE = 0x40044801
|
||||
HUPCL = 0x4000
|
||||
ICANON = 0x100
|
||||
IEXTEN = 0x400
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x800
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
|
||||
ISIG = 0x80
|
||||
IUCLC = 0x1000
|
||||
IXOFF = 0x400
|
||||
IXON = 0x200
|
||||
MAP_ANON = 0x20
|
||||
MAP_ANONYMOUS = 0x20
|
||||
MAP_DENYWRITE = 0x800
|
||||
MAP_EXECUTABLE = 0x1000
|
||||
MAP_GROWSDOWN = 0x100
|
||||
MAP_HUGETLB = 0x40000
|
||||
MAP_LOCKED = 0x80
|
||||
MAP_NONBLOCK = 0x10000
|
||||
MAP_NORESERVE = 0x40
|
||||
MAP_POPULATE = 0x8000
|
||||
MAP_STACK = 0x20000
|
||||
MAP_SYNC = 0x80000
|
||||
MCL_CURRENT = 0x2000
|
||||
MCL_FUTURE = 0x4000
|
||||
MCL_ONFAULT = 0x8000
|
||||
MEMERASE = 0x80084d02
|
||||
MEMERASE64 = 0x80104d14
|
||||
MEMGETBADBLOCK = 0x80084d0b
|
||||
MEMGETINFO = 0x40204d01
|
||||
MEMGETOOBSEL = 0x40c84d0a
|
||||
MEMGETREGIONCOUNT = 0x40044d07
|
||||
MEMISLOCKED = 0x40084d17
|
||||
MEMLOCK = 0x80084d05
|
||||
MEMREADOOB = 0xc00c4d04
|
||||
MEMSETBADBLOCK = 0x80084d0c
|
||||
MEMUNLOCK = 0x80084d06
|
||||
MEMWRITEOOB = 0xc00c4d03
|
||||
MTDFILEMODE = 0x20004d13
|
||||
NFDBITS = 0x20
|
||||
NL2 = 0x200
|
||||
NL3 = 0x300
|
||||
NLDLY = 0x300
|
||||
NOFLSH = 0x80000000
|
||||
NS_GET_NSTYPE = 0x2000b703
|
||||
NS_GET_OWNER_UID = 0x2000b704
|
||||
NS_GET_PARENT = 0x2000b702
|
||||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x4
|
||||
ONLCR = 0x2
|
||||
OTPERASE = 0x800c4d19
|
||||
OTPGETREGIONCOUNT = 0x80044d0e
|
||||
OTPGETREGIONINFO = 0x800c4d0f
|
||||
OTPLOCK = 0x400c4d10
|
||||
OTPSELECT = 0x40044d0d
|
||||
O_APPEND = 0x400
|
||||
O_ASYNC = 0x2000
|
||||
O_CLOEXEC = 0x80000
|
||||
O_CREAT = 0x40
|
||||
O_DIRECT = 0x20000
|
||||
O_DIRECTORY = 0x4000
|
||||
O_DSYNC = 0x1000
|
||||
O_EXCL = 0x80
|
||||
O_FSYNC = 0x101000
|
||||
O_LARGEFILE = 0x10000
|
||||
O_NDELAY = 0x800
|
||||
O_NOATIME = 0x40000
|
||||
O_NOCTTY = 0x100
|
||||
O_NOFOLLOW = 0x8000
|
||||
O_NONBLOCK = 0x800
|
||||
O_PATH = 0x200000
|
||||
O_RSYNC = 0x101000
|
||||
O_SYNC = 0x101000
|
||||
O_TMPFILE = 0x404000
|
||||
O_TRUNC = 0x200
|
||||
PARENB = 0x1000
|
||||
PARODD = 0x2000
|
||||
PENDIN = 0x20000000
|
||||
PERF_EVENT_IOC_DISABLE = 0x20002401
|
||||
PERF_EVENT_IOC_ENABLE = 0x20002400
|
||||
PERF_EVENT_IOC_ID = 0x40042407
|
||||
PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8004240b
|
||||
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409
|
||||
PERF_EVENT_IOC_PERIOD = 0x80082404
|
||||
PERF_EVENT_IOC_QUERY_BPF = 0xc004240a
|
||||
PERF_EVENT_IOC_REFRESH = 0x20002402
|
||||
PERF_EVENT_IOC_RESET = 0x20002403
|
||||
PERF_EVENT_IOC_SET_BPF = 0x80042408
|
||||
PERF_EVENT_IOC_SET_FILTER = 0x80042406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
|
||||
PPPIOCATTACH = 0x8004743d
|
||||
PPPIOCATTCHAN = 0x80047438
|
||||
PPPIOCBRIDGECHAN = 0x80047435
|
||||
PPPIOCCONNECT = 0x8004743a
|
||||
PPPIOCDETACH = 0x8004743c
|
||||
PPPIOCDISCONN = 0x20007439
|
||||
PPPIOCGASYNCMAP = 0x40047458
|
||||
PPPIOCGCHAN = 0x40047437
|
||||
PPPIOCGDEBUG = 0x40047441
|
||||
PPPIOCGFLAGS = 0x4004745a
|
||||
PPPIOCGIDLE = 0x4008743f
|
||||
PPPIOCGIDLE32 = 0x4008743f
|
||||
PPPIOCGIDLE64 = 0x4010743f
|
||||
PPPIOCGL2TPSTATS = 0x40487436
|
||||
PPPIOCGMRU = 0x40047453
|
||||
PPPIOCGRASYNCMAP = 0x40047455
|
||||
PPPIOCGUNIT = 0x40047456
|
||||
PPPIOCGXASYNCMAP = 0x40207450
|
||||
PPPIOCSACTIVE = 0x80087446
|
||||
PPPIOCSASYNCMAP = 0x80047457
|
||||
PPPIOCSCOMPRESS = 0x800c744d
|
||||
PPPIOCSDEBUG = 0x80047440
|
||||
PPPIOCSFLAGS = 0x80047459
|
||||
PPPIOCSMAXCID = 0x80047451
|
||||
PPPIOCSMRRU = 0x8004743b
|
||||
PPPIOCSMRU = 0x80047452
|
||||
PPPIOCSNPMODE = 0x8008744b
|
||||
PPPIOCSPASS = 0x80087447
|
||||
PPPIOCSRASYNCMAP = 0x80047454
|
||||
PPPIOCSXASYNCMAP = 0x8020744f
|
||||
PPPIOCUNBRIDGECHAN = 0x20007434
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PROT_SAO = 0x10
|
||||
PR_SET_PTRACER_ANY = 0xffffffff
|
||||
PTRACE_GETEVRREGS = 0x14
|
||||
PTRACE_GETFPREGS = 0xe
|
||||
PTRACE_GETREGS64 = 0x16
|
||||
PTRACE_GETVRREGS = 0x12
|
||||
PTRACE_GETVSRREGS = 0x1b
|
||||
PTRACE_GET_DEBUGREG = 0x19
|
||||
PTRACE_SETEVRREGS = 0x15
|
||||
PTRACE_SETFPREGS = 0xf
|
||||
PTRACE_SETREGS64 = 0x17
|
||||
PTRACE_SETVRREGS = 0x13
|
||||
PTRACE_SETVSRREGS = 0x1c
|
||||
PTRACE_SET_DEBUGREG = 0x1a
|
||||
PTRACE_SINGLEBLOCK = 0x100
|
||||
PTRACE_SYSEMU = 0x1d
|
||||
PTRACE_SYSEMU_SINGLESTEP = 0x1e
|
||||
PT_CCR = 0x26
|
||||
PT_CTR = 0x23
|
||||
PT_DAR = 0x29
|
||||
PT_DSCR = 0x2c
|
||||
PT_DSISR = 0x2a
|
||||
PT_FPR0 = 0x30
|
||||
PT_FPR31 = 0x6e
|
||||
PT_FPSCR = 0x71
|
||||
PT_LNK = 0x24
|
||||
PT_MQ = 0x27
|
||||
PT_MSR = 0x21
|
||||
PT_NIP = 0x20
|
||||
PT_ORIG_R3 = 0x22
|
||||
PT_R0 = 0x0
|
||||
PT_R1 = 0x1
|
||||
PT_R10 = 0xa
|
||||
PT_R11 = 0xb
|
||||
PT_R12 = 0xc
|
||||
PT_R13 = 0xd
|
||||
PT_R14 = 0xe
|
||||
PT_R15 = 0xf
|
||||
PT_R16 = 0x10
|
||||
PT_R17 = 0x11
|
||||
PT_R18 = 0x12
|
||||
PT_R19 = 0x13
|
||||
PT_R2 = 0x2
|
||||
PT_R20 = 0x14
|
||||
PT_R21 = 0x15
|
||||
PT_R22 = 0x16
|
||||
PT_R23 = 0x17
|
||||
PT_R24 = 0x18
|
||||
PT_R25 = 0x19
|
||||
PT_R26 = 0x1a
|
||||
PT_R27 = 0x1b
|
||||
PT_R28 = 0x1c
|
||||
PT_R29 = 0x1d
|
||||
PT_R3 = 0x3
|
||||
PT_R30 = 0x1e
|
||||
PT_R31 = 0x1f
|
||||
PT_R4 = 0x4
|
||||
PT_R5 = 0x5
|
||||
PT_R6 = 0x6
|
||||
PT_R7 = 0x7
|
||||
PT_R8 = 0x8
|
||||
PT_R9 = 0x9
|
||||
PT_REGS_COUNT = 0x2c
|
||||
PT_RESULT = 0x2b
|
||||
PT_TRAP = 0x28
|
||||
PT_XER = 0x25
|
||||
RLIMIT_AS = 0x9
|
||||
RLIMIT_MEMLOCK = 0x8
|
||||
RLIMIT_NOFILE = 0x7
|
||||
RLIMIT_NPROC = 0x6
|
||||
RLIMIT_RSS = 0x5
|
||||
RNDADDENTROPY = 0x80085203
|
||||
RNDADDTOENTCNT = 0x80045201
|
||||
RNDCLEARPOOL = 0x20005206
|
||||
RNDGETENTCNT = 0x40045200
|
||||
RNDGETPOOL = 0x40085202
|
||||
RNDRESEEDCRNG = 0x20005207
|
||||
RNDZAPENTCNT = 0x20005204
|
||||
RTC_AIE_OFF = 0x20007002
|
||||
RTC_AIE_ON = 0x20007001
|
||||
RTC_ALM_READ = 0x40247008
|
||||
RTC_ALM_SET = 0x80247007
|
||||
RTC_EPOCH_READ = 0x4004700d
|
||||
RTC_EPOCH_SET = 0x8004700e
|
||||
RTC_IRQP_READ = 0x4004700b
|
||||
RTC_IRQP_SET = 0x8004700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x401c7011
|
||||
RTC_PLL_SET = 0x801c7012
|
||||
RTC_RD_TIME = 0x40247009
|
||||
RTC_SET_TIME = 0x8024700a
|
||||
RTC_UIE_OFF = 0x20007004
|
||||
RTC_UIE_ON = 0x20007003
|
||||
RTC_VL_CLR = 0x20007014
|
||||
RTC_VL_READ = 0x40047013
|
||||
RTC_WIE_OFF = 0x20007010
|
||||
RTC_WIE_ON = 0x2000700f
|
||||
RTC_WKALM_RD = 0x40287010
|
||||
RTC_WKALM_SET = 0x8028700f
|
||||
SCM_TIMESTAMPING = 0x25
|
||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SIOCATMARK = 0x8905
|
||||
SIOCGPGRP = 0x8904
|
||||
SIOCGSTAMPNS_NEW = 0x40108907
|
||||
SIOCGSTAMP_NEW = 0x40108906
|
||||
SIOCINQ = 0x4004667f
|
||||
SIOCOUTQ = 0x40047473
|
||||
SIOCSPGRP = 0x8902
|
||||
SOCK_CLOEXEC = 0x80000
|
||||
SOCK_DGRAM = 0x2
|
||||
SOCK_NONBLOCK = 0x800
|
||||
SOCK_STREAM = 0x1
|
||||
SOL_SOCKET = 0x1
|
||||
SO_ACCEPTCONN = 0x1e
|
||||
SO_ATTACH_BPF = 0x32
|
||||
SO_ATTACH_REUSEPORT_CBPF = 0x33
|
||||
SO_ATTACH_REUSEPORT_EBPF = 0x34
|
||||
SO_BINDTODEVICE = 0x19
|
||||
SO_BINDTOIFINDEX = 0x3e
|
||||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x6
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
SO_COOKIE = 0x39
|
||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||
SO_DOMAIN = 0x27
|
||||
SO_DONTROUTE = 0x5
|
||||
SO_ERROR = 0x4
|
||||
SO_INCOMING_CPU = 0x31
|
||||
SO_INCOMING_NAPI_ID = 0x38
|
||||
SO_KEEPALIVE = 0x9
|
||||
SO_LINGER = 0xd
|
||||
SO_LOCK_FILTER = 0x2c
|
||||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0xa
|
||||
SO_PASSCRED = 0x14
|
||||
SO_PASSSEC = 0x22
|
||||
SO_PEEK_OFF = 0x2a
|
||||
SO_PEERCRED = 0x15
|
||||
SO_PEERGROUPS = 0x3b
|
||||
SO_PEERSEC = 0x1f
|
||||
SO_PREFER_BUSY_POLL = 0x45
|
||||
SO_PROTOCOL = 0x26
|
||||
SO_RCVBUF = 0x8
|
||||
SO_RCVBUFFORCE = 0x21
|
||||
SO_RCVLOWAT = 0x10
|
||||
SO_RCVTIMEO = 0x12
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x12
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
SO_SECURITY_AUTHENTICATION = 0x16
|
||||
SO_SECURITY_ENCRYPTION_NETWORK = 0x18
|
||||
SO_SECURITY_ENCRYPTION_TRANSPORT = 0x17
|
||||
SO_SELECT_ERR_QUEUE = 0x2d
|
||||
SO_SNDBUF = 0x7
|
||||
SO_SNDBUFFORCE = 0x20
|
||||
SO_SNDLOWAT = 0x11
|
||||
SO_SNDTIMEO = 0x13
|
||||
SO_SNDTIMEO_NEW = 0x43
|
||||
SO_SNDTIMEO_OLD = 0x13
|
||||
SO_TIMESTAMPING = 0x25
|
||||
SO_TIMESTAMPING_NEW = 0x41
|
||||
SO_TIMESTAMPING_OLD = 0x25
|
||||
SO_TIMESTAMPNS = 0x23
|
||||
SO_TIMESTAMPNS_NEW = 0x40
|
||||
SO_TIMESTAMPNS_OLD = 0x23
|
||||
SO_TIMESTAMP_NEW = 0x3f
|
||||
SO_TXTIME = 0x3d
|
||||
SO_TYPE = 0x3
|
||||
SO_WIFI_STATUS = 0x29
|
||||
SO_ZEROCOPY = 0x3c
|
||||
TAB1 = 0x400
|
||||
TAB2 = 0x800
|
||||
TAB3 = 0xc00
|
||||
TABDLY = 0xc00
|
||||
TCFLSH = 0x2000741f
|
||||
TCGETA = 0x40147417
|
||||
TCGETS = 0x402c7413
|
||||
TCSAFLUSH = 0x2
|
||||
TCSBRK = 0x2000741d
|
||||
TCSBRKP = 0x5425
|
||||
TCSETA = 0x80147418
|
||||
TCSETAF = 0x8014741c
|
||||
TCSETAW = 0x80147419
|
||||
TCSETS = 0x802c7414
|
||||
TCSETSF = 0x802c7416
|
||||
TCSETSW = 0x802c7415
|
||||
TCXONC = 0x2000741e
|
||||
TFD_CLOEXEC = 0x80000
|
||||
TFD_NONBLOCK = 0x800
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x541d
|
||||
TIOCEXCL = 0x540c
|
||||
TIOCGDEV = 0x40045432
|
||||
TIOCGETC = 0x40067412
|
||||
TIOCGETD = 0x5424
|
||||
TIOCGETP = 0x40067408
|
||||
TIOCGEXCL = 0x40045440
|
||||
TIOCGICOUNT = 0x545d
|
||||
TIOCGISO7816 = 0x40285442
|
||||
TIOCGLCKTRMIOS = 0x5456
|
||||
TIOCGLTC = 0x40067474
|
||||
TIOCGPGRP = 0x40047477
|
||||
TIOCGPKT = 0x40045438
|
||||
TIOCGPTLCK = 0x40045439
|
||||
TIOCGPTN = 0x40045430
|
||||
TIOCGPTPEER = 0x20005441
|
||||
TIOCGRS485 = 0x542e
|
||||
TIOCGSERIAL = 0x541e
|
||||
TIOCGSID = 0x5429
|
||||
TIOCGSOFTCAR = 0x5419
|
||||
TIOCGWINSZ = 0x40087468
|
||||
TIOCINQ = 0x4004667f
|
||||
TIOCLINUX = 0x541c
|
||||
TIOCMBIC = 0x5417
|
||||
TIOCMBIS = 0x5416
|
||||
TIOCMGET = 0x5415
|
||||
TIOCMIWAIT = 0x545c
|
||||
TIOCMSET = 0x5418
|
||||
TIOCM_CAR = 0x40
|
||||
TIOCM_CD = 0x40
|
||||
TIOCM_CTS = 0x20
|
||||
TIOCM_DSR = 0x100
|
||||
TIOCM_LOOP = 0x8000
|
||||
TIOCM_OUT1 = 0x2000
|
||||
TIOCM_OUT2 = 0x4000
|
||||
TIOCM_RI = 0x80
|
||||
TIOCM_RNG = 0x80
|
||||
TIOCM_SR = 0x10
|
||||
TIOCM_ST = 0x8
|
||||
TIOCNOTTY = 0x5422
|
||||
TIOCNXCL = 0x540d
|
||||
TIOCOUTQ = 0x40047473
|
||||
TIOCPKT = 0x5420
|
||||
TIOCSBRK = 0x5427
|
||||
TIOCSCTTY = 0x540e
|
||||
TIOCSERCONFIG = 0x5453
|
||||
TIOCSERGETLSR = 0x5459
|
||||
TIOCSERGETMULTI = 0x545a
|
||||
TIOCSERGSTRUCT = 0x5458
|
||||
TIOCSERGWILD = 0x5454
|
||||
TIOCSERSETMULTI = 0x545b
|
||||
TIOCSERSWILD = 0x5455
|
||||
TIOCSER_TEMT = 0x1
|
||||
TIOCSETC = 0x80067411
|
||||
TIOCSETD = 0x5423
|
||||
TIOCSETN = 0x8006740a
|
||||
TIOCSETP = 0x80067409
|
||||
TIOCSIG = 0x80045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x5457
|
||||
TIOCSLTC = 0x80067475
|
||||
TIOCSPGRP = 0x80047476
|
||||
TIOCSPTLCK = 0x80045431
|
||||
TIOCSRS485 = 0x542f
|
||||
TIOCSSERIAL = 0x541f
|
||||
TIOCSSOFTCAR = 0x541a
|
||||
TIOCSTART = 0x2000746e
|
||||
TIOCSTI = 0x5412
|
||||
TIOCSTOP = 0x2000746f
|
||||
TIOCSWINSZ = 0x80087467
|
||||
TIOCVHANGUP = 0x5437
|
||||
TOSTOP = 0x400000
|
||||
TUNATTACHFILTER = 0x800854d5
|
||||
TUNDETACHFILTER = 0x800854d6
|
||||
TUNGETDEVNETNS = 0x200054e3
|
||||
TUNGETFEATURES = 0x400454cf
|
||||
TUNGETFILTER = 0x400854db
|
||||
TUNGETIFF = 0x400454d2
|
||||
TUNGETSNDBUF = 0x400454d3
|
||||
TUNGETVNETBE = 0x400454df
|
||||
TUNGETVNETHDRSZ = 0x400454d7
|
||||
TUNGETVNETLE = 0x400454dd
|
||||
TUNSETCARRIER = 0x800454e2
|
||||
TUNSETDEBUG = 0x800454c9
|
||||
TUNSETFILTEREBPF = 0x400454e1
|
||||
TUNSETGROUP = 0x800454ce
|
||||
TUNSETIFF = 0x800454ca
|
||||
TUNSETIFINDEX = 0x800454da
|
||||
TUNSETLINK = 0x800454cd
|
||||
TUNSETNOCSUM = 0x800454c8
|
||||
TUNSETOFFLOAD = 0x800454d0
|
||||
TUNSETOWNER = 0x800454cc
|
||||
TUNSETPERSIST = 0x800454cb
|
||||
TUNSETQUEUE = 0x800454d9
|
||||
TUNSETSNDBUF = 0x800454d4
|
||||
TUNSETSTEERINGEBPF = 0x400454e0
|
||||
TUNSETTXFILTER = 0x800454d1
|
||||
TUNSETVNETBE = 0x800454de
|
||||
TUNSETVNETHDRSZ = 0x800454d8
|
||||
TUNSETVNETLE = 0x800454dc
|
||||
UBI_IOCATT = 0x80186f40
|
||||
UBI_IOCDET = 0x80046f41
|
||||
UBI_IOCEBCH = 0x80044f02
|
||||
UBI_IOCEBER = 0x80044f01
|
||||
UBI_IOCEBISMAP = 0x40044f05
|
||||
UBI_IOCEBMAP = 0x80084f03
|
||||
UBI_IOCEBUNMAP = 0x80044f04
|
||||
UBI_IOCMKVOL = 0x80986f00
|
||||
UBI_IOCRMVOL = 0x80046f01
|
||||
UBI_IOCRNVOL = 0x91106f03
|
||||
UBI_IOCRPEB = 0x80046f04
|
||||
UBI_IOCRSVOL = 0x800c6f02
|
||||
UBI_IOCSETVOLPROP = 0x80104f06
|
||||
UBI_IOCSPEB = 0x80046f05
|
||||
UBI_IOCVOLCRBLK = 0x80804f07
|
||||
UBI_IOCVOLRMBLK = 0x20004f08
|
||||
UBI_IOCVOLUP = 0x80084f00
|
||||
VDISCARD = 0x10
|
||||
VEOF = 0x4
|
||||
VEOL = 0x6
|
||||
VEOL2 = 0x8
|
||||
VMIN = 0x5
|
||||
VREPRINT = 0xb
|
||||
VSTART = 0xd
|
||||
VSTOP = 0xe
|
||||
VSUSP = 0xc
|
||||
VSWTC = 0x9
|
||||
VT1 = 0x10000
|
||||
VTDLY = 0x10000
|
||||
VTIME = 0x7
|
||||
VWERASE = 0xa
|
||||
WDIOC_GETBOOTSTATUS = 0x40045702
|
||||
WDIOC_GETPRETIMEOUT = 0x40045709
|
||||
WDIOC_GETSTATUS = 0x40045701
|
||||
WDIOC_GETSUPPORT = 0x40285700
|
||||
WDIOC_GETTEMP = 0x40045703
|
||||
WDIOC_GETTIMELEFT = 0x4004570a
|
||||
WDIOC_GETTIMEOUT = 0x40045707
|
||||
WDIOC_KEEPALIVE = 0x40045705
|
||||
WDIOC_SETOPTIONS = 0x40045704
|
||||
WORDSIZE = 0x20
|
||||
XCASE = 0x4000
|
||||
XTABS = 0xc00
|
||||
_HIDIOCGRAWNAME = 0x40804804
|
||||
_HIDIOCGRAWPHYS = 0x40404805
|
||||
_HIDIOCGRAWUNIQ = 0x40404808
|
||||
)
|
||||
|
||||
// Errors
|
||||
const (
|
||||
EADDRINUSE = syscall.Errno(0x62)
|
||||
EADDRNOTAVAIL = syscall.Errno(0x63)
|
||||
EADV = syscall.Errno(0x44)
|
||||
EAFNOSUPPORT = syscall.Errno(0x61)
|
||||
EALREADY = syscall.Errno(0x72)
|
||||
EBADE = syscall.Errno(0x34)
|
||||
EBADFD = syscall.Errno(0x4d)
|
||||
EBADMSG = syscall.Errno(0x4a)
|
||||
EBADR = syscall.Errno(0x35)
|
||||
EBADRQC = syscall.Errno(0x38)
|
||||
EBADSLT = syscall.Errno(0x39)
|
||||
EBFONT = syscall.Errno(0x3b)
|
||||
ECANCELED = syscall.Errno(0x7d)
|
||||
ECHRNG = syscall.Errno(0x2c)
|
||||
ECOMM = syscall.Errno(0x46)
|
||||
ECONNABORTED = syscall.Errno(0x67)
|
||||
ECONNREFUSED = syscall.Errno(0x6f)
|
||||
ECONNRESET = syscall.Errno(0x68)
|
||||
EDEADLK = syscall.Errno(0x23)
|
||||
EDEADLOCK = syscall.Errno(0x3a)
|
||||
EDESTADDRREQ = syscall.Errno(0x59)
|
||||
EDOTDOT = syscall.Errno(0x49)
|
||||
EDQUOT = syscall.Errno(0x7a)
|
||||
EHOSTDOWN = syscall.Errno(0x70)
|
||||
EHOSTUNREACH = syscall.Errno(0x71)
|
||||
EHWPOISON = syscall.Errno(0x85)
|
||||
EIDRM = syscall.Errno(0x2b)
|
||||
EILSEQ = syscall.Errno(0x54)
|
||||
EINPROGRESS = syscall.Errno(0x73)
|
||||
EISCONN = syscall.Errno(0x6a)
|
||||
EISNAM = syscall.Errno(0x78)
|
||||
EKEYEXPIRED = syscall.Errno(0x7f)
|
||||
EKEYREJECTED = syscall.Errno(0x81)
|
||||
EKEYREVOKED = syscall.Errno(0x80)
|
||||
EL2HLT = syscall.Errno(0x33)
|
||||
EL2NSYNC = syscall.Errno(0x2d)
|
||||
EL3HLT = syscall.Errno(0x2e)
|
||||
EL3RST = syscall.Errno(0x2f)
|
||||
ELIBACC = syscall.Errno(0x4f)
|
||||
ELIBBAD = syscall.Errno(0x50)
|
||||
ELIBEXEC = syscall.Errno(0x53)
|
||||
ELIBMAX = syscall.Errno(0x52)
|
||||
ELIBSCN = syscall.Errno(0x51)
|
||||
ELNRNG = syscall.Errno(0x30)
|
||||
ELOOP = syscall.Errno(0x28)
|
||||
EMEDIUMTYPE = syscall.Errno(0x7c)
|
||||
EMSGSIZE = syscall.Errno(0x5a)
|
||||
EMULTIHOP = syscall.Errno(0x48)
|
||||
ENAMETOOLONG = syscall.Errno(0x24)
|
||||
ENAVAIL = syscall.Errno(0x77)
|
||||
ENETDOWN = syscall.Errno(0x64)
|
||||
ENETRESET = syscall.Errno(0x66)
|
||||
ENETUNREACH = syscall.Errno(0x65)
|
||||
ENOANO = syscall.Errno(0x37)
|
||||
ENOBUFS = syscall.Errno(0x69)
|
||||
ENOCSI = syscall.Errno(0x32)
|
||||
ENODATA = syscall.Errno(0x3d)
|
||||
ENOKEY = syscall.Errno(0x7e)
|
||||
ENOLCK = syscall.Errno(0x25)
|
||||
ENOLINK = syscall.Errno(0x43)
|
||||
ENOMEDIUM = syscall.Errno(0x7b)
|
||||
ENOMSG = syscall.Errno(0x2a)
|
||||
ENONET = syscall.Errno(0x40)
|
||||
ENOPKG = syscall.Errno(0x41)
|
||||
ENOPROTOOPT = syscall.Errno(0x5c)
|
||||
ENOSR = syscall.Errno(0x3f)
|
||||
ENOSTR = syscall.Errno(0x3c)
|
||||
ENOSYS = syscall.Errno(0x26)
|
||||
ENOTCONN = syscall.Errno(0x6b)
|
||||
ENOTEMPTY = syscall.Errno(0x27)
|
||||
ENOTNAM = syscall.Errno(0x76)
|
||||
ENOTRECOVERABLE = syscall.Errno(0x83)
|
||||
ENOTSOCK = syscall.Errno(0x58)
|
||||
ENOTSUP = syscall.Errno(0x5f)
|
||||
ENOTUNIQ = syscall.Errno(0x4c)
|
||||
EOPNOTSUPP = syscall.Errno(0x5f)
|
||||
EOVERFLOW = syscall.Errno(0x4b)
|
||||
EOWNERDEAD = syscall.Errno(0x82)
|
||||
EPFNOSUPPORT = syscall.Errno(0x60)
|
||||
EPROTO = syscall.Errno(0x47)
|
||||
EPROTONOSUPPORT = syscall.Errno(0x5d)
|
||||
EPROTOTYPE = syscall.Errno(0x5b)
|
||||
EREMCHG = syscall.Errno(0x4e)
|
||||
EREMOTE = syscall.Errno(0x42)
|
||||
EREMOTEIO = syscall.Errno(0x79)
|
||||
ERESTART = syscall.Errno(0x55)
|
||||
ERFKILL = syscall.Errno(0x84)
|
||||
ESHUTDOWN = syscall.Errno(0x6c)
|
||||
ESOCKTNOSUPPORT = syscall.Errno(0x5e)
|
||||
ESRMNT = syscall.Errno(0x45)
|
||||
ESTALE = syscall.Errno(0x74)
|
||||
ESTRPIPE = syscall.Errno(0x56)
|
||||
ETIME = syscall.Errno(0x3e)
|
||||
ETIMEDOUT = syscall.Errno(0x6e)
|
||||
ETOOMANYREFS = syscall.Errno(0x6d)
|
||||
EUCLEAN = syscall.Errno(0x75)
|
||||
EUNATCH = syscall.Errno(0x31)
|
||||
EUSERS = syscall.Errno(0x57)
|
||||
EXFULL = syscall.Errno(0x36)
|
||||
)
|
||||
|
||||
// Signals
|
||||
const (
|
||||
SIGBUS = syscall.Signal(0x7)
|
||||
SIGCHLD = syscall.Signal(0x11)
|
||||
SIGCLD = syscall.Signal(0x11)
|
||||
SIGCONT = syscall.Signal(0x12)
|
||||
SIGIO = syscall.Signal(0x1d)
|
||||
SIGPOLL = syscall.Signal(0x1d)
|
||||
SIGPROF = syscall.Signal(0x1b)
|
||||
SIGPWR = syscall.Signal(0x1e)
|
||||
SIGSTKFLT = syscall.Signal(0x10)
|
||||
SIGSTOP = syscall.Signal(0x13)
|
||||
SIGSYS = syscall.Signal(0x1f)
|
||||
SIGTSTP = syscall.Signal(0x14)
|
||||
SIGTTIN = syscall.Signal(0x15)
|
||||
SIGTTOU = syscall.Signal(0x16)
|
||||
SIGURG = syscall.Signal(0x17)
|
||||
SIGUSR1 = syscall.Signal(0xa)
|
||||
SIGUSR2 = syscall.Signal(0xc)
|
||||
SIGVTALRM = syscall.Signal(0x1a)
|
||||
SIGWINCH = syscall.Signal(0x1c)
|
||||
SIGXCPU = syscall.Signal(0x18)
|
||||
SIGXFSZ = syscall.Signal(0x19)
|
||||
)
|
||||
|
||||
// Error table
|
||||
var errorList = [...]struct {
|
||||
num syscall.Errno
|
||||
name string
|
||||
desc string
|
||||
}{
|
||||
{1, "EPERM", "operation not permitted"},
|
||||
{2, "ENOENT", "no such file or directory"},
|
||||
{3, "ESRCH", "no such process"},
|
||||
{4, "EINTR", "interrupted system call"},
|
||||
{5, "EIO", "input/output error"},
|
||||
{6, "ENXIO", "no such device or address"},
|
||||
{7, "E2BIG", "argument list too long"},
|
||||
{8, "ENOEXEC", "exec format error"},
|
||||
{9, "EBADF", "bad file descriptor"},
|
||||
{10, "ECHILD", "no child processes"},
|
||||
{11, "EAGAIN", "resource temporarily unavailable"},
|
||||
{12, "ENOMEM", "cannot allocate memory"},
|
||||
{13, "EACCES", "permission denied"},
|
||||
{14, "EFAULT", "bad address"},
|
||||
{15, "ENOTBLK", "block device required"},
|
||||
{16, "EBUSY", "device or resource busy"},
|
||||
{17, "EEXIST", "file exists"},
|
||||
{18, "EXDEV", "invalid cross-device link"},
|
||||
{19, "ENODEV", "no such device"},
|
||||
{20, "ENOTDIR", "not a directory"},
|
||||
{21, "EISDIR", "is a directory"},
|
||||
{22, "EINVAL", "invalid argument"},
|
||||
{23, "ENFILE", "too many open files in system"},
|
||||
{24, "EMFILE", "too many open files"},
|
||||
{25, "ENOTTY", "inappropriate ioctl for device"},
|
||||
{26, "ETXTBSY", "text file busy"},
|
||||
{27, "EFBIG", "file too large"},
|
||||
{28, "ENOSPC", "no space left on device"},
|
||||
{29, "ESPIPE", "illegal seek"},
|
||||
{30, "EROFS", "read-only file system"},
|
||||
{31, "EMLINK", "too many links"},
|
||||
{32, "EPIPE", "broken pipe"},
|
||||
{33, "EDOM", "numerical argument out of domain"},
|
||||
{34, "ERANGE", "numerical result out of range"},
|
||||
{35, "EDEADLK", "resource deadlock avoided"},
|
||||
{36, "ENAMETOOLONG", "file name too long"},
|
||||
{37, "ENOLCK", "no locks available"},
|
||||
{38, "ENOSYS", "function not implemented"},
|
||||
{39, "ENOTEMPTY", "directory not empty"},
|
||||
{40, "ELOOP", "too many levels of symbolic links"},
|
||||
{42, "ENOMSG", "no message of desired type"},
|
||||
{43, "EIDRM", "identifier removed"},
|
||||
{44, "ECHRNG", "channel number out of range"},
|
||||
{45, "EL2NSYNC", "level 2 not synchronized"},
|
||||
{46, "EL3HLT", "level 3 halted"},
|
||||
{47, "EL3RST", "level 3 reset"},
|
||||
{48, "ELNRNG", "link number out of range"},
|
||||
{49, "EUNATCH", "protocol driver not attached"},
|
||||
{50, "ENOCSI", "no CSI structure available"},
|
||||
{51, "EL2HLT", "level 2 halted"},
|
||||
{52, "EBADE", "invalid exchange"},
|
||||
{53, "EBADR", "invalid request descriptor"},
|
||||
{54, "EXFULL", "exchange full"},
|
||||
{55, "ENOANO", "no anode"},
|
||||
{56, "EBADRQC", "invalid request code"},
|
||||
{57, "EBADSLT", "invalid slot"},
|
||||
{58, "EDEADLOCK", "file locking deadlock error"},
|
||||
{59, "EBFONT", "bad font file format"},
|
||||
{60, "ENOSTR", "device not a stream"},
|
||||
{61, "ENODATA", "no data available"},
|
||||
{62, "ETIME", "timer expired"},
|
||||
{63, "ENOSR", "out of streams resources"},
|
||||
{64, "ENONET", "machine is not on the network"},
|
||||
{65, "ENOPKG", "package not installed"},
|
||||
{66, "EREMOTE", "object is remote"},
|
||||
{67, "ENOLINK", "link has been severed"},
|
||||
{68, "EADV", "advertise error"},
|
||||
{69, "ESRMNT", "srmount error"},
|
||||
{70, "ECOMM", "communication error on send"},
|
||||
{71, "EPROTO", "protocol error"},
|
||||
{72, "EMULTIHOP", "multihop attempted"},
|
||||
{73, "EDOTDOT", "RFS specific error"},
|
||||
{74, "EBADMSG", "bad message"},
|
||||
{75, "EOVERFLOW", "value too large for defined data type"},
|
||||
{76, "ENOTUNIQ", "name not unique on network"},
|
||||
{77, "EBADFD", "file descriptor in bad state"},
|
||||
{78, "EREMCHG", "remote address changed"},
|
||||
{79, "ELIBACC", "can not access a needed shared library"},
|
||||
{80, "ELIBBAD", "accessing a corrupted shared library"},
|
||||
{81, "ELIBSCN", ".lib section in a.out corrupted"},
|
||||
{82, "ELIBMAX", "attempting to link in too many shared libraries"},
|
||||
{83, "ELIBEXEC", "cannot exec a shared library directly"},
|
||||
{84, "EILSEQ", "invalid or incomplete multibyte or wide character"},
|
||||
{85, "ERESTART", "interrupted system call should be restarted"},
|
||||
{86, "ESTRPIPE", "streams pipe error"},
|
||||
{87, "EUSERS", "too many users"},
|
||||
{88, "ENOTSOCK", "socket operation on non-socket"},
|
||||
{89, "EDESTADDRREQ", "destination address required"},
|
||||
{90, "EMSGSIZE", "message too long"},
|
||||
{91, "EPROTOTYPE", "protocol wrong type for socket"},
|
||||
{92, "ENOPROTOOPT", "protocol not available"},
|
||||
{93, "EPROTONOSUPPORT", "protocol not supported"},
|
||||
{94, "ESOCKTNOSUPPORT", "socket type not supported"},
|
||||
{95, "ENOTSUP", "operation not supported"},
|
||||
{96, "EPFNOSUPPORT", "protocol family not supported"},
|
||||
{97, "EAFNOSUPPORT", "address family not supported by protocol"},
|
||||
{98, "EADDRINUSE", "address already in use"},
|
||||
{99, "EADDRNOTAVAIL", "cannot assign requested address"},
|
||||
{100, "ENETDOWN", "network is down"},
|
||||
{101, "ENETUNREACH", "network is unreachable"},
|
||||
{102, "ENETRESET", "network dropped connection on reset"},
|
||||
{103, "ECONNABORTED", "software caused connection abort"},
|
||||
{104, "ECONNRESET", "connection reset by peer"},
|
||||
{105, "ENOBUFS", "no buffer space available"},
|
||||
{106, "EISCONN", "transport endpoint is already connected"},
|
||||
{107, "ENOTCONN", "transport endpoint is not connected"},
|
||||
{108, "ESHUTDOWN", "cannot send after transport endpoint shutdown"},
|
||||
{109, "ETOOMANYREFS", "too many references: cannot splice"},
|
||||
{110, "ETIMEDOUT", "connection timed out"},
|
||||
{111, "ECONNREFUSED", "connection refused"},
|
||||
{112, "EHOSTDOWN", "host is down"},
|
||||
{113, "EHOSTUNREACH", "no route to host"},
|
||||
{114, "EALREADY", "operation already in progress"},
|
||||
{115, "EINPROGRESS", "operation now in progress"},
|
||||
{116, "ESTALE", "stale file handle"},
|
||||
{117, "EUCLEAN", "structure needs cleaning"},
|
||||
{118, "ENOTNAM", "not a XENIX named type file"},
|
||||
{119, "ENAVAIL", "no XENIX semaphores available"},
|
||||
{120, "EISNAM", "is a named type file"},
|
||||
{121, "EREMOTEIO", "remote I/O error"},
|
||||
{122, "EDQUOT", "disk quota exceeded"},
|
||||
{123, "ENOMEDIUM", "no medium found"},
|
||||
{124, "EMEDIUMTYPE", "wrong medium type"},
|
||||
{125, "ECANCELED", "operation canceled"},
|
||||
{126, "ENOKEY", "required key not available"},
|
||||
{127, "EKEYEXPIRED", "key has expired"},
|
||||
{128, "EKEYREVOKED", "key has been revoked"},
|
||||
{129, "EKEYREJECTED", "key was rejected by service"},
|
||||
{130, "EOWNERDEAD", "owner died"},
|
||||
{131, "ENOTRECOVERABLE", "state not recoverable"},
|
||||
{132, "ERFKILL", "operation not possible due to RF-kill"},
|
||||
{133, "EHWPOISON", "memory page has hardware error"},
|
||||
}
|
||||
|
||||
// Signal table
|
||||
var signalList = [...]struct {
|
||||
num syscall.Signal
|
||||
name string
|
||||
desc string
|
||||
}{
|
||||
{1, "SIGHUP", "hangup"},
|
||||
{2, "SIGINT", "interrupt"},
|
||||
{3, "SIGQUIT", "quit"},
|
||||
{4, "SIGILL", "illegal instruction"},
|
||||
{5, "SIGTRAP", "trace/breakpoint trap"},
|
||||
{6, "SIGABRT", "aborted"},
|
||||
{7, "SIGBUS", "bus error"},
|
||||
{8, "SIGFPE", "floating point exception"},
|
||||
{9, "SIGKILL", "killed"},
|
||||
{10, "SIGUSR1", "user defined signal 1"},
|
||||
{11, "SIGSEGV", "segmentation fault"},
|
||||
{12, "SIGUSR2", "user defined signal 2"},
|
||||
{13, "SIGPIPE", "broken pipe"},
|
||||
{14, "SIGALRM", "alarm clock"},
|
||||
{15, "SIGTERM", "terminated"},
|
||||
{16, "SIGSTKFLT", "stack fault"},
|
||||
{17, "SIGCHLD", "child exited"},
|
||||
{18, "SIGCONT", "continued"},
|
||||
{19, "SIGSTOP", "stopped (signal)"},
|
||||
{20, "SIGTSTP", "stopped"},
|
||||
{21, "SIGTTIN", "stopped (tty input)"},
|
||||
{22, "SIGTTOU", "stopped (tty output)"},
|
||||
{23, "SIGURG", "urgent I/O condition"},
|
||||
{24, "SIGXCPU", "CPU time limit exceeded"},
|
||||
{25, "SIGXFSZ", "file size limit exceeded"},
|
||||
{26, "SIGVTALRM", "virtual timer expired"},
|
||||
{27, "SIGPROF", "profiling timer expired"},
|
||||
{28, "SIGWINCH", "window changed"},
|
||||
{29, "SIGIO", "I/O possible"},
|
||||
{30, "SIGPWR", "power failure"},
|
||||
{31, "SIGSYS", "bad system call"},
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
// +build ppc64,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
@ -60,6 +60,8 @@ const (
|
|||
CS8 = 0x300
|
||||
CSIZE = 0x300
|
||||
CSTOPB = 0x400
|
||||
ECCGETLAYOUT = 0x41484d11
|
||||
ECCGETSTATS = 0x40104d12
|
||||
ECHOCTL = 0x40
|
||||
ECHOE = 0x2
|
||||
ECHOK = 0x4
|
||||
|
@ -121,6 +123,19 @@ const (
|
|||
MCL_CURRENT = 0x2000
|
||||
MCL_FUTURE = 0x4000
|
||||
MCL_ONFAULT = 0x8000
|
||||
MEMERASE = 0x80084d02
|
||||
MEMERASE64 = 0x80104d14
|
||||
MEMGETBADBLOCK = 0x80084d0b
|
||||
MEMGETINFO = 0x40204d01
|
||||
MEMGETOOBSEL = 0x40c84d0a
|
||||
MEMGETREGIONCOUNT = 0x40044d07
|
||||
MEMISLOCKED = 0x40084d17
|
||||
MEMLOCK = 0x80084d05
|
||||
MEMREADOOB = 0xc0104d04
|
||||
MEMSETBADBLOCK = 0x80084d0c
|
||||
MEMUNLOCK = 0x80084d06
|
||||
MEMWRITEOOB = 0xc0104d03
|
||||
MTDFILEMODE = 0x20004d13
|
||||
NFDBITS = 0x40
|
||||
NL2 = 0x200
|
||||
NL3 = 0x300
|
||||
|
@ -132,6 +147,11 @@ const (
|
|||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x4
|
||||
ONLCR = 0x2
|
||||
OTPERASE = 0x800c4d19
|
||||
OTPGETREGIONCOUNT = 0x80044d0e
|
||||
OTPGETREGIONINFO = 0x800c4d0f
|
||||
OTPLOCK = 0x400c4d10
|
||||
OTPSELECT = 0x40044d0d
|
||||
O_APPEND = 0x400
|
||||
O_ASYNC = 0x2000
|
||||
O_CLOEXEC = 0x80000
|
||||
|
@ -289,6 +309,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8008700e
|
||||
RTC_IRQP_READ = 0x4008700b
|
||||
RTC_IRQP_SET = 0x8008700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x40207011
|
||||
|
@ -332,6 +354,7 @@ const (
|
|||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x6
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
|
@ -348,6 +371,7 @@ const (
|
|||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0xa
|
||||
SO_PASSCRED = 0x14
|
||||
|
@ -364,6 +388,7 @@ const (
|
|||
SO_RCVTIMEO = 0x12
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x12
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// +build ppc64le,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
@ -60,6 +60,8 @@ const (
|
|||
CS8 = 0x300
|
||||
CSIZE = 0x300
|
||||
CSTOPB = 0x400
|
||||
ECCGETLAYOUT = 0x41484d11
|
||||
ECCGETSTATS = 0x40104d12
|
||||
ECHOCTL = 0x40
|
||||
ECHOE = 0x2
|
||||
ECHOK = 0x4
|
||||
|
@ -121,6 +123,19 @@ const (
|
|||
MCL_CURRENT = 0x2000
|
||||
MCL_FUTURE = 0x4000
|
||||
MCL_ONFAULT = 0x8000
|
||||
MEMERASE = 0x80084d02
|
||||
MEMERASE64 = 0x80104d14
|
||||
MEMGETBADBLOCK = 0x80084d0b
|
||||
MEMGETINFO = 0x40204d01
|
||||
MEMGETOOBSEL = 0x40c84d0a
|
||||
MEMGETREGIONCOUNT = 0x40044d07
|
||||
MEMISLOCKED = 0x40084d17
|
||||
MEMLOCK = 0x80084d05
|
||||
MEMREADOOB = 0xc0104d04
|
||||
MEMSETBADBLOCK = 0x80084d0c
|
||||
MEMUNLOCK = 0x80084d06
|
||||
MEMWRITEOOB = 0xc0104d03
|
||||
MTDFILEMODE = 0x20004d13
|
||||
NFDBITS = 0x40
|
||||
NL2 = 0x200
|
||||
NL3 = 0x300
|
||||
|
@ -132,6 +147,11 @@ const (
|
|||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x4
|
||||
ONLCR = 0x2
|
||||
OTPERASE = 0x800c4d19
|
||||
OTPGETREGIONCOUNT = 0x80044d0e
|
||||
OTPGETREGIONINFO = 0x800c4d0f
|
||||
OTPLOCK = 0x400c4d10
|
||||
OTPSELECT = 0x40044d0d
|
||||
O_APPEND = 0x400
|
||||
O_ASYNC = 0x2000
|
||||
O_CLOEXEC = 0x80000
|
||||
|
@ -289,6 +309,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8008700e
|
||||
RTC_IRQP_READ = 0x4008700b
|
||||
RTC_IRQP_SET = 0x8008700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x40207011
|
||||
|
@ -332,6 +354,7 @@ const (
|
|||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x6
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
|
@ -348,6 +371,7 @@ const (
|
|||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0xa
|
||||
SO_PASSCRED = 0x14
|
||||
|
@ -364,6 +388,7 @@ const (
|
|||
SO_RCVTIMEO = 0x12
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x12
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// +build riscv64,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
@ -60,6 +60,8 @@ const (
|
|||
CS8 = 0x30
|
||||
CSIZE = 0x30
|
||||
CSTOPB = 0x40
|
||||
ECCGETLAYOUT = 0x81484d11
|
||||
ECCGETSTATS = 0x80104d12
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
|
@ -121,6 +123,19 @@ const (
|
|||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MCL_ONFAULT = 0x4
|
||||
MEMERASE = 0x40084d02
|
||||
MEMERASE64 = 0x40104d14
|
||||
MEMGETBADBLOCK = 0x40084d0b
|
||||
MEMGETINFO = 0x80204d01
|
||||
MEMGETOOBSEL = 0x80c84d0a
|
||||
MEMGETREGIONCOUNT = 0x80044d07
|
||||
MEMISLOCKED = 0x80084d17
|
||||
MEMLOCK = 0x40084d05
|
||||
MEMREADOOB = 0xc0104d04
|
||||
MEMSETBADBLOCK = 0x40084d0c
|
||||
MEMUNLOCK = 0x40084d06
|
||||
MEMWRITEOOB = 0xc0104d03
|
||||
MTDFILEMODE = 0x4d13
|
||||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
|
@ -130,6 +145,11 @@ const (
|
|||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
OTPERASE = 0x400c4d19
|
||||
OTPGETREGIONCOUNT = 0x40044d0e
|
||||
OTPGETREGIONINFO = 0x400c4d0f
|
||||
OTPLOCK = 0x800c4d10
|
||||
OTPSELECT = 0x80044d0d
|
||||
O_APPEND = 0x400
|
||||
O_ASYNC = 0x2000
|
||||
O_CLOEXEC = 0x80000
|
||||
|
@ -218,6 +238,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x4008700e
|
||||
RTC_IRQP_READ = 0x8008700b
|
||||
RTC_IRQP_SET = 0x4008700c
|
||||
RTC_PARAM_GET = 0x40187013
|
||||
RTC_PARAM_SET = 0x40187014
|
||||
RTC_PIE_OFF = 0x7006
|
||||
RTC_PIE_ON = 0x7005
|
||||
RTC_PLL_GET = 0x80207011
|
||||
|
@ -261,6 +283,7 @@ const (
|
|||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x6
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
|
@ -277,6 +300,7 @@ const (
|
|||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0xa
|
||||
SO_PASSCRED = 0x10
|
||||
|
@ -293,6 +317,7 @@ const (
|
|||
SO_RCVTIMEO = 0x14
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x14
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// +build s390x,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
@ -60,6 +60,8 @@ const (
|
|||
CS8 = 0x30
|
||||
CSIZE = 0x30
|
||||
CSTOPB = 0x40
|
||||
ECCGETLAYOUT = 0x81484d11
|
||||
ECCGETSTATS = 0x80104d12
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
|
@ -121,6 +123,19 @@ const (
|
|||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MCL_ONFAULT = 0x4
|
||||
MEMERASE = 0x40084d02
|
||||
MEMERASE64 = 0x40104d14
|
||||
MEMGETBADBLOCK = 0x40084d0b
|
||||
MEMGETINFO = 0x80204d01
|
||||
MEMGETOOBSEL = 0x80c84d0a
|
||||
MEMGETREGIONCOUNT = 0x80044d07
|
||||
MEMISLOCKED = 0x80084d17
|
||||
MEMLOCK = 0x40084d05
|
||||
MEMREADOOB = 0xc0104d04
|
||||
MEMSETBADBLOCK = 0x40084d0c
|
||||
MEMUNLOCK = 0x40084d06
|
||||
MEMWRITEOOB = 0xc0104d03
|
||||
MTDFILEMODE = 0x4d13
|
||||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
|
@ -130,6 +145,11 @@ const (
|
|||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
OTPERASE = 0x400c4d19
|
||||
OTPGETREGIONCOUNT = 0x40044d0e
|
||||
OTPGETREGIONINFO = 0x400c4d0f
|
||||
OTPLOCK = 0x800c4d10
|
||||
OTPSELECT = 0x80044d0d
|
||||
O_APPEND = 0x400
|
||||
O_ASYNC = 0x2000
|
||||
O_CLOEXEC = 0x80000
|
||||
|
@ -212,6 +232,8 @@ const (
|
|||
PTRACE_POKE_SYSTEM_CALL = 0x5008
|
||||
PTRACE_PROT = 0x15
|
||||
PTRACE_SINGLEBLOCK = 0xc
|
||||
PTRACE_SYSEMU = 0x1f
|
||||
PTRACE_SYSEMU_SINGLESTEP = 0x20
|
||||
PTRACE_TE_ABORT_RAND = 0x5011
|
||||
PT_ACR0 = 0x90
|
||||
PT_ACR1 = 0x94
|
||||
|
@ -291,6 +313,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x4008700e
|
||||
RTC_IRQP_READ = 0x8008700b
|
||||
RTC_IRQP_SET = 0x4008700c
|
||||
RTC_PARAM_GET = 0x40187013
|
||||
RTC_PARAM_SET = 0x40187014
|
||||
RTC_PIE_OFF = 0x7006
|
||||
RTC_PIE_ON = 0x7005
|
||||
RTC_PLL_GET = 0x80207011
|
||||
|
@ -334,6 +358,7 @@ const (
|
|||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x6
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
|
@ -350,6 +375,7 @@ const (
|
|||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0xa
|
||||
SO_PASSCRED = 0x10
|
||||
|
@ -366,6 +392,7 @@ const (
|
|||
SO_RCVTIMEO = 0x14
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x14
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// +build sparc64,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
@ -63,6 +63,8 @@ const (
|
|||
CS8 = 0x30
|
||||
CSIZE = 0x30
|
||||
CSTOPB = 0x40
|
||||
ECCGETLAYOUT = 0x41484d11
|
||||
ECCGETSTATS = 0x40104d12
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
|
@ -126,6 +128,19 @@ const (
|
|||
MCL_CURRENT = 0x2000
|
||||
MCL_FUTURE = 0x4000
|
||||
MCL_ONFAULT = 0x8000
|
||||
MEMERASE = 0x80084d02
|
||||
MEMERASE64 = 0x80104d14
|
||||
MEMGETBADBLOCK = 0x80084d0b
|
||||
MEMGETINFO = 0x40204d01
|
||||
MEMGETOOBSEL = 0x40c84d0a
|
||||
MEMGETREGIONCOUNT = 0x40044d07
|
||||
MEMISLOCKED = 0x40084d17
|
||||
MEMLOCK = 0x80084d05
|
||||
MEMREADOOB = 0xc0104d04
|
||||
MEMSETBADBLOCK = 0x80084d0c
|
||||
MEMUNLOCK = 0x80084d06
|
||||
MEMWRITEOOB = 0xc0104d03
|
||||
MTDFILEMODE = 0x20004d13
|
||||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
|
@ -135,6 +150,11 @@ const (
|
|||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
OTPERASE = 0x800c4d19
|
||||
OTPGETREGIONCOUNT = 0x80044d0e
|
||||
OTPGETREGIONINFO = 0x800c4d0f
|
||||
OTPLOCK = 0x400c4d10
|
||||
OTPSELECT = 0x40044d0d
|
||||
O_APPEND = 0x8
|
||||
O_ASYNC = 0x40
|
||||
O_CLOEXEC = 0x400000
|
||||
|
@ -284,6 +304,8 @@ const (
|
|||
RTC_EPOCH_SET = 0x8008700e
|
||||
RTC_IRQP_READ = 0x4008700b
|
||||
RTC_IRQP_SET = 0x8008700c
|
||||
RTC_PARAM_GET = 0x80187013
|
||||
RTC_PARAM_SET = 0x80187014
|
||||
RTC_PIE_OFF = 0x20007006
|
||||
RTC_PIE_ON = 0x20007005
|
||||
RTC_PLL_GET = 0x40207011
|
||||
|
@ -327,6 +349,7 @@ const (
|
|||
SO_BPF_EXTENSIONS = 0x32
|
||||
SO_BROADCAST = 0x20
|
||||
SO_BSDCOMPAT = 0x400
|
||||
SO_BUF_LOCK = 0x51
|
||||
SO_BUSY_POLL = 0x30
|
||||
SO_BUSY_POLL_BUDGET = 0x49
|
||||
SO_CNX_ADVICE = 0x37
|
||||
|
@ -343,6 +366,7 @@ const (
|
|||
SO_MARK = 0x22
|
||||
SO_MAX_PACING_RATE = 0x31
|
||||
SO_MEMINFO = 0x39
|
||||
SO_NETNS_COOKIE = 0x50
|
||||
SO_NOFCS = 0x27
|
||||
SO_OOBINLINE = 0x100
|
||||
SO_PASSCRED = 0x2
|
||||
|
@ -359,6 +383,7 @@ const (
|
|||
SO_RCVTIMEO = 0x2000
|
||||
SO_RCVTIMEO_NEW = 0x44
|
||||
SO_RCVTIMEO_OLD = 0x2000
|
||||
SO_RESERVE_MEM = 0x52
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_RXQ_OVFL = 0x24
|
||||
|
|
|
@ -1020,7 +1020,10 @@ const (
|
|||
RLIMIT_CPU = 0x0
|
||||
RLIMIT_DATA = 0x2
|
||||
RLIMIT_FSIZE = 0x1
|
||||
RLIMIT_MEMLOCK = 0x6
|
||||
RLIMIT_NOFILE = 0x8
|
||||
RLIMIT_NPROC = 0x7
|
||||
RLIMIT_RSS = 0x5
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0x7fffffffffffffff
|
||||
RTAX_AUTHOR = 0x6
|
||||
|
|
|
@ -1020,7 +1020,10 @@ const (
|
|||
RLIMIT_CPU = 0x0
|
||||
RLIMIT_DATA = 0x2
|
||||
RLIMIT_FSIZE = 0x1
|
||||
RLIMIT_MEMLOCK = 0x6
|
||||
RLIMIT_NOFILE = 0x8
|
||||
RLIMIT_NPROC = 0x7
|
||||
RLIMIT_RSS = 0x5
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0x7fffffffffffffff
|
||||
RTAX_AUTHOR = 0x6
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue