infrakit: Fix detection of running proceses

os.FindProcess() does not return an error when then process does not
exist. It even returns a dummy process object.

Use the go-ps package to find out if the hyperkit process is actually
running.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer 2017-03-09 17:37:22 +00:00
parent 534667b281
commit 0f7807e48d
40 changed files with 1899 additions and 9 deletions

View File

@ -13,6 +13,7 @@ import (
"strings" "strings"
log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus"
ps "github.com/mitchellh/go-ps"
"github.com/docker/infrakit/pkg/spi/instance" "github.com/docker/infrakit/pkg/spi/instance"
"github.com/docker/infrakit/pkg/template" "github.com/docker/infrakit/pkg/template"
@ -303,9 +304,9 @@ func (v hyperkitPlugin) execHyperKit(params map[string]interface{}) error {
for { for {
select { select {
case stderrl := <-stderrChan: case stderrl := <-stderrChan:
log.Warningln("HyperKit STDERR: ", stderrl) log.Warning("HyperKit STDERR: ", stderrl)
case stdoutl := <-stdoutChan: case stdoutl := <-stdoutChan:
log.Infoln("HyperKit STDOUT: ", stdoutl) log.Info("HyperKit STDOUT: ", stdoutl)
case <-done: case <-done:
return return
} }
@ -362,5 +363,23 @@ func getProcess(instanceDir string) (*os.Process, error) {
log.Warningln("Can't convert pidData: ", pidData, err) log.Warningln("Can't convert pidData: ", pidData, err)
return nil, err return nil, err
} }
return os.FindProcess(pid)
p, err := os.FindProcess(pid)
if err != nil {
log.Warningln("Can't find process with pid: ", pid)
return nil, err
}
// os.FindProcess on Unix always returns a process object even
// if the process does not exists. There does not seem to be
// a call to find out if the process is running either, so we
// use another package to find out.
proc, err := ps.FindProcess(p.Pid)
if err != nil {
log.Warningln("Can't find process", err)
return nil, err
}
if proc == nil {
return nil, errors.New("Process not found")
}
return p, nil
} }

View File

@ -1,15 +1,17 @@
github.com/Masterminds/sprig 2d2df7bd8bda53b5a55ed04422173cedd50500ea github.com/Masterminds/sprig 2009c2546db608c737012557c9d3e836468f0423
github.com/Sirupsen/logrus 0208149b40d863d2c1a2f8fe5753096a9cf2cc8b github.com/Sirupsen/logrus 1deb2db2a6fff8a35532079061b903c3a25eed52
github.com/aokoli/goutils 9c37978a95bd5c709a15883b6242714ea6709e64 github.com/aokoli/goutils 9c37978a95bd5c709a15883b6242714ea6709e64
github.com/docker/infrakit ecc0561f7bd44e832ce7dc07222b913082aeff6e github.com/armon/go-radix 4239b77079c7b5d1243b7b4736304ce8ddb6f0f2
github.com/docker/infrakit 9b2321847c2eb4af9e63b5ff13f71b72fc1aad53
github.com/gorilla/context 08b5f424b9271eedf6f9f0ce86cb9396ed337a42 github.com/gorilla/context 08b5f424b9271eedf6f9f0ce86cb9396ed337a42
github.com/gorilla/mux 599cba5e7b6137d46ddf58fb1765f5d928e69604 github.com/gorilla/mux 599cba5e7b6137d46ddf58fb1765f5d928e69604
github.com/gorilla/rpc 22c016f3df3febe0c1f6727598b6389507e03a18 github.com/gorilla/rpc 22c016f3df3febe0c1f6727598b6389507e03a18
github.com/inconshreveable/mousetrap 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 github.com/inconshreveable/mousetrap 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
github.com/jmespath/go-jmespath bd40a432e4c76585ef6b72d3fd96fb9b6dc7b68d github.com/jmespath/go-jmespath bd40a432e4c76585ef6b72d3fd96fb9b6dc7b68d
github.com/mitchellh/go-ps 4fdf99ab29366514c69ccccddab5dc58b8d84062
github.com/satori/go.uuid b061729afc07e77a8aa4fad0a2fd840958f1942a github.com/satori/go.uuid b061729afc07e77a8aa4fad0a2fd840958f1942a
github.com/spf13/cobra fcd0c5a1df88f5d6784cb4feead962c3f3d0b66c github.com/spf13/cobra 16c014f1a19d865b765b420e74508f80eb831ada
github.com/spf13/pflag 9ff6c6923cfffbcd502984b8e0c80539a94968b7 github.com/spf13/pflag 9ff6c6923cfffbcd502984b8e0c80539a94968b7
golang.org/x/crypto 453249f01cfeb54c3d549ddb75ff152ca243f9d8 golang.org/x/crypto 728b753d0135da6801d45a38e6f43ff55779c5c2
golang.org/x/sys 76cc09b634294339fa19ec41b5f2a0b3932cea8b golang.org/x/sys 99f16d856c9836c42d24e7ab64ea72916925fa97
gopkg.in/tylerb/graceful.v1 4654dfbb6ad53cb5e27f37d99b02e16c1872fbbb gopkg.in/tylerb/graceful.v1 4654dfbb6ad53cb5e27f37d99b02e16c1872fbbb

View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2014 Armon Dadgar
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,38 @@
go-radix [![Build Status](https://travis-ci.org/armon/go-radix.png)](https://travis-ci.org/armon/go-radix)
=========
Provides the `radix` package that implements a [radix tree](http://en.wikipedia.org/wiki/Radix_tree).
The package only provides a single `Tree` implementation, optimized for sparse nodes.
As a radix tree, it provides the following:
* O(k) operations. In many cases, this can be faster than a hash table since
the hash function is an O(k) operation, and hash tables have very poor cache locality.
* Minimum / Maximum value lookups
* Ordered iteration
For an immutable variant, see [go-immutable-radix](https://github.com/hashicorp/go-immutable-radix).
Documentation
=============
The full documentation is available on [Godoc](http://godoc.org/github.com/armon/go-radix).
Example
=======
Below is a simple example of usage
```go
// Create a tree
r := radix.New()
r.Insert("foo", 1)
r.Insert("bar", 2)
r.Insert("foobar", 2)
// Find the longest prefix match
m, _, _ := r.LongestPrefix("foozip")
if m != "foo" {
panic("should be foo")
}
```

View File

@ -0,0 +1,496 @@
package radix
import (
"sort"
"strings"
)
// WalkFn is used when walking the tree. Takes a
// key and value, returning if iteration should
// be terminated.
type WalkFn func(s string, v interface{}) bool
// leafNode is used to represent a value
type leafNode struct {
key string
val interface{}
}
// edge is used to represent an edge node
type edge struct {
label byte
node *node
}
type node struct {
// leaf is used to store possible leaf
leaf *leafNode
// prefix is the common prefix we ignore
prefix string
// Edges should be stored in-order for iteration.
// We avoid a fully materialized slice to save memory,
// since in most cases we expect to be sparse
edges edges
}
func (n *node) isLeaf() bool {
return n.leaf != nil
}
func (n *node) addEdge(e edge) {
n.edges = append(n.edges, e)
n.edges.Sort()
}
func (n *node) replaceEdge(e edge) {
num := len(n.edges)
idx := sort.Search(num, func(i int) bool {
return n.edges[i].label >= e.label
})
if idx < num && n.edges[idx].label == e.label {
n.edges[idx].node = e.node
return
}
panic("replacing missing edge")
}
func (n *node) getEdge(label byte) *node {
num := len(n.edges)
idx := sort.Search(num, func(i int) bool {
return n.edges[i].label >= label
})
if idx < num && n.edges[idx].label == label {
return n.edges[idx].node
}
return nil
}
func (n *node) delEdge(label byte) {
num := len(n.edges)
idx := sort.Search(num, func(i int) bool {
return n.edges[i].label >= label
})
if idx < num && n.edges[idx].label == label {
copy(n.edges[idx:], n.edges[idx+1:])
n.edges[len(n.edges)-1] = edge{}
n.edges = n.edges[:len(n.edges)-1]
}
}
type edges []edge
func (e edges) Len() int {
return len(e)
}
func (e edges) Less(i, j int) bool {
return e[i].label < e[j].label
}
func (e edges) Swap(i, j int) {
e[i], e[j] = e[j], e[i]
}
func (e edges) Sort() {
sort.Sort(e)
}
// Tree implements a radix tree. This can be treated as a
// Dictionary abstract data type. The main advantage over
// a standard hash map is prefix-based lookups and
// ordered iteration,
type Tree struct {
root *node
size int
}
// New returns an empty Tree
func New() *Tree {
return NewFromMap(nil)
}
// NewFromMap returns a new tree containing the keys
// from an existing map
func NewFromMap(m map[string]interface{}) *Tree {
t := &Tree{root: &node{}}
for k, v := range m {
t.Insert(k, v)
}
return t
}
// Len is used to return the number of elements in the tree
func (t *Tree) Len() int {
return t.size
}
// longestPrefix finds the length of the shared prefix
// of two strings
func longestPrefix(k1, k2 string) int {
max := len(k1)
if l := len(k2); l < max {
max = l
}
var i int
for i = 0; i < max; i++ {
if k1[i] != k2[i] {
break
}
}
return i
}
// Insert is used to add a newentry or update
// an existing entry. Returns if updated.
func (t *Tree) Insert(s string, v interface{}) (interface{}, bool) {
var parent *node
n := t.root
search := s
for {
// Handle key exhaution
if len(search) == 0 {
if n.isLeaf() {
old := n.leaf.val
n.leaf.val = v
return old, true
}
n.leaf = &leafNode{
key: s,
val: v,
}
t.size++
return nil, false
}
// Look for the edge
parent = n
n = n.getEdge(search[0])
// No edge, create one
if n == nil {
e := edge{
label: search[0],
node: &node{
leaf: &leafNode{
key: s,
val: v,
},
prefix: search,
},
}
parent.addEdge(e)
t.size++
return nil, false
}
// Determine longest prefix of the search key on match
commonPrefix := longestPrefix(search, n.prefix)
if commonPrefix == len(n.prefix) {
search = search[commonPrefix:]
continue
}
// Split the node
t.size++
child := &node{
prefix: search[:commonPrefix],
}
parent.replaceEdge(edge{
label: search[0],
node: child,
})
// Restore the existing node
child.addEdge(edge{
label: n.prefix[commonPrefix],
node: n,
})
n.prefix = n.prefix[commonPrefix:]
// Create a new leaf node
leaf := &leafNode{
key: s,
val: v,
}
// If the new key is a subset, add to to this node
search = search[commonPrefix:]
if len(search) == 0 {
child.leaf = leaf
return nil, false
}
// Create a new edge for the node
child.addEdge(edge{
label: search[0],
node: &node{
leaf: leaf,
prefix: search,
},
})
return nil, false
}
}
// Delete is used to delete a key, returning the previous
// value and if it was deleted
func (t *Tree) Delete(s string) (interface{}, bool) {
var parent *node
var label byte
n := t.root
search := s
for {
// Check for key exhaution
if len(search) == 0 {
if !n.isLeaf() {
break
}
goto DELETE
}
// Look for an edge
parent = n
label = search[0]
n = n.getEdge(label)
if n == nil {
break
}
// Consume the search prefix
if strings.HasPrefix(search, n.prefix) {
search = search[len(n.prefix):]
} else {
break
}
}
return nil, false
DELETE:
// Delete the leaf
leaf := n.leaf
n.leaf = nil
t.size--
// Check if we should delete this node from the parent
if parent != nil && len(n.edges) == 0 {
parent.delEdge(label)
}
// Check if we should merge this node
if n != t.root && len(n.edges) == 1 {
n.mergeChild()
}
// Check if we should merge the parent's other child
if parent != nil && parent != t.root && len(parent.edges) == 1 && !parent.isLeaf() {
parent.mergeChild()
}
return leaf.val, true
}
func (n *node) mergeChild() {
e := n.edges[0]
child := e.node
n.prefix = n.prefix + child.prefix
n.leaf = child.leaf
n.edges = child.edges
}
// Get is used to lookup a specific key, returning
// the value and if it was found
func (t *Tree) Get(s string) (interface{}, bool) {
n := t.root
search := s
for {
// Check for key exhaution
if len(search) == 0 {
if n.isLeaf() {
return n.leaf.val, true
}
break
}
// Look for an edge
n = n.getEdge(search[0])
if n == nil {
break
}
// Consume the search prefix
if strings.HasPrefix(search, n.prefix) {
search = search[len(n.prefix):]
} else {
break
}
}
return nil, false
}
// LongestPrefix is like Get, but instead of an
// exact match, it will return the longest prefix match.
func (t *Tree) LongestPrefix(s string) (string, interface{}, bool) {
var last *leafNode
n := t.root
search := s
for {
// Look for a leaf node
if n.isLeaf() {
last = n.leaf
}
// Check for key exhaution
if len(search) == 0 {
break
}
// Look for an edge
n = n.getEdge(search[0])
if n == nil {
break
}
// Consume the search prefix
if strings.HasPrefix(search, n.prefix) {
search = search[len(n.prefix):]
} else {
break
}
}
if last != nil {
return last.key, last.val, true
}
return "", nil, false
}
// Minimum is used to return the minimum value in the tree
func (t *Tree) Minimum() (string, interface{}, bool) {
n := t.root
for {
if n.isLeaf() {
return n.leaf.key, n.leaf.val, true
}
if len(n.edges) > 0 {
n = n.edges[0].node
} else {
break
}
}
return "", nil, false
}
// Maximum is used to return the maximum value in the tree
func (t *Tree) Maximum() (string, interface{}, bool) {
n := t.root
for {
if num := len(n.edges); num > 0 {
n = n.edges[num-1].node
continue
}
if n.isLeaf() {
return n.leaf.key, n.leaf.val, true
}
break
}
return "", nil, false
}
// Walk is used to walk the tree
func (t *Tree) Walk(fn WalkFn) {
recursiveWalk(t.root, fn)
}
// WalkPrefix is used to walk the tree under a prefix
func (t *Tree) WalkPrefix(prefix string, fn WalkFn) {
n := t.root
search := prefix
for {
// Check for key exhaution
if len(search) == 0 {
recursiveWalk(n, fn)
return
}
// Look for an edge
n = n.getEdge(search[0])
if n == nil {
break
}
// Consume the search prefix
if strings.HasPrefix(search, n.prefix) {
search = search[len(n.prefix):]
} else if strings.HasPrefix(n.prefix, search) {
// Child may be under our search prefix
recursiveWalk(n, fn)
return
} else {
break
}
}
}
// WalkPath is used to walk the tree, but only visiting nodes
// from the root down to a given leaf. Where WalkPrefix walks
// all the entries *under* the given prefix, this walks the
// entries *above* the given prefix.
func (t *Tree) WalkPath(path string, fn WalkFn) {
n := t.root
search := path
for {
// Visit the leaf values if any
if n.leaf != nil && fn(n.leaf.key, n.leaf.val) {
return
}
// Check for key exhaution
if len(search) == 0 {
return
}
// Look for an edge
n = n.getEdge(search[0])
if n == nil {
return
}
// Consume the search prefix
if strings.HasPrefix(search, n.prefix) {
search = search[len(n.prefix):]
} else {
break
}
}
}
// recursiveWalk is used to do a pre-order walk of a node
// recursively. Returns true if the walk should be aborted
func recursiveWalk(n *node, fn WalkFn) bool {
// Visit the leaf values if any
if n.leaf != nil && fn(n.leaf.key, n.leaf.val) {
return true
}
// Recurse on the children
for _, e := range n.edges {
if recursiveWalk(e.node, fn) {
return true
}
}
return false
}
// ToMap is used to walk the tree and convert it into a map
func (t *Tree) ToMap() map[string]interface{} {
out := make(map[string]interface{}, t.size)
t.Walk(func(k string, v interface{}) bool {
out[k] = v
return false
})
return out
}

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Mitchell Hashimoto
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,34 @@
# Process List Library for Go
go-ps is a library for Go that implements OS-specific APIs to list and
manipulate processes in a platform-safe way. The library can find and
list processes on Linux, Mac OS X, Solaris, and Windows.
If you're new to Go, this library has a good amount of advanced Go educational
value as well. It uses some advanced features of Go: build tags, accessing
DLL methods for Windows, cgo for Darwin, etc.
How it works:
* **Darwin** uses the `sysctl` syscall to retrieve the process table.
* **Unix** uses the procfs at `/proc` to inspect the process tree.
* **Windows** uses the Windows API, and methods such as
`CreateToolhelp32Snapshot` to get a point-in-time snapshot of
the process table.
## Installation
Install using standard `go get`:
```
$ go get github.com/mitchellh/go-ps
...
```
## TODO
Want to contribute? Here is a short TODO list of things that aren't
implemented for this library that would be nice:
* FreeBSD support
* Plan9 support

View File

@ -0,0 +1,40 @@
// ps provides an API for finding and listing processes in a platform-agnostic
// way.
//
// NOTE: If you're reading these docs online via GoDocs or some other system,
// you might only see the Unix docs. This project makes heavy use of
// platform-specific implementations. We recommend reading the source if you
// are interested.
package ps
// Process is the generic interface that is implemented on every platform
// and provides common operations for processes.
type Process interface {
// Pid is the process ID for this process.
Pid() int
// PPid is the parent process ID for this process.
PPid() int
// Executable name running this process. This is not a path to the
// executable.
Executable() string
}
// Processes returns all processes.
//
// This of course will be a point-in-time snapshot of when this method was
// called. Some operating systems don't provide snapshot capability of the
// process table, in which case the process table returned might contain
// ephemeral entities that happened to be running when this was called.
func Processes() ([]Process, error) {
return processes()
}
// FindProcess looks up a single process by pid.
//
// Process will be nil and error will be nil if a matching process is
// not found.
func FindProcess(pid int) (Process, error) {
return findProcess(pid)
}

View File

@ -0,0 +1,138 @@
// +build darwin
package ps
import (
"bytes"
"encoding/binary"
"syscall"
"unsafe"
)
type DarwinProcess struct {
pid int
ppid int
binary string
}
func (p *DarwinProcess) Pid() int {
return p.pid
}
func (p *DarwinProcess) PPid() int {
return p.ppid
}
func (p *DarwinProcess) Executable() string {
return p.binary
}
func findProcess(pid int) (Process, error) {
ps, err := processes()
if err != nil {
return nil, err
}
for _, p := range ps {
if p.Pid() == pid {
return p, nil
}
}
return nil, nil
}
func processes() ([]Process, error) {
buf, err := darwinSyscall()
if err != nil {
return nil, err
}
procs := make([]*kinfoProc, 0, 50)
k := 0
for i := _KINFO_STRUCT_SIZE; i < buf.Len(); i += _KINFO_STRUCT_SIZE {
proc := &kinfoProc{}
err = binary.Read(bytes.NewBuffer(buf.Bytes()[k:i]), binary.LittleEndian, proc)
if err != nil {
return nil, err
}
k = i
procs = append(procs, proc)
}
darwinProcs := make([]Process, len(procs))
for i, p := range procs {
darwinProcs[i] = &DarwinProcess{
pid: int(p.Pid),
ppid: int(p.PPid),
binary: darwinCstring(p.Comm),
}
}
return darwinProcs, nil
}
func darwinCstring(s [16]byte) string {
i := 0
for _, b := range s {
if b != 0 {
i++
} else {
break
}
}
return string(s[:i])
}
func darwinSyscall() (*bytes.Buffer, error) {
mib := [4]int32{_CTRL_KERN, _KERN_PROC, _KERN_PROC_ALL, 0}
size := uintptr(0)
_, _, errno := syscall.Syscall6(
syscall.SYS___SYSCTL,
uintptr(unsafe.Pointer(&mib[0])),
4,
0,
uintptr(unsafe.Pointer(&size)),
0,
0)
if errno != 0 {
return nil, errno
}
bs := make([]byte, size)
_, _, errno = syscall.Syscall6(
syscall.SYS___SYSCTL,
uintptr(unsafe.Pointer(&mib[0])),
4,
uintptr(unsafe.Pointer(&bs[0])),
uintptr(unsafe.Pointer(&size)),
0,
0)
if errno != 0 {
return nil, errno
}
return bytes.NewBuffer(bs[0:size]), nil
}
const (
_CTRL_KERN = 1
_KERN_PROC = 14
_KERN_PROC_ALL = 0
_KINFO_STRUCT_SIZE = 648
)
type kinfoProc struct {
_ [40]byte
Pid int32
_ [199]byte
Comm [16]byte
_ [301]byte
PPid int32
_ [84]byte
}

View File

@ -0,0 +1,260 @@
// +build freebsd,amd64
package ps
import (
"bytes"
"encoding/binary"
"syscall"
"unsafe"
)
// copied from sys/sysctl.h
const (
CTL_KERN = 1 // "high kernel": proc, limits
KERN_PROC = 14 // struct: process entries
KERN_PROC_PID = 1 // by process id
KERN_PROC_PROC = 8 // only return procs
KERN_PROC_PATHNAME = 12 // path to executable
)
// copied from sys/user.h
type Kinfo_proc struct {
Ki_structsize int32
Ki_layout int32
Ki_args int64
Ki_paddr int64
Ki_addr int64
Ki_tracep int64
Ki_textvp int64
Ki_fd int64
Ki_vmspace int64
Ki_wchan int64
Ki_pid int32
Ki_ppid int32
Ki_pgid int32
Ki_tpgid int32
Ki_sid int32
Ki_tsid int32
Ki_jobc [2]byte
Ki_spare_short1 [2]byte
Ki_tdev int32
Ki_siglist [16]byte
Ki_sigmask [16]byte
Ki_sigignore [16]byte
Ki_sigcatch [16]byte
Ki_uid int32
Ki_ruid int32
Ki_svuid int32
Ki_rgid int32
Ki_svgid int32
Ki_ngroups [2]byte
Ki_spare_short2 [2]byte
Ki_groups [64]byte
Ki_size int64
Ki_rssize int64
Ki_swrss int64
Ki_tsize int64
Ki_dsize int64
Ki_ssize int64
Ki_xstat [2]byte
Ki_acflag [2]byte
Ki_pctcpu int32
Ki_estcpu int32
Ki_slptime int32
Ki_swtime int32
Ki_cow int32
Ki_runtime int64
Ki_start [16]byte
Ki_childtime [16]byte
Ki_flag int64
Ki_kiflag int64
Ki_traceflag int32
Ki_stat [1]byte
Ki_nice [1]byte
Ki_lock [1]byte
Ki_rqindex [1]byte
Ki_oncpu [1]byte
Ki_lastcpu [1]byte
Ki_ocomm [17]byte
Ki_wmesg [9]byte
Ki_login [18]byte
Ki_lockname [9]byte
Ki_comm [20]byte
Ki_emul [17]byte
Ki_sparestrings [68]byte
Ki_spareints [36]byte
Ki_cr_flags int32
Ki_jid int32
Ki_numthreads int32
Ki_tid int32
Ki_pri int32
Ki_rusage [144]byte
Ki_rusage_ch [144]byte
Ki_pcb int64
Ki_kstack int64
Ki_udata int64
Ki_tdaddr int64
Ki_spareptrs [48]byte
Ki_spareint64s [96]byte
Ki_sflag int64
Ki_tdflags int64
}
// UnixProcess is an implementation of Process that contains Unix-specific
// fields and information.
type UnixProcess struct {
pid int
ppid int
state rune
pgrp int
sid int
binary string
}
func (p *UnixProcess) Pid() int {
return p.pid
}
func (p *UnixProcess) PPid() int {
return p.ppid
}
func (p *UnixProcess) Executable() string {
return p.binary
}
// Refresh reloads all the data associated with this process.
func (p *UnixProcess) Refresh() error {
mib := []int32{CTL_KERN, KERN_PROC, KERN_PROC_PID, int32(p.pid)}
buf, length, err := call_syscall(mib)
if err != nil {
return err
}
proc_k := Kinfo_proc{}
if length != uint64(unsafe.Sizeof(proc_k)) {
return err
}
k, err := parse_kinfo_proc(buf)
if err != nil {
return err
}
p.ppid, p.pgrp, p.sid, p.binary = copy_params(&k)
return nil
}
func copy_params(k *Kinfo_proc) (int, int, int, string) {
n := -1
for i, b := range k.Ki_comm {
if b == 0 {
break
}
n = i + 1
}
comm := string(k.Ki_comm[:n])
return int(k.Ki_ppid), int(k.Ki_pgid), int(k.Ki_sid), comm
}
func findProcess(pid int) (Process, error) {
mib := []int32{CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, int32(pid)}
_, _, err := call_syscall(mib)
if err != nil {
return nil, err
}
return newUnixProcess(pid)
}
func processes() ([]Process, error) {
results := make([]Process, 0, 50)
mib := []int32{CTL_KERN, KERN_PROC, KERN_PROC_PROC, 0}
buf, length, err := call_syscall(mib)
if err != nil {
return results, err
}
// get kinfo_proc size
k := Kinfo_proc{}
procinfo_len := int(unsafe.Sizeof(k))
count := int(length / uint64(procinfo_len))
// parse buf to procs
for i := 0; i < count; i++ {
b := buf[i*procinfo_len : i*procinfo_len+procinfo_len]
k, err := parse_kinfo_proc(b)
if err != nil {
continue
}
p, err := newUnixProcess(int(k.Ki_pid))
if err != nil {
continue
}
p.ppid, p.pgrp, p.sid, p.binary = copy_params(&k)
results = append(results, p)
}
return results, nil
}
func parse_kinfo_proc(buf []byte) (Kinfo_proc, error) {
var k Kinfo_proc
br := bytes.NewReader(buf)
err := binary.Read(br, binary.LittleEndian, &k)
if err != nil {
return k, err
}
return k, nil
}
func call_syscall(mib []int32) ([]byte, uint64, error) {
miblen := uint64(len(mib))
// get required buffer size
length := uint64(0)
_, _, err := syscall.RawSyscall6(
syscall.SYS___SYSCTL,
uintptr(unsafe.Pointer(&mib[0])),
uintptr(miblen),
0,
uintptr(unsafe.Pointer(&length)),
0,
0)
if err != 0 {
b := make([]byte, 0)
return b, length, err
}
if length == 0 {
b := make([]byte, 0)
return b, length, err
}
// get proc info itself
buf := make([]byte, length)
_, _, err = syscall.RawSyscall6(
syscall.SYS___SYSCTL,
uintptr(unsafe.Pointer(&mib[0])),
uintptr(miblen),
uintptr(unsafe.Pointer(&buf[0])),
uintptr(unsafe.Pointer(&length)),
0,
0)
if err != 0 {
return buf, length, err
}
return buf, length, nil
}
func newUnixProcess(pid int) (*UnixProcess, error) {
p := &UnixProcess{pid: pid}
return p, p.Refresh()
}

View File

@ -0,0 +1,35 @@
// +build linux
package ps
import (
"fmt"
"io/ioutil"
"strings"
)
// Refresh reloads all the data associated with this process.
func (p *UnixProcess) Refresh() error {
statPath := fmt.Sprintf("/proc/%d/stat", p.pid)
dataBytes, err := ioutil.ReadFile(statPath)
if err != nil {
return err
}
// First, parse out the image name
data := string(dataBytes)
binStart := strings.IndexRune(data, '(') + 1
binEnd := strings.IndexRune(data[binStart:], ')')
p.binary = data[binStart : binStart+binEnd]
// Move past the image name and start parsing the rest
data = data[binStart+binEnd+2:]
_, err = fmt.Sscanf(data,
"%c %d %d %d",
&p.state,
&p.ppid,
&p.pgrp,
&p.sid)
return err
}

View File

@ -0,0 +1,96 @@
// +build solaris
package ps
import (
"encoding/binary"
"fmt"
"os"
)
type ushort_t uint16
type id_t int32
type pid_t int32
type uid_t int32
type gid_t int32
type dev_t uint64
type size_t uint64
type uintptr_t uint64
type timestruc_t [16]byte
// This is copy from /usr/include/sys/procfs.h
type psinfo_t struct {
Pr_flag int32 /* process flags (DEPRECATED; do not use) */
Pr_nlwp int32 /* number of active lwps in the process */
Pr_pid pid_t /* unique process id */
Pr_ppid pid_t /* process id of parent */
Pr_pgid pid_t /* pid of process group leader */
Pr_sid pid_t /* session id */
Pr_uid uid_t /* real user id */
Pr_euid uid_t /* effective user id */
Pr_gid gid_t /* real group id */
Pr_egid gid_t /* effective group id */
Pr_addr uintptr_t /* address of process */
Pr_size size_t /* size of process image in Kbytes */
Pr_rssize size_t /* resident set size in Kbytes */
Pr_pad1 size_t
Pr_ttydev dev_t /* controlling tty device (or PRNODEV) */
// Guess this following 2 ushort_t values require a padding to properly
// align to the 64bit mark.
Pr_pctcpu ushort_t /* % of recent cpu time used by all lwps */
Pr_pctmem ushort_t /* % of system memory used by process */
Pr_pad64bit [4]byte
Pr_start timestruc_t /* process start time, from the epoch */
Pr_time timestruc_t /* usr+sys cpu time for this process */
Pr_ctime timestruc_t /* usr+sys cpu time for reaped children */
Pr_fname [16]byte /* name of execed file */
Pr_psargs [80]byte /* initial characters of arg list */
Pr_wstat int32 /* if zombie, the wait() status */
Pr_argc int32 /* initial argument count */
Pr_argv uintptr_t /* address of initial argument vector */
Pr_envp uintptr_t /* address of initial environment vector */
Pr_dmodel [1]byte /* data model of the process */
Pr_pad2 [3]byte
Pr_taskid id_t /* task id */
Pr_projid id_t /* project id */
Pr_nzomb int32 /* number of zombie lwps in the process */
Pr_poolid id_t /* pool id */
Pr_zoneid id_t /* zone id */
Pr_contract id_t /* process contract */
Pr_filler int32 /* reserved for future use */
Pr_lwp [128]byte /* information for representative lwp */
}
func (p *UnixProcess) Refresh() error {
var psinfo psinfo_t
path := fmt.Sprintf("/proc/%d/psinfo", p.pid)
fh, err := os.Open(path)
if err != nil {
return err
}
defer fh.Close()
err = binary.Read(fh, binary.LittleEndian, &psinfo)
if err != nil {
return err
}
p.ppid = int(psinfo.Pr_ppid)
p.binary = toString(psinfo.Pr_fname[:], 16)
return nil
}
func toString(array []byte, len int) string {
for i := 0; i < len; i++ {
if array[i] == 0 {
return string(array[:i])
}
}
return string(array[:])
}

View File

@ -0,0 +1,101 @@
// +build linux solaris
package ps
import (
"fmt"
"io"
"os"
"strconv"
)
// UnixProcess is an implementation of Process that contains Unix-specific
// fields and information.
type UnixProcess struct {
pid int
ppid int
state rune
pgrp int
sid int
binary string
}
func (p *UnixProcess) Pid() int {
return p.pid
}
func (p *UnixProcess) PPid() int {
return p.ppid
}
func (p *UnixProcess) Executable() string {
return p.binary
}
func findProcess(pid int) (Process, error) {
dir := fmt.Sprintf("/proc/%d", pid)
_, err := os.Stat(dir)
if err != nil {
if os.IsNotExist(err) {
return nil, nil
}
return nil, err
}
return newUnixProcess(pid)
}
func processes() ([]Process, error) {
d, err := os.Open("/proc")
if err != nil {
return nil, err
}
defer d.Close()
results := make([]Process, 0, 50)
for {
fis, err := d.Readdir(10)
if err == io.EOF {
break
}
if err != nil {
return nil, err
}
for _, fi := range fis {
// We only care about directories, since all pids are dirs
if !fi.IsDir() {
continue
}
// We only care if the name starts with a numeric
name := fi.Name()
if name[0] < '0' || name[0] > '9' {
continue
}
// From this point forward, any errors we just ignore, because
// it might simply be that the process doesn't exist anymore.
pid, err := strconv.ParseInt(name, 10, 0)
if err != nil {
continue
}
p, err := newUnixProcess(int(pid))
if err != nil {
continue
}
results = append(results, p)
}
}
return results, nil
}
func newUnixProcess(pid int) (*UnixProcess, error) {
p := &UnixProcess{pid: pid}
return p, p.Refresh()
}

View File

@ -0,0 +1,119 @@
// +build windows
package ps
import (
"fmt"
"syscall"
"unsafe"
)
// Windows API functions
var (
modKernel32 = syscall.NewLazyDLL("kernel32.dll")
procCloseHandle = modKernel32.NewProc("CloseHandle")
procCreateToolhelp32Snapshot = modKernel32.NewProc("CreateToolhelp32Snapshot")
procProcess32First = modKernel32.NewProc("Process32FirstW")
procProcess32Next = modKernel32.NewProc("Process32NextW")
)
// Some constants from the Windows API
const (
ERROR_NO_MORE_FILES = 0x12
MAX_PATH = 260
)
// PROCESSENTRY32 is the Windows API structure that contains a process's
// information.
type PROCESSENTRY32 struct {
Size uint32
CntUsage uint32
ProcessID uint32
DefaultHeapID uintptr
ModuleID uint32
CntThreads uint32
ParentProcessID uint32
PriorityClassBase int32
Flags uint32
ExeFile [MAX_PATH]uint16
}
// WindowsProcess is an implementation of Process for Windows.
type WindowsProcess struct {
pid int
ppid int
exe string
}
func (p *WindowsProcess) Pid() int {
return p.pid
}
func (p *WindowsProcess) PPid() int {
return p.ppid
}
func (p *WindowsProcess) Executable() string {
return p.exe
}
func newWindowsProcess(e *PROCESSENTRY32) *WindowsProcess {
// Find when the string ends for decoding
end := 0
for {
if e.ExeFile[end] == 0 {
break
}
end++
}
return &WindowsProcess{
pid: int(e.ProcessID),
ppid: int(e.ParentProcessID),
exe: syscall.UTF16ToString(e.ExeFile[:end]),
}
}
func findProcess(pid int) (Process, error) {
ps, err := processes()
if err != nil {
return nil, err
}
for _, p := range ps {
if p.Pid() == pid {
return p, nil
}
}
return nil, nil
}
func processes() ([]Process, error) {
handle, _, _ := procCreateToolhelp32Snapshot.Call(
0x00000002,
0)
if handle < 0 {
return nil, syscall.GetLastError()
}
defer procCloseHandle.Call(handle)
var entry PROCESSENTRY32
entry.Size = uint32(unsafe.Sizeof(entry))
ret, _, _ := procProcess32First.Call(handle, uintptr(unsafe.Pointer(&entry)))
if ret == 0 {
return nil, fmt.Errorf("Error retrieving process info.")
}
results := make([]Process, 0, 50)
for {
results = append(results, newWindowsProcess(&entry))
ret, _, _ := procProcess32Next.Call(handle, uintptr(unsafe.Pointer(&entry)))
if ret == 0 {
break
}
}
return results, nil
}

View File

@ -551,6 +551,28 @@ func (sa *SockaddrALG) sockaddr() (unsafe.Pointer, _Socklen, error) {
return unsafe.Pointer(&sa.raw), SizeofSockaddrALG, nil return unsafe.Pointer(&sa.raw), SizeofSockaddrALG, nil
} }
// SockaddrVM implements the Sockaddr interface for AF_VSOCK type sockets.
// SockaddrVM provides access to Linux 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_HOST: refers to other processes on the host.
CID uint32
Port uint32
raw RawSockaddrVM
}
func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) {
sa.raw.Family = AF_VSOCK
sa.raw.Port = sa.Port
sa.raw.Cid = sa.CID
return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
}
func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) { func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
switch rsa.Addr.Family { switch rsa.Addr.Family {
case AF_NETLINK: case AF_NETLINK:
@ -620,6 +642,14 @@ func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
sa.Addr[i] = pp.Addr[i] sa.Addr[i] = pp.Addr[i]
} }
return sa, nil 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 return nil, EAFNOSUPPORT
} }

View File

@ -60,6 +60,7 @@ package unix
#include <bluetooth/hci.h> #include <bluetooth/hci.h>
#include <linux/can.h> #include <linux/can.h>
#include <linux/if_alg.h> #include <linux/if_alg.h>
#include <linux/vm_sockets.h>
#ifdef TCSETS2 #ifdef TCSETS2
// On systems that have "struct termios2" use this as type Termios. // On systems that have "struct termios2" use this as type Termios.
@ -224,6 +225,8 @@ type RawSockaddrCAN C.struct_sockaddr_can
type RawSockaddrALG C.struct_sockaddr_alg type RawSockaddrALG C.struct_sockaddr_alg
type RawSockaddrVM C.struct_sockaddr_vm
type RawSockaddr C.struct_sockaddr type RawSockaddr C.struct_sockaddr
type RawSockaddrAny C.struct_sockaddr_any type RawSockaddrAny C.struct_sockaddr_any
@ -266,6 +269,7 @@ const (
SizeofSockaddrHCI = C.sizeof_struct_sockaddr_hci SizeofSockaddrHCI = C.sizeof_struct_sockaddr_hci
SizeofSockaddrCAN = C.sizeof_struct_sockaddr_can SizeofSockaddrCAN = C.sizeof_struct_sockaddr_can
SizeofSockaddrALG = C.sizeof_struct_sockaddr_alg SizeofSockaddrALG = C.sizeof_struct_sockaddr_alg
SizeofSockaddrVM = C.sizeof_struct_sockaddr_vm
SizeofLinger = C.sizeof_struct_linger SizeofLinger = C.sizeof_struct_linger
SizeofIPMreq = C.sizeof_struct_ip_mreq SizeofIPMreq = C.sizeof_struct_ip_mreq
SizeofIPMreqn = C.sizeof_struct_ip_mreqn SizeofIPMreqn = C.sizeof_struct_ip_mreqn

View File

@ -51,6 +51,7 @@ const (
AF_TIPC = 0x1e AF_TIPC = 0x1e
AF_UNIX = 0x1 AF_UNIX = 0x1
AF_UNSPEC = 0x0 AF_UNSPEC = 0x0
AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0 ALG_OP_DECRYPT = 0x0
@ -152,6 +153,21 @@ const (
B75 = 0x2 B75 = 0x2
B921600 = 0x1007 B921600 = 0x1007
B9600 = 0xd B9600 = 0xd
BLKBSZGET = 0x80041270
BLKBSZSET = 0x40041271
BLKFLSBUF = 0x1261
BLKFRAGET = 0x1265
BLKFRASET = 0x1264
BLKGETSIZE = 0x1260
BLKGETSIZE64 = 0x80041272
BLKRAGET = 0x1263
BLKRASET = 0x1262
BLKROGET = 0x125e
BLKROSET = 0x125d
BLKRRPART = 0x125f
BLKSECTGET = 0x1267
BLKSECTSET = 0x1266
BLKSSZGET = 0x1268
BOTHER = 0x1000 BOTHER = 0x1000
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
@ -1309,6 +1325,13 @@ const (
SO_TIMESTAMPING = 0x25 SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23 SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3 SO_TYPE = 0x3
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
SO_VM_SOCKETS_TRUSTED = 0x5
SPLICE_F_GIFT = 0x8 SPLICE_F_GIFT = 0x8
SPLICE_F_MORE = 0x4 SPLICE_F_MORE = 0x4
SPLICE_F_MOVE = 0x1 SPLICE_F_MOVE = 0x1
@ -1485,6 +1508,11 @@ const (
VINTR = 0x0 VINTR = 0x0
VKILL = 0x3 VKILL = 0x3
VLNEXT = 0xf VLNEXT = 0xf
VMADDR_CID_ANY = 0xffffffff
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_RESERVED = 0x1
VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x6 VMIN = 0x6
VQUIT = 0x1 VQUIT = 0x1
VREPRINT = 0xc VREPRINT = 0xc

View File

@ -51,6 +51,7 @@ const (
AF_TIPC = 0x1e AF_TIPC = 0x1e
AF_UNIX = 0x1 AF_UNIX = 0x1
AF_UNSPEC = 0x0 AF_UNSPEC = 0x0
AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0 ALG_OP_DECRYPT = 0x0
@ -152,6 +153,21 @@ const (
B75 = 0x2 B75 = 0x2
B921600 = 0x1007 B921600 = 0x1007
B9600 = 0xd B9600 = 0xd
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
BLKFLSBUF = 0x1261
BLKFRAGET = 0x1265
BLKFRASET = 0x1264
BLKGETSIZE = 0x1260
BLKGETSIZE64 = 0x80081272
BLKRAGET = 0x1263
BLKRASET = 0x1262
BLKROGET = 0x125e
BLKROSET = 0x125d
BLKRRPART = 0x125f
BLKSECTGET = 0x1267
BLKSECTSET = 0x1266
BLKSSZGET = 0x1268
BOTHER = 0x1000 BOTHER = 0x1000
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
@ -1316,6 +1332,13 @@ const (
SO_TIMESTAMPING = 0x25 SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23 SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3 SO_TYPE = 0x3
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
SO_VM_SOCKETS_TRUSTED = 0x5
SPLICE_F_GIFT = 0x8 SPLICE_F_GIFT = 0x8
SPLICE_F_MORE = 0x4 SPLICE_F_MORE = 0x4
SPLICE_F_MOVE = 0x1 SPLICE_F_MOVE = 0x1
@ -1492,7 +1515,13 @@ const (
VINTR = 0x0 VINTR = 0x0
VKILL = 0x3 VKILL = 0x3
VLNEXT = 0xf VLNEXT = 0xf
VMADDR_CID_ANY = 0xffffffff
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_RESERVED = 0x1
VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x6 VMIN = 0x6
VM_SOCKETS_INVALID_VERSION = 0xffffffff
VQUIT = 0x1 VQUIT = 0x1
VREPRINT = 0xc VREPRINT = 0xc
VSTART = 0x8 VSTART = 0x8

View File

@ -50,6 +50,7 @@ const (
AF_TIPC = 0x1e AF_TIPC = 0x1e
AF_UNIX = 0x1 AF_UNIX = 0x1
AF_UNSPEC = 0x0 AF_UNSPEC = 0x0
AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0 ALG_OP_DECRYPT = 0x0
@ -148,6 +149,21 @@ const (
B75 = 0x2 B75 = 0x2
B921600 = 0x1007 B921600 = 0x1007
B9600 = 0xd B9600 = 0xd
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
BLKFLSBUF = 0x1261
BLKFRAGET = 0x1265
BLKFRASET = 0x1264
BLKGETSIZE = 0x1260
BLKGETSIZE64 = 0x80081272
BLKRAGET = 0x1263
BLKRASET = 0x1262
BLKROGET = 0x125e
BLKROSET = 0x125d
BLKRRPART = 0x125f
BLKSECTGET = 0x1267
BLKSECTSET = 0x1266
BLKSSZGET = 0x1268
BOTHER = 0x1000 BOTHER = 0x1000
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
@ -1237,6 +1253,13 @@ const (
SO_TIMESTAMPING = 0x25 SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23 SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3 SO_TYPE = 0x3
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
SO_VM_SOCKETS_TRUSTED = 0x5
SPLICE_F_GIFT = 0x8 SPLICE_F_GIFT = 0x8
SPLICE_F_MORE = 0x4 SPLICE_F_MORE = 0x4
SPLICE_F_MOVE = 0x1 SPLICE_F_MOVE = 0x1
@ -1413,6 +1436,11 @@ const (
VINTR = 0x0 VINTR = 0x0
VKILL = 0x3 VKILL = 0x3
VLNEXT = 0xf VLNEXT = 0xf
VMADDR_CID_ANY = 0xffffffff
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_RESERVED = 0x1
VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x6 VMIN = 0x6
VQUIT = 0x1 VQUIT = 0x1
VREPRINT = 0xc VREPRINT = 0xc

View File

@ -156,6 +156,21 @@ const (
B75 = 0x2 B75 = 0x2
B921600 = 0x1007 B921600 = 0x1007
B9600 = 0xd B9600 = 0xd
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
BLKFLSBUF = 0x1261
BLKFRAGET = 0x1265
BLKFRASET = 0x1264
BLKGETSIZE = 0x1260
BLKGETSIZE64 = 0x80081272
BLKRAGET = 0x1263
BLKRASET = 0x1262
BLKROGET = 0x125e
BLKROSET = 0x125d
BLKRRPART = 0x125f
BLKSECTGET = 0x1267
BLKSECTSET = 0x1266
BLKSSZGET = 0x1268
BOTHER = 0x1000 BOTHER = 0x1000
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
@ -1367,6 +1382,13 @@ const (
SO_TIMESTAMPING = 0x25 SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23 SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3 SO_TYPE = 0x3
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29 SO_WIFI_STATUS = 0x29
SPLICE_F_GIFT = 0x8 SPLICE_F_GIFT = 0x8
SPLICE_F_MORE = 0x4 SPLICE_F_MORE = 0x4
@ -1566,6 +1588,11 @@ const (
VINTR = 0x0 VINTR = 0x0
VKILL = 0x3 VKILL = 0x3
VLNEXT = 0xf VLNEXT = 0xf
VMADDR_CID_ANY = 0xffffffff
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_RESERVED = 0x1
VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x6 VMIN = 0x6
VQUIT = 0x1 VQUIT = 0x1
VREPRINT = 0xc VREPRINT = 0xc

View File

@ -50,6 +50,7 @@ const (
AF_TIPC = 0x1e AF_TIPC = 0x1e
AF_UNIX = 0x1 AF_UNIX = 0x1
AF_UNSPEC = 0x0 AF_UNSPEC = 0x0
AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0 ALG_OP_DECRYPT = 0x0
@ -151,6 +152,21 @@ const (
B75 = 0x2 B75 = 0x2
B921600 = 0x1007 B921600 = 0x1007
B9600 = 0xd B9600 = 0xd
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
BLKFLSBUF = 0x1261
BLKFRAGET = 0x1265
BLKFRASET = 0x1264
BLKGETSIZE = 0x1260
BLKGETSIZE64 = 0x80081272
BLKRAGET = 0x1263
BLKRASET = 0x1262
BLKROGET = 0x125e
BLKROSET = 0x125d
BLKRRPART = 0x125f
BLKSECTGET = 0x1267
BLKSECTSET = 0x1266
BLKSSZGET = 0x1268
BOTHER = 0x1000 BOTHER = 0x1000
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
@ -1290,6 +1306,13 @@ const (
SO_TIMESTAMPING = 0x25 SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23 SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x1008 SO_TYPE = 0x1008
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
SO_VM_SOCKETS_TRUSTED = 0x5
SPLICE_F_GIFT = 0x8 SPLICE_F_GIFT = 0x8
SPLICE_F_MORE = 0x4 SPLICE_F_MORE = 0x4
SPLICE_F_MOVE = 0x1 SPLICE_F_MOVE = 0x1
@ -1462,6 +1485,11 @@ const (
VINTR = 0x0 VINTR = 0x0
VKILL = 0x3 VKILL = 0x3
VLNEXT = 0xf VLNEXT = 0xf
VMADDR_CID_ANY = 0xffffffff
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_RESERVED = 0x1
VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x4 VMIN = 0x4
VQUIT = 0x1 VQUIT = 0x1
VREPRINT = 0xc VREPRINT = 0xc

View File

@ -159,6 +159,21 @@ const (
B75 = 0x2 B75 = 0x2
B921600 = 0x1007 B921600 = 0x1007
B9600 = 0xd B9600 = 0xd
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
BLKFLSBUF = 0x1261
BLKFRAGET = 0x1265
BLKFRASET = 0x1264
BLKGETSIZE = 0x1260
BLKGETSIZE64 = 0x80081272
BLKRAGET = 0x1263
BLKRASET = 0x1262
BLKROGET = 0x125e
BLKROSET = 0x125d
BLKRRPART = 0x125f
BLKSECTGET = 0x1267
BLKSECTSET = 0x1266
BLKSSZGET = 0x1268
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
@ -1379,6 +1394,13 @@ const (
SO_TIMESTAMPING = 0x25 SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23 SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x1008 SO_TYPE = 0x1008
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29 SO_WIFI_STATUS = 0x29
SPLICE_F_GIFT = 0x8 SPLICE_F_GIFT = 0x8
SPLICE_F_MORE = 0x4 SPLICE_F_MORE = 0x4
@ -1561,6 +1583,11 @@ const (
VINTR = 0x0 VINTR = 0x0
VKILL = 0x3 VKILL = 0x3
VLNEXT = 0xf VLNEXT = 0xf
VMADDR_CID_ANY = 0xffffffff
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_RESERVED = 0x1
VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x4 VMIN = 0x4
VQUIT = 0x1 VQUIT = 0x1
VREPRINT = 0xc VREPRINT = 0xc

View File

@ -159,6 +159,21 @@ const (
B75 = 0x2 B75 = 0x2
B921600 = 0x1007 B921600 = 0x1007
B9600 = 0xd B9600 = 0xd
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
BLKFLSBUF = 0x1261
BLKFRAGET = 0x1265
BLKFRASET = 0x1264
BLKGETSIZE = 0x1260
BLKGETSIZE64 = 0x80081272
BLKRAGET = 0x1263
BLKRASET = 0x1262
BLKROGET = 0x125e
BLKROSET = 0x125d
BLKRRPART = 0x125f
BLKSECTGET = 0x1267
BLKSECTSET = 0x1266
BLKSSZGET = 0x1268
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
@ -1379,6 +1394,13 @@ const (
SO_TIMESTAMPING = 0x25 SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23 SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x1008 SO_TYPE = 0x1008
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29 SO_WIFI_STATUS = 0x29
SPLICE_F_GIFT = 0x8 SPLICE_F_GIFT = 0x8
SPLICE_F_MORE = 0x4 SPLICE_F_MORE = 0x4
@ -1561,6 +1583,11 @@ const (
VINTR = 0x0 VINTR = 0x0
VKILL = 0x3 VKILL = 0x3
VLNEXT = 0xf VLNEXT = 0xf
VMADDR_CID_ANY = 0xffffffff
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_RESERVED = 0x1
VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x4 VMIN = 0x4
VQUIT = 0x1 VQUIT = 0x1
VREPRINT = 0xc VREPRINT = 0xc

View File

@ -160,6 +160,21 @@ const (
B75 = 0x2 B75 = 0x2
B921600 = 0x1007 B921600 = 0x1007
B9600 = 0xd B9600 = 0xd
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
BLKFLSBUF = 0x1261
BLKFRAGET = 0x1265
BLKFRASET = 0x1264
BLKGETSIZE = 0x1260
BLKGETSIZE64 = 0x80081272
BLKRAGET = 0x1263
BLKRASET = 0x1262
BLKROGET = 0x125e
BLKROSET = 0x125d
BLKRRPART = 0x125f
BLKSECTGET = 0x1267
BLKSECTSET = 0x1266
BLKSSZGET = 0x1268
BOTHER = 0x1000 BOTHER = 0x1000
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
@ -1452,6 +1467,13 @@ const (
SO_TIMESTAMPING = 0x25 SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23 SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x1008 SO_TYPE = 0x1008
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29 SO_WIFI_STATUS = 0x29
SPLICE_F_GIFT = 0x8 SPLICE_F_GIFT = 0x8
SPLICE_F_MORE = 0x4 SPLICE_F_MORE = 0x4
@ -1660,6 +1682,11 @@ const (
VINTR = 0x0 VINTR = 0x0
VKILL = 0x3 VKILL = 0x3
VLNEXT = 0xf VLNEXT = 0xf
VMADDR_CID_ANY = 0xffffffff
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_RESERVED = 0x1
VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x4 VMIN = 0x4
VQUIT = 0x1 VQUIT = 0x1
VREPRINT = 0xc VREPRINT = 0xc

View File

@ -157,6 +157,21 @@ const (
B75 = 0x2 B75 = 0x2
B921600 = 0x16 B921600 = 0x16
B9600 = 0xd B9600 = 0xd
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
BLKFLSBUF = 0x1261
BLKFRAGET = 0x1265
BLKFRASET = 0x1264
BLKGETSIZE = 0x1260
BLKGETSIZE64 = 0x80081272
BLKRAGET = 0x1263
BLKRASET = 0x1262
BLKROGET = 0x125e
BLKROSET = 0x125d
BLKRRPART = 0x125f
BLKSECTGET = 0x1267
BLKSECTSET = 0x1266
BLKSSZGET = 0x1268
BOTHER = 0x1f BOTHER = 0x1f
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
@ -1435,6 +1450,13 @@ const (
SO_TIMESTAMPING = 0x25 SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23 SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3 SO_TYPE = 0x3
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29 SO_WIFI_STATUS = 0x29
SPLICE_F_GIFT = 0x8 SPLICE_F_GIFT = 0x8
SPLICE_F_MORE = 0x4 SPLICE_F_MORE = 0x4
@ -1638,6 +1660,11 @@ const (
VINTR = 0x0 VINTR = 0x0
VKILL = 0x3 VKILL = 0x3
VLNEXT = 0xf VLNEXT = 0xf
VMADDR_CID_ANY = 0xffffffff
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_RESERVED = 0x1
VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x5 VMIN = 0x5
VQUIT = 0x1 VQUIT = 0x1
VREPRINT = 0xb VREPRINT = 0xb

View File

@ -156,6 +156,21 @@ const (
B75 = 0x2 B75 = 0x2
B921600 = 0x16 B921600 = 0x16
B9600 = 0xd B9600 = 0xd
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
BLKFLSBUF = 0x1261
BLKFRAGET = 0x1265
BLKFRASET = 0x1264
BLKGETSIZE = 0x1260
BLKGETSIZE64 = 0x80081272
BLKRAGET = 0x1263
BLKRASET = 0x1262
BLKROGET = 0x125e
BLKROSET = 0x125d
BLKRRPART = 0x125f
BLKSECTGET = 0x1267
BLKSECTSET = 0x1266
BLKSSZGET = 0x1268
BOTHER = 0x1f BOTHER = 0x1f
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
@ -1431,6 +1446,13 @@ const (
SO_TIMESTAMPING = 0x25 SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23 SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3 SO_TYPE = 0x3
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29 SO_WIFI_STATUS = 0x29
SPLICE_F_GIFT = 0x8 SPLICE_F_GIFT = 0x8
SPLICE_F_MORE = 0x4 SPLICE_F_MORE = 0x4
@ -1634,6 +1656,11 @@ const (
VINTR = 0x0 VINTR = 0x0
VKILL = 0x3 VKILL = 0x3
VLNEXT = 0xf VLNEXT = 0xf
VMADDR_CID_ANY = 0xffffffff
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_RESERVED = 0x1
VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x5 VMIN = 0x5
VQUIT = 0x1 VQUIT = 0x1
VREPRINT = 0xb VREPRINT = 0xb

View File

@ -159,6 +159,21 @@ const (
B75 = 0x2 B75 = 0x2
B921600 = 0x1007 B921600 = 0x1007
B9600 = 0xd B9600 = 0xd
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
BLKFLSBUF = 0x1261
BLKFRAGET = 0x1265
BLKFRASET = 0x1264
BLKGETSIZE = 0x1260
BLKGETSIZE64 = 0x80081272
BLKRAGET = 0x1263
BLKRASET = 0x1262
BLKROGET = 0x125e
BLKROSET = 0x125d
BLKRRPART = 0x125f
BLKSECTGET = 0x1267
BLKSECTSET = 0x1266
BLKSSZGET = 0x1268
BOTHER = 0x1000 BOTHER = 0x1000
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
@ -1485,6 +1500,13 @@ const (
SO_TIMESTAMPING = 0x25 SO_TIMESTAMPING = 0x25
SO_TIMESTAMPNS = 0x23 SO_TIMESTAMPNS = 0x23
SO_TYPE = 0x3 SO_TYPE = 0x3
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x29 SO_WIFI_STATUS = 0x29
SPLICE_F_GIFT = 0x8 SPLICE_F_GIFT = 0x8
SPLICE_F_MORE = 0x4 SPLICE_F_MORE = 0x4
@ -1692,6 +1714,11 @@ const (
VINTR = 0x0 VINTR = 0x0
VKILL = 0x3 VKILL = 0x3
VLNEXT = 0xf VLNEXT = 0xf
VMADDR_CID_ANY = 0xffffffff
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_RESERVED = 0x1
VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x6 VMIN = 0x6
VQUIT = 0x1 VQUIT = 0x1
VREPRINT = 0xc VREPRINT = 0xc

View File

@ -163,6 +163,21 @@ const (
B76800 = 0x1005 B76800 = 0x1005
B921600 = 0x1009 B921600 = 0x1009
B9600 = 0xd B9600 = 0xd
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
BLKFLSBUF = 0x1261
BLKFRAGET = 0x1265
BLKFRASET = 0x1264
BLKGETSIZE = 0x1260
BLKGETSIZE64 = 0x80081272
BLKRAGET = 0x1263
BLKRASET = 0x1262
BLKROGET = 0x125e
BLKROSET = 0x125d
BLKRRPART = 0x125f
BLKSECTGET = 0x1267
BLKSECTSET = 0x1266
BLKSSZGET = 0x1268
BOTHER = 0x1000 BOTHER = 0x1000
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
@ -1525,6 +1540,13 @@ const (
SO_TIMESTAMPING = 0x23 SO_TIMESTAMPING = 0x23
SO_TIMESTAMPNS = 0x21 SO_TIMESTAMPNS = 0x21
SO_TYPE = 0x1008 SO_TYPE = 0x1008
SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2
SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1
SO_VM_SOCKETS_BUFFER_SIZE = 0x0
SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6
SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7
SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3
SO_VM_SOCKETS_TRUSTED = 0x5
SO_WIFI_STATUS = 0x25 SO_WIFI_STATUS = 0x25
SPLICE_F_GIFT = 0x8 SPLICE_F_GIFT = 0x8
SPLICE_F_MORE = 0x4 SPLICE_F_MORE = 0x4
@ -1734,6 +1756,11 @@ const (
VINTR = 0x0 VINTR = 0x0
VKILL = 0x3 VKILL = 0x3
VLNEXT = 0xf VLNEXT = 0xf
VMADDR_CID_ANY = 0xffffffff
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_RESERVED = 0x1
VMADDR_PORT_ANY = 0xffffffff
VMIN = 0x4 VMIN = 0x4
VQUIT = 0x1 VQUIT = 0x1
VREPRINT = 0xc VREPRINT = 0xc

View File

@ -218,6 +218,14 @@ type RawSockaddrALG struct {
Name [64]uint8 Name [64]uint8
} }
type RawSockaddrVM struct {
Family uint16
Reserved1 uint16
Port uint32
Cid uint32
Zero [4]uint8
}
type RawSockaddr struct { type RawSockaddr struct {
Family uint16 Family uint16
Data [14]int8 Data [14]int8
@ -343,6 +351,7 @@ const (
SizeofSockaddrHCI = 0x6 SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10 SizeofSockaddrCAN = 0x10
SizeofSockaddrALG = 0x58 SizeofSockaddrALG = 0x58
SizeofSockaddrVM = 0x10
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIPMreq = 0x8 SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc SizeofIPMreqn = 0xc

View File

@ -220,6 +220,14 @@ type RawSockaddrALG struct {
Name [64]uint8 Name [64]uint8
} }
type RawSockaddrVM struct {
Family uint16
Reserved1 uint16
Port uint32
Cid uint32
Zero [4]uint8
}
type RawSockaddr struct { type RawSockaddr struct {
Family uint16 Family uint16
Data [14]int8 Data [14]int8
@ -347,6 +355,7 @@ const (
SizeofSockaddrHCI = 0x6 SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10 SizeofSockaddrCAN = 0x10
SizeofSockaddrALG = 0x58 SizeofSockaddrALG = 0x58
SizeofSockaddrVM = 0x10
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIPMreq = 0x8 SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc SizeofIPMreqn = 0xc

View File

@ -222,6 +222,14 @@ type RawSockaddrALG struct {
Name [64]uint8 Name [64]uint8
} }
type RawSockaddrVM struct {
Family uint16
Reserved1 uint16
Port uint32
Cid uint32
Zero [4]uint8
}
type RawSockaddr struct { type RawSockaddr struct {
Family uint16 Family uint16
Data [14]uint8 Data [14]uint8
@ -347,6 +355,7 @@ const (
SizeofSockaddrHCI = 0x6 SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10 SizeofSockaddrCAN = 0x10
SizeofSockaddrALG = 0x58 SizeofSockaddrALG = 0x58
SizeofSockaddrVM = 0x10
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIPMreq = 0x8 SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc SizeofIPMreqn = 0xc

View File

@ -221,6 +221,14 @@ type RawSockaddrALG struct {
Name [64]uint8 Name [64]uint8
} }
type RawSockaddrVM struct {
Family uint16
Reserved1 uint16
Port uint32
Cid uint32
Zero [4]uint8
}
type RawSockaddr struct { type RawSockaddr struct {
Family uint16 Family uint16
Data [14]int8 Data [14]int8
@ -348,6 +356,7 @@ const (
SizeofSockaddrHCI = 0x6 SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10 SizeofSockaddrCAN = 0x10
SizeofSockaddrALG = 0x58 SizeofSockaddrALG = 0x58
SizeofSockaddrVM = 0x10
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIPMreq = 0x8 SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc SizeofIPMreqn = 0xc

View File

@ -221,6 +221,14 @@ type RawSockaddrALG struct {
Name [64]uint8 Name [64]uint8
} }
type RawSockaddrVM struct {
Family uint16
Reserved1 uint16
Port uint32
Cid uint32
Zero [4]uint8
}
type RawSockaddr struct { type RawSockaddr struct {
Family uint16 Family uint16
Data [14]int8 Data [14]int8
@ -345,6 +353,7 @@ const (
SizeofSockaddrHCI = 0x6 SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10 SizeofSockaddrCAN = 0x10
SizeofSockaddrALG = 0x58 SizeofSockaddrALG = 0x58
SizeofSockaddrVM = 0x10
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIPMreq = 0x8 SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc SizeofIPMreqn = 0xc

View File

@ -221,6 +221,14 @@ type RawSockaddrALG struct {
Name [64]uint8 Name [64]uint8
} }
type RawSockaddrVM struct {
Family uint16
Reserved1 uint16
Port uint32
Cid uint32
Zero [4]uint8
}
type RawSockaddr struct { type RawSockaddr struct {
Family uint16 Family uint16
Data [14]int8 Data [14]int8
@ -347,6 +355,7 @@ const (
SizeofSockaddrHCI = 0x6 SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10 SizeofSockaddrCAN = 0x10
SizeofSockaddrALG = 0x58 SizeofSockaddrALG = 0x58
SizeofSockaddrVM = 0x10
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIPMreq = 0x8 SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc SizeofIPMreqn = 0xc

View File

@ -221,6 +221,14 @@ type RawSockaddrALG struct {
Name [64]uint8 Name [64]uint8
} }
type RawSockaddrVM struct {
Family uint16
Reserved1 uint16
Port uint32
Cid uint32
Zero [4]uint8
}
type RawSockaddr struct { type RawSockaddr struct {
Family uint16 Family uint16
Data [14]int8 Data [14]int8
@ -347,6 +355,7 @@ const (
SizeofSockaddrHCI = 0x6 SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10 SizeofSockaddrCAN = 0x10
SizeofSockaddrALG = 0x58 SizeofSockaddrALG = 0x58
SizeofSockaddrVM = 0x10
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIPMreq = 0x8 SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc SizeofIPMreqn = 0xc

View File

@ -221,6 +221,14 @@ type RawSockaddrALG struct {
Name [64]uint8 Name [64]uint8
} }
type RawSockaddrVM struct {
Family uint16
Reserved1 uint16
Port uint32
Cid uint32
Zero [4]uint8
}
type RawSockaddr struct { type RawSockaddr struct {
Family uint16 Family uint16
Data [14]int8 Data [14]int8
@ -345,6 +353,7 @@ const (
SizeofSockaddrHCI = 0x6 SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10 SizeofSockaddrCAN = 0x10
SizeofSockaddrALG = 0x58 SizeofSockaddrALG = 0x58
SizeofSockaddrVM = 0x10
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIPMreq = 0x8 SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc SizeofIPMreqn = 0xc

View File

@ -222,6 +222,14 @@ type RawSockaddrALG struct {
Name [64]uint8 Name [64]uint8
} }
type RawSockaddrVM struct {
Family uint16
Reserved1 uint16
Port uint32
Cid uint32
Zero [4]uint8
}
type RawSockaddr struct { type RawSockaddr struct {
Family uint16 Family uint16
Data [14]uint8 Data [14]uint8
@ -349,6 +357,7 @@ const (
SizeofSockaddrHCI = 0x6 SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10 SizeofSockaddrCAN = 0x10
SizeofSockaddrALG = 0x58 SizeofSockaddrALG = 0x58
SizeofSockaddrVM = 0x10
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIPMreq = 0x8 SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc SizeofIPMreqn = 0xc

View File

@ -222,6 +222,14 @@ type RawSockaddrALG struct {
Name [64]uint8 Name [64]uint8
} }
type RawSockaddrVM struct {
Family uint16
Reserved1 uint16
Port uint32
Cid uint32
Zero [4]uint8
}
type RawSockaddr struct { type RawSockaddr struct {
Family uint16 Family uint16
Data [14]uint8 Data [14]uint8
@ -349,6 +357,7 @@ const (
SizeofSockaddrHCI = 0x6 SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10 SizeofSockaddrCAN = 0x10
SizeofSockaddrALG = 0x58 SizeofSockaddrALG = 0x58
SizeofSockaddrVM = 0x10
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIPMreq = 0x8 SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc SizeofIPMreqn = 0xc

View File

@ -221,6 +221,14 @@ type RawSockaddrALG struct {
Name [64]uint8 Name [64]uint8
} }
type RawSockaddrVM struct {
Family uint16
Reserved1 uint16
Port uint32
Cid uint32
Zero [4]uint8
}
type RawSockaddr struct { type RawSockaddr struct {
Family uint16 Family uint16
Data [14]int8 Data [14]int8
@ -347,6 +355,7 @@ const (
SizeofSockaddrHCI = 0x6 SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10 SizeofSockaddrCAN = 0x10
SizeofSockaddrALG = 0x58 SizeofSockaddrALG = 0x58
SizeofSockaddrVM = 0x10
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIPMreq = 0x8 SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc SizeofIPMreqn = 0xc

View File

@ -226,6 +226,14 @@ type RawSockaddrALG struct {
Name [64]uint8 Name [64]uint8
} }
type RawSockaddrVM struct {
Family uint16
Reserved1 uint16
Port uint32
Cid uint32
Zero [4]uint8
}
type RawSockaddr struct { type RawSockaddr struct {
Family uint16 Family uint16
Data [14]int8 Data [14]int8
@ -352,6 +360,7 @@ const (
SizeofSockaddrHCI = 0x6 SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10 SizeofSockaddrCAN = 0x10
SizeofSockaddrALG = 0x58 SizeofSockaddrALG = 0x58
SizeofSockaddrVM = 0x10
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIPMreq = 0x8 SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc SizeofIPMreqn = 0xc