mirror of https://github.com/prometheus/prometheus
discovery/openstack: pass context to the OpenStack client (#5231)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>pull/5346/head
parent
7c8f0b0864
commit
67385f356f
|
@ -20,7 +20,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/go-kit/kit/log/level"
|
||||
"github.com/gophercloud/gophercloud"
|
||||
"github.com/gophercloud/gophercloud/openstack"
|
||||
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/hypervisors"
|
||||
|
@ -42,56 +41,18 @@ type HypervisorDiscovery struct {
|
|||
provider *gophercloud.ProviderClient
|
||||
authOpts *gophercloud.AuthOptions
|
||||
region string
|
||||
interval time.Duration
|
||||
logger log.Logger
|
||||
port int
|
||||
}
|
||||
|
||||
// NewHypervisorDiscovery returns a new hypervisor discovery.
|
||||
func NewHypervisorDiscovery(provider *gophercloud.ProviderClient, opts *gophercloud.AuthOptions,
|
||||
interval time.Duration, port int, region string, l log.Logger) *HypervisorDiscovery {
|
||||
port int, region string, l log.Logger) *HypervisorDiscovery {
|
||||
return &HypervisorDiscovery{provider: provider, authOpts: opts,
|
||||
region: region, interval: interval, port: port, logger: l}
|
||||
region: region, port: port, logger: l}
|
||||
}
|
||||
|
||||
// Run implements the Discoverer interface.
|
||||
func (h *HypervisorDiscovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
||||
// Get an initial set right away.
|
||||
tg, err := h.refresh()
|
||||
if err != nil {
|
||||
level.Error(h.logger).Log("msg", "Unable refresh target groups", "err", err.Error())
|
||||
} else {
|
||||
select {
|
||||
case ch <- []*targetgroup.Group{tg}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ticker := time.NewTicker(h.interval)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
tg, err := h.refresh()
|
||||
if err != nil {
|
||||
level.Error(h.logger).Log("msg", "Unable refresh target groups", "err", err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
select {
|
||||
case ch <- []*targetgroup.Group{tg}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (h *HypervisorDiscovery) refresh() (*targetgroup.Group, error) {
|
||||
func (h *HypervisorDiscovery) refresh(ctx context.Context) (*targetgroup.Group, error) {
|
||||
var err error
|
||||
t0 := time.Now()
|
||||
defer func() {
|
||||
|
@ -101,6 +62,7 @@ func (h *HypervisorDiscovery) refresh() (*targetgroup.Group, error) {
|
|||
}
|
||||
}()
|
||||
|
||||
h.provider.Context = ctx
|
||||
err = openstack.Authenticate(h.provider, *h.authOpts)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not authenticate to OpenStack: %s", err)
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
package openstack
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
|
@ -38,7 +40,7 @@ func (s *OpenstackSDHypervisorTestSuite) SetupTest(t *testing.T) {
|
|||
s.Mock.HandleAuthSuccessfully()
|
||||
}
|
||||
|
||||
func (s *OpenstackSDHypervisorTestSuite) openstackAuthSuccess() (Discovery, error) {
|
||||
func (s *OpenstackSDHypervisorTestSuite) openstackAuthSuccess() (*Discovery, error) {
|
||||
conf := SDConfig{
|
||||
IdentityEndpoint: s.Mock.Endpoint(),
|
||||
Password: "test",
|
||||
|
@ -56,7 +58,8 @@ func TestOpenstackSDHypervisorRefresh(t *testing.T) {
|
|||
mock.SetupTest(t)
|
||||
|
||||
hypervisor, _ := mock.openstackAuthSuccess()
|
||||
tg, err := hypervisor.refresh()
|
||||
ctx := context.Background()
|
||||
tg, err := hypervisor.r.refresh(ctx)
|
||||
testutil.Ok(t, err)
|
||||
testutil.Assert(t, tg != nil, "")
|
||||
testutil.Assert(t, tg.Targets != nil, "")
|
||||
|
@ -78,3 +81,17 @@ func TestOpenstackSDHypervisorRefresh(t *testing.T) {
|
|||
|
||||
mock.TearDownSuite()
|
||||
}
|
||||
|
||||
func TestOpenstackSDHypervisorRefreshWithDoneContext(t *testing.T) {
|
||||
mock := &OpenstackSDHypervisorTestSuite{}
|
||||
mock.SetupTest(t)
|
||||
|
||||
hypervisor, _ := mock.openstackAuthSuccess()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
_, err := hypervisor.r.refresh(ctx)
|
||||
testutil.NotOk(t, err, "")
|
||||
testutil.Assert(t, strings.Contains(err.Error(), context.Canceled.Error()), "%q doesn't contain %q", err, context.Canceled)
|
||||
|
||||
mock.TearDownSuite()
|
||||
}
|
||||
|
|
|
@ -48,7 +48,6 @@ type InstanceDiscovery struct {
|
|||
provider *gophercloud.ProviderClient
|
||||
authOpts *gophercloud.AuthOptions
|
||||
region string
|
||||
interval time.Duration
|
||||
logger log.Logger
|
||||
port int
|
||||
allTenants bool
|
||||
|
@ -56,49 +55,12 @@ type InstanceDiscovery struct {
|
|||
|
||||
// NewInstanceDiscovery returns a new instance discovery.
|
||||
func NewInstanceDiscovery(provider *gophercloud.ProviderClient, opts *gophercloud.AuthOptions,
|
||||
interval time.Duration, port int, region string, allTenants bool, l log.Logger) *InstanceDiscovery {
|
||||
port int, region string, allTenants bool, l log.Logger) *InstanceDiscovery {
|
||||
if l == nil {
|
||||
l = log.NewNopLogger()
|
||||
}
|
||||
return &InstanceDiscovery{provider: provider, authOpts: opts,
|
||||
region: region, interval: interval, port: port, allTenants: allTenants, logger: l}
|
||||
}
|
||||
|
||||
// Run implements the Discoverer interface.
|
||||
func (i *InstanceDiscovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
||||
// Get an initial set right away.
|
||||
tg, err := i.refresh()
|
||||
if err != nil {
|
||||
level.Error(i.logger).Log("msg", "Unable to refresh target groups", "err", err.Error())
|
||||
} else {
|
||||
select {
|
||||
case ch <- []*targetgroup.Group{tg}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ticker := time.NewTicker(i.interval)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
tg, err := i.refresh()
|
||||
if err != nil {
|
||||
level.Error(i.logger).Log("msg", "Unable to refresh target groups", "err", err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
select {
|
||||
case ch <- []*targetgroup.Group{tg}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
region: region, port: port, allTenants: allTenants, logger: l}
|
||||
}
|
||||
|
||||
type floatingIPKey struct {
|
||||
|
@ -106,7 +68,7 @@ type floatingIPKey struct {
|
|||
fixed string
|
||||
}
|
||||
|
||||
func (i *InstanceDiscovery) refresh() (*targetgroup.Group, error) {
|
||||
func (i *InstanceDiscovery) refresh(ctx context.Context) (*targetgroup.Group, error) {
|
||||
var err error
|
||||
t0 := time.Now()
|
||||
defer func() {
|
||||
|
@ -116,6 +78,7 @@ func (i *InstanceDiscovery) refresh() (*targetgroup.Group, error) {
|
|||
}
|
||||
}()
|
||||
|
||||
i.provider.Context = ctx
|
||||
err = openstack.Authenticate(i.provider, *i.authOpts)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not authenticate to OpenStack: %s", err)
|
||||
|
@ -161,6 +124,9 @@ func (i *InstanceDiscovery) refresh() (*targetgroup.Group, error) {
|
|||
Source: fmt.Sprintf("OS_" + i.region),
|
||||
}
|
||||
err = pager.EachPage(func(page pagination.Page) (bool, error) {
|
||||
if ctx.Err() != nil {
|
||||
return false, fmt.Errorf("could not extract instances: %s", ctx.Err())
|
||||
}
|
||||
instanceList, err := servers.ExtractServers(page)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("could not extract instances: %s", err)
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
package openstack
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/prometheus/common/model"
|
||||
|
@ -40,7 +42,7 @@ func (s *OpenstackSDInstanceTestSuite) SetupTest(t *testing.T) {
|
|||
s.Mock.HandleAuthSuccessfully()
|
||||
}
|
||||
|
||||
func (s *OpenstackSDInstanceTestSuite) openstackAuthSuccess() (Discovery, error) {
|
||||
func (s *OpenstackSDInstanceTestSuite) openstackAuthSuccess() (*Discovery, error) {
|
||||
conf := SDConfig{
|
||||
IdentityEndpoint: s.Mock.Endpoint(),
|
||||
Password: "test",
|
||||
|
@ -61,7 +63,8 @@ func TestOpenstackSDInstanceRefresh(t *testing.T) {
|
|||
instance, err := mock.openstackAuthSuccess()
|
||||
testutil.Ok(t, err)
|
||||
|
||||
tg, err := instance.refresh()
|
||||
ctx := context.Background()
|
||||
tg, err := instance.r.refresh(ctx)
|
||||
|
||||
testutil.Ok(t, err)
|
||||
testutil.Assert(t, tg != nil, "")
|
||||
|
@ -117,3 +120,17 @@ func TestOpenstackSDInstanceRefresh(t *testing.T) {
|
|||
|
||||
mock.TearDownSuite()
|
||||
}
|
||||
|
||||
func TestOpenstackSDInstanceRefreshWithDoneContext(t *testing.T) {
|
||||
mock := &OpenstackSDHypervisorTestSuite{}
|
||||
mock.SetupTest(t)
|
||||
|
||||
hypervisor, _ := mock.openstackAuthSuccess()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
_, err := hypervisor.r.refresh(ctx)
|
||||
testutil.NotOk(t, err, "")
|
||||
testutil.Assert(t, strings.Contains(err.Error(), context.Canceled.Error()), "%q doesn't contain %q", err, context.Canceled)
|
||||
|
||||
mock.TearDownSuite()
|
||||
}
|
||||
|
|
|
@ -21,12 +21,14 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/go-kit/kit/log/level"
|
||||
"github.com/gophercloud/gophercloud"
|
||||
"github.com/gophercloud/gophercloud/openstack"
|
||||
"github.com/mwitkow/go-conntrack"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
config_util "github.com/prometheus/common/config"
|
||||
"github.com/prometheus/common/model"
|
||||
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
)
|
||||
|
||||
|
@ -117,15 +119,20 @@ func init() {
|
|||
prometheus.MustRegister(refreshDuration)
|
||||
}
|
||||
|
||||
type refresher interface {
|
||||
refresh(ctx context.Context) (tg *targetgroup.Group, err error)
|
||||
}
|
||||
|
||||
// Discovery periodically performs OpenStack-SD requests. It implements
|
||||
// the Discoverer interface.
|
||||
type Discovery interface {
|
||||
Run(ctx context.Context, ch chan<- []*targetgroup.Group)
|
||||
refresh() (tg *targetgroup.Group, err error)
|
||||
type Discovery struct {
|
||||
interval time.Duration
|
||||
logger log.Logger
|
||||
r refresher
|
||||
}
|
||||
|
||||
// NewDiscovery returns a new OpenStackDiscovery which periodically refreshes its targets.
|
||||
func NewDiscovery(conf *SDConfig, l log.Logger) (Discovery, error) {
|
||||
func NewDiscovery(conf *SDConfig, l log.Logger) (*Discovery, error) {
|
||||
var opts gophercloud.AuthOptions
|
||||
if conf.IdentityEndpoint == "" {
|
||||
var err error
|
||||
|
@ -167,16 +174,51 @@ func NewDiscovery(conf *SDConfig, l log.Logger) (Discovery, error) {
|
|||
},
|
||||
Timeout: 5 * time.Duration(conf.RefreshInterval),
|
||||
}
|
||||
var r refresher
|
||||
switch conf.Role {
|
||||
case OpenStackRoleHypervisor:
|
||||
hypervisor := NewHypervisorDiscovery(client, &opts,
|
||||
time.Duration(conf.RefreshInterval), conf.Port, conf.Region, l)
|
||||
return hypervisor, nil
|
||||
r = NewHypervisorDiscovery(client, &opts, conf.Port, conf.Region, l)
|
||||
case OpenStackRoleInstance:
|
||||
instance := NewInstanceDiscovery(client, &opts,
|
||||
time.Duration(conf.RefreshInterval), conf.Port, conf.Region, conf.AllTenants, l)
|
||||
return instance, nil
|
||||
r = NewInstanceDiscovery(client, &opts, conf.Port, conf.Region, conf.AllTenants, l)
|
||||
default:
|
||||
return nil, errors.New("unknown OpenStack discovery role")
|
||||
}
|
||||
return &Discovery{r: r, logger: l, interval: time.Duration(conf.RefreshInterval)}, nil
|
||||
}
|
||||
|
||||
// Run implements the Discoverer interface.
|
||||
func (d *Discovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
||||
// Get an initial set right away.
|
||||
tg, err := d.r.refresh(ctx)
|
||||
if err != nil {
|
||||
level.Error(d.logger).Log("msg", "Unable to refresh target groups", "err", err.Error())
|
||||
} else {
|
||||
select {
|
||||
case ch <- []*targetgroup.Group{tg}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ticker := time.NewTicker(d.interval)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
tg, err := d.r.refresh(ctx)
|
||||
if err != nil {
|
||||
level.Error(d.logger).Log("msg", "Unable to refresh target groups", "err", err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
select {
|
||||
case ch <- []*targetgroup.Group{tg}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
5
go.mod
5
go.mod
|
@ -42,7 +42,7 @@ require (
|
|||
github.com/google/gofuzz v0.0.0-20150304233714-bbcb9da2d746 // indirect
|
||||
github.com/google/pprof v0.0.0-20180605153948-8b03ce837f34
|
||||
github.com/googleapis/gnostic v0.0.0-20180520015035-48a0ecefe2e4 // indirect
|
||||
github.com/gophercloud/gophercloud v0.0.0-20181206160319-9d88c34913a9
|
||||
github.com/gophercloud/gophercloud v0.0.0-20190301152420-fca40860790e
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.6.3
|
||||
|
@ -110,7 +110,6 @@ require (
|
|||
github.com/spf13/pflag v1.0.3 // indirect
|
||||
github.com/stretchr/testify v1.2.2
|
||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 // indirect
|
||||
golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8 // indirect
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
|
||||
golang.org/x/time v0.0.0-20170424234030-8be79e1e0910
|
||||
|
@ -124,7 +123,7 @@ require (
|
|||
gopkg.in/inf.v0 v0.9.0 // indirect
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
||||
gopkg.in/vmihailenco/msgpack.v2 v2.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.1
|
||||
gopkg.in/yaml.v2 v2.2.2
|
||||
k8s.io/api v0.0.0-20181213150558-05914d821849
|
||||
k8s.io/apimachinery v0.0.0-20181127025237-2b1284ed4c93
|
||||
k8s.io/client-go v2.0.0-alpha.0.0.20181121191925-a47917edff34+incompatible
|
||||
|
|
12
go.sum
12
go.sum
|
@ -109,8 +109,8 @@ github.com/google/pprof v0.0.0-20180605153948-8b03ce837f34 h1:mGdRet4qWdrDnNidFr
|
|||
github.com/google/pprof v0.0.0-20180605153948-8b03ce837f34/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/googleapis/gnostic v0.0.0-20180520015035-48a0ecefe2e4 h1:yxHFSapGMUoyn+3v6LiJJxoJhvbDqIq8me0gAWehnSU=
|
||||
github.com/googleapis/gnostic v0.0.0-20180520015035-48a0ecefe2e4/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
|
||||
github.com/gophercloud/gophercloud v0.0.0-20181206160319-9d88c34913a9 h1:7TRGugCPfA2Mll6QT7cbhD1GXZwk7+1PUz8tYrOWXgQ=
|
||||
github.com/gophercloud/gophercloud v0.0.0-20181206160319-9d88c34913a9/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4=
|
||||
github.com/gophercloud/gophercloud v0.0.0-20190301152420-fca40860790e h1:hQpY0g0UGsLKLDs8UJ6xpA2gNCkEdEbvxSPqLItXCpI=
|
||||
github.com/gophercloud/gophercloud v0.0.0-20190301152420-fca40860790e/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM=
|
||||
|
@ -279,8 +279,8 @@ github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z
|
|||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||
go.opencensus.io v0.18.1-0.20181204023538-aab39bd6a98b h1:6ayHMBPtdP3jNuk+Sfhso+PTB7ZJQ5E1FBo403m2H8w=
|
||||
go.opencensus.io v0.18.1-0.20181204023538-aab39bd6a98b/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
|
||||
golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8 h1:h7zdf0RiEvWbYBKIx4b+q41xoUVnMmvsGZnIVE5syG8=
|
||||
golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE=
|
||||
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d h1:g9qWBGx4puODJTMVyoPrpoxPFgVGd+z1DZwjfRu4d0I=
|
||||
|
@ -296,6 +296,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h
|
|||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 h1:YoY1wS6JYVRpIfFngRf2HHo9R9dAne3xbkGOQ5rJXjU=
|
||||
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190209173611-3b5209105503 h1:5SvYFrOM3W8Mexn9/oA44Ji7vhXAZQ9hiP+1Q/DMrWg=
|
||||
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/time v0.0.0-20170424234030-8be79e1e0910 h1:bCMaBn7ph495H+x72gEvgcv+mDRd9dElbzo/mVCMxX4=
|
||||
|
@ -331,6 +333,8 @@ gopkg.in/vmihailenco/msgpack.v2 v2.9.1 h1:kb0VV7NuIojvRfzwslQeP3yArBqJHW9tOl4t38
|
|||
gopkg.in/vmihailenco/msgpack.v2 v2.9.1/go.mod h1:/3Dn1Npt9+MYyLpYYXjInO/5jvMLamn+AEGwNEOatn8=
|
||||
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
k8s.io/api v0.0.0-20181213150558-05914d821849 h1:WZFcFPXmLR7g5CxQNmjWv0mg8qulJLxDghbzS4pQtzY=
|
||||
k8s.io/api v0.0.0-20181213150558-05914d821849/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
language: go
|
||||
sudo: false
|
||||
install:
|
||||
- go get golang.org/x/crypto/ssh
|
||||
- go get -v -tags 'fixtures acceptance' ./...
|
||||
- go get github.com/wadey/gocovmerge
|
||||
- go get github.com/mattn/goveralls
|
||||
- go get golang.org/x/tools/cmd/goimports
|
||||
- GO111MODULE=off go get golang.org/x/crypto/ssh
|
||||
- GO111MODULE=off go get -v -tags 'fixtures acceptance' ./...
|
||||
- GO111MODULE=off go get github.com/wadey/gocovmerge
|
||||
- GO111MODULE=off go get github.com/mattn/goveralls
|
||||
- GO111MODULE=off go get golang.org/x/tools/cmd/goimports
|
||||
go:
|
||||
- "1.10"
|
||||
- "1.11"
|
||||
- "tip"
|
||||
env:
|
||||
global:
|
||||
- secure: "xSQsAG5wlL9emjbCdxzz/hYQsSpJ/bABO1kkbwMSISVcJ3Nk0u4ywF+LS4bgeOnwPfmFvNTOqVDu3RwEvMeWXSI76t1piCPcObutb2faKLVD/hLoAS76gYX+Z8yGWGHrSB7Do5vTPj1ERe2UljdrnsSeOXzoDwFxYRaZLX4bBOB4AyoGvRniil5QXPATiA1tsWX1VMicj8a4F8X+xeESzjt1Q5Iy31e7vkptu71bhvXCaoo5QhYwT+pLR9dN0S1b7Ro0KVvkRefmr1lUOSYd2e74h6Lc34tC1h3uYZCS4h47t7v5cOXvMNxinEj2C51RvbjvZI1RLVdkuAEJD1Iz4+Ote46nXbZ//6XRZMZz/YxQ13l7ux1PFjgEB6HAapmF5Xd8PRsgeTU9LRJxpiTJ3P5QJ3leS1va8qnziM5kYipj/Rn+V8g2ad/rgkRox9LSiR9VYZD2Pe45YCb1mTKSl2aIJnV7nkOqsShY5LNB4JZSg7xIffA+9YVDktw8dJlATjZqt7WvJJ49g6A61mIUV4C15q2JPGKTkZzDiG81NtmS7hFa7k0yaE2ELgYocbcuyUcAahhxntYTC0i23nJmEHVNiZmBO3u7EgpWe4KGVfumU+lt12tIn5b3dZRBBUk3QakKKozSK1QPHGpk/AZGrhu7H6l8to6IICKWtDcyMPQ="
|
||||
- GO111MODULE=on
|
||||
before_script:
|
||||
- go vet ./...
|
||||
script:
|
||||
- ./script/coverage
|
||||
- ./script/unittest
|
||||
- ./script/format
|
||||
after_success:
|
||||
- $HOME/gopath/bin/goveralls -service=travis-ci -coverprofile=cover.out
|
||||
|
|
|
@ -185,7 +185,6 @@ func (opts *AuthOptions) ToTokenV3CreateMap(scope map[string]interface{}) (map[s
|
|||
// Populate the request structure based on the provided arguments. Create and return an error
|
||||
// if insufficient or incompatible information is present.
|
||||
var req request
|
||||
var userRequest userReq
|
||||
|
||||
if opts.Password == "" {
|
||||
if opts.TokenID != "" {
|
||||
|
@ -229,25 +228,44 @@ func (opts *AuthOptions) ToTokenV3CreateMap(scope map[string]interface{}) (map[s
|
|||
if opts.ApplicationCredentialSecret == "" {
|
||||
return nil, ErrAppCredMissingSecret{}
|
||||
}
|
||||
// make sure that only one of DomainName or DomainID were provided
|
||||
if opts.DomainID == "" && opts.DomainName == "" {
|
||||
return nil, ErrDomainIDOrDomainName{}
|
||||
|
||||
var userRequest *userReq
|
||||
|
||||
if opts.UserID != "" {
|
||||
// UserID could be used without the domain information
|
||||
userRequest = &userReq{
|
||||
ID: &opts.UserID,
|
||||
}
|
||||
}
|
||||
req.Auth.Identity.Methods = []string{"application_credential"}
|
||||
if opts.DomainID != "" {
|
||||
userRequest = userReq{
|
||||
|
||||
if userRequest == nil && opts.Username == "" {
|
||||
// Make sure that Username or UserID are provided
|
||||
return nil, ErrUsernameOrUserID{}
|
||||
}
|
||||
|
||||
if userRequest == nil && opts.DomainID != "" {
|
||||
userRequest = &userReq{
|
||||
Name: &opts.Username,
|
||||
Domain: &domainReq{ID: &opts.DomainID},
|
||||
}
|
||||
} else if opts.DomainName != "" {
|
||||
userRequest = userReq{
|
||||
}
|
||||
|
||||
if userRequest == nil && opts.DomainName != "" {
|
||||
userRequest = &userReq{
|
||||
Name: &opts.Username,
|
||||
Domain: &domainReq{Name: &opts.DomainName},
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure that DomainID or DomainName are provided among Username
|
||||
if userRequest == nil {
|
||||
return nil, ErrDomainIDOrDomainName{}
|
||||
}
|
||||
|
||||
req.Auth.Identity.Methods = []string{"application_credential"}
|
||||
req.Auth.Identity.ApplicationCredential = &applicationCredentialReq{
|
||||
Name: &opts.ApplicationCredentialName,
|
||||
User: &userRequest,
|
||||
User: userRequest,
|
||||
Secret: &opts.ApplicationCredentialSecret,
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package gophercloud
|
||||
|
||||
/*
|
||||
AuthResult is the result from the request that was used to obtain a provider
|
||||
client's Keystone token. It is returned from ProviderClient.GetAuthResult().
|
||||
|
||||
The following types satisfy this interface:
|
||||
|
||||
github.com/gophercloud/gophercloud/openstack/identity/v2/tokens.CreateResult
|
||||
github.com/gophercloud/gophercloud/openstack/identity/v3/tokens.CreateResult
|
||||
|
||||
Usage example:
|
||||
|
||||
import (
|
||||
"github.com/gophercloud/gophercloud"
|
||||
tokens2 "github.com/gophercloud/gophercloud/openstack/identity/v2/tokens"
|
||||
tokens3 "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens"
|
||||
)
|
||||
|
||||
func GetAuthenticatedUserID(providerClient *gophercloud.ProviderClient) (string, error) {
|
||||
r := providerClient.GetAuthResult()
|
||||
if r == nil {
|
||||
//ProviderClient did not use openstack.Authenticate(), e.g. because token
|
||||
//was set manually with ProviderClient.SetToken()
|
||||
return "", errors.New("no AuthResult available")
|
||||
}
|
||||
switch r := r.(type) {
|
||||
case tokens2.CreateResult:
|
||||
u, err := r.ExtractUser()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return u.ID, nil
|
||||
case tokens3.CreateResult:
|
||||
u, err := r.ExtractUser()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return u.ID, nil
|
||||
default:
|
||||
panic(fmt.Sprintf("got unexpected AuthResult type %t", r))
|
||||
}
|
||||
}
|
||||
|
||||
Both implementing types share a lot of methods by name, like ExtractUser() in
|
||||
this example. But those methods cannot be part of the AuthResult interface
|
||||
because the return types are different (in this case, type tokens2.User vs.
|
||||
type tokens3.User).
|
||||
*/
|
||||
type AuthResult interface {
|
||||
ExtractTokenID() (string, error)
|
||||
}
|
|
@ -41,7 +41,7 @@ pass in the parent provider, like so:
|
|||
|
||||
opts := gophercloud.EndpointOpts{Region: "RegionOne"}
|
||||
|
||||
client := openstack.NewComputeV2(provider, opts)
|
||||
client, err := openstack.NewComputeV2(provider, opts)
|
||||
|
||||
Resources
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
module github.com/gophercloud/gophercloud
|
||||
|
||||
require (
|
||||
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67
|
||||
golang.org/x/sys v0.0.0-20190209173611-3b5209105503 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.2
|
||||
)
|
|
@ -0,0 +1,8 @@
|
|||
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE=
|
||||
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/sys v0.0.0-20190209173611-3b5209105503 h1:5SvYFrOM3W8Mexn9/oA44Ji7vhXAZQ9hiP+1Q/DMrWg=
|
||||
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
@ -59,11 +59,14 @@ func AuthOptionsFromEnv() (gophercloud.AuthOptions, error) {
|
|||
return nilOptions, err
|
||||
}
|
||||
|
||||
if username == "" && userID == "" {
|
||||
err := gophercloud.ErrMissingAnyoneOfEnvironmentVariables{
|
||||
EnvironmentVariables: []string{"OS_USERNAME", "OS_USERID"},
|
||||
if userID == "" && username == "" {
|
||||
// Empty username and userID could be ignored, when applicationCredentialID and applicationCredentialSecret are set
|
||||
if applicationCredentialID == "" && applicationCredentialSecret == "" {
|
||||
err := gophercloud.ErrMissingAnyoneOfEnvironmentVariables{
|
||||
EnvironmentVariables: []string{"OS_USERID", "OS_USERNAME"},
|
||||
}
|
||||
return nilOptions, err
|
||||
}
|
||||
return nilOptions, err
|
||||
}
|
||||
|
||||
if password == "" && applicationCredentialID == "" && applicationCredentialName == "" {
|
||||
|
@ -80,6 +83,19 @@ func AuthOptionsFromEnv() (gophercloud.AuthOptions, error) {
|
|||
return nilOptions, err
|
||||
}
|
||||
|
||||
if applicationCredentialID == "" && applicationCredentialName != "" && applicationCredentialSecret != "" {
|
||||
if userID == "" && username == "" {
|
||||
return nilOptions, gophercloud.ErrMissingAnyoneOfEnvironmentVariables{
|
||||
EnvironmentVariables: []string{"OS_USERID", "OS_USERNAME"},
|
||||
}
|
||||
}
|
||||
if username != "" && domainID == "" && domainName == "" {
|
||||
return nilOptions, gophercloud.ErrMissingAnyoneOfEnvironmentVariables{
|
||||
EnvironmentVariables: []string{"OS_DOMAIN_ID", "OS_DOMAIN_NAME"},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ao := gophercloud.AuthOptions{
|
||||
IdentityEndpoint: authURL,
|
||||
UserID: userID,
|
||||
|
|
|
@ -135,7 +135,7 @@ func v2auth(client *gophercloud.ProviderClient, endpoint string, options gopherc
|
|||
|
||||
result := tokens2.Create(v2Client, v2Opts)
|
||||
|
||||
token, err := result.ExtractToken()
|
||||
err = client.SetTokenAndAuthResult(result)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -150,8 +150,9 @@ func v2auth(client *gophercloud.ProviderClient, endpoint string, options gopherc
|
|||
// with the token and reauth func zeroed out. combined with setting `AllowReauth` to `false`,
|
||||
// this should retry authentication only once
|
||||
tac := *client
|
||||
tac.SetThrowaway(true)
|
||||
tac.ReauthFunc = nil
|
||||
tac.TokenID = ""
|
||||
tac.SetTokenAndAuthResult(nil)
|
||||
tao := options
|
||||
tao.AllowReauth = false
|
||||
client.ReauthFunc = func() error {
|
||||
|
@ -159,11 +160,10 @@ func v2auth(client *gophercloud.ProviderClient, endpoint string, options gopherc
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
client.TokenID = tac.TokenID
|
||||
client.CopyTokenFrom(&tac)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
client.TokenID = token.ID
|
||||
client.EndpointLocator = func(opts gophercloud.EndpointOpts) (string, error) {
|
||||
return V2EndpointURL(catalog, opts)
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ func v3auth(client *gophercloud.ProviderClient, endpoint string, opts tokens3.Au
|
|||
|
||||
result := tokens3.Create(v3Client, opts)
|
||||
|
||||
token, err := result.ExtractToken()
|
||||
err = client.SetTokenAndAuthResult(result)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -199,15 +199,14 @@ func v3auth(client *gophercloud.ProviderClient, endpoint string, opts tokens3.Au
|
|||
return err
|
||||
}
|
||||
|
||||
client.TokenID = token.ID
|
||||
|
||||
if opts.CanReauth() {
|
||||
// here we're creating a throw-away client (tac). it's a copy of the user's provider client, but
|
||||
// with the token and reauth func zeroed out. combined with setting `AllowReauth` to `false`,
|
||||
// this should retry authentication only once
|
||||
tac := *client
|
||||
tac.SetThrowaway(true)
|
||||
tac.ReauthFunc = nil
|
||||
tac.TokenID = ""
|
||||
tac.SetTokenAndAuthResult(nil)
|
||||
var tao tokens3.AuthOptionsBuilder
|
||||
switch ot := opts.(type) {
|
||||
case *gophercloud.AuthOptions:
|
||||
|
@ -226,7 +225,7 @@ func v3auth(client *gophercloud.ProviderClient, endpoint string, opts tokens3.Au
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
client.TokenID = tac.TokenID
|
||||
client.CopyTokenFrom(&tac)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
@ -305,6 +304,12 @@ func initClientOpts(client *gophercloud.ProviderClient, eo gophercloud.EndpointO
|
|||
return sc, nil
|
||||
}
|
||||
|
||||
// NewBareMetalV1 creates a ServiceClient that may be used with the v1
|
||||
// bare metal package.
|
||||
func NewBareMetalV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
|
||||
return initClientOpts(client, eo, "baremetal")
|
||||
}
|
||||
|
||||
// NewObjectStorageV1 creates a ServiceClient that may be used with the v1
|
||||
// object storage package.
|
||||
func NewObjectStorageV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
|
||||
|
|
2
vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/requests.go
generated
vendored
2
vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/requests.go
generated
vendored
|
@ -148,7 +148,7 @@ func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r Create
|
|||
return
|
||||
}
|
||||
|
||||
// Get retrieves details of a single flavor. Use ExtractFlavor to convert its
|
||||
// Get retrieves details of a single flavor. Use Extract to convert its
|
||||
// result into a Flavor.
|
||||
func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
|
||||
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
|
||||
|
|
11
vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/microversions.go
generated
vendored
Normal file
11
vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/microversions.go
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
package servers
|
||||
|
||||
// ExtractTags will extract the tags of a server.
|
||||
// This requires the client to be set to microversion 2.26 or later.
|
||||
func (r serverResult) ExtractTags() ([]string, error) {
|
||||
var s struct {
|
||||
Tags []string `json:"tags"`
|
||||
}
|
||||
err := r.ExtractInto(&s)
|
||||
return s.Tags, err
|
||||
}
|
20
vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go
generated
vendored
20
vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go
generated
vendored
|
@ -183,12 +183,22 @@ type CreateOpts struct {
|
|||
// AccessIPv4 specifies an IPv4 address for the instance.
|
||||
AccessIPv4 string `json:"accessIPv4,omitempty"`
|
||||
|
||||
// AccessIPv6 pecifies an IPv6 address for the instance.
|
||||
// AccessIPv6 specifies an IPv6 address for the instance.
|
||||
AccessIPv6 string `json:"accessIPv6,omitempty"`
|
||||
|
||||
// Min specifies Minimum number of servers to launch.
|
||||
Min int `json:"min_count,omitempty"`
|
||||
|
||||
// Max specifies Maximum number of servers to launch.
|
||||
Max int `json:"max_count,omitempty"`
|
||||
|
||||
// ServiceClient will allow calls to be made to retrieve an image or
|
||||
// flavor ID by name.
|
||||
ServiceClient *gophercloud.ServiceClient `json:"-"`
|
||||
|
||||
// Tags allows a server to be tagged with single-word metadata.
|
||||
// Requires microversion 2.52 or later.
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
// ToServerCreateMap assembles a request body based on the contents of a
|
||||
|
@ -272,6 +282,14 @@ func (opts CreateOpts) ToServerCreateMap() (map[string]interface{}, error) {
|
|||
b["flavorRef"] = flavorID
|
||||
}
|
||||
|
||||
if opts.Min != 0 {
|
||||
b["min_count"] = opts.Min
|
||||
}
|
||||
|
||||
if opts.Max != 0 {
|
||||
b["max_count"] = opts.Max
|
||||
}
|
||||
|
||||
return map[string]interface{}{"server": b}, nil
|
||||
}
|
||||
|
||||
|
|
2
vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/requests.go
generated
vendored
2
vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/requests.go
generated
vendored
|
@ -85,7 +85,7 @@ type UpdateOpts struct {
|
|||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Description is the description of the tenant.
|
||||
Description string `json:"description,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
|
||||
// Enabled sets the tenant status to enabled or disabled.
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
|
|
15
vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/results.go
generated
vendored
15
vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/results.go
generated
vendored
|
@ -135,6 +135,21 @@ func (r CreateResult) ExtractToken() (*Token, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ExtractTokenID implements the gophercloud.AuthResult interface. The returned
|
||||
// string is the same as the ID field of the Token struct returned from
|
||||
// ExtractToken().
|
||||
func (r CreateResult) ExtractTokenID() (string, error) {
|
||||
var s struct {
|
||||
Access struct {
|
||||
Token struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"token"`
|
||||
} `json:"access"`
|
||||
}
|
||||
err := r.ExtractInto(&s)
|
||||
return s.Access.Token.ID, err
|
||||
}
|
||||
|
||||
// ExtractServiceCatalog returns the ServiceCatalog that was generated along
|
||||
// with the user's Token.
|
||||
func (r CreateResult) ExtractServiceCatalog() (*ServiceCatalog, error) {
|
||||
|
|
7
vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go
generated
vendored
7
vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go
generated
vendored
|
@ -102,6 +102,13 @@ func (r commonResult) ExtractToken() (*Token, error) {
|
|||
return &s, err
|
||||
}
|
||||
|
||||
// ExtractTokenID implements the gophercloud.AuthResult interface. The returned
|
||||
// string is the same as the ID field of the Token struct returned from
|
||||
// ExtractToken().
|
||||
func (r CreateResult) ExtractTokenID() (string, error) {
|
||||
return r.Header.Get("X-Subject-Token"), r.Err
|
||||
}
|
||||
|
||||
// ExtractServiceCatalog returns the ServiceCatalog that was generated along
|
||||
// with the user's Token.
|
||||
func (r commonResult) ExtractServiceCatalog() (*ServiceCatalog, error) {
|
||||
|
|
|
@ -2,7 +2,9 @@ package gophercloud
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
@ -71,26 +73,44 @@ type ProviderClient struct {
|
|||
// authentication functions for different Identity service versions.
|
||||
ReauthFunc func() error
|
||||
|
||||
// Throwaway determines whether if this client is a throw-away client. It's a copy of user's provider client
|
||||
// with the token and reauth func zeroed. Such client can be used to perform reauthorization.
|
||||
Throwaway bool
|
||||
|
||||
// Context is the context passed to the HTTP request.
|
||||
Context context.Context
|
||||
|
||||
// mut is a mutex for the client. It protects read and write access to client attributes such as getting
|
||||
// and setting the TokenID.
|
||||
mut *sync.RWMutex
|
||||
|
||||
// reauthmut is a mutex for reauthentication it attempts to ensure that only one reauthentication
|
||||
// attempt happens at one time.
|
||||
reauthmut *reauthlock
|
||||
|
||||
authResult AuthResult
|
||||
}
|
||||
|
||||
// reauthlock represents a set of attributes used to help in the reauthentication process.
|
||||
type reauthlock struct {
|
||||
sync.RWMutex
|
||||
reauthing bool
|
||||
reauthing bool
|
||||
reauthingErr error
|
||||
done *sync.Cond
|
||||
}
|
||||
|
||||
// AuthenticatedHeaders returns a map of HTTP headers that are common for all
|
||||
// authenticated service requests.
|
||||
// authenticated service requests. Blocks if Reauthenticate is in progress.
|
||||
func (client *ProviderClient) AuthenticatedHeaders() (m map[string]string) {
|
||||
if client.IsThrowaway() {
|
||||
return
|
||||
}
|
||||
if client.reauthmut != nil {
|
||||
client.reauthmut.RLock()
|
||||
if client.reauthmut.reauthing {
|
||||
client.reauthmut.RUnlock()
|
||||
return
|
||||
client.reauthmut.Lock()
|
||||
for client.reauthmut.reauthing {
|
||||
client.reauthmut.done.Wait()
|
||||
}
|
||||
client.reauthmut.RUnlock()
|
||||
client.reauthmut.Unlock()
|
||||
}
|
||||
t := client.Token()
|
||||
if t == "" {
|
||||
|
@ -106,6 +126,20 @@ func (client *ProviderClient) UseTokenLock() {
|
|||
client.reauthmut = new(reauthlock)
|
||||
}
|
||||
|
||||
// GetAuthResult returns the result from the request that was used to obtain a
|
||||
// provider client's Keystone token.
|
||||
//
|
||||
// The result is nil when authentication has not yet taken place, when the token
|
||||
// was set manually with SetToken(), or when a ReauthFunc was used that does not
|
||||
// record the AuthResult.
|
||||
func (client *ProviderClient) GetAuthResult() AuthResult {
|
||||
if client.mut != nil {
|
||||
client.mut.RLock()
|
||||
defer client.mut.RUnlock()
|
||||
}
|
||||
return client.authResult
|
||||
}
|
||||
|
||||
// Token safely reads the value of the auth token from the ProviderClient. Applications should
|
||||
// call this method to access the token instead of the TokenID field
|
||||
func (client *ProviderClient) Token() string {
|
||||
|
@ -117,13 +151,71 @@ func (client *ProviderClient) Token() string {
|
|||
}
|
||||
|
||||
// SetToken safely sets the value of the auth token in the ProviderClient. Applications may
|
||||
// use this method in a custom ReauthFunc
|
||||
// use this method in a custom ReauthFunc.
|
||||
//
|
||||
// WARNING: This function is deprecated. Use SetTokenAndAuthResult() instead.
|
||||
func (client *ProviderClient) SetToken(t string) {
|
||||
if client.mut != nil {
|
||||
client.mut.Lock()
|
||||
defer client.mut.Unlock()
|
||||
}
|
||||
client.TokenID = t
|
||||
client.authResult = nil
|
||||
}
|
||||
|
||||
// SetTokenAndAuthResult safely sets the value of the auth token in the
|
||||
// ProviderClient and also records the AuthResult that was returned from the
|
||||
// token creation request. Applications may call this in a custom ReauthFunc.
|
||||
func (client *ProviderClient) SetTokenAndAuthResult(r AuthResult) error {
|
||||
tokenID := ""
|
||||
var err error
|
||||
if r != nil {
|
||||
tokenID, err = r.ExtractTokenID()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if client.mut != nil {
|
||||
client.mut.Lock()
|
||||
defer client.mut.Unlock()
|
||||
}
|
||||
client.TokenID = tokenID
|
||||
client.authResult = r
|
||||
return nil
|
||||
}
|
||||
|
||||
// CopyTokenFrom safely copies the token from another ProviderClient into the
|
||||
// this one.
|
||||
func (client *ProviderClient) CopyTokenFrom(other *ProviderClient) {
|
||||
if client.mut != nil {
|
||||
client.mut.Lock()
|
||||
defer client.mut.Unlock()
|
||||
}
|
||||
if other.mut != nil && other.mut != client.mut {
|
||||
other.mut.RLock()
|
||||
defer other.mut.RUnlock()
|
||||
}
|
||||
client.TokenID = other.TokenID
|
||||
client.authResult = other.authResult
|
||||
}
|
||||
|
||||
// IsThrowaway safely reads the value of the client Throwaway field.
|
||||
func (client *ProviderClient) IsThrowaway() bool {
|
||||
if client.reauthmut != nil {
|
||||
client.reauthmut.RLock()
|
||||
defer client.reauthmut.RUnlock()
|
||||
}
|
||||
return client.Throwaway
|
||||
}
|
||||
|
||||
// SetThrowaway safely sets the value of the client Throwaway field.
|
||||
func (client *ProviderClient) SetThrowaway(v bool) {
|
||||
if client.reauthmut != nil {
|
||||
client.reauthmut.Lock()
|
||||
defer client.reauthmut.Unlock()
|
||||
}
|
||||
client.Throwaway = v
|
||||
}
|
||||
|
||||
// Reauthenticate calls client.ReauthFunc in a thread-safe way. If this is
|
||||
|
@ -136,14 +228,25 @@ func (client *ProviderClient) Reauthenticate(previousToken string) (err error) {
|
|||
return nil
|
||||
}
|
||||
|
||||
if client.mut == nil {
|
||||
if client.reauthmut == nil {
|
||||
return client.ReauthFunc()
|
||||
}
|
||||
client.mut.Lock()
|
||||
defer client.mut.Unlock()
|
||||
|
||||
client.reauthmut.Lock()
|
||||
if client.reauthmut.reauthing {
|
||||
for !client.reauthmut.reauthing {
|
||||
client.reauthmut.done.Wait()
|
||||
}
|
||||
err = client.reauthmut.reauthingErr
|
||||
client.reauthmut.Unlock()
|
||||
return err
|
||||
}
|
||||
client.reauthmut.Unlock()
|
||||
|
||||
client.reauthmut.Lock()
|
||||
client.reauthmut.reauthing = true
|
||||
client.reauthmut.done = sync.NewCond(client.reauthmut)
|
||||
client.reauthmut.reauthingErr = nil
|
||||
client.reauthmut.Unlock()
|
||||
|
||||
if previousToken == "" || client.TokenID == previousToken {
|
||||
|
@ -152,6 +255,8 @@ func (client *ProviderClient) Reauthenticate(previousToken string) (err error) {
|
|||
|
||||
client.reauthmut.Lock()
|
||||
client.reauthmut.reauthing = false
|
||||
client.reauthmut.reauthingErr = err
|
||||
client.reauthmut.done.Broadcast()
|
||||
client.reauthmut.Unlock()
|
||||
return
|
||||
}
|
||||
|
@ -192,7 +297,7 @@ func (client *ProviderClient) Request(method, url string, options *RequestOpts)
|
|||
// io.ReadSeeker as-is. Default the content-type to application/json.
|
||||
if options.JSONBody != nil {
|
||||
if options.RawBody != nil {
|
||||
panic("Please provide only one of JSONBody or RawBody to gophercloud.Request().")
|
||||
return nil, errors.New("please provide only one of JSONBody or RawBody to gophercloud.Request()")
|
||||
}
|
||||
|
||||
rendered, err := json.Marshal(options.JSONBody)
|
||||
|
@ -213,6 +318,9 @@ func (client *ProviderClient) Request(method, url string, options *RequestOpts)
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if client.Context != nil {
|
||||
req = req.WithContext(client.Context)
|
||||
}
|
||||
|
||||
// Populate the request headers. Apply options.MoreHeaders last, to give the caller the chance to
|
||||
// modify or omit any header.
|
||||
|
@ -251,13 +359,14 @@ func (client *ProviderClient) Request(method, url string, options *RequestOpts)
|
|||
}
|
||||
|
||||
// Allow default OkCodes if none explicitly set
|
||||
if options.OkCodes == nil {
|
||||
options.OkCodes = defaultOkCodes(method)
|
||||
okc := options.OkCodes
|
||||
if okc == nil {
|
||||
okc = defaultOkCodes(method)
|
||||
}
|
||||
|
||||
// Validate the HTTP response status.
|
||||
var ok bool
|
||||
for _, code := range options.OkCodes {
|
||||
for _, code := range okc {
|
||||
if resp.StatusCode == code {
|
||||
ok = true
|
||||
break
|
||||
|
|
|
@ -129,6 +129,8 @@ func (client *ServiceClient) setMicroversionHeader(opts *RequestOpts) {
|
|||
opts.MoreHeaders["X-OpenStack-Manila-API-Version"] = client.Microversion
|
||||
case "volume":
|
||||
opts.MoreHeaders["X-OpenStack-Volume-API-Version"] = client.Microversion
|
||||
case "baremetal":
|
||||
opts.MoreHeaders["X-OpenStack-Ironic-API-Version"] = client.Microversion
|
||||
}
|
||||
|
||||
if client.Type != "" {
|
||||
|
|
|
@ -159,6 +159,10 @@ func bytesToKey(b []byte, pasteActive bool) (rune, []byte) {
|
|||
return keyClearScreen, b[1:]
|
||||
case 23: // ^W
|
||||
return keyDeleteWord, b[1:]
|
||||
case 14: // ^N
|
||||
return keyDown, b[1:]
|
||||
case 16: // ^P
|
||||
return keyUp, b[1:]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd
|
||||
// +build aix darwin dragonfly freebsd linux,!appengine netbsd openbsd
|
||||
|
||||
// Package terminal provides support functions for dealing with terminals, as
|
||||
// commonly found on UNIX systems.
|
||||
|
@ -25,7 +25,7 @@ type State struct {
|
|||
termios unix.Termios
|
||||
}
|
||||
|
||||
// IsTerminal returns true if the given file descriptor is a terminal.
|
||||
// IsTerminal returns whether the given file descriptor is a terminal.
|
||||
func IsTerminal(fd int) bool {
|
||||
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
|
||||
return err == nil
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// 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 aix
|
||||
|
||||
package terminal
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
const ioctlReadTermios = unix.TCGETS
|
||||
const ioctlWriteTermios = unix.TCSETS
|
|
@ -21,7 +21,7 @@ import (
|
|||
|
||||
type State struct{}
|
||||
|
||||
// IsTerminal returns true if the given file descriptor is a terminal.
|
||||
// IsTerminal returns whether the given file descriptor is a terminal.
|
||||
func IsTerminal(fd int) bool {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ type State struct {
|
|||
termios unix.Termios
|
||||
}
|
||||
|
||||
// IsTerminal returns true if the given file descriptor is a terminal.
|
||||
// IsTerminal returns whether the given file descriptor is a terminal.
|
||||
func IsTerminal(fd int) bool {
|
||||
_, err := unix.IoctlGetTermio(fd, unix.TCGETA)
|
||||
return err == nil
|
||||
|
|
|
@ -26,7 +26,7 @@ type State struct {
|
|||
mode uint32
|
||||
}
|
||||
|
||||
// IsTerminal returns true if the given file descriptor is a terminal.
|
||||
// IsTerminal returns whether the given file descriptor is a terminal.
|
||||
func IsTerminal(fd int) bool {
|
||||
var st uint32
|
||||
err := windows.GetConsoleMode(windows.Handle(fd), &st)
|
||||
|
|
|
@ -14,7 +14,7 @@ migrating the build system to use containers so the builds are reproducible.
|
|||
This is being done on an OS-by-OS basis. Please update this documentation as
|
||||
components of the build system change.
|
||||
|
||||
### Old Build System (currently for `GOOS != "Linux" || GOARCH == "sparc64"`)
|
||||
### Old Build System (currently for `GOOS != "linux"`)
|
||||
|
||||
The old build system generates the Go files based on the C header files
|
||||
present on your system. This means that files
|
||||
|
@ -34,7 +34,7 @@ your specific system. Running `mkall.sh -n` shows the commands that will be run.
|
|||
|
||||
Requirements: bash, perl, go
|
||||
|
||||
### New Build System (currently for `GOOS == "Linux" && GOARCH != "sparc64"`)
|
||||
### New Build System (currently for `GOOS == "linux"`)
|
||||
|
||||
The new build system uses a Docker container to generate the go files directly
|
||||
from source checkouts of the kernel and various system libraries. This means
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
// 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 !gccgo
|
||||
|
||||
#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)
|
|
@ -0,0 +1,29 @@
|
|||
// 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 !gccgo
|
||||
|
||||
#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)
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd
|
||||
// +build dragonfly freebsd linux netbsd openbsd
|
||||
|
||||
package unix
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
// 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.
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
|
||||
func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
|
||||
return fcntl(int(fd), cmd, arg)
|
||||
}
|
||||
|
||||
// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
|
||||
func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
|
||||
_, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk))))
|
||||
return err
|
||||
}
|
|
@ -10,13 +10,14 @@
|
|||
GOOSARCH="${GOOS}_${GOARCH}"
|
||||
|
||||
# defaults
|
||||
mksyscall="./mksyscall.pl"
|
||||
mksyscall="go run mksyscall.go"
|
||||
mkerrors="./mkerrors.sh"
|
||||
zerrors="zerrors_$GOOSARCH.go"
|
||||
mksysctl=""
|
||||
zsysctl="zsysctl_$GOOSARCH.go"
|
||||
mksysnum=
|
||||
mktypes=
|
||||
mkasm=
|
||||
run="sh"
|
||||
cmd=""
|
||||
|
||||
|
@ -45,8 +46,8 @@ case "$#" in
|
|||
exit 2
|
||||
esac
|
||||
|
||||
if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
|
||||
# Use then new build system
|
||||
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 $(dirname "$(readlink -f "$0")"):/build generate:$GOOS
|
||||
|
@ -61,106 +62,109 @@ _* | *_ | _)
|
|||
;;
|
||||
aix_ppc)
|
||||
mkerrors="$mkerrors -maix32"
|
||||
mksyscall="./mksyscall_aix_ppc.pl -aix"
|
||||
mksyscall="go run mksyscall_aix_ppc.go -aix"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
aix_ppc64)
|
||||
mkerrors="$mkerrors -maix64"
|
||||
mksyscall="./mksyscall_aix_ppc64.pl -aix"
|
||||
mksyscall="go run mksyscall_aix_ppc64.go -aix"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
darwin_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32"
|
||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
||||
mksyscall="go run mksyscall.go -l32"
|
||||
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
mkasm="go run mkasm_darwin.go"
|
||||
;;
|
||||
darwin_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
||||
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
mkasm="go run mkasm_darwin.go"
|
||||
;;
|
||||
darwin_arm)
|
||||
mkerrors="$mkerrors"
|
||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
||||
mksyscall="go run mksyscall.go -l32"
|
||||
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
mkasm="go run mkasm_darwin.go"
|
||||
;;
|
||||
darwin_arm64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
||||
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
mkasm="go run mkasm_darwin.go"
|
||||
;;
|
||||
dragonfly_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksyscall="./mksyscall.pl -dragonfly"
|
||||
mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl"
|
||||
mksyscall="go run mksyscall.go -dragonfly"
|
||||
mksysnum="go run mksysnum.go 'https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
freebsd_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32"
|
||||
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
|
||||
mksyscall="go run mksyscall.go -l32"
|
||||
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
freebsd_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
|
||||
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
freebsd_arm)
|
||||
mkerrors="$mkerrors"
|
||||
mksyscall="./mksyscall.pl -l32 -arm"
|
||||
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
|
||||
mksyscall="go run mksyscall.go -l32 -arm"
|
||||
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
|
||||
# Let the type of C char be signed for making the bare syscall
|
||||
# API consistent across platforms.
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||
;;
|
||||
linux_sparc64)
|
||||
GOOSARCH_in=syscall_linux_sparc64.go
|
||||
unistd_h=/usr/include/sparc64-linux-gnu/asm/unistd.h
|
||||
freebsd_arm64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
netbsd_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32 -netbsd"
|
||||
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
|
||||
mksyscall="go run mksyscall.go -l32 -netbsd"
|
||||
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
netbsd_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksyscall="./mksyscall.pl -netbsd"
|
||||
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
|
||||
mksyscall="go run mksyscall.go -netbsd"
|
||||
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
netbsd_arm)
|
||||
mkerrors="$mkerrors"
|
||||
mksyscall="./mksyscall.pl -l32 -netbsd -arm"
|
||||
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
|
||||
mksyscall="go run mksyscall.go -l32 -netbsd -arm"
|
||||
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
|
||||
# Let the type of C char be signed for making the bare syscall
|
||||
# API consistent across platforms.
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||
;;
|
||||
openbsd_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32 -openbsd"
|
||||
mksyscall="go run mksyscall.go -l32 -openbsd"
|
||||
mksysctl="./mksysctl_openbsd.pl"
|
||||
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
|
||||
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
openbsd_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksyscall="./mksyscall.pl -openbsd"
|
||||
mksyscall="go run mksyscall.go -openbsd"
|
||||
mksysctl="./mksysctl_openbsd.pl"
|
||||
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
|
||||
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
openbsd_arm)
|
||||
mkerrors="$mkerrors"
|
||||
mksyscall="./mksyscall.pl -l32 -openbsd -arm"
|
||||
mksyscall="go run mksyscall.go -l32 -openbsd -arm"
|
||||
mksysctl="./mksysctl_openbsd.pl"
|
||||
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
|
||||
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
||||
# Let the type of C char be signed for making the bare syscall
|
||||
# API consistent across platforms.
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||
|
@ -191,6 +195,11 @@ esac
|
|||
if [ "$GOOSARCH" == "aix_ppc64" ]; then
|
||||
# aix/ppc64 script generates files instead of writing to stdin.
|
||||
echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ;
|
||||
elif [ "$GOOS" == "darwin" ]; then
|
||||
# pre-1.12, direct syscalls
|
||||
echo "$mksyscall -tags $GOOS,$GOARCH,!go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.1_11.go";
|
||||
# 1.12 and later, syscalls via libSystem
|
||||
echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
|
||||
else
|
||||
echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
|
||||
fi
|
||||
|
@ -200,5 +209,6 @@ esac
|
|||
if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
|
||||
if [ -n "$mktypes" ]; then
|
||||
echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go";
|
||||
if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi
|
||||
fi
|
||||
) | $run
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
// 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 ignore
|
||||
|
||||
// mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go.
|
||||
//This program must be run after mksyscall.go.
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
in1, err := ioutil.ReadFile("syscall_darwin.go")
|
||||
if err != nil {
|
||||
log.Fatalf("can't open syscall_darwin.go: %s", err)
|
||||
}
|
||||
arch := os.Args[1]
|
||||
in2, err := ioutil.ReadFile(fmt.Sprintf("syscall_darwin_%s.go", arch))
|
||||
if err != nil {
|
||||
log.Fatalf("can't open syscall_darwin_%s.go: %s", arch, err)
|
||||
}
|
||||
in3, err := ioutil.ReadFile(fmt.Sprintf("zsyscall_darwin_%s.go", arch))
|
||||
if err != nil {
|
||||
log.Fatalf("can't open zsyscall_darwin_%s.go: %s", arch, err)
|
||||
}
|
||||
in := string(in1) + string(in2) + string(in3)
|
||||
|
||||
trampolines := map[string]bool{}
|
||||
|
||||
var out bytes.Buffer
|
||||
|
||||
fmt.Fprintf(&out, "// go run mkasm_darwin.go %s\n", strings.Join(os.Args[1:], " "))
|
||||
fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n")
|
||||
fmt.Fprintf(&out, "\n")
|
||||
fmt.Fprintf(&out, "// +build go1.12\n")
|
||||
fmt.Fprintf(&out, "\n")
|
||||
fmt.Fprintf(&out, "#include \"textflag.h\"\n")
|
||||
for _, line := range strings.Split(in, "\n") {
|
||||
if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") {
|
||||
continue
|
||||
}
|
||||
fn := line[5 : len(line)-13]
|
||||
if !trampolines[fn] {
|
||||
trampolines[fn] = true
|
||||
fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn)
|
||||
fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn)
|
||||
}
|
||||
}
|
||||
err = ioutil.WriteFile(fmt.Sprintf("zsyscall_darwin_%s.s", arch), out.Bytes(), 0644)
|
||||
if err != nil {
|
||||
log.Fatalf("can't write zsyscall_darwin_%s.s: %s", arch, err)
|
||||
}
|
||||
}
|
|
@ -17,12 +17,10 @@ if test -z "$GOARCH" -o -z "$GOOS"; then
|
|||
fi
|
||||
|
||||
# Check that we are using the new build system if we should
|
||||
if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
|
||||
if [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
|
||||
echo 1>&2 "In the new build system, mkerrors should not be called directly."
|
||||
echo 1>&2 "See README.md"
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$GOOS" = "linux" ]] && [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
|
||||
echo 1>&2 "In the Docker based build system, mkerrors should not be called directly."
|
||||
echo 1>&2 "See README.md"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$GOOS" = "aix" ]]; then
|
||||
|
@ -181,12 +179,15 @@ struct ltchars {
|
|||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/signalfd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/xattr.h>
|
||||
#include <linux/errqueue.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_alg.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_ppp.h>
|
||||
#include <linux/if_tun.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <linux/if_addr.h>
|
||||
|
@ -222,7 +223,15 @@ struct ltchars {
|
|||
#include <linux/if_xdp.h>
|
||||
#include <mtd/ubi-user.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#if defined(__sparc__)
|
||||
// On sparc{,64}, the kernel defines struct termios2 itself which clashes with the
|
||||
// definition in glibc. As only the error constants are needed here, include the
|
||||
// generic termibits.h (which is included by termbits.h on sparc).
|
||||
#include <asm-generic/termbits.h>
|
||||
#else
|
||||
#include <asm/termbits.h>
|
||||
#endif
|
||||
|
||||
#ifndef MSG_FASTOPEN
|
||||
#define MSG_FASTOPEN 0x20000000
|
||||
|
@ -250,16 +259,6 @@ struct ltchars {
|
|||
#define FS_KEY_DESC_PREFIX "fscrypt:"
|
||||
#define FS_KEY_DESC_PREFIX_SIZE 8
|
||||
#define FS_MAX_KEY_SIZE 64
|
||||
|
||||
// XDP socket constants do not appear to be picked up otherwise.
|
||||
// Copied from samples/bpf/xdpsock_user.c.
|
||||
#ifndef SOL_XDP
|
||||
#define SOL_XDP 283
|
||||
#endif
|
||||
|
||||
#ifndef AF_XDP
|
||||
#define AF_XDP 44
|
||||
#endif
|
||||
'
|
||||
|
||||
includes_NetBSD='
|
||||
|
@ -446,7 +445,7 @@ ccflags="$@"
|
|||
$2 !~ "MNT_BITS" &&
|
||||
$2 ~ /^(MS|MNT|UMOUNT)_/ ||
|
||||
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
|
||||
$2 ~ /^(O|F|E?FD|NAME|S|PTRACE|PT)_/ ||
|
||||
$2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT)_/ ||
|
||||
$2 ~ /^KEXEC_/ ||
|
||||
$2 ~ /^LINUX_REBOOT_CMD_/ ||
|
||||
$2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
|
||||
|
@ -467,12 +466,13 @@ ccflags="$@"
|
|||
$2 ~ /^CLONE_[A-Z_]+/ ||
|
||||
$2 !~ /^(BPF_TIMEVAL)$/ &&
|
||||
$2 ~ /^(BPF|DLT)_/ ||
|
||||
$2 ~ /^CLOCK_/ ||
|
||||
$2 ~ /^(CLOCK|TIMER)_/ ||
|
||||
$2 ~ /^CAN_/ ||
|
||||
$2 ~ /^CAP_/ ||
|
||||
$2 ~ /^ALG_/ ||
|
||||
$2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE|IOC_(GET|SET)_ENCRYPTION)/ ||
|
||||
$2 ~ /^GRND_/ ||
|
||||
$2 ~ /^RND/ ||
|
||||
$2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
|
||||
$2 ~ /^KEYCTL_/ ||
|
||||
$2 ~ /^PERF_EVENT_IOC_/ ||
|
||||
|
@ -500,6 +500,7 @@ ccflags="$@"
|
|||
$2 ~ /^(HDIO|WIN|SMART)_/ ||
|
||||
$2 !~ "WMESGLEN" &&
|
||||
$2 ~ /^W[A-Z0-9]+$/ ||
|
||||
$2 ~/^PPPIOC/ ||
|
||||
$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)}
|
||||
|
|
|
@ -28,10 +28,10 @@ func main() {
|
|||
if goarch == "" {
|
||||
goarch = os.Getenv("GOARCH")
|
||||
}
|
||||
// Check that we are using the new build system if we should be.
|
||||
if goos == "linux" && goarch != "sparc64" {
|
||||
// Check that we are using the Docker-based build system if we should be.
|
||||
if goos == "linux" {
|
||||
if os.Getenv("GOLANG_SYS_BUILD") != "docker" {
|
||||
os.Stderr.WriteString("In the new build system, mkpost should not be called directly.\n")
|
||||
os.Stderr.WriteString("In the Docker-based build system, mkpost should not be called directly.\n")
|
||||
os.Stderr.WriteString("See README.md\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
@ -46,6 +46,10 @@ func main() {
|
|||
valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__val(\s+\S+\s+)}`)
|
||||
b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$3}"))
|
||||
|
||||
// Intentionally export __fds_bits field in FdSet
|
||||
fdSetRegex := regexp.MustCompile(`type (FdSet) struct {(\s+)X__fds_bits(\s+\S+\s+)}`)
|
||||
b = fdSetRegex.ReplaceAll(b, []byte("type $1 struct {${2}Bits$3}"))
|
||||
|
||||
// If we have empty Ptrace structs, we should delete them. Only s390x emits
|
||||
// nonempty Ptrace structs.
|
||||
ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`)
|
||||
|
|
|
@ -0,0 +1,402 @@
|
|||
// 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 ignore
|
||||
|
||||
/*
|
||||
This program reads a file containing function prototypes
|
||||
(like syscall_darwin.go) and generates system call bodies.
|
||||
The prototypes are marked by lines beginning with "//sys"
|
||||
and read like func declarations if //sys is replaced by func, but:
|
||||
* The parameter lists must give a name for each argument.
|
||||
This includes return parameters.
|
||||
* The parameter lists must give a type for each argument:
|
||||
the (x, y, z int) shorthand is not allowed.
|
||||
* If the return parameter is an error number, it must be named errno.
|
||||
|
||||
A line beginning with //sysnb is like //sys, except that the
|
||||
goroutine will not be suspended during the execution of the system
|
||||
call. This must only be used for system calls which can never
|
||||
block, as otherwise the system call could cause all goroutines to
|
||||
hang.
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
b32 = flag.Bool("b32", false, "32bit big-endian")
|
||||
l32 = flag.Bool("l32", false, "32bit little-endian")
|
||||
plan9 = flag.Bool("plan9", false, "plan9")
|
||||
openbsd = flag.Bool("openbsd", false, "openbsd")
|
||||
netbsd = flag.Bool("netbsd", false, "netbsd")
|
||||
dragonfly = flag.Bool("dragonfly", false, "dragonfly")
|
||||
arm = flag.Bool("arm", false, "arm") // 64-bit value should use (even, odd)-pair
|
||||
tags = flag.String("tags", "", "build tags")
|
||||
filename = flag.String("output", "", "output file name (standard output if omitted)")
|
||||
)
|
||||
|
||||
// cmdLine returns this programs's commandline arguments
|
||||
func cmdLine() string {
|
||||
return "go run mksyscall.go " + strings.Join(os.Args[1:], " ")
|
||||
}
|
||||
|
||||
// buildTags returns build tags
|
||||
func buildTags() string {
|
||||
return *tags
|
||||
}
|
||||
|
||||
// Param is function parameter
|
||||
type Param struct {
|
||||
Name string
|
||||
Type string
|
||||
}
|
||||
|
||||
// usage prints the program usage
|
||||
func usage() {
|
||||
fmt.Fprintf(os.Stderr, "usage: go run mksyscall.go [-b32 | -l32] [-tags x,y] [file ...]\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// parseParamList parses parameter list and returns a slice of parameters
|
||||
func parseParamList(list string) []string {
|
||||
list = strings.TrimSpace(list)
|
||||
if list == "" {
|
||||
return []string{}
|
||||
}
|
||||
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
|
||||
}
|
||||
|
||||
// parseParam splits a parameter into name and type
|
||||
func parseParam(p string) Param {
|
||||
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
|
||||
if ps == nil {
|
||||
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
|
||||
os.Exit(1)
|
||||
}
|
||||
return Param{ps[1], ps[2]}
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Get the OS and architecture (using GOARCH_TARGET if it exists)
|
||||
goos := os.Getenv("GOOS")
|
||||
if goos == "" {
|
||||
fmt.Fprintln(os.Stderr, "GOOS not defined in environment")
|
||||
os.Exit(1)
|
||||
}
|
||||
goarch := os.Getenv("GOARCH_TARGET")
|
||||
if goarch == "" {
|
||||
goarch = os.Getenv("GOARCH")
|
||||
}
|
||||
|
||||
// Check that we are using the Docker-based build system if we should
|
||||
if goos == "linux" {
|
||||
if os.Getenv("GOLANG_SYS_BUILD") != "docker" {
|
||||
fmt.Fprintf(os.Stderr, "In the Docker-based build system, mksyscall should not be called directly.\n")
|
||||
fmt.Fprintf(os.Stderr, "See README.md\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
flag.Usage = usage
|
||||
flag.Parse()
|
||||
if len(flag.Args()) <= 0 {
|
||||
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
|
||||
usage()
|
||||
}
|
||||
|
||||
endianness := ""
|
||||
if *b32 {
|
||||
endianness = "big-endian"
|
||||
} else if *l32 {
|
||||
endianness = "little-endian"
|
||||
}
|
||||
|
||||
libc := false
|
||||
if goos == "darwin" && strings.Contains(buildTags(), ",go1.12") {
|
||||
libc = true
|
||||
}
|
||||
trampolines := map[string]bool{}
|
||||
|
||||
text := ""
|
||||
for _, path := range flag.Args() {
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
s := bufio.NewScanner(file)
|
||||
for s.Scan() {
|
||||
t := s.Text()
|
||||
t = strings.TrimSpace(t)
|
||||
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
|
||||
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
|
||||
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
// Line must be of the form
|
||||
// func Open(path string, mode int, perm int) (fd int, errno error)
|
||||
// Split into name, in params, out params.
|
||||
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$`).FindStringSubmatch(t)
|
||||
if f == nil {
|
||||
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
|
||||
os.Exit(1)
|
||||
}
|
||||
funct, inps, outps, sysname := f[2], f[3], f[4], f[5]
|
||||
|
||||
// Split argument lists on comma.
|
||||
in := parseParamList(inps)
|
||||
out := parseParamList(outps)
|
||||
|
||||
// Try in vain to keep people from editing this file.
|
||||
// The theory is that they jump into the middle of the file
|
||||
// without reading the header.
|
||||
text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
||||
|
||||
// Go function header.
|
||||
outDecl := ""
|
||||
if len(out) > 0 {
|
||||
outDecl = fmt.Sprintf(" (%s)", strings.Join(out, ", "))
|
||||
}
|
||||
text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outDecl)
|
||||
|
||||
// Check if err return available
|
||||
errvar := ""
|
||||
for _, param := range out {
|
||||
p := parseParam(param)
|
||||
if p.Type == "error" {
|
||||
errvar = p.Name
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare arguments to Syscall.
|
||||
var args []string
|
||||
n := 0
|
||||
for _, param := range in {
|
||||
p := parseParam(param)
|
||||
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
||||
args = append(args, "uintptr(unsafe.Pointer("+p.Name+"))")
|
||||
} else if p.Type == "string" && errvar != "" {
|
||||
text += fmt.Sprintf("\tvar _p%d *byte\n", n)
|
||||
text += fmt.Sprintf("\t_p%d, %s = BytePtrFromString(%s)\n", n, errvar, p.Name)
|
||||
text += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
|
||||
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
||||
n++
|
||||
} else if p.Type == "string" {
|
||||
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
|
||||
text += fmt.Sprintf("\tvar _p%d *byte\n", n)
|
||||
text += fmt.Sprintf("\t_p%d, _ = BytePtrFromString(%s)\n", n, p.Name)
|
||||
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
||||
n++
|
||||
} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
|
||||
// Convert slice into pointer, length.
|
||||
// Have to be careful not to take address of &a[0] if len == 0:
|
||||
// pass dummy pointer in that case.
|
||||
// Used to pass nil, but some OSes or simulators reject write(fd, nil, 0).
|
||||
text += fmt.Sprintf("\tvar _p%d unsafe.Pointer\n", n)
|
||||
text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = unsafe.Pointer(&%s[0])\n\t}", p.Name, n, p.Name)
|
||||
text += fmt.Sprintf(" else {\n\t\t_p%d = unsafe.Pointer(&_zero)\n\t}\n", n)
|
||||
args = append(args, fmt.Sprintf("uintptr(_p%d)", n), fmt.Sprintf("uintptr(len(%s))", p.Name))
|
||||
n++
|
||||
} else if p.Type == "int64" && (*openbsd || *netbsd) {
|
||||
args = append(args, "0")
|
||||
if endianness == "big-endian" {
|
||||
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
} else if endianness == "little-endian" {
|
||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
||||
} else {
|
||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
}
|
||||
} else if p.Type == "int64" && *dragonfly {
|
||||
if regexp.MustCompile(`^(?i)extp(read|write)`).FindStringSubmatch(funct) == nil {
|
||||
args = append(args, "0")
|
||||
}
|
||||
if endianness == "big-endian" {
|
||||
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
} else if endianness == "little-endian" {
|
||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
||||
} else {
|
||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
}
|
||||
} else if p.Type == "int64" && endianness != "" {
|
||||
if len(args)%2 == 1 && *arm {
|
||||
// arm abi specifies 64-bit argument uses
|
||||
// (even, odd) pair
|
||||
args = append(args, "0")
|
||||
}
|
||||
if endianness == "big-endian" {
|
||||
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
} else {
|
||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
||||
}
|
||||
} else {
|
||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
}
|
||||
}
|
||||
|
||||
// Determine which form to use; pad args with zeros.
|
||||
asm := "Syscall"
|
||||
if nonblock != nil {
|
||||
if errvar == "" && goos == "linux" {
|
||||
asm = "RawSyscallNoError"
|
||||
} else {
|
||||
asm = "RawSyscall"
|
||||
}
|
||||
} else {
|
||||
if errvar == "" && goos == "linux" {
|
||||
asm = "SyscallNoError"
|
||||
}
|
||||
}
|
||||
if len(args) <= 3 {
|
||||
for len(args) < 3 {
|
||||
args = append(args, "0")
|
||||
}
|
||||
} else if len(args) <= 6 {
|
||||
asm += "6"
|
||||
for len(args) < 6 {
|
||||
args = append(args, "0")
|
||||
}
|
||||
} else if len(args) <= 9 {
|
||||
asm += "9"
|
||||
for len(args) < 9 {
|
||||
args = append(args, "0")
|
||||
}
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, "%s:%s too many arguments to system call\n", path, funct)
|
||||
}
|
||||
|
||||
// System call number.
|
||||
if sysname == "" {
|
||||
sysname = "SYS_" + funct
|
||||
sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
|
||||
sysname = strings.ToUpper(sysname)
|
||||
}
|
||||
|
||||
var libcFn string
|
||||
if libc {
|
||||
asm = "syscall_" + strings.ToLower(asm[:1]) + asm[1:] // internal syscall call
|
||||
sysname = strings.TrimPrefix(sysname, "SYS_") // remove SYS_
|
||||
sysname = strings.ToLower(sysname) // lowercase
|
||||
if sysname == "getdirentries64" {
|
||||
// Special case - libSystem name and
|
||||
// raw syscall name don't match.
|
||||
sysname = "__getdirentries64"
|
||||
}
|
||||
libcFn = sysname
|
||||
sysname = "funcPC(libc_" + sysname + "_trampoline)"
|
||||
}
|
||||
|
||||
// Actual call.
|
||||
arglist := strings.Join(args, ", ")
|
||||
call := fmt.Sprintf("%s(%s, %s)", asm, sysname, arglist)
|
||||
|
||||
// Assign return values.
|
||||
body := ""
|
||||
ret := []string{"_", "_", "_"}
|
||||
doErrno := false
|
||||
for i := 0; i < len(out); i++ {
|
||||
p := parseParam(out[i])
|
||||
reg := ""
|
||||
if p.Name == "err" && !*plan9 {
|
||||
reg = "e1"
|
||||
ret[2] = reg
|
||||
doErrno = true
|
||||
} else if p.Name == "err" && *plan9 {
|
||||
ret[0] = "r0"
|
||||
ret[2] = "e1"
|
||||
break
|
||||
} else {
|
||||
reg = fmt.Sprintf("r%d", i)
|
||||
ret[i] = reg
|
||||
}
|
||||
if p.Type == "bool" {
|
||||
reg = fmt.Sprintf("%s != 0", reg)
|
||||
}
|
||||
if p.Type == "int64" && endianness != "" {
|
||||
// 64-bit number in r1:r0 or r0:r1.
|
||||
if i+2 > len(out) {
|
||||
fmt.Fprintf(os.Stderr, "%s:%s not enough registers for int64 return\n", path, funct)
|
||||
}
|
||||
if endianness == "big-endian" {
|
||||
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i, i+1)
|
||||
} else {
|
||||
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i+1, i)
|
||||
}
|
||||
ret[i] = fmt.Sprintf("r%d", i)
|
||||
ret[i+1] = fmt.Sprintf("r%d", i+1)
|
||||
}
|
||||
if reg != "e1" || *plan9 {
|
||||
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
|
||||
}
|
||||
}
|
||||
if ret[0] == "_" && ret[1] == "_" && ret[2] == "_" {
|
||||
text += fmt.Sprintf("\t%s\n", call)
|
||||
} else {
|
||||
if errvar == "" && goos == "linux" {
|
||||
// raw syscall without error on Linux, see golang.org/issue/22924
|
||||
text += fmt.Sprintf("\t%s, %s := %s\n", ret[0], ret[1], call)
|
||||
} else {
|
||||
text += fmt.Sprintf("\t%s, %s, %s := %s\n", ret[0], ret[1], ret[2], call)
|
||||
}
|
||||
}
|
||||
text += body
|
||||
|
||||
if *plan9 && ret[2] == "e1" {
|
||||
text += "\tif int32(r0) == -1 {\n"
|
||||
text += "\t\terr = e1\n"
|
||||
text += "\t}\n"
|
||||
} else if doErrno {
|
||||
text += "\tif e1 != 0 {\n"
|
||||
text += "\t\terr = errnoErr(e1)\n"
|
||||
text += "\t}\n"
|
||||
}
|
||||
text += "\treturn\n"
|
||||
text += "}\n\n"
|
||||
|
||||
if libc && !trampolines[libcFn] {
|
||||
// some system calls share a trampoline, like read and readlen.
|
||||
trampolines[libcFn] = true
|
||||
// Declare assembly trampoline.
|
||||
text += fmt.Sprintf("func libc_%s_trampoline()\n", libcFn)
|
||||
// Assembly trampoline calls the libc_* function, which this magic
|
||||
// redirects to use the function from libSystem.
|
||||
text += fmt.Sprintf("//go:linkname libc_%s libc_%s\n", libcFn, libcFn)
|
||||
text += fmt.Sprintf("//go:cgo_import_dynamic libc_%s %s \"/usr/lib/libSystem.B.dylib\"\n", libcFn, libcFn)
|
||||
text += "\n"
|
||||
}
|
||||
}
|
||||
if err := s.Err(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
file.Close()
|
||||
}
|
||||
fmt.Printf(srcTemplate, cmdLine(), buildTags(), text)
|
||||
}
|
||||
|
||||
const srcTemplate = `// %s
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build %s
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var _ syscall.Errno
|
||||
|
||||
%s
|
||||
`
|
|
@ -1,341 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
# 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.
|
||||
|
||||
# This program reads a file containing function prototypes
|
||||
# (like syscall_darwin.go) and generates system call bodies.
|
||||
# The prototypes are marked by lines beginning with "//sys"
|
||||
# and read like func declarations if //sys is replaced by func, but:
|
||||
# * The parameter lists must give a name for each argument.
|
||||
# This includes return parameters.
|
||||
# * The parameter lists must give a type for each argument:
|
||||
# the (x, y, z int) shorthand is not allowed.
|
||||
# * If the return parameter is an error number, it must be named errno.
|
||||
|
||||
# A line beginning with //sysnb is like //sys, except that the
|
||||
# goroutine will not be suspended during the execution of the system
|
||||
# call. This must only be used for system calls which can never
|
||||
# block, as otherwise the system call could cause all goroutines to
|
||||
# hang.
|
||||
|
||||
use strict;
|
||||
|
||||
my $cmdline = "mksyscall.pl " . join(' ', @ARGV);
|
||||
my $errors = 0;
|
||||
my $_32bit = "";
|
||||
my $plan9 = 0;
|
||||
my $openbsd = 0;
|
||||
my $netbsd = 0;
|
||||
my $dragonfly = 0;
|
||||
my $arm = 0; # 64-bit value should use (even, odd)-pair
|
||||
my $tags = ""; # build tags
|
||||
|
||||
if($ARGV[0] eq "-b32") {
|
||||
$_32bit = "big-endian";
|
||||
shift;
|
||||
} elsif($ARGV[0] eq "-l32") {
|
||||
$_32bit = "little-endian";
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-plan9") {
|
||||
$plan9 = 1;
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-openbsd") {
|
||||
$openbsd = 1;
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-netbsd") {
|
||||
$netbsd = 1;
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-dragonfly") {
|
||||
$dragonfly = 1;
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-arm") {
|
||||
$arm = 1;
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-tags") {
|
||||
shift;
|
||||
$tags = $ARGV[0];
|
||||
shift;
|
||||
}
|
||||
|
||||
if($ARGV[0] =~ /^-/) {
|
||||
print STDERR "usage: mksyscall.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Check that we are using the new build system if we should
|
||||
if($ENV{'GOOS'} eq "linux" && $ENV{'GOARCH'} ne "sparc64") {
|
||||
if($ENV{'GOLANG_SYS_BUILD'} ne "docker") {
|
||||
print STDERR "In the new build system, mksyscall should not be called directly.\n";
|
||||
print STDERR "See README.md\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub parseparamlist($) {
|
||||
my ($list) = @_;
|
||||
$list =~ s/^\s*//;
|
||||
$list =~ s/\s*$//;
|
||||
if($list eq "") {
|
||||
return ();
|
||||
}
|
||||
return split(/\s*,\s*/, $list);
|
||||
}
|
||||
|
||||
sub parseparam($) {
|
||||
my ($p) = @_;
|
||||
if($p !~ /^(\S*) (\S*)$/) {
|
||||
print STDERR "$ARGV:$.: malformed parameter: $p\n";
|
||||
$errors = 1;
|
||||
return ("xx", "int");
|
||||
}
|
||||
return ($1, $2);
|
||||
}
|
||||
|
||||
my $text = "";
|
||||
while(<>) {
|
||||
chomp;
|
||||
s/\s+/ /g;
|
||||
s/^\s+//;
|
||||
s/\s+$//;
|
||||
my $nonblock = /^\/\/sysnb /;
|
||||
next if !/^\/\/sys / && !$nonblock;
|
||||
|
||||
# Line must be of the form
|
||||
# func Open(path string, mode int, perm int) (fd int, errno error)
|
||||
# Split into name, in params, out params.
|
||||
if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$/) {
|
||||
print STDERR "$ARGV:$.: malformed //sys declaration\n";
|
||||
$errors = 1;
|
||||
next;
|
||||
}
|
||||
my ($func, $in, $out, $sysname) = ($2, $3, $4, $5);
|
||||
|
||||
# Split argument lists on comma.
|
||||
my @in = parseparamlist($in);
|
||||
my @out = parseparamlist($out);
|
||||
|
||||
# Try in vain to keep people from editing this file.
|
||||
# The theory is that they jump into the middle of the file
|
||||
# without reading the header.
|
||||
$text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
|
||||
|
||||
# Go function header.
|
||||
my $out_decl = @out ? sprintf(" (%s)", join(', ', @out)) : "";
|
||||
$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out_decl;
|
||||
|
||||
# Check if err return available
|
||||
my $errvar = "";
|
||||
foreach my $p (@out) {
|
||||
my ($name, $type) = parseparam($p);
|
||||
if($type eq "error") {
|
||||
$errvar = $name;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# Prepare arguments to Syscall.
|
||||
my @args = ();
|
||||
my $n = 0;
|
||||
foreach my $p (@in) {
|
||||
my ($name, $type) = parseparam($p);
|
||||
if($type =~ /^\*/) {
|
||||
push @args, "uintptr(unsafe.Pointer($name))";
|
||||
} elsif($type eq "string" && $errvar ne "") {
|
||||
$text .= "\tvar _p$n *byte\n";
|
||||
$text .= "\t_p$n, $errvar = BytePtrFromString($name)\n";
|
||||
$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
|
||||
push @args, "uintptr(unsafe.Pointer(_p$n))";
|
||||
$n++;
|
||||
} elsif($type eq "string") {
|
||||
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
|
||||
$text .= "\tvar _p$n *byte\n";
|
||||
$text .= "\t_p$n, _ = BytePtrFromString($name)\n";
|
||||
push @args, "uintptr(unsafe.Pointer(_p$n))";
|
||||
$n++;
|
||||
} elsif($type =~ /^\[\](.*)/) {
|
||||
# Convert slice into pointer, length.
|
||||
# Have to be careful not to take address of &a[0] if len == 0:
|
||||
# pass dummy pointer in that case.
|
||||
# Used to pass nil, but some OSes or simulators reject write(fd, nil, 0).
|
||||
$text .= "\tvar _p$n unsafe.Pointer\n";
|
||||
$text .= "\tif len($name) > 0 {\n\t\t_p$n = unsafe.Pointer(\&${name}[0])\n\t}";
|
||||
$text .= " else {\n\t\t_p$n = unsafe.Pointer(&_zero)\n\t}";
|
||||
$text .= "\n";
|
||||
push @args, "uintptr(_p$n)", "uintptr(len($name))";
|
||||
$n++;
|
||||
} elsif($type eq "int64" && ($openbsd || $netbsd)) {
|
||||
push @args, "0";
|
||||
if($_32bit eq "big-endian") {
|
||||
push @args, "uintptr($name>>32)", "uintptr($name)";
|
||||
} elsif($_32bit eq "little-endian") {
|
||||
push @args, "uintptr($name)", "uintptr($name>>32)";
|
||||
} else {
|
||||
push @args, "uintptr($name)";
|
||||
}
|
||||
} elsif($type eq "int64" && $dragonfly) {
|
||||
if ($func !~ /^extp(read|write)/i) {
|
||||
push @args, "0";
|
||||
}
|
||||
if($_32bit eq "big-endian") {
|
||||
push @args, "uintptr($name>>32)", "uintptr($name)";
|
||||
} elsif($_32bit eq "little-endian") {
|
||||
push @args, "uintptr($name)", "uintptr($name>>32)";
|
||||
} else {
|
||||
push @args, "uintptr($name)";
|
||||
}
|
||||
} elsif($type eq "int64" && $_32bit ne "") {
|
||||
if(@args % 2 && $arm) {
|
||||
# arm abi specifies 64-bit argument uses
|
||||
# (even, odd) pair
|
||||
push @args, "0"
|
||||
}
|
||||
if($_32bit eq "big-endian") {
|
||||
push @args, "uintptr($name>>32)", "uintptr($name)";
|
||||
} else {
|
||||
push @args, "uintptr($name)", "uintptr($name>>32)";
|
||||
}
|
||||
} else {
|
||||
push @args, "uintptr($name)";
|
||||
}
|
||||
}
|
||||
|
||||
# Determine which form to use; pad args with zeros.
|
||||
my $asm = "Syscall";
|
||||
if ($nonblock) {
|
||||
if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
|
||||
$asm = "RawSyscallNoError";
|
||||
} else {
|
||||
$asm = "RawSyscall";
|
||||
}
|
||||
} else {
|
||||
if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
|
||||
$asm = "SyscallNoError";
|
||||
}
|
||||
}
|
||||
if(@args <= 3) {
|
||||
while(@args < 3) {
|
||||
push @args, "0";
|
||||
}
|
||||
} elsif(@args <= 6) {
|
||||
$asm .= "6";
|
||||
while(@args < 6) {
|
||||
push @args, "0";
|
||||
}
|
||||
} elsif(@args <= 9) {
|
||||
$asm .= "9";
|
||||
while(@args < 9) {
|
||||
push @args, "0";
|
||||
}
|
||||
} else {
|
||||
print STDERR "$ARGV:$.: too many arguments to system call\n";
|
||||
}
|
||||
|
||||
# System call number.
|
||||
if($sysname eq "") {
|
||||
$sysname = "SYS_$func";
|
||||
$sysname =~ s/([a-z])([A-Z])/${1}_$2/g; # turn FooBar into Foo_Bar
|
||||
$sysname =~ y/a-z/A-Z/;
|
||||
}
|
||||
|
||||
# Actual call.
|
||||
my $args = join(', ', @args);
|
||||
my $call = "$asm($sysname, $args)";
|
||||
|
||||
# Assign return values.
|
||||
my $body = "";
|
||||
my @ret = ("_", "_", "_");
|
||||
my $do_errno = 0;
|
||||
for(my $i=0; $i<@out; $i++) {
|
||||
my $p = $out[$i];
|
||||
my ($name, $type) = parseparam($p);
|
||||
my $reg = "";
|
||||
if($name eq "err" && !$plan9) {
|
||||
$reg = "e1";
|
||||
$ret[2] = $reg;
|
||||
$do_errno = 1;
|
||||
} elsif($name eq "err" && $plan9) {
|
||||
$ret[0] = "r0";
|
||||
$ret[2] = "e1";
|
||||
next;
|
||||
} else {
|
||||
$reg = sprintf("r%d", $i);
|
||||
$ret[$i] = $reg;
|
||||
}
|
||||
if($type eq "bool") {
|
||||
$reg = "$reg != 0";
|
||||
}
|
||||
if($type eq "int64" && $_32bit ne "") {
|
||||
# 64-bit number in r1:r0 or r0:r1.
|
||||
if($i+2 > @out) {
|
||||
print STDERR "$ARGV:$.: not enough registers for int64 return\n";
|
||||
}
|
||||
if($_32bit eq "big-endian") {
|
||||
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1);
|
||||
} else {
|
||||
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i);
|
||||
}
|
||||
$ret[$i] = sprintf("r%d", $i);
|
||||
$ret[$i+1] = sprintf("r%d", $i+1);
|
||||
}
|
||||
if($reg ne "e1" || $plan9) {
|
||||
$body .= "\t$name = $type($reg)\n";
|
||||
}
|
||||
}
|
||||
if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
|
||||
$text .= "\t$call\n";
|
||||
} else {
|
||||
if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
|
||||
# raw syscall without error on Linux, see golang.org/issue/22924
|
||||
$text .= "\t$ret[0], $ret[1] := $call\n";
|
||||
} else {
|
||||
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
|
||||
}
|
||||
}
|
||||
$text .= $body;
|
||||
|
||||
if ($plan9 && $ret[2] eq "e1") {
|
||||
$text .= "\tif int32(r0) == -1 {\n";
|
||||
$text .= "\t\terr = e1\n";
|
||||
$text .= "\t}\n";
|
||||
} elsif ($do_errno) {
|
||||
$text .= "\tif e1 != 0 {\n";
|
||||
$text .= "\t\terr = errnoErr(e1)\n";
|
||||
$text .= "\t}\n";
|
||||
}
|
||||
$text .= "\treturn\n";
|
||||
$text .= "}\n\n";
|
||||
}
|
||||
|
||||
chomp $text;
|
||||
chomp $text;
|
||||
|
||||
if($errors) {
|
||||
exit 1;
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
// $cmdline
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $tags
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var _ syscall.Errno
|
||||
|
||||
$text
|
||||
EOF
|
||||
exit 0;
|
|
@ -0,0 +1,404 @@
|
|||
// 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 ignore
|
||||
|
||||
/*
|
||||
This program reads a file containing function prototypes
|
||||
(like syscall_aix.go) and generates system call bodies.
|
||||
The prototypes are marked by lines beginning with "//sys"
|
||||
and read like func declarations if //sys is replaced by func, but:
|
||||
* The parameter lists must give a name for each argument.
|
||||
This includes return parameters.
|
||||
* The parameter lists must give a type for each argument:
|
||||
the (x, y, z int) shorthand is not allowed.
|
||||
* If the return parameter is an error number, it must be named err.
|
||||
* If go func name needs to be different than its libc name,
|
||||
* or the function is not in libc, name could be specified
|
||||
* at the end, after "=" sign, like
|
||||
//sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
b32 = flag.Bool("b32", false, "32bit big-endian")
|
||||
l32 = flag.Bool("l32", false, "32bit little-endian")
|
||||
aix = flag.Bool("aix", false, "aix")
|
||||
tags = flag.String("tags", "", "build tags")
|
||||
)
|
||||
|
||||
// cmdLine returns this programs's commandline arguments
|
||||
func cmdLine() string {
|
||||
return "go run mksyscall_aix_ppc.go " + strings.Join(os.Args[1:], " ")
|
||||
}
|
||||
|
||||
// buildTags returns build tags
|
||||
func buildTags() string {
|
||||
return *tags
|
||||
}
|
||||
|
||||
// Param is function parameter
|
||||
type Param struct {
|
||||
Name string
|
||||
Type string
|
||||
}
|
||||
|
||||
// usage prints the program usage
|
||||
func usage() {
|
||||
fmt.Fprintf(os.Stderr, "usage: go run mksyscall_aix_ppc.go [-b32 | -l32] [-tags x,y] [file ...]\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// parseParamList parses parameter list and returns a slice of parameters
|
||||
func parseParamList(list string) []string {
|
||||
list = strings.TrimSpace(list)
|
||||
if list == "" {
|
||||
return []string{}
|
||||
}
|
||||
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
|
||||
}
|
||||
|
||||
// parseParam splits a parameter into name and type
|
||||
func parseParam(p string) Param {
|
||||
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
|
||||
if ps == nil {
|
||||
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
|
||||
os.Exit(1)
|
||||
}
|
||||
return Param{ps[1], ps[2]}
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Usage = usage
|
||||
flag.Parse()
|
||||
if len(flag.Args()) <= 0 {
|
||||
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
|
||||
usage()
|
||||
}
|
||||
|
||||
endianness := ""
|
||||
if *b32 {
|
||||
endianness = "big-endian"
|
||||
} else if *l32 {
|
||||
endianness = "little-endian"
|
||||
}
|
||||
|
||||
pack := ""
|
||||
text := ""
|
||||
cExtern := "/*\n#include <stdint.h>\n#include <stddef.h>\n"
|
||||
for _, path := range flag.Args() {
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
s := bufio.NewScanner(file)
|
||||
for s.Scan() {
|
||||
t := s.Text()
|
||||
t = strings.TrimSpace(t)
|
||||
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
|
||||
if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
|
||||
pack = p[1]
|
||||
}
|
||||
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
|
||||
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
// Line must be of the form
|
||||
// func Open(path string, mode int, perm int) (fd int, err error)
|
||||
// Split into name, in params, out params.
|
||||
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
|
||||
if f == nil {
|
||||
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
|
||||
os.Exit(1)
|
||||
}
|
||||
funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
|
||||
|
||||
// Split argument lists on comma.
|
||||
in := parseParamList(inps)
|
||||
out := parseParamList(outps)
|
||||
|
||||
inps = strings.Join(in, ", ")
|
||||
outps = strings.Join(out, ", ")
|
||||
|
||||
// Try in vain to keep people from editing this file.
|
||||
// The theory is that they jump into the middle of the file
|
||||
// without reading the header.
|
||||
text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
||||
|
||||
// Check if value return, err return available
|
||||
errvar := ""
|
||||
retvar := ""
|
||||
rettype := ""
|
||||
for _, param := range out {
|
||||
p := parseParam(param)
|
||||
if p.Type == "error" {
|
||||
errvar = p.Name
|
||||
} else {
|
||||
retvar = p.Name
|
||||
rettype = p.Type
|
||||
}
|
||||
}
|
||||
|
||||
// System call name.
|
||||
if sysname == "" {
|
||||
sysname = funct
|
||||
}
|
||||
sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
|
||||
sysname = strings.ToLower(sysname) // All libc functions are lowercase.
|
||||
|
||||
cRettype := ""
|
||||
if rettype == "unsafe.Pointer" {
|
||||
cRettype = "uintptr_t"
|
||||
} else if rettype == "uintptr" {
|
||||
cRettype = "uintptr_t"
|
||||
} else if regexp.MustCompile(`^_`).FindStringSubmatch(rettype) != nil {
|
||||
cRettype = "uintptr_t"
|
||||
} else if rettype == "int" {
|
||||
cRettype = "int"
|
||||
} else if rettype == "int32" {
|
||||
cRettype = "int"
|
||||
} else if rettype == "int64" {
|
||||
cRettype = "long long"
|
||||
} else if rettype == "uint32" {
|
||||
cRettype = "unsigned int"
|
||||
} else if rettype == "uint64" {
|
||||
cRettype = "unsigned long long"
|
||||
} else {
|
||||
cRettype = "int"
|
||||
}
|
||||
if sysname == "exit" {
|
||||
cRettype = "void"
|
||||
}
|
||||
|
||||
// Change p.Types to c
|
||||
var cIn []string
|
||||
for _, param := range in {
|
||||
p := parseParam(param)
|
||||
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
||||
cIn = append(cIn, "uintptr_t")
|
||||
} else if p.Type == "string" {
|
||||
cIn = append(cIn, "uintptr_t")
|
||||
} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
|
||||
cIn = append(cIn, "uintptr_t", "size_t")
|
||||
} else if p.Type == "unsafe.Pointer" {
|
||||
cIn = append(cIn, "uintptr_t")
|
||||
} else if p.Type == "uintptr" {
|
||||
cIn = append(cIn, "uintptr_t")
|
||||
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
|
||||
cIn = append(cIn, "uintptr_t")
|
||||
} else if p.Type == "int" {
|
||||
cIn = append(cIn, "int")
|
||||
} else if p.Type == "int32" {
|
||||
cIn = append(cIn, "int")
|
||||
} else if p.Type == "int64" {
|
||||
cIn = append(cIn, "long long")
|
||||
} else if p.Type == "uint32" {
|
||||
cIn = append(cIn, "unsigned int")
|
||||
} else if p.Type == "uint64" {
|
||||
cIn = append(cIn, "unsigned long long")
|
||||
} else {
|
||||
cIn = append(cIn, "int")
|
||||
}
|
||||
}
|
||||
|
||||
if funct != "fcntl" && funct != "FcntlInt" && funct != "readlen" && funct != "writelen" {
|
||||
// Imports of system calls from libc
|
||||
cExtern += fmt.Sprintf("%s %s", cRettype, sysname)
|
||||
cIn := strings.Join(cIn, ", ")
|
||||
cExtern += fmt.Sprintf("(%s);\n", cIn)
|
||||
}
|
||||
|
||||
// So file name.
|
||||
if *aix {
|
||||
if modname == "" {
|
||||
modname = "libc.a/shr_64.o"
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, "%s: only syscall using libc are available\n", funct)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
strconvfunc := "C.CString"
|
||||
|
||||
// Go function header.
|
||||
if outps != "" {
|
||||
outps = fmt.Sprintf(" (%s)", outps)
|
||||
}
|
||||
if text != "" {
|
||||
text += "\n"
|
||||
}
|
||||
|
||||
text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outps)
|
||||
|
||||
// Prepare arguments to Syscall.
|
||||
var args []string
|
||||
n := 0
|
||||
argN := 0
|
||||
for _, param := range in {
|
||||
p := parseParam(param)
|
||||
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
||||
args = append(args, "C.uintptr_t(uintptr(unsafe.Pointer("+p.Name+")))")
|
||||
} else if p.Type == "string" && errvar != "" {
|
||||
text += fmt.Sprintf("\t_p%d := uintptr(unsafe.Pointer(%s(%s)))\n", n, strconvfunc, p.Name)
|
||||
args = append(args, fmt.Sprintf("C.uintptr_t(_p%d)", n))
|
||||
n++
|
||||
} else if p.Type == "string" {
|
||||
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
|
||||
text += fmt.Sprintf("\t_p%d := uintptr(unsafe.Pointer(%s(%s)))\n", n, strconvfunc, p.Name)
|
||||
args = append(args, fmt.Sprintf("C.uintptr_t(_p%d)", n))
|
||||
n++
|
||||
} else if m := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); m != nil {
|
||||
// Convert slice into pointer, length.
|
||||
// Have to be careful not to take address of &a[0] if len == 0:
|
||||
// pass nil in that case.
|
||||
text += fmt.Sprintf("\tvar _p%d *%s\n", n, m[1])
|
||||
text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
|
||||
args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(unsafe.Pointer(_p%d)))", n))
|
||||
n++
|
||||
text += fmt.Sprintf("\tvar _p%d int\n", n)
|
||||
text += fmt.Sprintf("\t_p%d = len(%s)\n", n, p.Name)
|
||||
args = append(args, fmt.Sprintf("C.size_t(_p%d)", n))
|
||||
n++
|
||||
} else if p.Type == "int64" && endianness != "" {
|
||||
if endianness == "big-endian" {
|
||||
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
} else {
|
||||
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
||||
}
|
||||
n++
|
||||
} else if p.Type == "bool" {
|
||||
text += fmt.Sprintf("\tvar _p%d uint32\n", n)
|
||||
text += fmt.Sprintf("\tif %s {\n\t\t_p%d = 1\n\t} else {\n\t\t_p%d = 0\n\t}\n", p.Name, n, n)
|
||||
args = append(args, fmt.Sprintf("_p%d", n))
|
||||
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
|
||||
args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(%s))", p.Name))
|
||||
} else if p.Type == "unsafe.Pointer" {
|
||||
args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(%s))", p.Name))
|
||||
} else if p.Type == "int" {
|
||||
if (argN == 2) && ((funct == "readlen") || (funct == "writelen")) {
|
||||
args = append(args, fmt.Sprintf("C.size_t(%s)", p.Name))
|
||||
} else if argN == 0 && funct == "fcntl" {
|
||||
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||
} else if (argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt")) {
|
||||
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||
} else {
|
||||
args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
|
||||
}
|
||||
} else if p.Type == "int32" {
|
||||
args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
|
||||
} else if p.Type == "int64" {
|
||||
args = append(args, fmt.Sprintf("C.longlong(%s)", p.Name))
|
||||
} else if p.Type == "uint32" {
|
||||
args = append(args, fmt.Sprintf("C.uint(%s)", p.Name))
|
||||
} else if p.Type == "uint64" {
|
||||
args = append(args, fmt.Sprintf("C.ulonglong(%s)", p.Name))
|
||||
} else if p.Type == "uintptr" {
|
||||
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||
} else {
|
||||
args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
|
||||
}
|
||||
argN++
|
||||
}
|
||||
|
||||
// Actual call.
|
||||
arglist := strings.Join(args, ", ")
|
||||
call := ""
|
||||
if sysname == "exit" {
|
||||
if errvar != "" {
|
||||
call += "er :="
|
||||
} else {
|
||||
call += ""
|
||||
}
|
||||
} else if errvar != "" {
|
||||
call += "r0,er :="
|
||||
} else if retvar != "" {
|
||||
call += "r0,_ :="
|
||||
} else {
|
||||
call += ""
|
||||
}
|
||||
call += fmt.Sprintf("C.%s(%s)", sysname, arglist)
|
||||
|
||||
// Assign return values.
|
||||
body := ""
|
||||
for i := 0; i < len(out); i++ {
|
||||
p := parseParam(out[i])
|
||||
reg := ""
|
||||
if p.Name == "err" {
|
||||
reg = "e1"
|
||||
} else {
|
||||
reg = "r0"
|
||||
}
|
||||
if reg != "e1" {
|
||||
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
|
||||
}
|
||||
}
|
||||
|
||||
// verify return
|
||||
if sysname != "exit" && errvar != "" {
|
||||
if regexp.MustCompile(`^uintptr`).FindStringSubmatch(cRettype) != nil {
|
||||
body += "\tif (uintptr(r0) ==^uintptr(0) && er != nil) {\n"
|
||||
body += fmt.Sprintf("\t\t%s = er\n", errvar)
|
||||
body += "\t}\n"
|
||||
} else {
|
||||
body += "\tif (r0 ==-1 && er != nil) {\n"
|
||||
body += fmt.Sprintf("\t\t%s = er\n", errvar)
|
||||
body += "\t}\n"
|
||||
}
|
||||
} else if errvar != "" {
|
||||
body += "\tif (er != nil) {\n"
|
||||
body += fmt.Sprintf("\t\t%s = er\n", errvar)
|
||||
body += "\t}\n"
|
||||
}
|
||||
|
||||
text += fmt.Sprintf("\t%s\n", call)
|
||||
text += body
|
||||
|
||||
text += "\treturn\n"
|
||||
text += "}\n"
|
||||
}
|
||||
if err := s.Err(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
file.Close()
|
||||
}
|
||||
imp := ""
|
||||
if pack != "unix" {
|
||||
imp = "import \"golang.org/x/sys/unix\"\n"
|
||||
|
||||
}
|
||||
fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, cExtern, imp, text)
|
||||
}
|
||||
|
||||
const srcTemplate = `// %s
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build %s
|
||||
|
||||
package %s
|
||||
|
||||
|
||||
%s
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
|
||||
%s
|
||||
|
||||
%s
|
||||
`
|
|
@ -1,384 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
# 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.
|
||||
|
||||
# This program reads a file containing function prototypes
|
||||
# (like syscall_aix.go) and generates system call bodies.
|
||||
# The prototypes are marked by lines beginning with "//sys"
|
||||
# and read like func declarations if //sys is replaced by func, but:
|
||||
# * The parameter lists must give a name for each argument.
|
||||
# This includes return parameters.
|
||||
# * The parameter lists must give a type for each argument:
|
||||
# the (x, y, z int) shorthand is not allowed.
|
||||
# * If the return parameter is an error number, it must be named err.
|
||||
# * If go func name needs to be different than its libc name,
|
||||
# * or the function is not in libc, name could be specified
|
||||
# * at the end, after "=" sign, like
|
||||
# //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
|
||||
|
||||
use strict;
|
||||
|
||||
my $cmdline = "mksyscall_aix_ppc.pl " . join(' ', @ARGV);
|
||||
my $errors = 0;
|
||||
my $_32bit = "";
|
||||
my $tags = ""; # build tags
|
||||
my $aix = 0;
|
||||
my $solaris = 0;
|
||||
|
||||
binmode STDOUT;
|
||||
|
||||
if($ARGV[0] eq "-b32") {
|
||||
$_32bit = "big-endian";
|
||||
shift;
|
||||
} elsif($ARGV[0] eq "-l32") {
|
||||
$_32bit = "little-endian";
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-aix") {
|
||||
$aix = 1;
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-tags") {
|
||||
shift;
|
||||
$tags = $ARGV[0];
|
||||
shift;
|
||||
}
|
||||
|
||||
if($ARGV[0] =~ /^-/) {
|
||||
print STDERR "usage: mksyscall_aix.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub parseparamlist($) {
|
||||
my ($list) = @_;
|
||||
$list =~ s/^\s*//;
|
||||
$list =~ s/\s*$//;
|
||||
if($list eq "") {
|
||||
return ();
|
||||
}
|
||||
return split(/\s*,\s*/, $list);
|
||||
}
|
||||
|
||||
sub parseparam($) {
|
||||
my ($p) = @_;
|
||||
if($p !~ /^(\S*) (\S*)$/) {
|
||||
print STDERR "$ARGV:$.: malformed parameter: $p\n";
|
||||
$errors = 1;
|
||||
return ("xx", "int");
|
||||
}
|
||||
return ($1, $2);
|
||||
}
|
||||
|
||||
my $package = "";
|
||||
my $text = "";
|
||||
my $c_extern = "/*\n#include <stdint.h>\n#include <stddef.h>\n";
|
||||
my @vars = ();
|
||||
while(<>) {
|
||||
chomp;
|
||||
s/\s+/ /g;
|
||||
s/^\s+//;
|
||||
s/\s+$//;
|
||||
$package = $1 if !$package && /^package (\S+)$/;
|
||||
my $nonblock = /^\/\/sysnb /;
|
||||
next if !/^\/\/sys / && !$nonblock;
|
||||
|
||||
# Line must be of the form
|
||||
# func Open(path string, mode int, perm int) (fd int, err error)
|
||||
# Split into name, in params, out params.
|
||||
if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) {
|
||||
print STDERR "$ARGV:$.: malformed //sys declaration\n";
|
||||
$errors = 1;
|
||||
next;
|
||||
}
|
||||
my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6);
|
||||
|
||||
# Split argument lists on comma.
|
||||
my @in = parseparamlist($in);
|
||||
my @out = parseparamlist($out);
|
||||
|
||||
$in = join(', ', @in);
|
||||
$out = join(', ', @out);
|
||||
|
||||
# Try in vain to keep people from editing this file.
|
||||
# The theory is that they jump into the middle of the file
|
||||
# without reading the header.
|
||||
$text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
|
||||
|
||||
# Check if value return, err return available
|
||||
my $errvar = "";
|
||||
my $retvar = "";
|
||||
my $rettype = "";
|
||||
foreach my $p (@out) {
|
||||
my ($name, $type) = parseparam($p);
|
||||
if($type eq "error") {
|
||||
$errvar = $name;
|
||||
} else {
|
||||
$retvar = $name;
|
||||
$rettype = $type;
|
||||
}
|
||||
}
|
||||
|
||||
# System call name.
|
||||
#if($func ne "fcntl") {
|
||||
|
||||
if($sysname eq "") {
|
||||
$sysname = "$func";
|
||||
}
|
||||
|
||||
$sysname =~ s/([a-z])([A-Z])/${1}_$2/g;
|
||||
$sysname =~ y/A-Z/a-z/; # All libc functions are lowercase.
|
||||
|
||||
my $C_rettype = "";
|
||||
if($rettype eq "unsafe.Pointer") {
|
||||
$C_rettype = "uintptr_t";
|
||||
} elsif($rettype eq "uintptr") {
|
||||
$C_rettype = "uintptr_t";
|
||||
} elsif($rettype =~ /^_/) {
|
||||
$C_rettype = "uintptr_t";
|
||||
} elsif($rettype eq "int") {
|
||||
$C_rettype = "int";
|
||||
} elsif($rettype eq "int32") {
|
||||
$C_rettype = "int";
|
||||
} elsif($rettype eq "int64") {
|
||||
$C_rettype = "long long";
|
||||
} elsif($rettype eq "uint32") {
|
||||
$C_rettype = "unsigned int";
|
||||
} elsif($rettype eq "uint64") {
|
||||
$C_rettype = "unsigned long long";
|
||||
} else {
|
||||
$C_rettype = "int";
|
||||
}
|
||||
if($sysname eq "exit") {
|
||||
$C_rettype = "void";
|
||||
}
|
||||
|
||||
# Change types to c
|
||||
my @c_in = ();
|
||||
foreach my $p (@in) {
|
||||
my ($name, $type) = parseparam($p);
|
||||
if($type =~ /^\*/) {
|
||||
push @c_in, "uintptr_t";
|
||||
} elsif($type eq "string") {
|
||||
push @c_in, "uintptr_t";
|
||||
} elsif($type =~ /^\[\](.*)/) {
|
||||
push @c_in, "uintptr_t", "size_t";
|
||||
} elsif($type eq "unsafe.Pointer") {
|
||||
push @c_in, "uintptr_t";
|
||||
} elsif($type eq "uintptr") {
|
||||
push @c_in, "uintptr_t";
|
||||
} elsif($type =~ /^_/) {
|
||||
push @c_in, "uintptr_t";
|
||||
} elsif($type eq "int") {
|
||||
push @c_in, "int";
|
||||
} elsif($type eq "int32") {
|
||||
push @c_in, "int";
|
||||
} elsif($type eq "int64") {
|
||||
push @c_in, "long long";
|
||||
} elsif($type eq "uint32") {
|
||||
push @c_in, "unsigned int";
|
||||
} elsif($type eq "uint64") {
|
||||
push @c_in, "unsigned long long";
|
||||
} else {
|
||||
push @c_in, "int";
|
||||
}
|
||||
}
|
||||
|
||||
if ($func ne "fcntl" && $func ne "FcntlInt" && $func ne "readlen" && $func ne "writelen") {
|
||||
# Imports of system calls from libc
|
||||
$c_extern .= "$C_rettype $sysname";
|
||||
my $c_in = join(', ', @c_in);
|
||||
$c_extern .= "($c_in);\n";
|
||||
}
|
||||
|
||||
# So file name.
|
||||
if($aix) {
|
||||
if($modname eq "") {
|
||||
$modname = "libc.a/shr_64.o";
|
||||
} else {
|
||||
print STDERR "$func: only syscall using libc are available\n";
|
||||
$errors = 1;
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
my $strconvfunc = "C.CString";
|
||||
my $strconvtype = "*byte";
|
||||
|
||||
# Go function header.
|
||||
if($out ne "") {
|
||||
$out = " ($out)";
|
||||
}
|
||||
if($text ne "") {
|
||||
$text .= "\n"
|
||||
}
|
||||
|
||||
$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out ;
|
||||
|
||||
# Prepare arguments to call.
|
||||
my @args = ();
|
||||
my $n = 0;
|
||||
my $arg_n = 0;
|
||||
foreach my $p (@in) {
|
||||
my ($name, $type) = parseparam($p);
|
||||
if($type =~ /^\*/) {
|
||||
push @args, "C.uintptr_t(uintptr(unsafe.Pointer($name)))";
|
||||
} elsif($type eq "string" && $errvar ne "") {
|
||||
$text .= "\t_p$n := uintptr(unsafe.Pointer($strconvfunc($name)))\n";
|
||||
push @args, "C.uintptr_t(_p$n)";
|
||||
$n++;
|
||||
} elsif($type eq "string") {
|
||||
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
|
||||
$text .= "\t_p$n := uintptr(unsafe.Pointer($strconvfunc($name)))\n";
|
||||
push @args, "C.uintptr_t(_p$n)";
|
||||
$n++;
|
||||
} elsif($type =~ /^\[\](.*)/) {
|
||||
# Convert slice into pointer, length.
|
||||
# Have to be careful not to take address of &a[0] if len == 0:
|
||||
# pass nil in that case.
|
||||
$text .= "\tvar _p$n *$1\n";
|
||||
$text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n";
|
||||
push @args, "C.uintptr_t(uintptr(unsafe.Pointer(_p$n)))";
|
||||
$n++;
|
||||
$text .= "\tvar _p$n int\n";
|
||||
$text .= "\t_p$n = len($name)\n";
|
||||
push @args, "C.size_t(_p$n)";
|
||||
$n++;
|
||||
} elsif($type eq "int64" && $_32bit ne "") {
|
||||
if($_32bit eq "big-endian") {
|
||||
push @args, "uintptr($name >> 32)", "uintptr($name)";
|
||||
} else {
|
||||
push @args, "uintptr($name)", "uintptr($name >> 32)";
|
||||
}
|
||||
$n++;
|
||||
} elsif($type eq "bool") {
|
||||
$text .= "\tvar _p$n uint32\n";
|
||||
$text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n";
|
||||
push @args, "_p$n";
|
||||
$n++;
|
||||
} elsif($type =~ /^_/) {
|
||||
push @args, "C.uintptr_t(uintptr($name))";
|
||||
} elsif($type eq "unsafe.Pointer") {
|
||||
push @args, "C.uintptr_t(uintptr($name))";
|
||||
} elsif($type eq "int") {
|
||||
if (($arg_n == 2) && (($func eq "readlen") || ($func eq "writelen"))) {
|
||||
push @args, "C.size_t($name)";
|
||||
} elsif ($arg_n == 0 && $func eq "fcntl") {
|
||||
push @args, "C.uintptr_t($name)";
|
||||
} elsif (($arg_n == 2) && (($func eq "fcntl") || ($func eq "FcntlInt"))) {
|
||||
push @args, "C.uintptr_t($name)";
|
||||
} else {
|
||||
push @args, "C.int($name)";
|
||||
}
|
||||
} elsif($type eq "int32") {
|
||||
push @args, "C.int($name)";
|
||||
} elsif($type eq "int64") {
|
||||
push @args, "C.longlong($name)";
|
||||
} elsif($type eq "uint32") {
|
||||
push @args, "C.uint($name)";
|
||||
} elsif($type eq "uint64") {
|
||||
push @args, "C.ulonglong($name)";
|
||||
} elsif($type eq "uintptr") {
|
||||
push @args, "C.uintptr_t($name)";
|
||||
} else {
|
||||
push @args, "C.int($name)";
|
||||
}
|
||||
$arg_n++;
|
||||
}
|
||||
my $nargs = @args;
|
||||
|
||||
|
||||
# Determine which form to use; pad args with zeros.
|
||||
if ($nonblock) {
|
||||
}
|
||||
|
||||
my $args = join(', ', @args);
|
||||
my $call = "";
|
||||
if ($sysname eq "exit") {
|
||||
if ($errvar ne "") {
|
||||
$call .= "er :=";
|
||||
} else {
|
||||
$call .= "";
|
||||
}
|
||||
} elsif ($errvar ne "") {
|
||||
$call .= "r0,er :=";
|
||||
} elsif ($retvar ne "") {
|
||||
$call .= "r0,_ :=";
|
||||
} else {
|
||||
$call .= ""
|
||||
}
|
||||
$call .= "C.$sysname($args)";
|
||||
|
||||
# Assign return values.
|
||||
my $body = "";
|
||||
my $failexpr = "";
|
||||
|
||||
for(my $i=0; $i<@out; $i++) {
|
||||
my $p = $out[$i];
|
||||
my ($name, $type) = parseparam($p);
|
||||
my $reg = "";
|
||||
if($name eq "err") {
|
||||
$reg = "e1";
|
||||
} else {
|
||||
$reg = "r0";
|
||||
}
|
||||
if($reg ne "e1" ) {
|
||||
$body .= "\t$name = $type($reg)\n";
|
||||
}
|
||||
}
|
||||
|
||||
# verify return
|
||||
if ($sysname ne "exit" && $errvar ne "") {
|
||||
if ($C_rettype =~ /^uintptr/) {
|
||||
$body .= "\tif \(uintptr\(r0\) ==\^uintptr\(0\) && er != nil\) {\n";
|
||||
$body .= "\t\t$errvar = er\n";
|
||||
$body .= "\t}\n";
|
||||
} else {
|
||||
$body .= "\tif \(r0 ==-1 && er != nil\) {\n";
|
||||
$body .= "\t\t$errvar = er\n";
|
||||
$body .= "\t}\n";
|
||||
}
|
||||
} elsif ($errvar ne "") {
|
||||
$body .= "\tif \(er != nil\) {\n";
|
||||
$body .= "\t\t$errvar = er\n";
|
||||
$body .= "\t}\n";
|
||||
}
|
||||
|
||||
$text .= "\t$call\n";
|
||||
$text .= $body;
|
||||
|
||||
$text .= "\treturn\n";
|
||||
$text .= "}\n";
|
||||
}
|
||||
|
||||
if($errors) {
|
||||
exit 1;
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
// $cmdline
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $tags
|
||||
|
||||
package $package
|
||||
|
||||
|
||||
$c_extern
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
print "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
|
||||
|
||||
chomp($_=<<EOF);
|
||||
|
||||
$text
|
||||
EOF
|
||||
print $_;
|
||||
exit 0;
|
|
@ -0,0 +1,602 @@
|
|||
// 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 ignore
|
||||
|
||||
/*
|
||||
This program reads a file containing function prototypes
|
||||
(like syscall_aix.go) and generates system call bodies.
|
||||
The prototypes are marked by lines beginning with "//sys"
|
||||
and read like func declarations if //sys is replaced by func, but:
|
||||
* The parameter lists must give a name for each argument.
|
||||
This includes return parameters.
|
||||
* The parameter lists must give a type for each argument:
|
||||
the (x, y, z int) shorthand is not allowed.
|
||||
* If the return parameter is an error number, it must be named err.
|
||||
* If go func name needs to be different than its libc name,
|
||||
* or the function is not in libc, name could be specified
|
||||
* at the end, after "=" sign, like
|
||||
//sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
|
||||
|
||||
|
||||
This program will generate three files and handle both gc and gccgo implementation:
|
||||
- zsyscall_aix_ppc64.go: the common part of each implementation (error handler, pointer creation)
|
||||
- zsyscall_aix_ppc64_gc.go: gc part with //go_cgo_import_dynamic and a call to syscall6
|
||||
- zsyscall_aix_ppc64_gccgo.go: gccgo part with C function and conversion to C type.
|
||||
|
||||
The generated code looks like this
|
||||
|
||||
zsyscall_aix_ppc64.go
|
||||
func asyscall(...) (n int, err error) {
|
||||
// Pointer Creation
|
||||
r1, e1 := callasyscall(...)
|
||||
// Type Conversion
|
||||
// Error Handler
|
||||
return
|
||||
}
|
||||
|
||||
zsyscall_aix_ppc64_gc.go
|
||||
//go:cgo_import_dynamic libc_asyscall asyscall "libc.a/shr_64.o"
|
||||
//go:linkname libc_asyscall libc_asyscall
|
||||
var asyscall syscallFunc
|
||||
|
||||
func callasyscall(...) (r1 uintptr, e1 Errno) {
|
||||
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_asyscall)), "nb_args", ... )
|
||||
return
|
||||
}
|
||||
|
||||
zsyscall_aix_ppc64_ggcgo.go
|
||||
|
||||
// int asyscall(...)
|
||||
|
||||
import "C"
|
||||
|
||||
func callasyscall(...) (r1 uintptr, e1 Errno) {
|
||||
r1 = uintptr(C.asyscall(...))
|
||||
e1 = syscall.GetErrno()
|
||||
return
|
||||
}
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
b32 = flag.Bool("b32", false, "32bit big-endian")
|
||||
l32 = flag.Bool("l32", false, "32bit little-endian")
|
||||
aix = flag.Bool("aix", false, "aix")
|
||||
tags = flag.String("tags", "", "build tags")
|
||||
)
|
||||
|
||||
// cmdLine returns this programs's commandline arguments
|
||||
func cmdLine() string {
|
||||
return "go run mksyscall_aix_ppc64.go " + strings.Join(os.Args[1:], " ")
|
||||
}
|
||||
|
||||
// buildTags returns build tags
|
||||
func buildTags() string {
|
||||
return *tags
|
||||
}
|
||||
|
||||
// Param is function parameter
|
||||
type Param struct {
|
||||
Name string
|
||||
Type string
|
||||
}
|
||||
|
||||
// usage prints the program usage
|
||||
func usage() {
|
||||
fmt.Fprintf(os.Stderr, "usage: go run mksyscall_aix_ppc64.go [-b32 | -l32] [-tags x,y] [file ...]\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// parseParamList parses parameter list and returns a slice of parameters
|
||||
func parseParamList(list string) []string {
|
||||
list = strings.TrimSpace(list)
|
||||
if list == "" {
|
||||
return []string{}
|
||||
}
|
||||
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
|
||||
}
|
||||
|
||||
// parseParam splits a parameter into name and type
|
||||
func parseParam(p string) Param {
|
||||
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
|
||||
if ps == nil {
|
||||
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
|
||||
os.Exit(1)
|
||||
}
|
||||
return Param{ps[1], ps[2]}
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Usage = usage
|
||||
flag.Parse()
|
||||
if len(flag.Args()) <= 0 {
|
||||
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
|
||||
usage()
|
||||
}
|
||||
|
||||
endianness := ""
|
||||
if *b32 {
|
||||
endianness = "big-endian"
|
||||
} else if *l32 {
|
||||
endianness = "little-endian"
|
||||
}
|
||||
|
||||
pack := ""
|
||||
// GCCGO
|
||||
textgccgo := ""
|
||||
cExtern := "/*\n#include <stdint.h>\n"
|
||||
// GC
|
||||
textgc := ""
|
||||
dynimports := ""
|
||||
linknames := ""
|
||||
var vars []string
|
||||
// COMMON
|
||||
textcommon := ""
|
||||
for _, path := range flag.Args() {
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
s := bufio.NewScanner(file)
|
||||
for s.Scan() {
|
||||
t := s.Text()
|
||||
t = strings.TrimSpace(t)
|
||||
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
|
||||
if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
|
||||
pack = p[1]
|
||||
}
|
||||
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
|
||||
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
// Line must be of the form
|
||||
// func Open(path string, mode int, perm int) (fd int, err error)
|
||||
// Split into name, in params, out params.
|
||||
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
|
||||
if f == nil {
|
||||
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
|
||||
os.Exit(1)
|
||||
}
|
||||
funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
|
||||
|
||||
// Split argument lists on comma.
|
||||
in := parseParamList(inps)
|
||||
out := parseParamList(outps)
|
||||
|
||||
inps = strings.Join(in, ", ")
|
||||
outps = strings.Join(out, ", ")
|
||||
|
||||
if sysname == "" {
|
||||
sysname = funct
|
||||
}
|
||||
|
||||
onlyCommon := false
|
||||
if funct == "readlen" || funct == "writelen" || funct == "FcntlInt" || funct == "FcntlFlock" {
|
||||
// This function call another syscall which is already implemented.
|
||||
// Therefore, the gc and gccgo part must not be generated.
|
||||
onlyCommon = true
|
||||
}
|
||||
|
||||
// Try in vain to keep people from editing this file.
|
||||
// The theory is that they jump into the middle of the file
|
||||
// without reading the header.
|
||||
|
||||
textcommon += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
||||
if !onlyCommon {
|
||||
textgccgo += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
||||
textgc += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
||||
}
|
||||
|
||||
// Check if value return, err return available
|
||||
errvar := ""
|
||||
rettype := ""
|
||||
for _, param := range out {
|
||||
p := parseParam(param)
|
||||
if p.Type == "error" {
|
||||
errvar = p.Name
|
||||
} else {
|
||||
rettype = p.Type
|
||||
}
|
||||
}
|
||||
|
||||
sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
|
||||
sysname = strings.ToLower(sysname) // All libc functions are lowercase.
|
||||
|
||||
// GCCGO Prototype return type
|
||||
cRettype := ""
|
||||
if rettype == "unsafe.Pointer" {
|
||||
cRettype = "uintptr_t"
|
||||
} else if rettype == "uintptr" {
|
||||
cRettype = "uintptr_t"
|
||||
} else if regexp.MustCompile(`^_`).FindStringSubmatch(rettype) != nil {
|
||||
cRettype = "uintptr_t"
|
||||
} else if rettype == "int" {
|
||||
cRettype = "int"
|
||||
} else if rettype == "int32" {
|
||||
cRettype = "int"
|
||||
} else if rettype == "int64" {
|
||||
cRettype = "long long"
|
||||
} else if rettype == "uint32" {
|
||||
cRettype = "unsigned int"
|
||||
} else if rettype == "uint64" {
|
||||
cRettype = "unsigned long long"
|
||||
} else {
|
||||
cRettype = "int"
|
||||
}
|
||||
if sysname == "exit" {
|
||||
cRettype = "void"
|
||||
}
|
||||
|
||||
// GCCGO Prototype arguments type
|
||||
var cIn []string
|
||||
for i, param := range in {
|
||||
p := parseParam(param)
|
||||
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
||||
cIn = append(cIn, "uintptr_t")
|
||||
} else if p.Type == "string" {
|
||||
cIn = append(cIn, "uintptr_t")
|
||||
} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
|
||||
cIn = append(cIn, "uintptr_t", "size_t")
|
||||
} else if p.Type == "unsafe.Pointer" {
|
||||
cIn = append(cIn, "uintptr_t")
|
||||
} else if p.Type == "uintptr" {
|
||||
cIn = append(cIn, "uintptr_t")
|
||||
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
|
||||
cIn = append(cIn, "uintptr_t")
|
||||
} else if p.Type == "int" {
|
||||
if (i == 0 || i == 2) && funct == "fcntl" {
|
||||
// These fcntl arguments needs to be uintptr to be able to call FcntlInt and FcntlFlock
|
||||
cIn = append(cIn, "uintptr_t")
|
||||
} else {
|
||||
cIn = append(cIn, "int")
|
||||
}
|
||||
|
||||
} else if p.Type == "int32" {
|
||||
cIn = append(cIn, "int")
|
||||
} else if p.Type == "int64" {
|
||||
cIn = append(cIn, "long long")
|
||||
} else if p.Type == "uint32" {
|
||||
cIn = append(cIn, "unsigned int")
|
||||
} else if p.Type == "uint64" {
|
||||
cIn = append(cIn, "unsigned long long")
|
||||
} else {
|
||||
cIn = append(cIn, "int")
|
||||
}
|
||||
}
|
||||
|
||||
if !onlyCommon {
|
||||
// GCCGO Prototype Generation
|
||||
// Imports of system calls from libc
|
||||
cExtern += fmt.Sprintf("%s %s", cRettype, sysname)
|
||||
cIn := strings.Join(cIn, ", ")
|
||||
cExtern += fmt.Sprintf("(%s);\n", cIn)
|
||||
}
|
||||
// GC Library name
|
||||
if modname == "" {
|
||||
modname = "libc.a/shr_64.o"
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, "%s: only syscall using libc are available\n", funct)
|
||||
os.Exit(1)
|
||||
}
|
||||
sysvarname := fmt.Sprintf("libc_%s", sysname)
|
||||
|
||||
if !onlyCommon {
|
||||
// GC Runtime import of function to allow cross-platform builds.
|
||||
dynimports += fmt.Sprintf("//go:cgo_import_dynamic %s %s \"%s\"\n", sysvarname, sysname, modname)
|
||||
// GC Link symbol to proc address variable.
|
||||
linknames += fmt.Sprintf("//go:linkname %s %s\n", sysvarname, sysvarname)
|
||||
// GC Library proc address variable.
|
||||
vars = append(vars, sysvarname)
|
||||
}
|
||||
|
||||
strconvfunc := "BytePtrFromString"
|
||||
strconvtype := "*byte"
|
||||
|
||||
// Go function header.
|
||||
if outps != "" {
|
||||
outps = fmt.Sprintf(" (%s)", outps)
|
||||
}
|
||||
if textcommon != "" {
|
||||
textcommon += "\n"
|
||||
}
|
||||
|
||||
textcommon += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outps)
|
||||
|
||||
// Prepare arguments tocall.
|
||||
var argscommon []string // Arguments in the common part
|
||||
var argscall []string // Arguments for call prototype
|
||||
var argsgc []string // Arguments for gc call (with syscall6)
|
||||
var argsgccgo []string // Arguments for gccgo call (with C.name_of_syscall)
|
||||
n := 0
|
||||
argN := 0
|
||||
for _, param := range in {
|
||||
p := parseParam(param)
|
||||
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
||||
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(%s))", p.Name))
|
||||
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
|
||||
argsgc = append(argsgc, p.Name)
|
||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||
} else if p.Type == "string" && errvar != "" {
|
||||
textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
|
||||
textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
|
||||
textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
|
||||
|
||||
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
||||
argscall = append(argscall, fmt.Sprintf("_p%d uintptr ", n))
|
||||
argsgc = append(argsgc, fmt.Sprintf("_p%d", n))
|
||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n))
|
||||
n++
|
||||
} else if p.Type == "string" {
|
||||
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
|
||||
textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
|
||||
textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
|
||||
textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
|
||||
|
||||
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
||||
argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n))
|
||||
argsgc = append(argsgc, fmt.Sprintf("_p%d", n))
|
||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n))
|
||||
n++
|
||||
} else if m := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); m != nil {
|
||||
// Convert slice into pointer, length.
|
||||
// Have to be careful not to take address of &a[0] if len == 0:
|
||||
// pass nil in that case.
|
||||
textcommon += fmt.Sprintf("\tvar _p%d *%s\n", n, m[1])
|
||||
textcommon += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
|
||||
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n), fmt.Sprintf("len(%s)", p.Name))
|
||||
argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n), fmt.Sprintf("_lenp%d int", n))
|
||||
argsgc = append(argsgc, fmt.Sprintf("_p%d", n), fmt.Sprintf("uintptr(_lenp%d)", n))
|
||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n), fmt.Sprintf("C.size_t(_lenp%d)", n))
|
||||
n++
|
||||
} else if p.Type == "int64" && endianness != "" {
|
||||
fmt.Fprintf(os.Stderr, path+":"+funct+" uses int64 with 32 bits mode. Case not yet implemented\n")
|
||||
} else if p.Type == "bool" {
|
||||
fmt.Fprintf(os.Stderr, path+":"+funct+" uses bool. Case not yet implemented\n")
|
||||
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil || p.Type == "unsafe.Pointer" {
|
||||
argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
|
||||
argsgc = append(argsgc, p.Name)
|
||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||
} else if p.Type == "int" {
|
||||
if (argN == 0 || argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt") || (funct == "FcntlFlock")) {
|
||||
// These fcntl arguments need to be uintptr to be able to call FcntlInt and FcntlFlock
|
||||
argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
|
||||
argsgc = append(argsgc, p.Name)
|
||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||
|
||||
} else {
|
||||
argscommon = append(argscommon, p.Name)
|
||||
argscall = append(argscall, fmt.Sprintf("%s int", p.Name))
|
||||
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
|
||||
}
|
||||
} else if p.Type == "int32" {
|
||||
argscommon = append(argscommon, p.Name)
|
||||
argscall = append(argscall, fmt.Sprintf("%s int32", p.Name))
|
||||
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
|
||||
} else if p.Type == "int64" {
|
||||
argscommon = append(argscommon, p.Name)
|
||||
argscall = append(argscall, fmt.Sprintf("%s int64", p.Name))
|
||||
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.longlong(%s)", p.Name))
|
||||
} else if p.Type == "uint32" {
|
||||
argscommon = append(argscommon, p.Name)
|
||||
argscall = append(argscall, fmt.Sprintf("%s uint32", p.Name))
|
||||
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uint(%s)", p.Name))
|
||||
} else if p.Type == "uint64" {
|
||||
argscommon = append(argscommon, p.Name)
|
||||
argscall = append(argscall, fmt.Sprintf("%s uint64", p.Name))
|
||||
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.ulonglong(%s)", p.Name))
|
||||
} else if p.Type == "uintptr" {
|
||||
argscommon = append(argscommon, p.Name)
|
||||
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
|
||||
argsgc = append(argsgc, p.Name)
|
||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||
} else {
|
||||
argscommon = append(argscommon, fmt.Sprintf("int(%s)", p.Name))
|
||||
argscall = append(argscall, fmt.Sprintf("%s int", p.Name))
|
||||
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||
argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
|
||||
}
|
||||
argN++
|
||||
}
|
||||
nargs := len(argsgc)
|
||||
|
||||
// COMMON function generation
|
||||
argscommonlist := strings.Join(argscommon, ", ")
|
||||
callcommon := fmt.Sprintf("call%s(%s)", sysname, argscommonlist)
|
||||
ret := []string{"_", "_"}
|
||||
body := ""
|
||||
doErrno := false
|
||||
for i := 0; i < len(out); i++ {
|
||||
p := parseParam(out[i])
|
||||
reg := ""
|
||||
if p.Name == "err" {
|
||||
reg = "e1"
|
||||
ret[1] = reg
|
||||
doErrno = true
|
||||
} else {
|
||||
reg = "r0"
|
||||
ret[0] = reg
|
||||
}
|
||||
if p.Type == "bool" {
|
||||
reg = fmt.Sprintf("%s != 0", reg)
|
||||
}
|
||||
if reg != "e1" {
|
||||
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
|
||||
}
|
||||
}
|
||||
if ret[0] == "_" && ret[1] == "_" {
|
||||
textcommon += fmt.Sprintf("\t%s\n", callcommon)
|
||||
} else {
|
||||
textcommon += fmt.Sprintf("\t%s, %s := %s\n", ret[0], ret[1], callcommon)
|
||||
}
|
||||
textcommon += body
|
||||
|
||||
if doErrno {
|
||||
textcommon += "\tif e1 != 0 {\n"
|
||||
textcommon += "\t\terr = errnoErr(e1)\n"
|
||||
textcommon += "\t}\n"
|
||||
}
|
||||
textcommon += "\treturn\n"
|
||||
textcommon += "}\n"
|
||||
|
||||
if onlyCommon {
|
||||
continue
|
||||
}
|
||||
|
||||
// CALL Prototype
|
||||
callProto := fmt.Sprintf("func call%s(%s) (r1 uintptr, e1 Errno) {\n", sysname, strings.Join(argscall, ", "))
|
||||
|
||||
// GC function generation
|
||||
asm := "syscall6"
|
||||
if nonblock != nil {
|
||||
asm = "rawSyscall6"
|
||||
}
|
||||
|
||||
if len(argsgc) <= 6 {
|
||||
for len(argsgc) < 6 {
|
||||
argsgc = append(argsgc, "0")
|
||||
}
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, "%s: too many arguments to system call", funct)
|
||||
os.Exit(1)
|
||||
}
|
||||
argsgclist := strings.Join(argsgc, ", ")
|
||||
callgc := fmt.Sprintf("%s(uintptr(unsafe.Pointer(&%s)), %d, %s)", asm, sysvarname, nargs, argsgclist)
|
||||
|
||||
textgc += callProto
|
||||
textgc += fmt.Sprintf("\tr1, _, e1 = %s\n", callgc)
|
||||
textgc += "\treturn\n}\n"
|
||||
|
||||
// GCCGO function generation
|
||||
argsgccgolist := strings.Join(argsgccgo, ", ")
|
||||
callgccgo := fmt.Sprintf("C.%s(%s)", sysname, argsgccgolist)
|
||||
textgccgo += callProto
|
||||
textgccgo += fmt.Sprintf("\tr1 = uintptr(%s)\n", callgccgo)
|
||||
textgccgo += "\te1 = syscall.GetErrno()\n"
|
||||
textgccgo += "\treturn\n}\n"
|
||||
}
|
||||
if err := s.Err(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
file.Close()
|
||||
}
|
||||
imp := ""
|
||||
if pack != "unix" {
|
||||
imp = "import \"golang.org/x/sys/unix\"\n"
|
||||
|
||||
}
|
||||
|
||||
// Print zsyscall_aix_ppc64.go
|
||||
err := ioutil.WriteFile("zsyscall_aix_ppc64.go",
|
||||
[]byte(fmt.Sprintf(srcTemplate1, cmdLine(), buildTags(), pack, imp, textcommon)),
|
||||
0644)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Print zsyscall_aix_ppc64_gc.go
|
||||
vardecls := "\t" + strings.Join(vars, ",\n\t")
|
||||
vardecls += " syscallFunc"
|
||||
err = ioutil.WriteFile("zsyscall_aix_ppc64_gc.go",
|
||||
[]byte(fmt.Sprintf(srcTemplate2, cmdLine(), buildTags(), pack, imp, dynimports, linknames, vardecls, textgc)),
|
||||
0644)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Print zsyscall_aix_ppc64_gccgo.go
|
||||
err = ioutil.WriteFile("zsyscall_aix_ppc64_gccgo.go",
|
||||
[]byte(fmt.Sprintf(srcTemplate3, cmdLine(), buildTags(), pack, cExtern, imp, textgccgo)),
|
||||
0644)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
const srcTemplate1 = `// %s
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build %s
|
||||
|
||||
package %s
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
|
||||
%s
|
||||
|
||||
%s
|
||||
`
|
||||
const srcTemplate2 = `// %s
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build %s
|
||||
// +build !gccgo
|
||||
|
||||
package %s
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
type syscallFunc uintptr
|
||||
|
||||
var (
|
||||
%s
|
||||
)
|
||||
|
||||
// Implemented in runtime/syscall_aix.go.
|
||||
func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||
func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||
|
||||
%s
|
||||
`
|
||||
const srcTemplate3 = `// %s
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build %s
|
||||
// +build gccgo
|
||||
|
||||
package %s
|
||||
|
||||
%s
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
|
||||
%s
|
||||
|
||||
%s
|
||||
`
|
|
@ -1,579 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
# 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.
|
||||
|
||||
# This program reads a file containing function prototypes
|
||||
# (like syscall_aix.go) and generates system call bodies.
|
||||
# The prototypes are marked by lines beginning with "//sys"
|
||||
# and read like func declarations if //sys is replaced by func, but:
|
||||
# * The parameter lists must give a name for each argument.
|
||||
# This includes return parameters.
|
||||
# * The parameter lists must give a type for each argument:
|
||||
# the (x, y, z int) shorthand is not allowed.
|
||||
# * If the return parameter is an error number, it must be named err.
|
||||
# * If go func name needs to be different than its libc name,
|
||||
# * or the function is not in libc, name could be specified
|
||||
# * at the end, after "=" sign, like
|
||||
# //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
|
||||
|
||||
# This program will generate three files and handle both gc and gccgo implementation:
|
||||
# - zsyscall_aix_ppc64.go: the common part of each implementation (error handler, pointer creation)
|
||||
# - zsyscall_aix_ppc64_gc.go: gc part with //go_cgo_import_dynamic and a call to syscall6
|
||||
# - zsyscall_aix_ppc64_gccgo.go: gccgo part with C function and conversion to C type.
|
||||
|
||||
# The generated code looks like this
|
||||
#
|
||||
# zsyscall_aix_ppc64.go
|
||||
# func asyscall(...) (n int, err error) {
|
||||
# // Pointer Creation
|
||||
# r1, e1 := callasyscall(...)
|
||||
# // Type Conversion
|
||||
# // Error Handler
|
||||
# return
|
||||
# }
|
||||
#
|
||||
# zsyscall_aix_ppc64_gc.go
|
||||
# //go:cgo_import_dynamic libc_asyscall asyscall "libc.a/shr_64.o"
|
||||
# //go:linkname libc_asyscall libc_asyscall
|
||||
# var asyscall syscallFunc
|
||||
#
|
||||
# func callasyscall(...) (r1 uintptr, e1 Errno) {
|
||||
# r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_asyscall)), "nb_args", ... )
|
||||
# return
|
||||
# }
|
||||
#
|
||||
# zsyscall_aix_ppc64_ggcgo.go
|
||||
# /*
|
||||
# int asyscall(...)
|
||||
#
|
||||
# */
|
||||
# import "C"
|
||||
#
|
||||
# func callasyscall(...) (r1 uintptr, e1 Errno) {
|
||||
# r1 = uintptr(C.asyscall(...))
|
||||
# e1 = syscall.GetErrno()
|
||||
# return
|
||||
# }
|
||||
|
||||
|
||||
|
||||
use strict;
|
||||
|
||||
my $cmdline = "mksyscall_aix_ppc64.pl " . join(' ', @ARGV);
|
||||
my $errors = 0;
|
||||
my $_32bit = "";
|
||||
my $tags = ""; # build tags
|
||||
my $aix = 0;
|
||||
my $solaris = 0;
|
||||
|
||||
binmode STDOUT;
|
||||
|
||||
if($ARGV[0] eq "-b32") {
|
||||
$_32bit = "big-endian";
|
||||
shift;
|
||||
} elsif($ARGV[0] eq "-l32") {
|
||||
$_32bit = "little-endian";
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-aix") {
|
||||
$aix = 1;
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-tags") {
|
||||
shift;
|
||||
$tags = $ARGV[0];
|
||||
shift;
|
||||
}
|
||||
|
||||
if($ARGV[0] =~ /^-/) {
|
||||
print STDERR "usage: mksyscall_aix.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub parseparamlist($) {
|
||||
my ($list) = @_;
|
||||
$list =~ s/^\s*//;
|
||||
$list =~ s/\s*$//;
|
||||
if($list eq "") {
|
||||
return ();
|
||||
}
|
||||
return split(/\s*,\s*/, $list);
|
||||
}
|
||||
|
||||
sub parseparam($) {
|
||||
my ($p) = @_;
|
||||
if($p !~ /^(\S*) (\S*)$/) {
|
||||
print STDERR "$ARGV:$.: malformed parameter: $p\n";
|
||||
$errors = 1;
|
||||
return ("xx", "int");
|
||||
}
|
||||
return ($1, $2);
|
||||
}
|
||||
|
||||
my $package = "";
|
||||
# GCCGO
|
||||
my $textgccgo = "";
|
||||
my $c_extern = "/*\n#include <stdint.h>\n";
|
||||
# GC
|
||||
my $textgc = "";
|
||||
my $dynimports = "";
|
||||
my $linknames = "";
|
||||
my @vars = ();
|
||||
# COMMUN
|
||||
my $textcommon = "";
|
||||
|
||||
while(<>) {
|
||||
chomp;
|
||||
s/\s+/ /g;
|
||||
s/^\s+//;
|
||||
s/\s+$//;
|
||||
$package = $1 if !$package && /^package (\S+)$/;
|
||||
my $nonblock = /^\/\/sysnb /;
|
||||
next if !/^\/\/sys / && !$nonblock;
|
||||
|
||||
# Line must be of the form
|
||||
# func Open(path string, mode int, perm int) (fd int, err error)
|
||||
# Split into name, in params, out params.
|
||||
if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) {
|
||||
print STDERR "$ARGV:$.: malformed //sys declaration\n";
|
||||
$errors = 1;
|
||||
next;
|
||||
}
|
||||
my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6);
|
||||
|
||||
# Split argument lists on comma.
|
||||
my @in = parseparamlist($in);
|
||||
my @out = parseparamlist($out);
|
||||
|
||||
$in = join(', ', @in);
|
||||
$out = join(', ', @out);
|
||||
|
||||
if($sysname eq "") {
|
||||
$sysname = "$func";
|
||||
}
|
||||
|
||||
my $onlyCommon = 0;
|
||||
if ($func eq "readlen" || $func eq "writelen" || $func eq "FcntlInt" || $func eq "FcntlFlock") {
|
||||
# This function call another syscall which is already implemented.
|
||||
# Therefore, the gc and gccgo part must not be generated.
|
||||
$onlyCommon = 1
|
||||
}
|
||||
|
||||
# Try in vain to keep people from editing this file.
|
||||
# The theory is that they jump into the middle of the file
|
||||
# without reading the header.
|
||||
|
||||
$textcommon .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
|
||||
if (!$onlyCommon) {
|
||||
$textgccgo .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
|
||||
$textgc .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
|
||||
}
|
||||
|
||||
|
||||
# Check if value return, err return available
|
||||
my $errvar = "";
|
||||
my $retvar = "";
|
||||
my $rettype = "";
|
||||
foreach my $p (@out) {
|
||||
my ($name, $type) = parseparam($p);
|
||||
if($type eq "error") {
|
||||
$errvar = $name;
|
||||
} else {
|
||||
$retvar = $name;
|
||||
$rettype = $type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$sysname =~ s/([a-z])([A-Z])/${1}_$2/g;
|
||||
$sysname =~ y/A-Z/a-z/; # All libc functions are lowercase.
|
||||
|
||||
# GCCGO Prototype return type
|
||||
my $C_rettype = "";
|
||||
if($rettype eq "unsafe.Pointer") {
|
||||
$C_rettype = "uintptr_t";
|
||||
} elsif($rettype eq "uintptr") {
|
||||
$C_rettype = "uintptr_t";
|
||||
} elsif($rettype =~ /^_/) {
|
||||
$C_rettype = "uintptr_t";
|
||||
} elsif($rettype eq "int") {
|
||||
$C_rettype = "int";
|
||||
} elsif($rettype eq "int32") {
|
||||
$C_rettype = "int";
|
||||
} elsif($rettype eq "int64") {
|
||||
$C_rettype = "long long";
|
||||
} elsif($rettype eq "uint32") {
|
||||
$C_rettype = "unsigned int";
|
||||
} elsif($rettype eq "uint64") {
|
||||
$C_rettype = "unsigned long long";
|
||||
} else {
|
||||
$C_rettype = "int";
|
||||
}
|
||||
if($sysname eq "exit") {
|
||||
$C_rettype = "void";
|
||||
}
|
||||
|
||||
# GCCGO Prototype arguments type
|
||||
my @c_in = ();
|
||||
foreach my $i (0 .. $#in) {
|
||||
my ($name, $type) = parseparam($in[$i]);
|
||||
if($type =~ /^\*/) {
|
||||
push @c_in, "uintptr_t";
|
||||
} elsif($type eq "string") {
|
||||
push @c_in, "uintptr_t";
|
||||
} elsif($type =~ /^\[\](.*)/) {
|
||||
push @c_in, "uintptr_t", "size_t";
|
||||
} elsif($type eq "unsafe.Pointer") {
|
||||
push @c_in, "uintptr_t";
|
||||
} elsif($type eq "uintptr") {
|
||||
push @c_in, "uintptr_t";
|
||||
} elsif($type =~ /^_/) {
|
||||
push @c_in, "uintptr_t";
|
||||
} elsif($type eq "int") {
|
||||
if (($i == 0 || $i == 2) && $func eq "fcntl"){
|
||||
# These fcntl arguments needs to be uintptr to be able to call FcntlInt and FcntlFlock
|
||||
push @c_in, "uintptr_t";
|
||||
} else {
|
||||
push @c_in, "int";
|
||||
}
|
||||
} elsif($type eq "int32") {
|
||||
push @c_in, "int";
|
||||
} elsif($type eq "int64") {
|
||||
push @c_in, "long long";
|
||||
} elsif($type eq "uint32") {
|
||||
push @c_in, "unsigned int";
|
||||
} elsif($type eq "uint64") {
|
||||
push @c_in, "unsigned long long";
|
||||
} else {
|
||||
push @c_in, "int";
|
||||
}
|
||||
}
|
||||
|
||||
if (!$onlyCommon){
|
||||
# GCCGO Prototype Generation
|
||||
# Imports of system calls from libc
|
||||
$c_extern .= "$C_rettype $sysname";
|
||||
my $c_in = join(', ', @c_in);
|
||||
$c_extern .= "($c_in);\n";
|
||||
}
|
||||
|
||||
# GC Library name
|
||||
if($modname eq "") {
|
||||
$modname = "libc.a/shr_64.o";
|
||||
} else {
|
||||
print STDERR "$func: only syscall using libc are available\n";
|
||||
$errors = 1;
|
||||
next;
|
||||
}
|
||||
my $sysvarname = "libc_${sysname}";
|
||||
|
||||
if (!$onlyCommon){
|
||||
# GC Runtime import of function to allow cross-platform builds.
|
||||
$dynimports .= "//go:cgo_import_dynamic ${sysvarname} ${sysname} \"$modname\"\n";
|
||||
# GC Link symbol to proc address variable.
|
||||
$linknames .= "//go:linkname ${sysvarname} ${sysvarname}\n";
|
||||
# GC Library proc address variable.
|
||||
push @vars, $sysvarname;
|
||||
}
|
||||
|
||||
my $strconvfunc ="BytePtrFromString";
|
||||
my $strconvtype = "*byte";
|
||||
|
||||
# Go function header.
|
||||
if($out ne "") {
|
||||
$out = " ($out)";
|
||||
}
|
||||
if($textcommon ne "") {
|
||||
$textcommon .= "\n"
|
||||
}
|
||||
|
||||
$textcommon .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out ;
|
||||
|
||||
# Prepare arguments to call.
|
||||
my @argscommun = (); # Arguments in the commun part
|
||||
my @argscall = (); # Arguments for call prototype
|
||||
my @argsgc = (); # Arguments for gc call (with syscall6)
|
||||
my @argsgccgo = (); # Arguments for gccgo call (with C.name_of_syscall)
|
||||
my $n = 0;
|
||||
my $arg_n = 0;
|
||||
foreach my $p (@in) {
|
||||
my ($name, $type) = parseparam($p);
|
||||
if($type =~ /^\*/) {
|
||||
push @argscommun, "uintptr(unsafe.Pointer($name))";
|
||||
push @argscall, "$name uintptr";
|
||||
push @argsgc, "$name";
|
||||
push @argsgccgo, "C.uintptr_t($name)";
|
||||
} elsif($type eq "string" && $errvar ne "") {
|
||||
$textcommon .= "\tvar _p$n $strconvtype\n";
|
||||
$textcommon .= "\t_p$n, $errvar = $strconvfunc($name)\n";
|
||||
$textcommon .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
|
||||
|
||||
push @argscommun, "uintptr(unsafe.Pointer(_p$n))";
|
||||
push @argscall, "_p$n uintptr ";
|
||||
push @argsgc, "_p$n";
|
||||
push @argsgccgo, "C.uintptr_t(_p$n)";
|
||||
$n++;
|
||||
} elsif($type eq "string") {
|
||||
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
|
||||
$textcommon .= "\tvar _p$n $strconvtype\n";
|
||||
$textcommon .= "\t_p$n, $errvar = $strconvfunc($name)\n";
|
||||
$textcommon .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
|
||||
|
||||
push @argscommun, "uintptr(unsafe.Pointer(_p$n))";
|
||||
push @argscall, "_p$n uintptr";
|
||||
push @argsgc, "_p$n";
|
||||
push @argsgccgo, "C.uintptr_t(_p$n)";
|
||||
$n++;
|
||||
} elsif($type =~ /^\[\](.*)/) {
|
||||
# Convert slice into pointer, length.
|
||||
# Have to be careful not to take address of &a[0] if len == 0:
|
||||
# pass nil in that case.
|
||||
$textcommon .= "\tvar _p$n *$1\n";
|
||||
$textcommon .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n";
|
||||
push @argscommun, "uintptr(unsafe.Pointer(_p$n))", "len($name)";
|
||||
push @argscall, "_p$n uintptr", "_lenp$n int";
|
||||
push @argsgc, "_p$n", "uintptr(_lenp$n)";
|
||||
push @argsgccgo, "C.uintptr_t(_p$n)", "C.size_t(_lenp$n)";
|
||||
$n++;
|
||||
} elsif($type eq "int64" && $_32bit ne "") {
|
||||
print STDERR "$ARGV:$.: $func uses int64 with 32 bits mode. Case not yet implemented\n";
|
||||
# if($_32bit eq "big-endian") {
|
||||
# push @args, "uintptr($name >> 32)", "uintptr($name)";
|
||||
# } else {
|
||||
# push @args, "uintptr($name)", "uintptr($name >> 32)";
|
||||
# }
|
||||
# $n++;
|
||||
} elsif($type eq "bool") {
|
||||
print STDERR "$ARGV:$.: $func uses bool. Case not yet implemented\n";
|
||||
# $text .= "\tvar _p$n uint32\n";
|
||||
# $text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n";
|
||||
# push @args, "_p$n";
|
||||
# $n++;
|
||||
} elsif($type =~ /^_/ ||$type eq "unsafe.Pointer") {
|
||||
push @argscommun, "uintptr($name)";
|
||||
push @argscall, "$name uintptr";
|
||||
push @argsgc, "$name";
|
||||
push @argsgccgo, "C.uintptr_t($name)";
|
||||
} elsif($type eq "int") {
|
||||
if (($arg_n == 0 || $arg_n == 2) && ($func eq "fcntl" || $func eq "FcntlInt" || $func eq "FcntlFlock")) {
|
||||
# These fcntl arguments need to be uintptr to be able to call FcntlInt and FcntlFlock
|
||||
push @argscommun, "uintptr($name)";
|
||||
push @argscall, "$name uintptr";
|
||||
push @argsgc, "$name";
|
||||
push @argsgccgo, "C.uintptr_t($name)";
|
||||
} else {
|
||||
push @argscommun, "$name";
|
||||
push @argscall, "$name int";
|
||||
push @argsgc, "uintptr($name)";
|
||||
push @argsgccgo, "C.int($name)";
|
||||
}
|
||||
} elsif($type eq "int32") {
|
||||
push @argscommun, "$name";
|
||||
push @argscall, "$name int32";
|
||||
push @argsgc, "uintptr($name)";
|
||||
push @argsgccgo, "C.int($name)";
|
||||
} elsif($type eq "int64") {
|
||||
push @argscommun, "$name";
|
||||
push @argscall, "$name int64";
|
||||
push @argsgc, "uintptr($name)";
|
||||
push @argsgccgo, "C.longlong($name)";
|
||||
} elsif($type eq "uint32") {
|
||||
push @argscommun, "$name";
|
||||
push @argscall, "$name uint32";
|
||||
push @argsgc, "uintptr($name)";
|
||||
push @argsgccgo, "C.uint($name)";
|
||||
} elsif($type eq "uint64") {
|
||||
push @argscommun, "$name";
|
||||
push @argscall, "$name uint64";
|
||||
push @argsgc, "uintptr($name)";
|
||||
push @argsgccgo, "C.ulonglong($name)";
|
||||
} elsif($type eq "uintptr") {
|
||||
push @argscommun, "$name";
|
||||
push @argscall, "$name uintptr";
|
||||
push @argsgc, "$name";
|
||||
push @argsgccgo, "C.uintptr_t($name)";
|
||||
} else {
|
||||
push @argscommun, "int($name)";
|
||||
push @argscall, "$name int";
|
||||
push @argsgc, "uintptr($name)";
|
||||
push @argsgccgo, "C.int($name)";
|
||||
}
|
||||
$arg_n++;
|
||||
}
|
||||
my $nargs = @argsgc;
|
||||
|
||||
# COMMUN function generation
|
||||
my $argscommun = join(', ', @argscommun);
|
||||
my $callcommun = "call$sysname($argscommun)";
|
||||
my @ret = ("_", "_");
|
||||
my $body = "";
|
||||
my $do_errno = 0;
|
||||
for(my $i=0; $i<@out; $i++) {
|
||||
my $p = $out[$i];
|
||||
my ($name, $type) = parseparam($p);
|
||||
my $reg = "";
|
||||
if($name eq "err") {
|
||||
$reg = "e1";
|
||||
$ret[1] = $reg;
|
||||
$do_errno = 1;
|
||||
} else {
|
||||
$reg = "r0";
|
||||
$ret[0] = $reg;
|
||||
}
|
||||
if($type eq "bool") {
|
||||
$reg = "$reg != 0";
|
||||
}
|
||||
if($reg ne "e1") {
|
||||
$body .= "\t$name = $type($reg)\n";
|
||||
}
|
||||
}
|
||||
if ($ret[0] eq "_" && $ret[1] eq "_") {
|
||||
$textcommon .= "\t$callcommun\n";
|
||||
} else {
|
||||
$textcommon .= "\t$ret[0], $ret[1] := $callcommun\n";
|
||||
}
|
||||
$textcommon .= $body;
|
||||
|
||||
if ($do_errno) {
|
||||
$textcommon .= "\tif e1 != 0 {\n";
|
||||
$textcommon .= "\t\terr = errnoErr(e1)\n";
|
||||
$textcommon .= "\t}\n";
|
||||
}
|
||||
$textcommon .= "\treturn\n";
|
||||
$textcommon .= "}\n";
|
||||
|
||||
if ($onlyCommon){
|
||||
next
|
||||
}
|
||||
# CALL Prototype
|
||||
my $callProto = sprintf "func call%s(%s) (r1 uintptr, e1 Errno) {\n", $sysname, join(', ', @argscall);
|
||||
|
||||
# GC function generation
|
||||
my $asm = "syscall6";
|
||||
if ($nonblock) {
|
||||
$asm = "rawSyscall6";
|
||||
}
|
||||
|
||||
if(@argsgc <= 6) {
|
||||
while(@argsgc < 6) {
|
||||
push @argsgc, "0";
|
||||
}
|
||||
} else {
|
||||
print STDERR "$ARGV:$.: too many arguments to system call\n";
|
||||
}
|
||||
my $argsgc = join(', ', @argsgc);
|
||||
my $callgc = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $argsgc)";
|
||||
|
||||
$textgc .= $callProto;
|
||||
$textgc .= "\tr1, _, e1 = $callgc\n";
|
||||
$textgc .= "\treturn\n}\n";
|
||||
|
||||
# GCCGO function generation
|
||||
my $argsgccgo = join(', ', @argsgccgo);
|
||||
my $callgccgo = "C.$sysname($argsgccgo)";
|
||||
$textgccgo .= $callProto;
|
||||
$textgccgo .= "\tr1 = uintptr($callgccgo)\n";
|
||||
$textgccgo .= "\te1 = syscall.GetErrno()\n";
|
||||
$textgccgo .= "\treturn\n}\n";
|
||||
}
|
||||
|
||||
if($errors) {
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Print zsyscall_aix_ppc64.go
|
||||
open(my $fcommun, '>', 'zsyscall_aix_ppc64.go');
|
||||
my $tofcommun = <<EOF;
|
||||
// $cmdline
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $tags
|
||||
|
||||
package $package
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
EOF
|
||||
|
||||
$tofcommun .= "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
|
||||
|
||||
$tofcommun .=<<EOF;
|
||||
|
||||
$textcommon
|
||||
EOF
|
||||
print $fcommun $tofcommun;
|
||||
|
||||
|
||||
# Print zsyscall_aix_ppc64_gc.go
|
||||
open(my $fgc, '>', 'zsyscall_aix_ppc64_gc.go');
|
||||
my $tofgc = <<EOF;
|
||||
// $cmdline
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $tags
|
||||
// +build !gccgo
|
||||
|
||||
package $package
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
$tofgc .= "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
|
||||
|
||||
my $vardecls = "\t" . join(",\n\t", @vars);
|
||||
$vardecls .= " syscallFunc";
|
||||
|
||||
$tofgc .=<<EOF;
|
||||
$dynimports
|
||||
$linknames
|
||||
type syscallFunc uintptr
|
||||
|
||||
var (
|
||||
$vardecls
|
||||
)
|
||||
|
||||
// Implemented in runtime/syscall_aix.go.
|
||||
func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||
func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||
|
||||
$textgc
|
||||
EOF
|
||||
print $fgc $tofgc;
|
||||
|
||||
# Print zsyscall_aix_ppc64_gc.go
|
||||
open(my $fgccgo, '>', 'zsyscall_aix_ppc64_gccgo.go');
|
||||
my $tofgccgo = <<EOF;
|
||||
// $cmdline
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $tags
|
||||
// +build gccgo
|
||||
|
||||
package $package
|
||||
|
||||
|
||||
$c_extern
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
$tofgccgo .= "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
|
||||
|
||||
$tofgccgo .=<<EOF;
|
||||
|
||||
$textgccgo
|
||||
EOF
|
||||
print $fgccgo $tofgccgo;
|
||||
exit 0;
|
|
@ -0,0 +1,190 @@
|
|||
// 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 ignore
|
||||
|
||||
// Generate system call table for DragonFly, NetBSD,
|
||||
// FreeBSD, OpenBSD or Darwin from master list
|
||||
// (for example, /usr/src/sys/kern/syscalls.master or
|
||||
// sys/syscall.h).
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
goos, goarch string
|
||||
)
|
||||
|
||||
// cmdLine returns this programs's commandline arguments
|
||||
func cmdLine() string {
|
||||
return "go run mksysnum.go " + strings.Join(os.Args[1:], " ")
|
||||
}
|
||||
|
||||
// buildTags returns build tags
|
||||
func buildTags() string {
|
||||
return fmt.Sprintf("%s,%s", goarch, goos)
|
||||
}
|
||||
|
||||
func checkErr(err error) {
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
// source string and substring slice for regexp
|
||||
type re struct {
|
||||
str string // source string
|
||||
sub []string // matched sub-string
|
||||
}
|
||||
|
||||
// Match performs regular expression match
|
||||
func (r *re) Match(exp string) bool {
|
||||
r.sub = regexp.MustCompile(exp).FindStringSubmatch(r.str)
|
||||
if r.sub != nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// fetchFile fetches a text file from URL
|
||||
func fetchFile(URL string) io.Reader {
|
||||
resp, err := http.Get(URL)
|
||||
checkErr(err)
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
checkErr(err)
|
||||
return strings.NewReader(string(body))
|
||||
}
|
||||
|
||||
// readFile reads a text file from path
|
||||
func readFile(path string) io.Reader {
|
||||
file, err := os.Open(os.Args[1])
|
||||
checkErr(err)
|
||||
return file
|
||||
}
|
||||
|
||||
func format(name, num, proto string) string {
|
||||
name = strings.ToUpper(name)
|
||||
// There are multiple entries for enosys and nosys, so comment them out.
|
||||
nm := re{str: name}
|
||||
if nm.Match(`^SYS_E?NOSYS$`) {
|
||||
name = fmt.Sprintf("// %s", name)
|
||||
}
|
||||
if name == `SYS_SYS_EXIT` {
|
||||
name = `SYS_EXIT`
|
||||
}
|
||||
return fmt.Sprintf(" %s = %s; // %s\n", name, num, proto)
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Get the OS (using GOOS_TARGET if it exist)
|
||||
goos = os.Getenv("GOOS_TARGET")
|
||||
if goos == "" {
|
||||
goos = os.Getenv("GOOS")
|
||||
}
|
||||
// Get the architecture (using GOARCH_TARGET if it exists)
|
||||
goarch = os.Getenv("GOARCH_TARGET")
|
||||
if goarch == "" {
|
||||
goarch = os.Getenv("GOARCH")
|
||||
}
|
||||
// Check if GOOS and GOARCH environment variables are defined
|
||||
if goarch == "" || goos == "" {
|
||||
fmt.Fprintf(os.Stderr, "GOARCH or GOOS not defined in environment\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
file := strings.TrimSpace(os.Args[1])
|
||||
var syscalls io.Reader
|
||||
if strings.HasPrefix(file, "https://") || strings.HasPrefix(file, "http://") {
|
||||
// Download syscalls.master file
|
||||
syscalls = fetchFile(file)
|
||||
} else {
|
||||
syscalls = readFile(file)
|
||||
}
|
||||
|
||||
var text, line string
|
||||
s := bufio.NewScanner(syscalls)
|
||||
for s.Scan() {
|
||||
t := re{str: line}
|
||||
if t.Match(`^(.*)\\$`) {
|
||||
// Handle continuation
|
||||
line = t.sub[1]
|
||||
line += strings.TrimLeft(s.Text(), " \t")
|
||||
} else {
|
||||
// New line
|
||||
line = s.Text()
|
||||
}
|
||||
t = re{str: line}
|
||||
if t.Match(`\\$`) {
|
||||
continue
|
||||
}
|
||||
t = re{str: line}
|
||||
|
||||
switch goos {
|
||||
case "dragonfly":
|
||||
if t.Match(`^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$`) {
|
||||
num, proto := t.sub[1], t.sub[2]
|
||||
name := fmt.Sprintf("SYS_%s", t.sub[3])
|
||||
text += format(name, num, proto)
|
||||
}
|
||||
case "freebsd":
|
||||
if t.Match(`^([0-9]+)\s+\S+\s+(?:NO)?STD\s+({ \S+\s+(\w+).*)$`) {
|
||||
num, proto := t.sub[1], t.sub[2]
|
||||
name := fmt.Sprintf("SYS_%s", t.sub[3])
|
||||
text += format(name, num, proto)
|
||||
}
|
||||
case "openbsd":
|
||||
if t.Match(`^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$`) {
|
||||
num, proto, name := t.sub[1], t.sub[3], t.sub[4]
|
||||
text += format(name, num, proto)
|
||||
}
|
||||
case "netbsd":
|
||||
if t.Match(`^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$`) {
|
||||
num, proto, compat := t.sub[1], t.sub[6], t.sub[8]
|
||||
name := t.sub[7] + "_" + t.sub[9]
|
||||
if t.sub[11] != "" {
|
||||
name = t.sub[7] + "_" + t.sub[11]
|
||||
}
|
||||
name = strings.ToUpper(name)
|
||||
if compat == "" || compat == "13" || compat == "30" || compat == "50" {
|
||||
text += fmt.Sprintf(" %s = %s; // %s\n", name, num, proto)
|
||||
}
|
||||
}
|
||||
case "darwin":
|
||||
if t.Match(`^#define\s+SYS_(\w+)\s+([0-9]+)`) {
|
||||
name, num := t.sub[1], t.sub[2]
|
||||
name = strings.ToUpper(name)
|
||||
text += fmt.Sprintf(" SYS_%s = %s;\n", name, num)
|
||||
}
|
||||
default:
|
||||
fmt.Fprintf(os.Stderr, "unrecognized GOOS=%s\n", goos)
|
||||
os.Exit(1)
|
||||
|
||||
}
|
||||
}
|
||||
err := s.Err()
|
||||
checkErr(err)
|
||||
|
||||
fmt.Printf(template, cmdLine(), buildTags(), text)
|
||||
}
|
||||
|
||||
const template = `// %s
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build %s
|
||||
|
||||
package unix
|
||||
|
||||
const(
|
||||
%s)`
|
|
@ -1,39 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
# 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.
|
||||
#
|
||||
# Generate system call table for Darwin from sys/syscall.h
|
||||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_darwin.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
||||
while(<>){
|
||||
if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){
|
||||
my $name = $1;
|
||||
my $num = $2;
|
||||
$name =~ y/a-z/A-Z/;
|
||||
print " SYS_$name = $num;"
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
)
|
||||
EOF
|
|
@ -1,50 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
# 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.
|
||||
#
|
||||
# Generate system call table for DragonFly from master list
|
||||
# (for example, /usr/src/sys/kern/syscalls.master).
|
||||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_dragonfly.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
||||
while(<>){
|
||||
if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){
|
||||
my $num = $1;
|
||||
my $proto = $2;
|
||||
my $name = "SYS_$3";
|
||||
$name =~ y/a-z/A-Z/;
|
||||
|
||||
# There are multiple entries for enosys and nosys, so comment them out.
|
||||
if($name =~ /^SYS_E?NOSYS$/){
|
||||
$name = "// $name";
|
||||
}
|
||||
if($name eq 'SYS_SYS_EXIT'){
|
||||
$name = 'SYS_EXIT';
|
||||
}
|
||||
|
||||
print " $name = $num; // $proto\n";
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
)
|
||||
EOF
|
|
@ -1,50 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
# 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.
|
||||
#
|
||||
# Generate system call table for FreeBSD from master list
|
||||
# (for example, /usr/src/sys/kern/syscalls.master).
|
||||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_freebsd.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
||||
while(<>){
|
||||
if(/^([0-9]+)\s+\S+\s+(?:NO)?STD\s+({ \S+\s+(\w+).*)$/){
|
||||
my $num = $1;
|
||||
my $proto = $2;
|
||||
my $name = "SYS_$3";
|
||||
$name =~ y/a-z/A-Z/;
|
||||
|
||||
# There are multiple entries for enosys and nosys, so comment them out.
|
||||
if($name =~ /^SYS_E?NOSYS$/){
|
||||
$name = "// $name";
|
||||
}
|
||||
if($name eq 'SYS_SYS_EXIT'){
|
||||
$name = 'SYS_EXIT';
|
||||
}
|
||||
|
||||
print " $name = $num; // $proto\n";
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
)
|
||||
EOF
|
|
@ -1,58 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
# 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.
|
||||
#
|
||||
# Generate system call table for OpenBSD from master list
|
||||
# (for example, /usr/src/sys/kern/syscalls.master).
|
||||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_netbsd.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
||||
my $line = '';
|
||||
while(<>){
|
||||
if($line =~ /^(.*)\\$/) {
|
||||
# Handle continuation
|
||||
$line = $1;
|
||||
$_ =~ s/^\s+//;
|
||||
$line .= $_;
|
||||
} else {
|
||||
# New line
|
||||
$line = $_;
|
||||
}
|
||||
next if $line =~ /\\$/;
|
||||
if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) {
|
||||
my $num = $1;
|
||||
my $proto = $6;
|
||||
my $compat = $8;
|
||||
my $name = "$7_$9";
|
||||
|
||||
$name = "$7_$11" if $11 ne '';
|
||||
$name =~ y/a-z/A-Z/;
|
||||
|
||||
if($compat eq '' || $compat eq '13' || $compat eq '30' || $compat eq '50') {
|
||||
print " $name = $num; // $proto\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
)
|
||||
EOF
|
|
@ -1,50 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
# 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.
|
||||
#
|
||||
# Generate system call table for OpenBSD from master list
|
||||
# (for example, /usr/src/sys/kern/syscalls.master).
|
||||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_openbsd.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
||||
while(<>){
|
||||
if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){
|
||||
my $num = $1;
|
||||
my $proto = $3;
|
||||
my $name = $4;
|
||||
$name =~ y/a-z/A-Z/;
|
||||
|
||||
# There are multiple entries for enosys and nosys, so comment them out.
|
||||
if($name =~ /^SYS_E?NOSYS$/){
|
||||
$name = "// $name";
|
||||
}
|
||||
if($name eq 'SYS_SYS_EXIT'){
|
||||
$name = 'SYS_EXIT';
|
||||
}
|
||||
|
||||
print " $name = $num; // $proto\n";
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
)
|
||||
EOF
|
|
@ -8,17 +8,30 @@
|
|||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
import (
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Round the length of a raw sockaddr up to align it properly.
|
||||
func cmsgAlignOf(salen int) int {
|
||||
salign := SizeofPtr
|
||||
// NOTE: It seems like 64-bit Darwin, DragonFly BSD and
|
||||
// Solaris kernels still require 32-bit aligned access to
|
||||
// network subsystem.
|
||||
if darwin64Bit || dragonfly64Bit || solaris64Bit {
|
||||
salign = 4
|
||||
|
||||
switch runtime.GOOS {
|
||||
case "darwin", "dragonfly", "solaris":
|
||||
// NOTE: It seems like 64-bit Darwin, DragonFly BSD and
|
||||
// Solaris kernels still require 32-bit aligned access to
|
||||
// network subsystem.
|
||||
if SizeofPtr == 8 {
|
||||
salign = 4
|
||||
}
|
||||
case "openbsd":
|
||||
// OpenBSD armv7 requires 64-bit alignment.
|
||||
if runtime.GOARCH == "arm" {
|
||||
salign = 8
|
||||
}
|
||||
}
|
||||
|
||||
return (salen + salign - 1) & ^(salign - 1)
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,7 @@
|
|||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
import "unsafe"
|
||||
|
||||
/*
|
||||
* Wrapped
|
||||
|
@ -230,7 +227,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
|
||||
// Some versions of AIX have a bug in getsockname (see IV78655).
|
||||
// We can't rely on sa.Len being set correctly.
|
||||
n := SizeofSockaddrUnix - 3 // substract leading Family, Len, terminating NUL.
|
||||
n := SizeofSockaddrUnix - 3 // subtract leading Family, Len, terminating NUL.
|
||||
for i := 0; i < n; i++ {
|
||||
if pp.Path[i] == 0 {
|
||||
n = i
|
||||
|
@ -271,6 +268,13 @@ func Gettimeofday(tv *Timeval) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
// TODO
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
return -1, ENOSYS
|
||||
|
@ -385,10 +389,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
|||
|
||||
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
||||
|
||||
func Flock(fd int, how int) (err error) {
|
||||
return syscall.Flock(fd, how)
|
||||
}
|
||||
|
||||
/*
|
||||
* Direct access
|
||||
*/
|
||||
|
|
|
@ -108,17 +108,8 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (
|
|||
return nil, err
|
||||
}
|
||||
|
||||
_, _, e1 := Syscall6(
|
||||
SYS_GETATTRLIST,
|
||||
uintptr(unsafe.Pointer(_p0)),
|
||||
uintptr(unsafe.Pointer(&attrList)),
|
||||
uintptr(unsafe.Pointer(&attrBuf[0])),
|
||||
uintptr(len(attrBuf)),
|
||||
uintptr(options),
|
||||
0,
|
||||
)
|
||||
if e1 != 0 {
|
||||
return nil, e1
|
||||
if err := getattrlist(_p0, unsafe.Pointer(&attrList), unsafe.Pointer(&attrBuf[0]), uintptr(len(attrBuf)), int(options)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
size := *(*uint32)(unsafe.Pointer(&attrBuf[0]))
|
||||
|
||||
|
@ -151,6 +142,8 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (
|
|||
return
|
||||
}
|
||||
|
||||
//sys getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
|
||||
|
||||
//sysnb pipe() (r int, w int, err error)
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
|
@ -168,12 +161,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
|||
_p0 = unsafe.Pointer(&buf[0])
|
||||
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(_p0), bufsize, uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
return getfsstat(_p0, bufsize, flags)
|
||||
}
|
||||
|
||||
func xattrPointer(dest []byte) *byte {
|
||||
|
@ -298,21 +286,16 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
|
|||
if flags&AT_SYMLINK_NOFOLLOW != 0 {
|
||||
options |= FSOPT_NOFOLLOW
|
||||
}
|
||||
_, _, e1 := Syscall6(
|
||||
SYS_SETATTRLIST,
|
||||
uintptr(unsafe.Pointer(_p0)),
|
||||
uintptr(unsafe.Pointer(&attrList)),
|
||||
uintptr(unsafe.Pointer(&attributes)),
|
||||
uintptr(unsafe.Sizeof(attributes)),
|
||||
uintptr(options),
|
||||
0,
|
||||
)
|
||||
if e1 != 0 {
|
||||
return e1
|
||||
}
|
||||
return nil
|
||||
return setattrlist(
|
||||
_p0,
|
||||
unsafe.Pointer(&attrList),
|
||||
unsafe.Pointer(&attributes),
|
||||
unsafe.Sizeof(attributes),
|
||||
options)
|
||||
}
|
||||
|
||||
//sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
|
||||
|
||||
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error {
|
||||
// Darwin doesn't support SYS_UTIMENSAT
|
||||
return ENOSYS
|
||||
|
@ -411,6 +394,18 @@ func Uname(uname *Utsname) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
var length = int64(count)
|
||||
err = sendfile(infd, outfd, *offset, &length, nil, 0)
|
||||
written = int(length)
|
||||
return
|
||||
}
|
||||
|
||||
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
|
@ -421,6 +416,7 @@ func Uname(uname *Utsname) error {
|
|||
//sys Chmod(path string, mode uint32) (err error)
|
||||
//sys Chown(path string, uid int, gid int) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sys Dup(fd int) (nfd int, err error)
|
||||
//sys Dup2(from int, to int) (err error)
|
||||
|
@ -435,12 +431,8 @@ func Uname(uname *Utsname) error {
|
|||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||
//sys Flock(fd int, how int) (err error)
|
||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||
//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 Fsync(fd int) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
|
||||
//sys Getdtablesize() (size int)
|
||||
//sysnb Getegid() (egid int)
|
||||
//sysnb Geteuid() (uid int)
|
||||
|
@ -460,7 +452,6 @@ func Uname(uname *Utsname) error {
|
|||
//sys Link(path string, link string) (err error)
|
||||
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
||||
//sys Listen(s int, backlog int) (err error)
|
||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
|
@ -492,8 +483,6 @@ func Uname(uname *Utsname) error {
|
|||
//sysnb Setsid() (pid int, err error)
|
||||
//sysnb Settimeofday(tp *Timeval) (err error)
|
||||
//sysnb Setuid(uid int) (err error)
|
||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
||||
//sys Symlink(path string, link string) (err error)
|
||||
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Sync() (err error)
|
||||
|
|
|
@ -8,7 +8,6 @@ package unix
|
|||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
|
@ -48,21 +47,17 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
var length = uint64(count)
|
||||
|
||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
|
||||
|
||||
written = int(length)
|
||||
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of darwin/386 the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
||||
|
||||
//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 Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
|
||||
//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 Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
||||
|
|
|
@ -8,7 +8,6 @@ package unix
|
|||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
|
@ -48,21 +47,17 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
var length = uint64(count)
|
||||
|
||||
_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
|
||||
|
||||
written = int(length)
|
||||
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of darwin/amd64 the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
||||
|
||||
//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 Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
|
||||
//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 Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
||||
|
|
|
@ -6,7 +6,6 @@ package unix
|
|||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
|
@ -46,21 +45,20 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
var length = uint64(count)
|
||||
|
||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
|
||||
|
||||
written = int(length)
|
||||
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of darwin/arm the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
||||
|
||||
//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)
|
||||
|
||||
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||
return 0, ENOSYS
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ package unix
|
|||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
|
@ -48,21 +47,20 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
var length = uint64(count)
|
||||
|
||||
_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
|
||||
|
||||
written = int(length)
|
||||
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of darwin/arm64 the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
||||
|
||||
//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)
|
||||
|
||||
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||
return 0, ENOSYS
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
// 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 darwin,go1.12
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// Implemented in the runtime package (runtime/sys_darwin.go)
|
||||
func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
||||
func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||
func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||
func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) // 32-bit only
|
||||
func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
||||
func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||
|
||||
//go:linkname syscall_syscall syscall.syscall
|
||||
//go:linkname syscall_syscall6 syscall.syscall6
|
||||
//go:linkname syscall_syscall6X syscall.syscall6X
|
||||
//go:linkname syscall_syscall9 syscall.syscall9
|
||||
//go:linkname syscall_rawSyscall syscall.rawSyscall
|
||||
//go:linkname syscall_rawSyscall6 syscall.rawSyscall6
|
||||
|
||||
// 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))
|
||||
}
|
|
@ -234,6 +234,13 @@ func Uname(uname *Utsname) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
|
@ -297,6 +304,7 @@ func Uname(uname *Utsname) error {
|
|||
//sys read(fd int, p []byte) (n int, err error)
|
||||
//sys Readlink(path string, buf []byte) (n int, err error)
|
||||
//sys Rename(from string, to string) (err error)
|
||||
//sys Renameat(fromfd int, from string, tofd int, to string) (err error)
|
||||
//sys Revoke(path string) (err error)
|
||||
//sys Rmdir(path string) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
||||
|
|
|
@ -500,6 +500,13 @@ func convertFromDirents11(buf []byte, old []byte) int {
|
|||
return dstPos
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
// 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 arm64,freebsd
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
}
|
||||
|
||||
func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: sec, Usec: usec}
|
||||
}
|
||||
|
||||
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
||||
k.Ident = uint64(fd)
|
||||
k.Filter = int16(mode)
|
||||
k.Flags = uint16(flags)
|
||||
}
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
var writtenOut uint64 = 0
|
||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
|
||||
|
||||
written = int(writtenOut)
|
||||
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
|
@ -12,6 +12,9 @@
|
|||
package unix
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"net"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
@ -55,6 +58,15 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
|
|||
// ioctl itself should not be exposed directly, but additional get/set
|
||||
// functions for specific types are permissible.
|
||||
|
||||
// IoctlSetPointerInt performs an ioctl operation which sets an
|
||||
// integer value on fd, using the specified request number. The ioctl
|
||||
// argument is called with a pointer to the integer value, rather than
|
||||
// passing the integer value directly.
|
||||
func IoctlSetPointerInt(fd int, req uint, value int) error {
|
||||
v := int32(value)
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
|
||||
}
|
||||
|
||||
// IoctlSetInt performs an ioctl operation which sets an integer value
|
||||
// on fd, using the specified request number.
|
||||
func IoctlSetInt(fd int, req uint, value int) error {
|
||||
|
@ -69,6 +81,12 @@ func ioctlSetTermios(fd int, req uint, value *Termios) error {
|
|||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlSetRTCTime(fd int, value *RTCTime) error {
|
||||
err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value)))
|
||||
runtime.KeepAlive(value)
|
||||
return err
|
||||
}
|
||||
|
||||
// IoctlGetInt performs an ioctl operation which gets an integer value
|
||||
// from fd, using the specified request number.
|
||||
func IoctlGetInt(fd int, req uint) (int, error) {
|
||||
|
@ -89,6 +107,12 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
|||
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
|
||||
}
|
||||
|
||||
//sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
|
||||
|
||||
func Link(oldpath string, newpath string) (err error) {
|
||||
|
@ -710,6 +734,51 @@ func (sa *SockaddrXDP) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
return unsafe.Pointer(&sa.raw), SizeofSockaddrXDP, nil
|
||||
}
|
||||
|
||||
// This constant mirrors the #define of PX_PROTO_OE in
|
||||
// linux/if_pppox.h. We're defining this by hand here instead of
|
||||
// autogenerating through mkerrors.sh because including
|
||||
// linux/if_pppox.h causes some declaration conflicts with other
|
||||
// includes (linux/if_pppox.h includes linux/in.h, which conflicts
|
||||
// with netinet/in.h). Given that we only need a single zero constant
|
||||
// out of that file, it's cleaner to just define it by hand here.
|
||||
const px_proto_oe = 0
|
||||
|
||||
type SockaddrPPPoE struct {
|
||||
SID uint16
|
||||
Remote net.HardwareAddr
|
||||
Dev string
|
||||
raw RawSockaddrPPPoX
|
||||
}
|
||||
|
||||
func (sa *SockaddrPPPoE) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
if len(sa.Remote) != 6 {
|
||||
return nil, 0, EINVAL
|
||||
}
|
||||
if len(sa.Dev) > IFNAMSIZ-1 {
|
||||
return nil, 0, EINVAL
|
||||
}
|
||||
|
||||
*(*uint16)(unsafe.Pointer(&sa.raw[0])) = AF_PPPOX
|
||||
// This next field is in host-endian byte order. We can't use the
|
||||
// same unsafe pointer cast as above, because this value is not
|
||||
// 32-bit aligned and some architectures don't allow unaligned
|
||||
// access.
|
||||
//
|
||||
// However, the value of px_proto_oe is 0, so we can use
|
||||
// encoding/binary helpers to write the bytes without worrying
|
||||
// about the ordering.
|
||||
binary.BigEndian.PutUint32(sa.raw[2:6], px_proto_oe)
|
||||
// This field is deliberately big-endian, unlike the previous
|
||||
// one. The kernel expects SID to be in network byte order.
|
||||
binary.BigEndian.PutUint16(sa.raw[6:8], sa.SID)
|
||||
copy(sa.raw[8:14], sa.Remote)
|
||||
for i := 14; i < 14+IFNAMSIZ; i++ {
|
||||
sa.raw[i] = 0
|
||||
}
|
||||
copy(sa.raw[14:], sa.Dev)
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrPPPoX, nil
|
||||
}
|
||||
|
||||
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
switch rsa.Addr.Family {
|
||||
case AF_NETLINK:
|
||||
|
@ -820,6 +889,22 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
SharedUmemFD: pp.Shared_umem_fd,
|
||||
}
|
||||
return sa, nil
|
||||
case AF_PPPOX:
|
||||
pp := (*RawSockaddrPPPoX)(unsafe.Pointer(rsa))
|
||||
if binary.BigEndian.Uint32(pp[2:6]) != px_proto_oe {
|
||||
return nil, EINVAL
|
||||
}
|
||||
sa := &SockaddrPPPoE{
|
||||
SID: binary.BigEndian.Uint16(pp[6:8]),
|
||||
Remote: net.HardwareAddr(pp[8:14]),
|
||||
}
|
||||
for i := 14; i < 14+IFNAMSIZ; i++ {
|
||||
if pp[i] == 0 {
|
||||
sa.Dev = string(pp[14:i])
|
||||
break
|
||||
}
|
||||
}
|
||||
return sa, nil
|
||||
}
|
||||
return nil, EAFNOSUPPORT
|
||||
}
|
||||
|
@ -1288,6 +1373,13 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
|||
return mount(source, target, fstype, flags, datap)
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
// Sendto
|
||||
// Recvfrom
|
||||
// Socketpair
|
||||
|
@ -1302,6 +1394,7 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
|||
//sys Chroot(path string) (err error)
|
||||
//sys ClockGetres(clockid int32, res *Timespec) (err error)
|
||||
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
||||
//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sys CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
||||
//sys DeleteModule(name string, flags int) (err error)
|
||||
|
@ -1362,7 +1455,6 @@ func Getpgrp() (pid int) {
|
|||
//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)
|
||||
//sys Removexattr(path string, attr string) (err error)
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error)
|
||||
//sys RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error)
|
||||
//sys Setdomainname(p []byte) (err error)
|
||||
|
@ -1387,6 +1479,7 @@ func Setgid(uid int) (err error) {
|
|||
|
||||
//sys Setpriority(which int, who int, prio int) (err error)
|
||||
//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
|
||||
//sys Signalfd(fd int, mask *Sigset_t, flags int) = SYS_SIGNALFD4
|
||||
//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error)
|
||||
//sys Sync()
|
||||
//sys Syncfs(fd int) (err error)
|
||||
|
@ -1431,15 +1524,12 @@ func Munmap(b []byte) (err error) {
|
|||
// Vmsplice splices user pages from a slice of Iovecs into a pipe specified by fd,
|
||||
// using the specified flags.
|
||||
func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
||||
n, _, errno := Syscall6(
|
||||
SYS_VMSPLICE,
|
||||
uintptr(fd),
|
||||
uintptr(unsafe.Pointer(&iovs[0])),
|
||||
uintptr(len(iovs)),
|
||||
uintptr(flags),
|
||||
0,
|
||||
0,
|
||||
)
|
||||
var p unsafe.Pointer
|
||||
if len(iovs) > 0 {
|
||||
p = unsafe.Pointer(&iovs[0])
|
||||
}
|
||||
|
||||
n, _, errno := Syscall6(SYS_VMSPLICE, uintptr(fd), uintptr(p), uintptr(len(iovs)), uintptr(flags), 0, 0)
|
||||
if errno != 0 {
|
||||
return 0, syscall.Errno(errno)
|
||||
}
|
||||
|
@ -1606,7 +1696,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
|
|||
// Shmdt
|
||||
// Shmget
|
||||
// Sigaltstack
|
||||
// Signalfd
|
||||
// Swapoff
|
||||
// Swapon
|
||||
// Sysfs
|
||||
|
|
|
@ -68,6 +68,7 @@ func Pipe2(p []int, flags int) (err error) {
|
|||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||
//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 sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
||||
//sys Setfsgid(gid int) (err error) = SYS_SETFSGID32
|
||||
//sys Setfsuid(uid int) (err error) = SYS_SETFSUID32
|
||||
|
|
|
@ -20,15 +20,30 @@ package unix
|
|||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
||||
//sysnb Getuid() (uid int)
|
||||
//sysnb InotifyInit() (fd int, err error)
|
||||
//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)
|
||||
//sys Listen(s int, n int) (err error)
|
||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||
|
||||
func Lstat(path string, stat *Stat_t) (err error) {
|
||||
return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
|
||||
}
|
||||
|
||||
//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 Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
|
||||
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
||||
|
|
|
@ -89,6 +89,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, 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 Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
||||
//sys Setfsgid(gid int) (err error) = SYS_SETFSGID32
|
||||
|
@ -257,3 +258,11 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
}
|
||||
|
||||
//sys armSyncFileRange(fd int, flags int, off int64, n int64) (err error) = SYS_ARM_SYNC_FILE_RANGE
|
||||
|
||||
func SyncFileRange(fd int, off int64, n int64, flags int) error {
|
||||
// The sync_file_range and arm_sync_file_range syscalls differ only in the
|
||||
// order of their arguments.
|
||||
return armSyncFileRange(fd, flags, off, n)
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ func EpollCreate(size int) (fd int, err error) {
|
|||
//sys Listen(s int, n int) (err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
|
||||
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
||||
|
|
|
@ -12,7 +12,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 Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sysnb Getegid() (egid int)
|
||||
|
@ -25,6 +24,7 @@ package unix
|
|||
//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 Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
|
||||
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
||||
|
@ -148,6 +148,7 @@ type stat_t struct {
|
|||
}
|
||||
|
||||
//sys fstat(fd int, st *stat_t) (err error)
|
||||
//sys fstatat(dirfd int, path string, st *stat_t, flags int) (err error) = SYS_NEWFSTATAT
|
||||
//sys lstat(path string, st *stat_t) (err error)
|
||||
//sys stat(path string, st *stat_t) (err error)
|
||||
|
||||
|
@ -158,6 +159,13 @@ func Fstat(fd int, s *Stat_t) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func Fstatat(dirfd int, path string, s *Stat_t, flags int) (err error) {
|
||||
st := &stat_t{}
|
||||
err = fstatat(dirfd, path, st, flags)
|
||||
fillStat_t(s, st)
|
||||
return
|
||||
}
|
||||
|
||||
func Lstat(path string, s *Stat_t) (err error) {
|
||||
st := &stat_t{}
|
||||
err = lstat(path, st)
|
||||
|
|
|
@ -28,6 +28,7 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
|
|||
//sys Listen(s int, n int) (err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||
//sys 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) (err error)
|
||||
|
|
|
@ -30,6 +30,7 @@ package unix
|
|||
//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 Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||
|
|
|
@ -207,3 +207,7 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|||
}
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import (
|
|||
//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 Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||
|
|
|
@ -26,6 +26,7 @@ package unix
|
|||
//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 Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||
|
|
|
@ -244,6 +244,13 @@ func Uname(uname *Utsname) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
// 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 arm64,netbsd
|
||||
|
||||
package unix
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
}
|
||||
|
||||
func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: sec, Usec: int32(usec)}
|
||||
}
|
||||
|
||||
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
||||
k.Ident = uint64(fd)
|
||||
k.Filter = uint32(mode)
|
||||
k.Flags = uint32(flags)
|
||||
}
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
|
@ -94,6 +94,13 @@ func Getwd() (string, error) {
|
|||
return string(buf[:n]), nil
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
// TODO
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
return -1, ENOSYS
|
||||
|
|
|
@ -585,6 +585,13 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|||
return poll(&fds[0], len(fds), timeout)
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,6 @@ package unix
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"runtime"
|
||||
"sort"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
@ -21,13 +20,6 @@ var (
|
|||
Stderr = 2
|
||||
)
|
||||
|
||||
const (
|
||||
darwin64Bit = runtime.GOOS == "darwin" && SizeofPtr == 8
|
||||
dragonfly64Bit = runtime.GOOS == "dragonfly" && SizeofPtr == 8
|
||||
netbsd32Bit = runtime.GOOS == "netbsd" && SizeofPtr == 4
|
||||
solaris64Bit = runtime.GOOS == "solaris" && SizeofPtr == 8
|
||||
)
|
||||
|
||||
// Do the interface allocations only once for common
|
||||
// Errno values.
|
||||
var (
|
||||
|
@ -359,13 +351,6 @@ func Socketpair(domain, typ, proto int) (fd [2]int, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
var ioSync int64
|
||||
|
||||
func CloseOnExec(fd int) { fcntl(fd, F_SETFD, FD_CLOEXEC) }
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -41,7 +41,7 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x2c
|
||||
AF_MAX = 0x2d
|
||||
AF_MPLS = 0x1c
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
|
@ -639,7 +639,7 @@ const (
|
|||
IFA_F_STABLE_PRIVACY = 0x800
|
||||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x9
|
||||
IFA_MAX = 0xa
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ATTACH_QUEUE = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
|
@ -707,6 +707,7 @@ const (
|
|||
IN_ISDIR = 0x40000000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IN_MASK_ADD = 0x20000000
|
||||
IN_MASK_CREATE = 0x10000000
|
||||
IN_MODIFY = 0x2
|
||||
IN_MOVE = 0xc0
|
||||
IN_MOVED_FROM = 0x40
|
||||
|
@ -778,6 +779,7 @@ const (
|
|||
IPV6_MINHOPCOUNT = 0x49
|
||||
IPV6_MTU = 0x18
|
||||
IPV6_MTU_DISCOVER = 0x17
|
||||
IPV6_MULTICAST_ALL = 0x1d
|
||||
IPV6_MULTICAST_HOPS = 0x12
|
||||
IPV6_MULTICAST_IF = 0x11
|
||||
IPV6_MULTICAST_LOOP = 0x13
|
||||
|
@ -913,6 +915,11 @@ const (
|
|||
KEYCTL_JOIN_SESSION_KEYRING = 0x1
|
||||
KEYCTL_LINK = 0x8
|
||||
KEYCTL_NEGATE = 0xd
|
||||
KEYCTL_PKEY_DECRYPT = 0x1a
|
||||
KEYCTL_PKEY_ENCRYPT = 0x19
|
||||
KEYCTL_PKEY_QUERY = 0x18
|
||||
KEYCTL_PKEY_SIGN = 0x1b
|
||||
KEYCTL_PKEY_VERIFY = 0x1c
|
||||
KEYCTL_READ = 0xb
|
||||
KEYCTL_REJECT = 0x13
|
||||
KEYCTL_RESTRICT_KEYRING = 0x1d
|
||||
|
@ -922,6 +929,10 @@ const (
|
|||
KEYCTL_SETPERM = 0x5
|
||||
KEYCTL_SET_REQKEY_KEYRING = 0xe
|
||||
KEYCTL_SET_TIMEOUT = 0xf
|
||||
KEYCTL_SUPPORTS_DECRYPT = 0x2
|
||||
KEYCTL_SUPPORTS_ENCRYPT = 0x1
|
||||
KEYCTL_SUPPORTS_SIGN = 0x4
|
||||
KEYCTL_SUPPORTS_VERIFY = 0x8
|
||||
KEYCTL_UNLINK = 0x9
|
||||
KEYCTL_UPDATE = 0x2
|
||||
KEY_REQKEY_DEFL_DEFAULT = 0x0
|
||||
|
@ -1101,6 +1112,7 @@ const (
|
|||
NETLINK_FIB_LOOKUP = 0xa
|
||||
NETLINK_FIREWALL = 0x3
|
||||
NETLINK_GENERIC = 0x10
|
||||
NETLINK_GET_STRICT_CHK = 0xc
|
||||
NETLINK_INET_DIAG = 0x4
|
||||
NETLINK_IP6_FW = 0xd
|
||||
NETLINK_ISCSI = 0x8
|
||||
|
@ -1244,6 +1256,7 @@ const (
|
|||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_IGNORE_OUTGOING = 0x17
|
||||
PACKET_KERNEL = 0x7
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
|
@ -1293,6 +1306,36 @@ const (
|
|||
PERF_EVENT_IOC_SET_FILTER = 0x40042406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
|
||||
PIPEFS_MAGIC = 0x50495045
|
||||
PPPIOCATTACH = 0x4004743d
|
||||
PPPIOCATTCHAN = 0x40047438
|
||||
PPPIOCCONNECT = 0x4004743a
|
||||
PPPIOCDETACH = 0x4004743c
|
||||
PPPIOCDISCONN = 0x7439
|
||||
PPPIOCGASYNCMAP = 0x80047458
|
||||
PPPIOCGCHAN = 0x80047437
|
||||
PPPIOCGDEBUG = 0x80047441
|
||||
PPPIOCGFLAGS = 0x8004745a
|
||||
PPPIOCGIDLE = 0x8008743f
|
||||
PPPIOCGL2TPSTATS = 0x80487436
|
||||
PPPIOCGMRU = 0x80047453
|
||||
PPPIOCGNPMODE = 0xc008744c
|
||||
PPPIOCGRASYNCMAP = 0x80047455
|
||||
PPPIOCGUNIT = 0x80047456
|
||||
PPPIOCGXASYNCMAP = 0x80207450
|
||||
PPPIOCNEWUNIT = 0xc004743e
|
||||
PPPIOCSACTIVE = 0x40087446
|
||||
PPPIOCSASYNCMAP = 0x40047457
|
||||
PPPIOCSCOMPRESS = 0x400c744d
|
||||
PPPIOCSDEBUG = 0x40047440
|
||||
PPPIOCSFLAGS = 0x40047459
|
||||
PPPIOCSMAXCID = 0x40047451
|
||||
PPPIOCSMRRU = 0x4004743b
|
||||
PPPIOCSMRU = 0x40047452
|
||||
PPPIOCSNPMODE = 0x4008744b
|
||||
PPPIOCSPASS = 0x40087447
|
||||
PPPIOCSRASYNCMAP = 0x40047454
|
||||
PPPIOCSXASYNCMAP = 0x4020744f
|
||||
PPPIOCXFERUNIT = 0x744e
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -1394,6 +1437,7 @@ const (
|
|||
PR_SPEC_DISABLE = 0x4
|
||||
PR_SPEC_ENABLE = 0x2
|
||||
PR_SPEC_FORCE_DISABLE = 0x8
|
||||
PR_SPEC_INDIRECT_BRANCH = 0x1
|
||||
PR_SPEC_NOT_AFFECTED = 0x0
|
||||
PR_SPEC_PRCTL = 0x1
|
||||
PR_SPEC_STORE_BYPASS = 0x0
|
||||
|
@ -1495,6 +1539,13 @@ const (
|
|||
RLIMIT_SIGPENDING = 0xb
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0xffffffffffffffff
|
||||
RNDADDENTROPY = 0x40085203
|
||||
RNDADDTOENTCNT = 0x40045201
|
||||
RNDCLEARPOOL = 0x5206
|
||||
RNDGETENTCNT = 0x80045200
|
||||
RNDGETPOOL = 0x80085202
|
||||
RNDRESEEDCRNG = 0x5207
|
||||
RNDZAPENTCNT = 0x5204
|
||||
RTAX_ADVMSS = 0x8
|
||||
RTAX_CC_ALGO = 0x10
|
||||
RTAX_CWND = 0x7
|
||||
|
@ -1696,11 +1747,14 @@ const (
|
|||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SC_LOG_FLUSH = 0x100000
|
||||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SELINUX_MAGIC = 0xf97cff8c
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1751,6 +1805,9 @@ const (
|
|||
SIOCGMIIPHY = 0x8947
|
||||
SIOCGMIIREG = 0x8948
|
||||
SIOCGPGRP = 0x8904
|
||||
SIOCGPPPCSTATS = 0x89f2
|
||||
SIOCGPPPSTATS = 0x89f0
|
||||
SIOCGPPPVER = 0x89f1
|
||||
SIOCGRARP = 0x8961
|
||||
SIOCGSKNS = 0x894c
|
||||
SIOCGSTAMP = 0x8906
|
||||
|
@ -1859,6 +1916,17 @@ const (
|
|||
SO_DETACH_FILTER = 0x1b
|
||||
SO_DOMAIN = 0x27
|
||||
SO_DONTROUTE = 0x5
|
||||
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
|
||||
SO_EE_CODE_TXTIME_MISSED = 0x2
|
||||
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
|
||||
SO_EE_ORIGIN_ICMP = 0x2
|
||||
SO_EE_ORIGIN_ICMP6 = 0x3
|
||||
SO_EE_ORIGIN_LOCAL = 0x1
|
||||
SO_EE_ORIGIN_NONE = 0x0
|
||||
SO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
SO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
SO_EE_ORIGIN_TXTIME = 0x6
|
||||
SO_EE_ORIGIN_ZEROCOPY = 0x5
|
||||
SO_ERROR = 0x4
|
||||
SO_GET_FILTER = 0x1a
|
||||
SO_INCOMING_CPU = 0x31
|
||||
|
@ -1978,7 +2046,7 @@ const (
|
|||
TASKSTATS_GENL_NAME = "TASKSTATS"
|
||||
TASKSTATS_GENL_VERSION = 0x1
|
||||
TASKSTATS_TYPE_MAX = 0x6
|
||||
TASKSTATS_VERSION = 0x8
|
||||
TASKSTATS_VERSION = 0x9
|
||||
TCFLSH = 0x540b
|
||||
TCGETA = 0x5405
|
||||
TCGETS = 0x5401
|
||||
|
@ -1992,6 +2060,7 @@ const (
|
|||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CC_INFO = 0x1a
|
||||
TCP_CM_INQ = 0x24
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_COOKIE_IN_ALWAYS = 0x1
|
||||
TCP_COOKIE_MAX = 0x10
|
||||
|
@ -2006,6 +2075,7 @@ const (
|
|||
TCP_FASTOPEN_KEY = 0x21
|
||||
TCP_FASTOPEN_NO_COOKIE = 0x22
|
||||
TCP_INFO = 0xb
|
||||
TCP_INQ = 0x24
|
||||
TCP_KEEPCNT = 0x6
|
||||
TCP_KEEPIDLE = 0x4
|
||||
TCP_KEEPINTVL = 0x5
|
||||
|
@ -2025,6 +2095,9 @@ const (
|
|||
TCP_QUEUE_SEQ = 0x15
|
||||
TCP_QUICKACK = 0xc
|
||||
TCP_REPAIR = 0x13
|
||||
TCP_REPAIR_OFF = 0x0
|
||||
TCP_REPAIR_OFF_NO_WP = -0x1
|
||||
TCP_REPAIR_ON = 0x1
|
||||
TCP_REPAIR_OPTIONS = 0x16
|
||||
TCP_REPAIR_QUEUE = 0x14
|
||||
TCP_REPAIR_WINDOW = 0x1d
|
||||
|
@ -2039,6 +2112,7 @@ const (
|
|||
TCP_ULP = 0x1f
|
||||
TCP_USER_TIMEOUT = 0x12
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCP_ZEROCOPY_RECEIVE = 0x23
|
||||
TCSAFLUSH = 0x2
|
||||
TCSBRK = 0x5409
|
||||
TCSBRKP = 0x5425
|
||||
|
@ -2055,6 +2129,7 @@ const (
|
|||
TCSETXF = 0x5434
|
||||
TCSETXW = 0x5435
|
||||
TCXONC = 0x540a
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x541d
|
||||
TIOCEXCL = 0x540c
|
||||
|
@ -2062,6 +2137,7 @@ const (
|
|||
TIOCGETD = 0x5424
|
||||
TIOCGEXCL = 0x80045440
|
||||
TIOCGICOUNT = 0x545d
|
||||
TIOCGISO7816 = 0x80285442
|
||||
TIOCGLCKTRMIOS = 0x5456
|
||||
TIOCGPGRP = 0x540f
|
||||
TIOCGPKT = 0x80045438
|
||||
|
@ -2115,6 +2191,7 @@ const (
|
|||
TIOCSER_TEMT = 0x1
|
||||
TIOCSETD = 0x5423
|
||||
TIOCSIG = 0x40045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x5457
|
||||
TIOCSPGRP = 0x5410
|
||||
TIOCSPTLCK = 0x40045431
|
||||
|
@ -2345,6 +2422,7 @@ const (
|
|||
XDP_UMEM_REG = 0x4
|
||||
XDP_ZEROCOPY = 0x4
|
||||
XENFS_SUPER_MAGIC = 0xabba1974
|
||||
XFS_SUPER_MAGIC = 0x58465342
|
||||
XTABS = 0x1800
|
||||
ZSMALLOC_MAGIC = 0x58295829
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x2c
|
||||
AF_MAX = 0x2d
|
||||
AF_MPLS = 0x1c
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
|
@ -639,7 +639,7 @@ const (
|
|||
IFA_F_STABLE_PRIVACY = 0x800
|
||||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x9
|
||||
IFA_MAX = 0xa
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ATTACH_QUEUE = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
|
@ -707,6 +707,7 @@ const (
|
|||
IN_ISDIR = 0x40000000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IN_MASK_ADD = 0x20000000
|
||||
IN_MASK_CREATE = 0x10000000
|
||||
IN_MODIFY = 0x2
|
||||
IN_MOVE = 0xc0
|
||||
IN_MOVED_FROM = 0x40
|
||||
|
@ -778,6 +779,7 @@ const (
|
|||
IPV6_MINHOPCOUNT = 0x49
|
||||
IPV6_MTU = 0x18
|
||||
IPV6_MTU_DISCOVER = 0x17
|
||||
IPV6_MULTICAST_ALL = 0x1d
|
||||
IPV6_MULTICAST_HOPS = 0x12
|
||||
IPV6_MULTICAST_IF = 0x11
|
||||
IPV6_MULTICAST_LOOP = 0x13
|
||||
|
@ -913,6 +915,11 @@ const (
|
|||
KEYCTL_JOIN_SESSION_KEYRING = 0x1
|
||||
KEYCTL_LINK = 0x8
|
||||
KEYCTL_NEGATE = 0xd
|
||||
KEYCTL_PKEY_DECRYPT = 0x1a
|
||||
KEYCTL_PKEY_ENCRYPT = 0x19
|
||||
KEYCTL_PKEY_QUERY = 0x18
|
||||
KEYCTL_PKEY_SIGN = 0x1b
|
||||
KEYCTL_PKEY_VERIFY = 0x1c
|
||||
KEYCTL_READ = 0xb
|
||||
KEYCTL_REJECT = 0x13
|
||||
KEYCTL_RESTRICT_KEYRING = 0x1d
|
||||
|
@ -922,6 +929,10 @@ const (
|
|||
KEYCTL_SETPERM = 0x5
|
||||
KEYCTL_SET_REQKEY_KEYRING = 0xe
|
||||
KEYCTL_SET_TIMEOUT = 0xf
|
||||
KEYCTL_SUPPORTS_DECRYPT = 0x2
|
||||
KEYCTL_SUPPORTS_ENCRYPT = 0x1
|
||||
KEYCTL_SUPPORTS_SIGN = 0x4
|
||||
KEYCTL_SUPPORTS_VERIFY = 0x8
|
||||
KEYCTL_UNLINK = 0x9
|
||||
KEYCTL_UPDATE = 0x2
|
||||
KEY_REQKEY_DEFL_DEFAULT = 0x0
|
||||
|
@ -1101,6 +1112,7 @@ const (
|
|||
NETLINK_FIB_LOOKUP = 0xa
|
||||
NETLINK_FIREWALL = 0x3
|
||||
NETLINK_GENERIC = 0x10
|
||||
NETLINK_GET_STRICT_CHK = 0xc
|
||||
NETLINK_INET_DIAG = 0x4
|
||||
NETLINK_IP6_FW = 0xd
|
||||
NETLINK_ISCSI = 0x8
|
||||
|
@ -1244,6 +1256,7 @@ const (
|
|||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_IGNORE_OUTGOING = 0x17
|
||||
PACKET_KERNEL = 0x7
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
|
@ -1293,6 +1306,36 @@ const (
|
|||
PERF_EVENT_IOC_SET_FILTER = 0x40082406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
|
||||
PIPEFS_MAGIC = 0x50495045
|
||||
PPPIOCATTACH = 0x4004743d
|
||||
PPPIOCATTCHAN = 0x40047438
|
||||
PPPIOCCONNECT = 0x4004743a
|
||||
PPPIOCDETACH = 0x4004743c
|
||||
PPPIOCDISCONN = 0x7439
|
||||
PPPIOCGASYNCMAP = 0x80047458
|
||||
PPPIOCGCHAN = 0x80047437
|
||||
PPPIOCGDEBUG = 0x80047441
|
||||
PPPIOCGFLAGS = 0x8004745a
|
||||
PPPIOCGIDLE = 0x8010743f
|
||||
PPPIOCGL2TPSTATS = 0x80487436
|
||||
PPPIOCGMRU = 0x80047453
|
||||
PPPIOCGNPMODE = 0xc008744c
|
||||
PPPIOCGRASYNCMAP = 0x80047455
|
||||
PPPIOCGUNIT = 0x80047456
|
||||
PPPIOCGXASYNCMAP = 0x80207450
|
||||
PPPIOCNEWUNIT = 0xc004743e
|
||||
PPPIOCSACTIVE = 0x40107446
|
||||
PPPIOCSASYNCMAP = 0x40047457
|
||||
PPPIOCSCOMPRESS = 0x4010744d
|
||||
PPPIOCSDEBUG = 0x40047440
|
||||
PPPIOCSFLAGS = 0x40047459
|
||||
PPPIOCSMAXCID = 0x40047451
|
||||
PPPIOCSMRRU = 0x4004743b
|
||||
PPPIOCSMRU = 0x40047452
|
||||
PPPIOCSNPMODE = 0x4008744b
|
||||
PPPIOCSPASS = 0x40107447
|
||||
PPPIOCSRASYNCMAP = 0x40047454
|
||||
PPPIOCSXASYNCMAP = 0x4020744f
|
||||
PPPIOCXFERUNIT = 0x744e
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -1394,6 +1437,7 @@ const (
|
|||
PR_SPEC_DISABLE = 0x4
|
||||
PR_SPEC_ENABLE = 0x2
|
||||
PR_SPEC_FORCE_DISABLE = 0x8
|
||||
PR_SPEC_INDIRECT_BRANCH = 0x1
|
||||
PR_SPEC_NOT_AFFECTED = 0x0
|
||||
PR_SPEC_PRCTL = 0x1
|
||||
PR_SPEC_STORE_BYPASS = 0x0
|
||||
|
@ -1496,6 +1540,13 @@ const (
|
|||
RLIMIT_SIGPENDING = 0xb
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0xffffffffffffffff
|
||||
RNDADDENTROPY = 0x40085203
|
||||
RNDADDTOENTCNT = 0x40045201
|
||||
RNDCLEARPOOL = 0x5206
|
||||
RNDGETENTCNT = 0x80045200
|
||||
RNDGETPOOL = 0x80085202
|
||||
RNDRESEEDCRNG = 0x5207
|
||||
RNDZAPENTCNT = 0x5204
|
||||
RTAX_ADVMSS = 0x8
|
||||
RTAX_CC_ALGO = 0x10
|
||||
RTAX_CWND = 0x7
|
||||
|
@ -1697,11 +1748,14 @@ const (
|
|||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SC_LOG_FLUSH = 0x100000
|
||||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SELINUX_MAGIC = 0xf97cff8c
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1752,6 +1806,9 @@ const (
|
|||
SIOCGMIIPHY = 0x8947
|
||||
SIOCGMIIREG = 0x8948
|
||||
SIOCGPGRP = 0x8904
|
||||
SIOCGPPPCSTATS = 0x89f2
|
||||
SIOCGPPPSTATS = 0x89f0
|
||||
SIOCGPPPVER = 0x89f1
|
||||
SIOCGRARP = 0x8961
|
||||
SIOCGSKNS = 0x894c
|
||||
SIOCGSTAMP = 0x8906
|
||||
|
@ -1860,6 +1917,17 @@ const (
|
|||
SO_DETACH_FILTER = 0x1b
|
||||
SO_DOMAIN = 0x27
|
||||
SO_DONTROUTE = 0x5
|
||||
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
|
||||
SO_EE_CODE_TXTIME_MISSED = 0x2
|
||||
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
|
||||
SO_EE_ORIGIN_ICMP = 0x2
|
||||
SO_EE_ORIGIN_ICMP6 = 0x3
|
||||
SO_EE_ORIGIN_LOCAL = 0x1
|
||||
SO_EE_ORIGIN_NONE = 0x0
|
||||
SO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
SO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
SO_EE_ORIGIN_TXTIME = 0x6
|
||||
SO_EE_ORIGIN_ZEROCOPY = 0x5
|
||||
SO_ERROR = 0x4
|
||||
SO_GET_FILTER = 0x1a
|
||||
SO_INCOMING_CPU = 0x31
|
||||
|
@ -1979,7 +2047,7 @@ const (
|
|||
TASKSTATS_GENL_NAME = "TASKSTATS"
|
||||
TASKSTATS_GENL_VERSION = 0x1
|
||||
TASKSTATS_TYPE_MAX = 0x6
|
||||
TASKSTATS_VERSION = 0x8
|
||||
TASKSTATS_VERSION = 0x9
|
||||
TCFLSH = 0x540b
|
||||
TCGETA = 0x5405
|
||||
TCGETS = 0x5401
|
||||
|
@ -1993,6 +2061,7 @@ const (
|
|||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CC_INFO = 0x1a
|
||||
TCP_CM_INQ = 0x24
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_COOKIE_IN_ALWAYS = 0x1
|
||||
TCP_COOKIE_MAX = 0x10
|
||||
|
@ -2007,6 +2076,7 @@ const (
|
|||
TCP_FASTOPEN_KEY = 0x21
|
||||
TCP_FASTOPEN_NO_COOKIE = 0x22
|
||||
TCP_INFO = 0xb
|
||||
TCP_INQ = 0x24
|
||||
TCP_KEEPCNT = 0x6
|
||||
TCP_KEEPIDLE = 0x4
|
||||
TCP_KEEPINTVL = 0x5
|
||||
|
@ -2026,6 +2096,9 @@ const (
|
|||
TCP_QUEUE_SEQ = 0x15
|
||||
TCP_QUICKACK = 0xc
|
||||
TCP_REPAIR = 0x13
|
||||
TCP_REPAIR_OFF = 0x0
|
||||
TCP_REPAIR_OFF_NO_WP = -0x1
|
||||
TCP_REPAIR_ON = 0x1
|
||||
TCP_REPAIR_OPTIONS = 0x16
|
||||
TCP_REPAIR_QUEUE = 0x14
|
||||
TCP_REPAIR_WINDOW = 0x1d
|
||||
|
@ -2040,6 +2113,7 @@ const (
|
|||
TCP_ULP = 0x1f
|
||||
TCP_USER_TIMEOUT = 0x12
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCP_ZEROCOPY_RECEIVE = 0x23
|
||||
TCSAFLUSH = 0x2
|
||||
TCSBRK = 0x5409
|
||||
TCSBRKP = 0x5425
|
||||
|
@ -2056,6 +2130,7 @@ const (
|
|||
TCSETXF = 0x5434
|
||||
TCSETXW = 0x5435
|
||||
TCXONC = 0x540a
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x541d
|
||||
TIOCEXCL = 0x540c
|
||||
|
@ -2063,6 +2138,7 @@ const (
|
|||
TIOCGETD = 0x5424
|
||||
TIOCGEXCL = 0x80045440
|
||||
TIOCGICOUNT = 0x545d
|
||||
TIOCGISO7816 = 0x80285442
|
||||
TIOCGLCKTRMIOS = 0x5456
|
||||
TIOCGPGRP = 0x540f
|
||||
TIOCGPKT = 0x80045438
|
||||
|
@ -2116,6 +2192,7 @@ const (
|
|||
TIOCSER_TEMT = 0x1
|
||||
TIOCSETD = 0x5423
|
||||
TIOCSIG = 0x40045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x5457
|
||||
TIOCSPGRP = 0x5410
|
||||
TIOCSPTLCK = 0x40045431
|
||||
|
@ -2345,6 +2422,7 @@ const (
|
|||
XDP_UMEM_REG = 0x4
|
||||
XDP_ZEROCOPY = 0x4
|
||||
XENFS_SUPER_MAGIC = 0xabba1974
|
||||
XFS_SUPER_MAGIC = 0x58465342
|
||||
XTABS = 0x1800
|
||||
ZSMALLOC_MAGIC = 0x58295829
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x2c
|
||||
AF_MAX = 0x2d
|
||||
AF_MPLS = 0x1c
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
|
@ -638,7 +638,7 @@ const (
|
|||
IFA_F_STABLE_PRIVACY = 0x800
|
||||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x9
|
||||
IFA_MAX = 0xa
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ATTACH_QUEUE = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
|
@ -706,6 +706,7 @@ const (
|
|||
IN_ISDIR = 0x40000000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IN_MASK_ADD = 0x20000000
|
||||
IN_MASK_CREATE = 0x10000000
|
||||
IN_MODIFY = 0x2
|
||||
IN_MOVE = 0xc0
|
||||
IN_MOVED_FROM = 0x40
|
||||
|
@ -777,6 +778,7 @@ const (
|
|||
IPV6_MINHOPCOUNT = 0x49
|
||||
IPV6_MTU = 0x18
|
||||
IPV6_MTU_DISCOVER = 0x17
|
||||
IPV6_MULTICAST_ALL = 0x1d
|
||||
IPV6_MULTICAST_HOPS = 0x12
|
||||
IPV6_MULTICAST_IF = 0x11
|
||||
IPV6_MULTICAST_LOOP = 0x13
|
||||
|
@ -912,6 +914,11 @@ const (
|
|||
KEYCTL_JOIN_SESSION_KEYRING = 0x1
|
||||
KEYCTL_LINK = 0x8
|
||||
KEYCTL_NEGATE = 0xd
|
||||
KEYCTL_PKEY_DECRYPT = 0x1a
|
||||
KEYCTL_PKEY_ENCRYPT = 0x19
|
||||
KEYCTL_PKEY_QUERY = 0x18
|
||||
KEYCTL_PKEY_SIGN = 0x1b
|
||||
KEYCTL_PKEY_VERIFY = 0x1c
|
||||
KEYCTL_READ = 0xb
|
||||
KEYCTL_REJECT = 0x13
|
||||
KEYCTL_RESTRICT_KEYRING = 0x1d
|
||||
|
@ -921,6 +928,10 @@ const (
|
|||
KEYCTL_SETPERM = 0x5
|
||||
KEYCTL_SET_REQKEY_KEYRING = 0xe
|
||||
KEYCTL_SET_TIMEOUT = 0xf
|
||||
KEYCTL_SUPPORTS_DECRYPT = 0x2
|
||||
KEYCTL_SUPPORTS_ENCRYPT = 0x1
|
||||
KEYCTL_SUPPORTS_SIGN = 0x4
|
||||
KEYCTL_SUPPORTS_VERIFY = 0x8
|
||||
KEYCTL_UNLINK = 0x9
|
||||
KEYCTL_UPDATE = 0x2
|
||||
KEY_REQKEY_DEFL_DEFAULT = 0x0
|
||||
|
@ -1099,6 +1110,7 @@ const (
|
|||
NETLINK_FIB_LOOKUP = 0xa
|
||||
NETLINK_FIREWALL = 0x3
|
||||
NETLINK_GENERIC = 0x10
|
||||
NETLINK_GET_STRICT_CHK = 0xc
|
||||
NETLINK_INET_DIAG = 0x4
|
||||
NETLINK_IP6_FW = 0xd
|
||||
NETLINK_ISCSI = 0x8
|
||||
|
@ -1242,6 +1254,7 @@ const (
|
|||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_IGNORE_OUTGOING = 0x17
|
||||
PACKET_KERNEL = 0x7
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
|
@ -1291,6 +1304,36 @@ const (
|
|||
PERF_EVENT_IOC_SET_FILTER = 0x40042406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
|
||||
PIPEFS_MAGIC = 0x50495045
|
||||
PPPIOCATTACH = 0x4004743d
|
||||
PPPIOCATTCHAN = 0x40047438
|
||||
PPPIOCCONNECT = 0x4004743a
|
||||
PPPIOCDETACH = 0x4004743c
|
||||
PPPIOCDISCONN = 0x7439
|
||||
PPPIOCGASYNCMAP = 0x80047458
|
||||
PPPIOCGCHAN = 0x80047437
|
||||
PPPIOCGDEBUG = 0x80047441
|
||||
PPPIOCGFLAGS = 0x8004745a
|
||||
PPPIOCGIDLE = 0x8008743f
|
||||
PPPIOCGL2TPSTATS = 0x80487436
|
||||
PPPIOCGMRU = 0x80047453
|
||||
PPPIOCGNPMODE = 0xc008744c
|
||||
PPPIOCGRASYNCMAP = 0x80047455
|
||||
PPPIOCGUNIT = 0x80047456
|
||||
PPPIOCGXASYNCMAP = 0x80207450
|
||||
PPPIOCNEWUNIT = 0xc004743e
|
||||
PPPIOCSACTIVE = 0x40087446
|
||||
PPPIOCSASYNCMAP = 0x40047457
|
||||
PPPIOCSCOMPRESS = 0x400c744d
|
||||
PPPIOCSDEBUG = 0x40047440
|
||||
PPPIOCSFLAGS = 0x40047459
|
||||
PPPIOCSMAXCID = 0x40047451
|
||||
PPPIOCSMRRU = 0x4004743b
|
||||
PPPIOCSMRU = 0x40047452
|
||||
PPPIOCSNPMODE = 0x4008744b
|
||||
PPPIOCSPASS = 0x40087447
|
||||
PPPIOCSRASYNCMAP = 0x40047454
|
||||
PPPIOCSXASYNCMAP = 0x4020744f
|
||||
PPPIOCXFERUNIT = 0x744e
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -1392,6 +1435,7 @@ const (
|
|||
PR_SPEC_DISABLE = 0x4
|
||||
PR_SPEC_ENABLE = 0x2
|
||||
PR_SPEC_FORCE_DISABLE = 0x8
|
||||
PR_SPEC_INDIRECT_BRANCH = 0x1
|
||||
PR_SPEC_NOT_AFFECTED = 0x0
|
||||
PR_SPEC_PRCTL = 0x1
|
||||
PR_SPEC_STORE_BYPASS = 0x0
|
||||
|
@ -1502,6 +1546,13 @@ const (
|
|||
RLIMIT_SIGPENDING = 0xb
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0xffffffffffffffff
|
||||
RNDADDENTROPY = 0x40085203
|
||||
RNDADDTOENTCNT = 0x40045201
|
||||
RNDCLEARPOOL = 0x5206
|
||||
RNDGETENTCNT = 0x80045200
|
||||
RNDGETPOOL = 0x80085202
|
||||
RNDRESEEDCRNG = 0x5207
|
||||
RNDZAPENTCNT = 0x5204
|
||||
RTAX_ADVMSS = 0x8
|
||||
RTAX_CC_ALGO = 0x10
|
||||
RTAX_CWND = 0x7
|
||||
|
@ -1703,11 +1754,14 @@ const (
|
|||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SC_LOG_FLUSH = 0x100000
|
||||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SELINUX_MAGIC = 0xf97cff8c
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1758,6 +1812,9 @@ const (
|
|||
SIOCGMIIPHY = 0x8947
|
||||
SIOCGMIIREG = 0x8948
|
||||
SIOCGPGRP = 0x8904
|
||||
SIOCGPPPCSTATS = 0x89f2
|
||||
SIOCGPPPSTATS = 0x89f0
|
||||
SIOCGPPPVER = 0x89f1
|
||||
SIOCGRARP = 0x8961
|
||||
SIOCGSKNS = 0x894c
|
||||
SIOCGSTAMP = 0x8906
|
||||
|
@ -1866,6 +1923,17 @@ const (
|
|||
SO_DETACH_FILTER = 0x1b
|
||||
SO_DOMAIN = 0x27
|
||||
SO_DONTROUTE = 0x5
|
||||
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
|
||||
SO_EE_CODE_TXTIME_MISSED = 0x2
|
||||
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
|
||||
SO_EE_ORIGIN_ICMP = 0x2
|
||||
SO_EE_ORIGIN_ICMP6 = 0x3
|
||||
SO_EE_ORIGIN_LOCAL = 0x1
|
||||
SO_EE_ORIGIN_NONE = 0x0
|
||||
SO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
SO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
SO_EE_ORIGIN_TXTIME = 0x6
|
||||
SO_EE_ORIGIN_ZEROCOPY = 0x5
|
||||
SO_ERROR = 0x4
|
||||
SO_GET_FILTER = 0x1a
|
||||
SO_INCOMING_CPU = 0x31
|
||||
|
@ -1985,7 +2053,7 @@ const (
|
|||
TASKSTATS_GENL_NAME = "TASKSTATS"
|
||||
TASKSTATS_GENL_VERSION = 0x1
|
||||
TASKSTATS_TYPE_MAX = 0x6
|
||||
TASKSTATS_VERSION = 0x8
|
||||
TASKSTATS_VERSION = 0x9
|
||||
TCFLSH = 0x540b
|
||||
TCGETA = 0x5405
|
||||
TCGETS = 0x5401
|
||||
|
@ -1999,6 +2067,7 @@ const (
|
|||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CC_INFO = 0x1a
|
||||
TCP_CM_INQ = 0x24
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_COOKIE_IN_ALWAYS = 0x1
|
||||
TCP_COOKIE_MAX = 0x10
|
||||
|
@ -2013,6 +2082,7 @@ const (
|
|||
TCP_FASTOPEN_KEY = 0x21
|
||||
TCP_FASTOPEN_NO_COOKIE = 0x22
|
||||
TCP_INFO = 0xb
|
||||
TCP_INQ = 0x24
|
||||
TCP_KEEPCNT = 0x6
|
||||
TCP_KEEPIDLE = 0x4
|
||||
TCP_KEEPINTVL = 0x5
|
||||
|
@ -2032,6 +2102,9 @@ const (
|
|||
TCP_QUEUE_SEQ = 0x15
|
||||
TCP_QUICKACK = 0xc
|
||||
TCP_REPAIR = 0x13
|
||||
TCP_REPAIR_OFF = 0x0
|
||||
TCP_REPAIR_OFF_NO_WP = -0x1
|
||||
TCP_REPAIR_ON = 0x1
|
||||
TCP_REPAIR_OPTIONS = 0x16
|
||||
TCP_REPAIR_QUEUE = 0x14
|
||||
TCP_REPAIR_WINDOW = 0x1d
|
||||
|
@ -2046,6 +2119,7 @@ const (
|
|||
TCP_ULP = 0x1f
|
||||
TCP_USER_TIMEOUT = 0x12
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCP_ZEROCOPY_RECEIVE = 0x23
|
||||
TCSAFLUSH = 0x2
|
||||
TCSBRK = 0x5409
|
||||
TCSBRKP = 0x5425
|
||||
|
@ -2062,6 +2136,7 @@ const (
|
|||
TCSETXF = 0x5434
|
||||
TCSETXW = 0x5435
|
||||
TCXONC = 0x540a
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x541d
|
||||
TIOCEXCL = 0x540c
|
||||
|
@ -2069,6 +2144,7 @@ const (
|
|||
TIOCGETD = 0x5424
|
||||
TIOCGEXCL = 0x80045440
|
||||
TIOCGICOUNT = 0x545d
|
||||
TIOCGISO7816 = 0x80285442
|
||||
TIOCGLCKTRMIOS = 0x5456
|
||||
TIOCGPGRP = 0x540f
|
||||
TIOCGPKT = 0x80045438
|
||||
|
@ -2122,6 +2198,7 @@ const (
|
|||
TIOCSER_TEMT = 0x1
|
||||
TIOCSETD = 0x5423
|
||||
TIOCSIG = 0x40045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x5457
|
||||
TIOCSPGRP = 0x5410
|
||||
TIOCSPTLCK = 0x40045431
|
||||
|
@ -2351,6 +2428,7 @@ const (
|
|||
XDP_UMEM_REG = 0x4
|
||||
XDP_ZEROCOPY = 0x4
|
||||
XENFS_SUPER_MAGIC = 0xabba1974
|
||||
XFS_SUPER_MAGIC = 0x58465342
|
||||
XTABS = 0x1800
|
||||
ZSMALLOC_MAGIC = 0x58295829
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x2c
|
||||
AF_MAX = 0x2d
|
||||
AF_MPLS = 0x1c
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
|
@ -641,7 +641,7 @@ const (
|
|||
IFA_F_STABLE_PRIVACY = 0x800
|
||||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x9
|
||||
IFA_MAX = 0xa
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ATTACH_QUEUE = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
|
@ -709,6 +709,7 @@ const (
|
|||
IN_ISDIR = 0x40000000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IN_MASK_ADD = 0x20000000
|
||||
IN_MASK_CREATE = 0x10000000
|
||||
IN_MODIFY = 0x2
|
||||
IN_MOVE = 0xc0
|
||||
IN_MOVED_FROM = 0x40
|
||||
|
@ -780,6 +781,7 @@ const (
|
|||
IPV6_MINHOPCOUNT = 0x49
|
||||
IPV6_MTU = 0x18
|
||||
IPV6_MTU_DISCOVER = 0x17
|
||||
IPV6_MULTICAST_ALL = 0x1d
|
||||
IPV6_MULTICAST_HOPS = 0x12
|
||||
IPV6_MULTICAST_IF = 0x11
|
||||
IPV6_MULTICAST_LOOP = 0x13
|
||||
|
@ -915,6 +917,11 @@ const (
|
|||
KEYCTL_JOIN_SESSION_KEYRING = 0x1
|
||||
KEYCTL_LINK = 0x8
|
||||
KEYCTL_NEGATE = 0xd
|
||||
KEYCTL_PKEY_DECRYPT = 0x1a
|
||||
KEYCTL_PKEY_ENCRYPT = 0x19
|
||||
KEYCTL_PKEY_QUERY = 0x18
|
||||
KEYCTL_PKEY_SIGN = 0x1b
|
||||
KEYCTL_PKEY_VERIFY = 0x1c
|
||||
KEYCTL_READ = 0xb
|
||||
KEYCTL_REJECT = 0x13
|
||||
KEYCTL_RESTRICT_KEYRING = 0x1d
|
||||
|
@ -924,6 +931,10 @@ const (
|
|||
KEYCTL_SETPERM = 0x5
|
||||
KEYCTL_SET_REQKEY_KEYRING = 0xe
|
||||
KEYCTL_SET_TIMEOUT = 0xf
|
||||
KEYCTL_SUPPORTS_DECRYPT = 0x2
|
||||
KEYCTL_SUPPORTS_ENCRYPT = 0x1
|
||||
KEYCTL_SUPPORTS_SIGN = 0x4
|
||||
KEYCTL_SUPPORTS_VERIFY = 0x8
|
||||
KEYCTL_UNLINK = 0x9
|
||||
KEYCTL_UPDATE = 0x2
|
||||
KEY_REQKEY_DEFL_DEFAULT = 0x0
|
||||
|
@ -1102,6 +1113,7 @@ const (
|
|||
NETLINK_FIB_LOOKUP = 0xa
|
||||
NETLINK_FIREWALL = 0x3
|
||||
NETLINK_GENERIC = 0x10
|
||||
NETLINK_GET_STRICT_CHK = 0xc
|
||||
NETLINK_INET_DIAG = 0x4
|
||||
NETLINK_IP6_FW = 0xd
|
||||
NETLINK_ISCSI = 0x8
|
||||
|
@ -1245,6 +1257,7 @@ const (
|
|||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_IGNORE_OUTGOING = 0x17
|
||||
PACKET_KERNEL = 0x7
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
|
@ -1294,6 +1307,36 @@ const (
|
|||
PERF_EVENT_IOC_SET_FILTER = 0x40082406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
|
||||
PIPEFS_MAGIC = 0x50495045
|
||||
PPPIOCATTACH = 0x4004743d
|
||||
PPPIOCATTCHAN = 0x40047438
|
||||
PPPIOCCONNECT = 0x4004743a
|
||||
PPPIOCDETACH = 0x4004743c
|
||||
PPPIOCDISCONN = 0x7439
|
||||
PPPIOCGASYNCMAP = 0x80047458
|
||||
PPPIOCGCHAN = 0x80047437
|
||||
PPPIOCGDEBUG = 0x80047441
|
||||
PPPIOCGFLAGS = 0x8004745a
|
||||
PPPIOCGIDLE = 0x8010743f
|
||||
PPPIOCGL2TPSTATS = 0x80487436
|
||||
PPPIOCGMRU = 0x80047453
|
||||
PPPIOCGNPMODE = 0xc008744c
|
||||
PPPIOCGRASYNCMAP = 0x80047455
|
||||
PPPIOCGUNIT = 0x80047456
|
||||
PPPIOCGXASYNCMAP = 0x80207450
|
||||
PPPIOCNEWUNIT = 0xc004743e
|
||||
PPPIOCSACTIVE = 0x40107446
|
||||
PPPIOCSASYNCMAP = 0x40047457
|
||||
PPPIOCSCOMPRESS = 0x4010744d
|
||||
PPPIOCSDEBUG = 0x40047440
|
||||
PPPIOCSFLAGS = 0x40047459
|
||||
PPPIOCSMAXCID = 0x40047451
|
||||
PPPIOCSMRRU = 0x4004743b
|
||||
PPPIOCSMRU = 0x40047452
|
||||
PPPIOCSNPMODE = 0x4008744b
|
||||
PPPIOCSPASS = 0x40107447
|
||||
PPPIOCSRASYNCMAP = 0x40047454
|
||||
PPPIOCSXASYNCMAP = 0x4020744f
|
||||
PPPIOCXFERUNIT = 0x744e
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -1395,6 +1438,7 @@ const (
|
|||
PR_SPEC_DISABLE = 0x4
|
||||
PR_SPEC_ENABLE = 0x2
|
||||
PR_SPEC_FORCE_DISABLE = 0x8
|
||||
PR_SPEC_INDIRECT_BRANCH = 0x1
|
||||
PR_SPEC_NOT_AFFECTED = 0x0
|
||||
PR_SPEC_PRCTL = 0x1
|
||||
PR_SPEC_STORE_BYPASS = 0x0
|
||||
|
@ -1486,6 +1530,13 @@ const (
|
|||
RLIMIT_SIGPENDING = 0xb
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0xffffffffffffffff
|
||||
RNDADDENTROPY = 0x40085203
|
||||
RNDADDTOENTCNT = 0x40045201
|
||||
RNDCLEARPOOL = 0x5206
|
||||
RNDGETENTCNT = 0x80045200
|
||||
RNDGETPOOL = 0x80085202
|
||||
RNDRESEEDCRNG = 0x5207
|
||||
RNDZAPENTCNT = 0x5204
|
||||
RTAX_ADVMSS = 0x8
|
||||
RTAX_CC_ALGO = 0x10
|
||||
RTAX_CWND = 0x7
|
||||
|
@ -1687,11 +1738,14 @@ const (
|
|||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SC_LOG_FLUSH = 0x100000
|
||||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SELINUX_MAGIC = 0xf97cff8c
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1742,6 +1796,9 @@ const (
|
|||
SIOCGMIIPHY = 0x8947
|
||||
SIOCGMIIREG = 0x8948
|
||||
SIOCGPGRP = 0x8904
|
||||
SIOCGPPPCSTATS = 0x89f2
|
||||
SIOCGPPPSTATS = 0x89f0
|
||||
SIOCGPPPVER = 0x89f1
|
||||
SIOCGRARP = 0x8961
|
||||
SIOCGSKNS = 0x894c
|
||||
SIOCGSTAMP = 0x8906
|
||||
|
@ -1850,6 +1907,17 @@ const (
|
|||
SO_DETACH_FILTER = 0x1b
|
||||
SO_DOMAIN = 0x27
|
||||
SO_DONTROUTE = 0x5
|
||||
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
|
||||
SO_EE_CODE_TXTIME_MISSED = 0x2
|
||||
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
|
||||
SO_EE_ORIGIN_ICMP = 0x2
|
||||
SO_EE_ORIGIN_ICMP6 = 0x3
|
||||
SO_EE_ORIGIN_LOCAL = 0x1
|
||||
SO_EE_ORIGIN_NONE = 0x0
|
||||
SO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
SO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
SO_EE_ORIGIN_TXTIME = 0x6
|
||||
SO_EE_ORIGIN_ZEROCOPY = 0x5
|
||||
SO_ERROR = 0x4
|
||||
SO_GET_FILTER = 0x1a
|
||||
SO_INCOMING_CPU = 0x31
|
||||
|
@ -1970,7 +2038,7 @@ const (
|
|||
TASKSTATS_GENL_NAME = "TASKSTATS"
|
||||
TASKSTATS_GENL_VERSION = 0x1
|
||||
TASKSTATS_TYPE_MAX = 0x6
|
||||
TASKSTATS_VERSION = 0x8
|
||||
TASKSTATS_VERSION = 0x9
|
||||
TCFLSH = 0x540b
|
||||
TCGETA = 0x5405
|
||||
TCGETS = 0x5401
|
||||
|
@ -1984,6 +2052,7 @@ const (
|
|||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CC_INFO = 0x1a
|
||||
TCP_CM_INQ = 0x24
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_COOKIE_IN_ALWAYS = 0x1
|
||||
TCP_COOKIE_MAX = 0x10
|
||||
|
@ -1998,6 +2067,7 @@ const (
|
|||
TCP_FASTOPEN_KEY = 0x21
|
||||
TCP_FASTOPEN_NO_COOKIE = 0x22
|
||||
TCP_INFO = 0xb
|
||||
TCP_INQ = 0x24
|
||||
TCP_KEEPCNT = 0x6
|
||||
TCP_KEEPIDLE = 0x4
|
||||
TCP_KEEPINTVL = 0x5
|
||||
|
@ -2017,6 +2087,9 @@ const (
|
|||
TCP_QUEUE_SEQ = 0x15
|
||||
TCP_QUICKACK = 0xc
|
||||
TCP_REPAIR = 0x13
|
||||
TCP_REPAIR_OFF = 0x0
|
||||
TCP_REPAIR_OFF_NO_WP = -0x1
|
||||
TCP_REPAIR_ON = 0x1
|
||||
TCP_REPAIR_OPTIONS = 0x16
|
||||
TCP_REPAIR_QUEUE = 0x14
|
||||
TCP_REPAIR_WINDOW = 0x1d
|
||||
|
@ -2031,6 +2104,7 @@ const (
|
|||
TCP_ULP = 0x1f
|
||||
TCP_USER_TIMEOUT = 0x12
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCP_ZEROCOPY_RECEIVE = 0x23
|
||||
TCSAFLUSH = 0x2
|
||||
TCSBRK = 0x5409
|
||||
TCSBRKP = 0x5425
|
||||
|
@ -2047,6 +2121,7 @@ const (
|
|||
TCSETXF = 0x5434
|
||||
TCSETXW = 0x5435
|
||||
TCXONC = 0x540a
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x541d
|
||||
TIOCEXCL = 0x540c
|
||||
|
@ -2054,6 +2129,7 @@ const (
|
|||
TIOCGETD = 0x5424
|
||||
TIOCGEXCL = 0x80045440
|
||||
TIOCGICOUNT = 0x545d
|
||||
TIOCGISO7816 = 0x80285442
|
||||
TIOCGLCKTRMIOS = 0x5456
|
||||
TIOCGPGRP = 0x540f
|
||||
TIOCGPKT = 0x80045438
|
||||
|
@ -2107,6 +2183,7 @@ const (
|
|||
TIOCSER_TEMT = 0x1
|
||||
TIOCSETD = 0x5423
|
||||
TIOCSIG = 0x40045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x5457
|
||||
TIOCSPGRP = 0x5410
|
||||
TIOCSPTLCK = 0x40045431
|
||||
|
@ -2336,6 +2413,7 @@ const (
|
|||
XDP_UMEM_REG = 0x4
|
||||
XDP_ZEROCOPY = 0x4
|
||||
XENFS_SUPER_MAGIC = 0xabba1974
|
||||
XFS_SUPER_MAGIC = 0x58465342
|
||||
XTABS = 0x1800
|
||||
ZSMALLOC_MAGIC = 0x58295829
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x2c
|
||||
AF_MAX = 0x2d
|
||||
AF_MPLS = 0x1c
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
|
@ -638,7 +638,7 @@ const (
|
|||
IFA_F_STABLE_PRIVACY = 0x800
|
||||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x9
|
||||
IFA_MAX = 0xa
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ATTACH_QUEUE = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
|
@ -706,6 +706,7 @@ const (
|
|||
IN_ISDIR = 0x40000000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IN_MASK_ADD = 0x20000000
|
||||
IN_MASK_CREATE = 0x10000000
|
||||
IN_MODIFY = 0x2
|
||||
IN_MOVE = 0xc0
|
||||
IN_MOVED_FROM = 0x40
|
||||
|
@ -777,6 +778,7 @@ const (
|
|||
IPV6_MINHOPCOUNT = 0x49
|
||||
IPV6_MTU = 0x18
|
||||
IPV6_MTU_DISCOVER = 0x17
|
||||
IPV6_MULTICAST_ALL = 0x1d
|
||||
IPV6_MULTICAST_HOPS = 0x12
|
||||
IPV6_MULTICAST_IF = 0x11
|
||||
IPV6_MULTICAST_LOOP = 0x13
|
||||
|
@ -912,6 +914,11 @@ const (
|
|||
KEYCTL_JOIN_SESSION_KEYRING = 0x1
|
||||
KEYCTL_LINK = 0x8
|
||||
KEYCTL_NEGATE = 0xd
|
||||
KEYCTL_PKEY_DECRYPT = 0x1a
|
||||
KEYCTL_PKEY_ENCRYPT = 0x19
|
||||
KEYCTL_PKEY_QUERY = 0x18
|
||||
KEYCTL_PKEY_SIGN = 0x1b
|
||||
KEYCTL_PKEY_VERIFY = 0x1c
|
||||
KEYCTL_READ = 0xb
|
||||
KEYCTL_REJECT = 0x13
|
||||
KEYCTL_RESTRICT_KEYRING = 0x1d
|
||||
|
@ -921,6 +928,10 @@ const (
|
|||
KEYCTL_SETPERM = 0x5
|
||||
KEYCTL_SET_REQKEY_KEYRING = 0xe
|
||||
KEYCTL_SET_TIMEOUT = 0xf
|
||||
KEYCTL_SUPPORTS_DECRYPT = 0x2
|
||||
KEYCTL_SUPPORTS_ENCRYPT = 0x1
|
||||
KEYCTL_SUPPORTS_SIGN = 0x4
|
||||
KEYCTL_SUPPORTS_VERIFY = 0x8
|
||||
KEYCTL_UNLINK = 0x9
|
||||
KEYCTL_UPDATE = 0x2
|
||||
KEY_REQKEY_DEFL_DEFAULT = 0x0
|
||||
|
@ -1099,6 +1110,7 @@ const (
|
|||
NETLINK_FIB_LOOKUP = 0xa
|
||||
NETLINK_FIREWALL = 0x3
|
||||
NETLINK_GENERIC = 0x10
|
||||
NETLINK_GET_STRICT_CHK = 0xc
|
||||
NETLINK_INET_DIAG = 0x4
|
||||
NETLINK_IP6_FW = 0xd
|
||||
NETLINK_ISCSI = 0x8
|
||||
|
@ -1242,6 +1254,7 @@ const (
|
|||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_IGNORE_OUTGOING = 0x17
|
||||
PACKET_KERNEL = 0x7
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
|
@ -1291,6 +1304,36 @@ const (
|
|||
PERF_EVENT_IOC_SET_FILTER = 0x80042406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
|
||||
PIPEFS_MAGIC = 0x50495045
|
||||
PPPIOCATTACH = 0x8004743d
|
||||
PPPIOCATTCHAN = 0x80047438
|
||||
PPPIOCCONNECT = 0x8004743a
|
||||
PPPIOCDETACH = 0x8004743c
|
||||
PPPIOCDISCONN = 0x20007439
|
||||
PPPIOCGASYNCMAP = 0x40047458
|
||||
PPPIOCGCHAN = 0x40047437
|
||||
PPPIOCGDEBUG = 0x40047441
|
||||
PPPIOCGFLAGS = 0x4004745a
|
||||
PPPIOCGIDLE = 0x4008743f
|
||||
PPPIOCGL2TPSTATS = 0x40487436
|
||||
PPPIOCGMRU = 0x40047453
|
||||
PPPIOCGNPMODE = 0xc008744c
|
||||
PPPIOCGRASYNCMAP = 0x40047455
|
||||
PPPIOCGUNIT = 0x40047456
|
||||
PPPIOCGXASYNCMAP = 0x40207450
|
||||
PPPIOCNEWUNIT = 0xc004743e
|
||||
PPPIOCSACTIVE = 0x80087446
|
||||
PPPIOCSASYNCMAP = 0x80047457
|
||||
PPPIOCSCOMPRESS = 0x800c744d
|
||||
PPPIOCSDEBUG = 0x80047440
|
||||
PPPIOCSFLAGS = 0x80047459
|
||||
PPPIOCSMAXCID = 0x80047451
|
||||
PPPIOCSMRRU = 0x8004743b
|
||||
PPPIOCSMRU = 0x80047452
|
||||
PPPIOCSNPMODE = 0x8008744b
|
||||
PPPIOCSPASS = 0x80087447
|
||||
PPPIOCSRASYNCMAP = 0x80047454
|
||||
PPPIOCSXASYNCMAP = 0x8020744f
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -1392,6 +1435,7 @@ const (
|
|||
PR_SPEC_DISABLE = 0x4
|
||||
PR_SPEC_ENABLE = 0x2
|
||||
PR_SPEC_FORCE_DISABLE = 0x8
|
||||
PR_SPEC_INDIRECT_BRANCH = 0x1
|
||||
PR_SPEC_NOT_AFFECTED = 0x0
|
||||
PR_SPEC_PRCTL = 0x1
|
||||
PR_SPEC_STORE_BYPASS = 0x0
|
||||
|
@ -1495,6 +1539,13 @@ const (
|
|||
RLIMIT_SIGPENDING = 0xb
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0xffffffffffffffff
|
||||
RNDADDENTROPY = 0x80085203
|
||||
RNDADDTOENTCNT = 0x80045201
|
||||
RNDCLEARPOOL = 0x20005206
|
||||
RNDGETENTCNT = 0x40045200
|
||||
RNDGETPOOL = 0x40085202
|
||||
RNDRESEEDCRNG = 0x20005207
|
||||
RNDZAPENTCNT = 0x20005204
|
||||
RTAX_ADVMSS = 0x8
|
||||
RTAX_CC_ALGO = 0x10
|
||||
RTAX_CWND = 0x7
|
||||
|
@ -1696,11 +1747,14 @@ const (
|
|||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SC_LOG_FLUSH = 0x100000
|
||||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SELINUX_MAGIC = 0xf97cff8c
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x80
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1751,6 +1805,9 @@ const (
|
|||
SIOCGMIIPHY = 0x8947
|
||||
SIOCGMIIREG = 0x8948
|
||||
SIOCGPGRP = 0x40047309
|
||||
SIOCGPPPCSTATS = 0x89f2
|
||||
SIOCGPPPSTATS = 0x89f0
|
||||
SIOCGPPPVER = 0x89f1
|
||||
SIOCGRARP = 0x8961
|
||||
SIOCGSKNS = 0x894c
|
||||
SIOCGSTAMP = 0x8906
|
||||
|
@ -1859,6 +1916,17 @@ const (
|
|||
SO_DETACH_FILTER = 0x1b
|
||||
SO_DOMAIN = 0x1029
|
||||
SO_DONTROUTE = 0x10
|
||||
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
|
||||
SO_EE_CODE_TXTIME_MISSED = 0x2
|
||||
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
|
||||
SO_EE_ORIGIN_ICMP = 0x2
|
||||
SO_EE_ORIGIN_ICMP6 = 0x3
|
||||
SO_EE_ORIGIN_LOCAL = 0x1
|
||||
SO_EE_ORIGIN_NONE = 0x0
|
||||
SO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
SO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
SO_EE_ORIGIN_TXTIME = 0x6
|
||||
SO_EE_ORIGIN_ZEROCOPY = 0x5
|
||||
SO_ERROR = 0x1007
|
||||
SO_GET_FILTER = 0x1a
|
||||
SO_INCOMING_CPU = 0x31
|
||||
|
@ -1979,7 +2047,7 @@ const (
|
|||
TASKSTATS_GENL_NAME = "TASKSTATS"
|
||||
TASKSTATS_GENL_VERSION = 0x1
|
||||
TASKSTATS_TYPE_MAX = 0x6
|
||||
TASKSTATS_VERSION = 0x8
|
||||
TASKSTATS_VERSION = 0x9
|
||||
TCFLSH = 0x5407
|
||||
TCGETA = 0x5401
|
||||
TCGETS = 0x540d
|
||||
|
@ -1992,6 +2060,7 @@ const (
|
|||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CC_INFO = 0x1a
|
||||
TCP_CM_INQ = 0x24
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_COOKIE_IN_ALWAYS = 0x1
|
||||
TCP_COOKIE_MAX = 0x10
|
||||
|
@ -2006,6 +2075,7 @@ const (
|
|||
TCP_FASTOPEN_KEY = 0x21
|
||||
TCP_FASTOPEN_NO_COOKIE = 0x22
|
||||
TCP_INFO = 0xb
|
||||
TCP_INQ = 0x24
|
||||
TCP_KEEPCNT = 0x6
|
||||
TCP_KEEPIDLE = 0x4
|
||||
TCP_KEEPINTVL = 0x5
|
||||
|
@ -2025,6 +2095,9 @@ const (
|
|||
TCP_QUEUE_SEQ = 0x15
|
||||
TCP_QUICKACK = 0xc
|
||||
TCP_REPAIR = 0x13
|
||||
TCP_REPAIR_OFF = 0x0
|
||||
TCP_REPAIR_OFF_NO_WP = -0x1
|
||||
TCP_REPAIR_ON = 0x1
|
||||
TCP_REPAIR_OPTIONS = 0x16
|
||||
TCP_REPAIR_QUEUE = 0x14
|
||||
TCP_REPAIR_WINDOW = 0x1d
|
||||
|
@ -2039,6 +2112,7 @@ const (
|
|||
TCP_ULP = 0x1f
|
||||
TCP_USER_TIMEOUT = 0x12
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCP_ZEROCOPY_RECEIVE = 0x23
|
||||
TCSAFLUSH = 0x5410
|
||||
TCSBRK = 0x5405
|
||||
TCSBRKP = 0x5486
|
||||
|
@ -2052,6 +2126,7 @@ const (
|
|||
TCSETSW = 0x540f
|
||||
TCSETSW2 = 0x8030542c
|
||||
TCXONC = 0x5406
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x80047478
|
||||
TIOCEXCL = 0x740d
|
||||
|
@ -2060,6 +2135,7 @@ const (
|
|||
TIOCGETP = 0x7408
|
||||
TIOCGEXCL = 0x40045440
|
||||
TIOCGICOUNT = 0x5492
|
||||
TIOCGISO7816 = 0x40285442
|
||||
TIOCGLCKTRMIOS = 0x548b
|
||||
TIOCGLTC = 0x7474
|
||||
TIOCGPGRP = 0x40047477
|
||||
|
@ -2116,6 +2192,7 @@ const (
|
|||
TIOCSETN = 0x740a
|
||||
TIOCSETP = 0x7409
|
||||
TIOCSIG = 0x80045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x548c
|
||||
TIOCSLTC = 0x7475
|
||||
TIOCSPGRP = 0x80047476
|
||||
|
@ -2347,6 +2424,7 @@ const (
|
|||
XDP_UMEM_REG = 0x4
|
||||
XDP_ZEROCOPY = 0x4
|
||||
XENFS_SUPER_MAGIC = 0xabba1974
|
||||
XFS_SUPER_MAGIC = 0x58465342
|
||||
XTABS = 0x1800
|
||||
ZSMALLOC_MAGIC = 0x58295829
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x2c
|
||||
AF_MAX = 0x2d
|
||||
AF_MPLS = 0x1c
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
|
@ -638,7 +638,7 @@ const (
|
|||
IFA_F_STABLE_PRIVACY = 0x800
|
||||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x9
|
||||
IFA_MAX = 0xa
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ATTACH_QUEUE = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
|
@ -706,6 +706,7 @@ const (
|
|||
IN_ISDIR = 0x40000000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IN_MASK_ADD = 0x20000000
|
||||
IN_MASK_CREATE = 0x10000000
|
||||
IN_MODIFY = 0x2
|
||||
IN_MOVE = 0xc0
|
||||
IN_MOVED_FROM = 0x40
|
||||
|
@ -777,6 +778,7 @@ const (
|
|||
IPV6_MINHOPCOUNT = 0x49
|
||||
IPV6_MTU = 0x18
|
||||
IPV6_MTU_DISCOVER = 0x17
|
||||
IPV6_MULTICAST_ALL = 0x1d
|
||||
IPV6_MULTICAST_HOPS = 0x12
|
||||
IPV6_MULTICAST_IF = 0x11
|
||||
IPV6_MULTICAST_LOOP = 0x13
|
||||
|
@ -912,6 +914,11 @@ const (
|
|||
KEYCTL_JOIN_SESSION_KEYRING = 0x1
|
||||
KEYCTL_LINK = 0x8
|
||||
KEYCTL_NEGATE = 0xd
|
||||
KEYCTL_PKEY_DECRYPT = 0x1a
|
||||
KEYCTL_PKEY_ENCRYPT = 0x19
|
||||
KEYCTL_PKEY_QUERY = 0x18
|
||||
KEYCTL_PKEY_SIGN = 0x1b
|
||||
KEYCTL_PKEY_VERIFY = 0x1c
|
||||
KEYCTL_READ = 0xb
|
||||
KEYCTL_REJECT = 0x13
|
||||
KEYCTL_RESTRICT_KEYRING = 0x1d
|
||||
|
@ -921,6 +928,10 @@ const (
|
|||
KEYCTL_SETPERM = 0x5
|
||||
KEYCTL_SET_REQKEY_KEYRING = 0xe
|
||||
KEYCTL_SET_TIMEOUT = 0xf
|
||||
KEYCTL_SUPPORTS_DECRYPT = 0x2
|
||||
KEYCTL_SUPPORTS_ENCRYPT = 0x1
|
||||
KEYCTL_SUPPORTS_SIGN = 0x4
|
||||
KEYCTL_SUPPORTS_VERIFY = 0x8
|
||||
KEYCTL_UNLINK = 0x9
|
||||
KEYCTL_UPDATE = 0x2
|
||||
KEY_REQKEY_DEFL_DEFAULT = 0x0
|
||||
|
@ -1099,6 +1110,7 @@ const (
|
|||
NETLINK_FIB_LOOKUP = 0xa
|
||||
NETLINK_FIREWALL = 0x3
|
||||
NETLINK_GENERIC = 0x10
|
||||
NETLINK_GET_STRICT_CHK = 0xc
|
||||
NETLINK_INET_DIAG = 0x4
|
||||
NETLINK_IP6_FW = 0xd
|
||||
NETLINK_ISCSI = 0x8
|
||||
|
@ -1242,6 +1254,7 @@ const (
|
|||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_IGNORE_OUTGOING = 0x17
|
||||
PACKET_KERNEL = 0x7
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
|
@ -1291,6 +1304,36 @@ const (
|
|||
PERF_EVENT_IOC_SET_FILTER = 0x80082406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
|
||||
PIPEFS_MAGIC = 0x50495045
|
||||
PPPIOCATTACH = 0x8004743d
|
||||
PPPIOCATTCHAN = 0x80047438
|
||||
PPPIOCCONNECT = 0x8004743a
|
||||
PPPIOCDETACH = 0x8004743c
|
||||
PPPIOCDISCONN = 0x20007439
|
||||
PPPIOCGASYNCMAP = 0x40047458
|
||||
PPPIOCGCHAN = 0x40047437
|
||||
PPPIOCGDEBUG = 0x40047441
|
||||
PPPIOCGFLAGS = 0x4004745a
|
||||
PPPIOCGIDLE = 0x4010743f
|
||||
PPPIOCGL2TPSTATS = 0x40487436
|
||||
PPPIOCGMRU = 0x40047453
|
||||
PPPIOCGNPMODE = 0xc008744c
|
||||
PPPIOCGRASYNCMAP = 0x40047455
|
||||
PPPIOCGUNIT = 0x40047456
|
||||
PPPIOCGXASYNCMAP = 0x40207450
|
||||
PPPIOCNEWUNIT = 0xc004743e
|
||||
PPPIOCSACTIVE = 0x80107446
|
||||
PPPIOCSASYNCMAP = 0x80047457
|
||||
PPPIOCSCOMPRESS = 0x8010744d
|
||||
PPPIOCSDEBUG = 0x80047440
|
||||
PPPIOCSFLAGS = 0x80047459
|
||||
PPPIOCSMAXCID = 0x80047451
|
||||
PPPIOCSMRRU = 0x8004743b
|
||||
PPPIOCSMRU = 0x80047452
|
||||
PPPIOCSNPMODE = 0x8008744b
|
||||
PPPIOCSPASS = 0x80107447
|
||||
PPPIOCSRASYNCMAP = 0x80047454
|
||||
PPPIOCSXASYNCMAP = 0x8020744f
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -1392,6 +1435,7 @@ const (
|
|||
PR_SPEC_DISABLE = 0x4
|
||||
PR_SPEC_ENABLE = 0x2
|
||||
PR_SPEC_FORCE_DISABLE = 0x8
|
||||
PR_SPEC_INDIRECT_BRANCH = 0x1
|
||||
PR_SPEC_NOT_AFFECTED = 0x0
|
||||
PR_SPEC_PRCTL = 0x1
|
||||
PR_SPEC_STORE_BYPASS = 0x0
|
||||
|
@ -1495,6 +1539,13 @@ const (
|
|||
RLIMIT_SIGPENDING = 0xb
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0xffffffffffffffff
|
||||
RNDADDENTROPY = 0x80085203
|
||||
RNDADDTOENTCNT = 0x80045201
|
||||
RNDCLEARPOOL = 0x20005206
|
||||
RNDGETENTCNT = 0x40045200
|
||||
RNDGETPOOL = 0x40085202
|
||||
RNDRESEEDCRNG = 0x20005207
|
||||
RNDZAPENTCNT = 0x20005204
|
||||
RTAX_ADVMSS = 0x8
|
||||
RTAX_CC_ALGO = 0x10
|
||||
RTAX_CWND = 0x7
|
||||
|
@ -1696,11 +1747,14 @@ const (
|
|||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SC_LOG_FLUSH = 0x100000
|
||||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SELINUX_MAGIC = 0xf97cff8c
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x80
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1751,6 +1805,9 @@ const (
|
|||
SIOCGMIIPHY = 0x8947
|
||||
SIOCGMIIREG = 0x8948
|
||||
SIOCGPGRP = 0x40047309
|
||||
SIOCGPPPCSTATS = 0x89f2
|
||||
SIOCGPPPSTATS = 0x89f0
|
||||
SIOCGPPPVER = 0x89f1
|
||||
SIOCGRARP = 0x8961
|
||||
SIOCGSKNS = 0x894c
|
||||
SIOCGSTAMP = 0x8906
|
||||
|
@ -1859,6 +1916,17 @@ const (
|
|||
SO_DETACH_FILTER = 0x1b
|
||||
SO_DOMAIN = 0x1029
|
||||
SO_DONTROUTE = 0x10
|
||||
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
|
||||
SO_EE_CODE_TXTIME_MISSED = 0x2
|
||||
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
|
||||
SO_EE_ORIGIN_ICMP = 0x2
|
||||
SO_EE_ORIGIN_ICMP6 = 0x3
|
||||
SO_EE_ORIGIN_LOCAL = 0x1
|
||||
SO_EE_ORIGIN_NONE = 0x0
|
||||
SO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
SO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
SO_EE_ORIGIN_TXTIME = 0x6
|
||||
SO_EE_ORIGIN_ZEROCOPY = 0x5
|
||||
SO_ERROR = 0x1007
|
||||
SO_GET_FILTER = 0x1a
|
||||
SO_INCOMING_CPU = 0x31
|
||||
|
@ -1979,7 +2047,7 @@ const (
|
|||
TASKSTATS_GENL_NAME = "TASKSTATS"
|
||||
TASKSTATS_GENL_VERSION = 0x1
|
||||
TASKSTATS_TYPE_MAX = 0x6
|
||||
TASKSTATS_VERSION = 0x8
|
||||
TASKSTATS_VERSION = 0x9
|
||||
TCFLSH = 0x5407
|
||||
TCGETA = 0x5401
|
||||
TCGETS = 0x540d
|
||||
|
@ -1992,6 +2060,7 @@ const (
|
|||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CC_INFO = 0x1a
|
||||
TCP_CM_INQ = 0x24
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_COOKIE_IN_ALWAYS = 0x1
|
||||
TCP_COOKIE_MAX = 0x10
|
||||
|
@ -2006,6 +2075,7 @@ const (
|
|||
TCP_FASTOPEN_KEY = 0x21
|
||||
TCP_FASTOPEN_NO_COOKIE = 0x22
|
||||
TCP_INFO = 0xb
|
||||
TCP_INQ = 0x24
|
||||
TCP_KEEPCNT = 0x6
|
||||
TCP_KEEPIDLE = 0x4
|
||||
TCP_KEEPINTVL = 0x5
|
||||
|
@ -2025,6 +2095,9 @@ const (
|
|||
TCP_QUEUE_SEQ = 0x15
|
||||
TCP_QUICKACK = 0xc
|
||||
TCP_REPAIR = 0x13
|
||||
TCP_REPAIR_OFF = 0x0
|
||||
TCP_REPAIR_OFF_NO_WP = -0x1
|
||||
TCP_REPAIR_ON = 0x1
|
||||
TCP_REPAIR_OPTIONS = 0x16
|
||||
TCP_REPAIR_QUEUE = 0x14
|
||||
TCP_REPAIR_WINDOW = 0x1d
|
||||
|
@ -2039,6 +2112,7 @@ const (
|
|||
TCP_ULP = 0x1f
|
||||
TCP_USER_TIMEOUT = 0x12
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCP_ZEROCOPY_RECEIVE = 0x23
|
||||
TCSAFLUSH = 0x5410
|
||||
TCSBRK = 0x5405
|
||||
TCSBRKP = 0x5486
|
||||
|
@ -2052,6 +2126,7 @@ const (
|
|||
TCSETSW = 0x540f
|
||||
TCSETSW2 = 0x8030542c
|
||||
TCXONC = 0x5406
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x80047478
|
||||
TIOCEXCL = 0x740d
|
||||
|
@ -2060,6 +2135,7 @@ const (
|
|||
TIOCGETP = 0x7408
|
||||
TIOCGEXCL = 0x40045440
|
||||
TIOCGICOUNT = 0x5492
|
||||
TIOCGISO7816 = 0x40285442
|
||||
TIOCGLCKTRMIOS = 0x548b
|
||||
TIOCGLTC = 0x7474
|
||||
TIOCGPGRP = 0x40047477
|
||||
|
@ -2116,6 +2192,7 @@ const (
|
|||
TIOCSETN = 0x740a
|
||||
TIOCSETP = 0x7409
|
||||
TIOCSIG = 0x80045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x548c
|
||||
TIOCSLTC = 0x7475
|
||||
TIOCSPGRP = 0x80047476
|
||||
|
@ -2347,6 +2424,7 @@ const (
|
|||
XDP_UMEM_REG = 0x4
|
||||
XDP_ZEROCOPY = 0x4
|
||||
XENFS_SUPER_MAGIC = 0xabba1974
|
||||
XFS_SUPER_MAGIC = 0x58465342
|
||||
XTABS = 0x1800
|
||||
ZSMALLOC_MAGIC = 0x58295829
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x2c
|
||||
AF_MAX = 0x2d
|
||||
AF_MPLS = 0x1c
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
|
@ -638,7 +638,7 @@ const (
|
|||
IFA_F_STABLE_PRIVACY = 0x800
|
||||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x9
|
||||
IFA_MAX = 0xa
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ATTACH_QUEUE = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
|
@ -706,6 +706,7 @@ const (
|
|||
IN_ISDIR = 0x40000000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IN_MASK_ADD = 0x20000000
|
||||
IN_MASK_CREATE = 0x10000000
|
||||
IN_MODIFY = 0x2
|
||||
IN_MOVE = 0xc0
|
||||
IN_MOVED_FROM = 0x40
|
||||
|
@ -777,6 +778,7 @@ const (
|
|||
IPV6_MINHOPCOUNT = 0x49
|
||||
IPV6_MTU = 0x18
|
||||
IPV6_MTU_DISCOVER = 0x17
|
||||
IPV6_MULTICAST_ALL = 0x1d
|
||||
IPV6_MULTICAST_HOPS = 0x12
|
||||
IPV6_MULTICAST_IF = 0x11
|
||||
IPV6_MULTICAST_LOOP = 0x13
|
||||
|
@ -912,6 +914,11 @@ const (
|
|||
KEYCTL_JOIN_SESSION_KEYRING = 0x1
|
||||
KEYCTL_LINK = 0x8
|
||||
KEYCTL_NEGATE = 0xd
|
||||
KEYCTL_PKEY_DECRYPT = 0x1a
|
||||
KEYCTL_PKEY_ENCRYPT = 0x19
|
||||
KEYCTL_PKEY_QUERY = 0x18
|
||||
KEYCTL_PKEY_SIGN = 0x1b
|
||||
KEYCTL_PKEY_VERIFY = 0x1c
|
||||
KEYCTL_READ = 0xb
|
||||
KEYCTL_REJECT = 0x13
|
||||
KEYCTL_RESTRICT_KEYRING = 0x1d
|
||||
|
@ -921,6 +928,10 @@ const (
|
|||
KEYCTL_SETPERM = 0x5
|
||||
KEYCTL_SET_REQKEY_KEYRING = 0xe
|
||||
KEYCTL_SET_TIMEOUT = 0xf
|
||||
KEYCTL_SUPPORTS_DECRYPT = 0x2
|
||||
KEYCTL_SUPPORTS_ENCRYPT = 0x1
|
||||
KEYCTL_SUPPORTS_SIGN = 0x4
|
||||
KEYCTL_SUPPORTS_VERIFY = 0x8
|
||||
KEYCTL_UNLINK = 0x9
|
||||
KEYCTL_UPDATE = 0x2
|
||||
KEY_REQKEY_DEFL_DEFAULT = 0x0
|
||||
|
@ -1099,6 +1110,7 @@ const (
|
|||
NETLINK_FIB_LOOKUP = 0xa
|
||||
NETLINK_FIREWALL = 0x3
|
||||
NETLINK_GENERIC = 0x10
|
||||
NETLINK_GET_STRICT_CHK = 0xc
|
||||
NETLINK_INET_DIAG = 0x4
|
||||
NETLINK_IP6_FW = 0xd
|
||||
NETLINK_ISCSI = 0x8
|
||||
|
@ -1242,6 +1254,7 @@ const (
|
|||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_IGNORE_OUTGOING = 0x17
|
||||
PACKET_KERNEL = 0x7
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
|
@ -1291,6 +1304,36 @@ const (
|
|||
PERF_EVENT_IOC_SET_FILTER = 0x80082406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
|
||||
PIPEFS_MAGIC = 0x50495045
|
||||
PPPIOCATTACH = 0x8004743d
|
||||
PPPIOCATTCHAN = 0x80047438
|
||||
PPPIOCCONNECT = 0x8004743a
|
||||
PPPIOCDETACH = 0x8004743c
|
||||
PPPIOCDISCONN = 0x20007439
|
||||
PPPIOCGASYNCMAP = 0x40047458
|
||||
PPPIOCGCHAN = 0x40047437
|
||||
PPPIOCGDEBUG = 0x40047441
|
||||
PPPIOCGFLAGS = 0x4004745a
|
||||
PPPIOCGIDLE = 0x4010743f
|
||||
PPPIOCGL2TPSTATS = 0x40487436
|
||||
PPPIOCGMRU = 0x40047453
|
||||
PPPIOCGNPMODE = 0xc008744c
|
||||
PPPIOCGRASYNCMAP = 0x40047455
|
||||
PPPIOCGUNIT = 0x40047456
|
||||
PPPIOCGXASYNCMAP = 0x40207450
|
||||
PPPIOCNEWUNIT = 0xc004743e
|
||||
PPPIOCSACTIVE = 0x80107446
|
||||
PPPIOCSASYNCMAP = 0x80047457
|
||||
PPPIOCSCOMPRESS = 0x8010744d
|
||||
PPPIOCSDEBUG = 0x80047440
|
||||
PPPIOCSFLAGS = 0x80047459
|
||||
PPPIOCSMAXCID = 0x80047451
|
||||
PPPIOCSMRRU = 0x8004743b
|
||||
PPPIOCSMRU = 0x80047452
|
||||
PPPIOCSNPMODE = 0x8008744b
|
||||
PPPIOCSPASS = 0x80107447
|
||||
PPPIOCSRASYNCMAP = 0x80047454
|
||||
PPPIOCSXASYNCMAP = 0x8020744f
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -1392,6 +1435,7 @@ const (
|
|||
PR_SPEC_DISABLE = 0x4
|
||||
PR_SPEC_ENABLE = 0x2
|
||||
PR_SPEC_FORCE_DISABLE = 0x8
|
||||
PR_SPEC_INDIRECT_BRANCH = 0x1
|
||||
PR_SPEC_NOT_AFFECTED = 0x0
|
||||
PR_SPEC_PRCTL = 0x1
|
||||
PR_SPEC_STORE_BYPASS = 0x0
|
||||
|
@ -1495,6 +1539,13 @@ const (
|
|||
RLIMIT_SIGPENDING = 0xb
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0xffffffffffffffff
|
||||
RNDADDENTROPY = 0x80085203
|
||||
RNDADDTOENTCNT = 0x80045201
|
||||
RNDCLEARPOOL = 0x20005206
|
||||
RNDGETENTCNT = 0x40045200
|
||||
RNDGETPOOL = 0x40085202
|
||||
RNDRESEEDCRNG = 0x20005207
|
||||
RNDZAPENTCNT = 0x20005204
|
||||
RTAX_ADVMSS = 0x8
|
||||
RTAX_CC_ALGO = 0x10
|
||||
RTAX_CWND = 0x7
|
||||
|
@ -1696,11 +1747,14 @@ const (
|
|||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SC_LOG_FLUSH = 0x100000
|
||||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SELINUX_MAGIC = 0xf97cff8c
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x80
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1751,6 +1805,9 @@ const (
|
|||
SIOCGMIIPHY = 0x8947
|
||||
SIOCGMIIREG = 0x8948
|
||||
SIOCGPGRP = 0x40047309
|
||||
SIOCGPPPCSTATS = 0x89f2
|
||||
SIOCGPPPSTATS = 0x89f0
|
||||
SIOCGPPPVER = 0x89f1
|
||||
SIOCGRARP = 0x8961
|
||||
SIOCGSKNS = 0x894c
|
||||
SIOCGSTAMP = 0x8906
|
||||
|
@ -1859,6 +1916,17 @@ const (
|
|||
SO_DETACH_FILTER = 0x1b
|
||||
SO_DOMAIN = 0x1029
|
||||
SO_DONTROUTE = 0x10
|
||||
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
|
||||
SO_EE_CODE_TXTIME_MISSED = 0x2
|
||||
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
|
||||
SO_EE_ORIGIN_ICMP = 0x2
|
||||
SO_EE_ORIGIN_ICMP6 = 0x3
|
||||
SO_EE_ORIGIN_LOCAL = 0x1
|
||||
SO_EE_ORIGIN_NONE = 0x0
|
||||
SO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
SO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
SO_EE_ORIGIN_TXTIME = 0x6
|
||||
SO_EE_ORIGIN_ZEROCOPY = 0x5
|
||||
SO_ERROR = 0x1007
|
||||
SO_GET_FILTER = 0x1a
|
||||
SO_INCOMING_CPU = 0x31
|
||||
|
@ -1979,7 +2047,7 @@ const (
|
|||
TASKSTATS_GENL_NAME = "TASKSTATS"
|
||||
TASKSTATS_GENL_VERSION = 0x1
|
||||
TASKSTATS_TYPE_MAX = 0x6
|
||||
TASKSTATS_VERSION = 0x8
|
||||
TASKSTATS_VERSION = 0x9
|
||||
TCFLSH = 0x5407
|
||||
TCGETA = 0x5401
|
||||
TCGETS = 0x540d
|
||||
|
@ -1992,6 +2060,7 @@ const (
|
|||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CC_INFO = 0x1a
|
||||
TCP_CM_INQ = 0x24
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_COOKIE_IN_ALWAYS = 0x1
|
||||
TCP_COOKIE_MAX = 0x10
|
||||
|
@ -2006,6 +2075,7 @@ const (
|
|||
TCP_FASTOPEN_KEY = 0x21
|
||||
TCP_FASTOPEN_NO_COOKIE = 0x22
|
||||
TCP_INFO = 0xb
|
||||
TCP_INQ = 0x24
|
||||
TCP_KEEPCNT = 0x6
|
||||
TCP_KEEPIDLE = 0x4
|
||||
TCP_KEEPINTVL = 0x5
|
||||
|
@ -2025,6 +2095,9 @@ const (
|
|||
TCP_QUEUE_SEQ = 0x15
|
||||
TCP_QUICKACK = 0xc
|
||||
TCP_REPAIR = 0x13
|
||||
TCP_REPAIR_OFF = 0x0
|
||||
TCP_REPAIR_OFF_NO_WP = -0x1
|
||||
TCP_REPAIR_ON = 0x1
|
||||
TCP_REPAIR_OPTIONS = 0x16
|
||||
TCP_REPAIR_QUEUE = 0x14
|
||||
TCP_REPAIR_WINDOW = 0x1d
|
||||
|
@ -2039,6 +2112,7 @@ const (
|
|||
TCP_ULP = 0x1f
|
||||
TCP_USER_TIMEOUT = 0x12
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCP_ZEROCOPY_RECEIVE = 0x23
|
||||
TCSAFLUSH = 0x5410
|
||||
TCSBRK = 0x5405
|
||||
TCSBRKP = 0x5486
|
||||
|
@ -2052,6 +2126,7 @@ const (
|
|||
TCSETSW = 0x540f
|
||||
TCSETSW2 = 0x8030542c
|
||||
TCXONC = 0x5406
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x80047478
|
||||
TIOCEXCL = 0x740d
|
||||
|
@ -2060,6 +2135,7 @@ const (
|
|||
TIOCGETP = 0x7408
|
||||
TIOCGEXCL = 0x40045440
|
||||
TIOCGICOUNT = 0x5492
|
||||
TIOCGISO7816 = 0x40285442
|
||||
TIOCGLCKTRMIOS = 0x548b
|
||||
TIOCGLTC = 0x7474
|
||||
TIOCGPGRP = 0x40047477
|
||||
|
@ -2116,6 +2192,7 @@ const (
|
|||
TIOCSETN = 0x740a
|
||||
TIOCSETP = 0x7409
|
||||
TIOCSIG = 0x80045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x548c
|
||||
TIOCSLTC = 0x7475
|
||||
TIOCSPGRP = 0x80047476
|
||||
|
@ -2347,6 +2424,7 @@ const (
|
|||
XDP_UMEM_REG = 0x4
|
||||
XDP_ZEROCOPY = 0x4
|
||||
XENFS_SUPER_MAGIC = 0xabba1974
|
||||
XFS_SUPER_MAGIC = 0x58465342
|
||||
XTABS = 0x1800
|
||||
ZSMALLOC_MAGIC = 0x58295829
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x2c
|
||||
AF_MAX = 0x2d
|
||||
AF_MPLS = 0x1c
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
|
@ -638,7 +638,7 @@ const (
|
|||
IFA_F_STABLE_PRIVACY = 0x800
|
||||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x9
|
||||
IFA_MAX = 0xa
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ATTACH_QUEUE = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
|
@ -706,6 +706,7 @@ const (
|
|||
IN_ISDIR = 0x40000000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IN_MASK_ADD = 0x20000000
|
||||
IN_MASK_CREATE = 0x10000000
|
||||
IN_MODIFY = 0x2
|
||||
IN_MOVE = 0xc0
|
||||
IN_MOVED_FROM = 0x40
|
||||
|
@ -777,6 +778,7 @@ const (
|
|||
IPV6_MINHOPCOUNT = 0x49
|
||||
IPV6_MTU = 0x18
|
||||
IPV6_MTU_DISCOVER = 0x17
|
||||
IPV6_MULTICAST_ALL = 0x1d
|
||||
IPV6_MULTICAST_HOPS = 0x12
|
||||
IPV6_MULTICAST_IF = 0x11
|
||||
IPV6_MULTICAST_LOOP = 0x13
|
||||
|
@ -912,6 +914,11 @@ const (
|
|||
KEYCTL_JOIN_SESSION_KEYRING = 0x1
|
||||
KEYCTL_LINK = 0x8
|
||||
KEYCTL_NEGATE = 0xd
|
||||
KEYCTL_PKEY_DECRYPT = 0x1a
|
||||
KEYCTL_PKEY_ENCRYPT = 0x19
|
||||
KEYCTL_PKEY_QUERY = 0x18
|
||||
KEYCTL_PKEY_SIGN = 0x1b
|
||||
KEYCTL_PKEY_VERIFY = 0x1c
|
||||
KEYCTL_READ = 0xb
|
||||
KEYCTL_REJECT = 0x13
|
||||
KEYCTL_RESTRICT_KEYRING = 0x1d
|
||||
|
@ -921,6 +928,10 @@ const (
|
|||
KEYCTL_SETPERM = 0x5
|
||||
KEYCTL_SET_REQKEY_KEYRING = 0xe
|
||||
KEYCTL_SET_TIMEOUT = 0xf
|
||||
KEYCTL_SUPPORTS_DECRYPT = 0x2
|
||||
KEYCTL_SUPPORTS_ENCRYPT = 0x1
|
||||
KEYCTL_SUPPORTS_SIGN = 0x4
|
||||
KEYCTL_SUPPORTS_VERIFY = 0x8
|
||||
KEYCTL_UNLINK = 0x9
|
||||
KEYCTL_UPDATE = 0x2
|
||||
KEY_REQKEY_DEFL_DEFAULT = 0x0
|
||||
|
@ -1099,6 +1110,7 @@ const (
|
|||
NETLINK_FIB_LOOKUP = 0xa
|
||||
NETLINK_FIREWALL = 0x3
|
||||
NETLINK_GENERIC = 0x10
|
||||
NETLINK_GET_STRICT_CHK = 0xc
|
||||
NETLINK_INET_DIAG = 0x4
|
||||
NETLINK_IP6_FW = 0xd
|
||||
NETLINK_ISCSI = 0x8
|
||||
|
@ -1242,6 +1254,7 @@ const (
|
|||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_IGNORE_OUTGOING = 0x17
|
||||
PACKET_KERNEL = 0x7
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
|
@ -1291,6 +1304,36 @@ const (
|
|||
PERF_EVENT_IOC_SET_FILTER = 0x80042406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
|
||||
PIPEFS_MAGIC = 0x50495045
|
||||
PPPIOCATTACH = 0x8004743d
|
||||
PPPIOCATTCHAN = 0x80047438
|
||||
PPPIOCCONNECT = 0x8004743a
|
||||
PPPIOCDETACH = 0x8004743c
|
||||
PPPIOCDISCONN = 0x20007439
|
||||
PPPIOCGASYNCMAP = 0x40047458
|
||||
PPPIOCGCHAN = 0x40047437
|
||||
PPPIOCGDEBUG = 0x40047441
|
||||
PPPIOCGFLAGS = 0x4004745a
|
||||
PPPIOCGIDLE = 0x4008743f
|
||||
PPPIOCGL2TPSTATS = 0x40487436
|
||||
PPPIOCGMRU = 0x40047453
|
||||
PPPIOCGNPMODE = 0xc008744c
|
||||
PPPIOCGRASYNCMAP = 0x40047455
|
||||
PPPIOCGUNIT = 0x40047456
|
||||
PPPIOCGXASYNCMAP = 0x40207450
|
||||
PPPIOCNEWUNIT = 0xc004743e
|
||||
PPPIOCSACTIVE = 0x80087446
|
||||
PPPIOCSASYNCMAP = 0x80047457
|
||||
PPPIOCSCOMPRESS = 0x800c744d
|
||||
PPPIOCSDEBUG = 0x80047440
|
||||
PPPIOCSFLAGS = 0x80047459
|
||||
PPPIOCSMAXCID = 0x80047451
|
||||
PPPIOCSMRRU = 0x8004743b
|
||||
PPPIOCSMRU = 0x80047452
|
||||
PPPIOCSNPMODE = 0x8008744b
|
||||
PPPIOCSPASS = 0x80087447
|
||||
PPPIOCSRASYNCMAP = 0x80047454
|
||||
PPPIOCSXASYNCMAP = 0x8020744f
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -1392,6 +1435,7 @@ const (
|
|||
PR_SPEC_DISABLE = 0x4
|
||||
PR_SPEC_ENABLE = 0x2
|
||||
PR_SPEC_FORCE_DISABLE = 0x8
|
||||
PR_SPEC_INDIRECT_BRANCH = 0x1
|
||||
PR_SPEC_NOT_AFFECTED = 0x0
|
||||
PR_SPEC_PRCTL = 0x1
|
||||
PR_SPEC_STORE_BYPASS = 0x0
|
||||
|
@ -1495,6 +1539,13 @@ const (
|
|||
RLIMIT_SIGPENDING = 0xb
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0xffffffffffffffff
|
||||
RNDADDENTROPY = 0x80085203
|
||||
RNDADDTOENTCNT = 0x80045201
|
||||
RNDCLEARPOOL = 0x20005206
|
||||
RNDGETENTCNT = 0x40045200
|
||||
RNDGETPOOL = 0x40085202
|
||||
RNDRESEEDCRNG = 0x20005207
|
||||
RNDZAPENTCNT = 0x20005204
|
||||
RTAX_ADVMSS = 0x8
|
||||
RTAX_CC_ALGO = 0x10
|
||||
RTAX_CWND = 0x7
|
||||
|
@ -1696,11 +1747,14 @@ const (
|
|||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SC_LOG_FLUSH = 0x100000
|
||||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SELINUX_MAGIC = 0xf97cff8c
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x80
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1751,6 +1805,9 @@ const (
|
|||
SIOCGMIIPHY = 0x8947
|
||||
SIOCGMIIREG = 0x8948
|
||||
SIOCGPGRP = 0x40047309
|
||||
SIOCGPPPCSTATS = 0x89f2
|
||||
SIOCGPPPSTATS = 0x89f0
|
||||
SIOCGPPPVER = 0x89f1
|
||||
SIOCGRARP = 0x8961
|
||||
SIOCGSKNS = 0x894c
|
||||
SIOCGSTAMP = 0x8906
|
||||
|
@ -1859,6 +1916,17 @@ const (
|
|||
SO_DETACH_FILTER = 0x1b
|
||||
SO_DOMAIN = 0x1029
|
||||
SO_DONTROUTE = 0x10
|
||||
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
|
||||
SO_EE_CODE_TXTIME_MISSED = 0x2
|
||||
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
|
||||
SO_EE_ORIGIN_ICMP = 0x2
|
||||
SO_EE_ORIGIN_ICMP6 = 0x3
|
||||
SO_EE_ORIGIN_LOCAL = 0x1
|
||||
SO_EE_ORIGIN_NONE = 0x0
|
||||
SO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
SO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
SO_EE_ORIGIN_TXTIME = 0x6
|
||||
SO_EE_ORIGIN_ZEROCOPY = 0x5
|
||||
SO_ERROR = 0x1007
|
||||
SO_GET_FILTER = 0x1a
|
||||
SO_INCOMING_CPU = 0x31
|
||||
|
@ -1979,7 +2047,7 @@ const (
|
|||
TASKSTATS_GENL_NAME = "TASKSTATS"
|
||||
TASKSTATS_GENL_VERSION = 0x1
|
||||
TASKSTATS_TYPE_MAX = 0x6
|
||||
TASKSTATS_VERSION = 0x8
|
||||
TASKSTATS_VERSION = 0x9
|
||||
TCFLSH = 0x5407
|
||||
TCGETA = 0x5401
|
||||
TCGETS = 0x540d
|
||||
|
@ -1992,6 +2060,7 @@ const (
|
|||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CC_INFO = 0x1a
|
||||
TCP_CM_INQ = 0x24
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_COOKIE_IN_ALWAYS = 0x1
|
||||
TCP_COOKIE_MAX = 0x10
|
||||
|
@ -2006,6 +2075,7 @@ const (
|
|||
TCP_FASTOPEN_KEY = 0x21
|
||||
TCP_FASTOPEN_NO_COOKIE = 0x22
|
||||
TCP_INFO = 0xb
|
||||
TCP_INQ = 0x24
|
||||
TCP_KEEPCNT = 0x6
|
||||
TCP_KEEPIDLE = 0x4
|
||||
TCP_KEEPINTVL = 0x5
|
||||
|
@ -2025,6 +2095,9 @@ const (
|
|||
TCP_QUEUE_SEQ = 0x15
|
||||
TCP_QUICKACK = 0xc
|
||||
TCP_REPAIR = 0x13
|
||||
TCP_REPAIR_OFF = 0x0
|
||||
TCP_REPAIR_OFF_NO_WP = -0x1
|
||||
TCP_REPAIR_ON = 0x1
|
||||
TCP_REPAIR_OPTIONS = 0x16
|
||||
TCP_REPAIR_QUEUE = 0x14
|
||||
TCP_REPAIR_WINDOW = 0x1d
|
||||
|
@ -2039,6 +2112,7 @@ const (
|
|||
TCP_ULP = 0x1f
|
||||
TCP_USER_TIMEOUT = 0x12
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCP_ZEROCOPY_RECEIVE = 0x23
|
||||
TCSAFLUSH = 0x5410
|
||||
TCSBRK = 0x5405
|
||||
TCSBRKP = 0x5486
|
||||
|
@ -2052,6 +2126,7 @@ const (
|
|||
TCSETSW = 0x540f
|
||||
TCSETSW2 = 0x8030542c
|
||||
TCXONC = 0x5406
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x80047478
|
||||
TIOCEXCL = 0x740d
|
||||
|
@ -2060,6 +2135,7 @@ const (
|
|||
TIOCGETP = 0x7408
|
||||
TIOCGEXCL = 0x40045440
|
||||
TIOCGICOUNT = 0x5492
|
||||
TIOCGISO7816 = 0x40285442
|
||||
TIOCGLCKTRMIOS = 0x548b
|
||||
TIOCGLTC = 0x7474
|
||||
TIOCGPGRP = 0x40047477
|
||||
|
@ -2116,6 +2192,7 @@ const (
|
|||
TIOCSETN = 0x740a
|
||||
TIOCSETP = 0x7409
|
||||
TIOCSIG = 0x80045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x548c
|
||||
TIOCSLTC = 0x7475
|
||||
TIOCSPGRP = 0x80047476
|
||||
|
@ -2347,6 +2424,7 @@ const (
|
|||
XDP_UMEM_REG = 0x4
|
||||
XDP_ZEROCOPY = 0x4
|
||||
XENFS_SUPER_MAGIC = 0xabba1974
|
||||
XFS_SUPER_MAGIC = 0x58465342
|
||||
XTABS = 0x1800
|
||||
ZSMALLOC_MAGIC = 0x58295829
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x2c
|
||||
AF_MAX = 0x2d
|
||||
AF_MPLS = 0x1c
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
|
@ -638,7 +638,7 @@ const (
|
|||
IFA_F_STABLE_PRIVACY = 0x800
|
||||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x9
|
||||
IFA_MAX = 0xa
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ATTACH_QUEUE = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
|
@ -706,6 +706,7 @@ const (
|
|||
IN_ISDIR = 0x40000000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IN_MASK_ADD = 0x20000000
|
||||
IN_MASK_CREATE = 0x10000000
|
||||
IN_MODIFY = 0x2
|
||||
IN_MOVE = 0xc0
|
||||
IN_MOVED_FROM = 0x40
|
||||
|
@ -777,6 +778,7 @@ const (
|
|||
IPV6_MINHOPCOUNT = 0x49
|
||||
IPV6_MTU = 0x18
|
||||
IPV6_MTU_DISCOVER = 0x17
|
||||
IPV6_MULTICAST_ALL = 0x1d
|
||||
IPV6_MULTICAST_HOPS = 0x12
|
||||
IPV6_MULTICAST_IF = 0x11
|
||||
IPV6_MULTICAST_LOOP = 0x13
|
||||
|
@ -912,6 +914,11 @@ const (
|
|||
KEYCTL_JOIN_SESSION_KEYRING = 0x1
|
||||
KEYCTL_LINK = 0x8
|
||||
KEYCTL_NEGATE = 0xd
|
||||
KEYCTL_PKEY_DECRYPT = 0x1a
|
||||
KEYCTL_PKEY_ENCRYPT = 0x19
|
||||
KEYCTL_PKEY_QUERY = 0x18
|
||||
KEYCTL_PKEY_SIGN = 0x1b
|
||||
KEYCTL_PKEY_VERIFY = 0x1c
|
||||
KEYCTL_READ = 0xb
|
||||
KEYCTL_REJECT = 0x13
|
||||
KEYCTL_RESTRICT_KEYRING = 0x1d
|
||||
|
@ -921,6 +928,10 @@ const (
|
|||
KEYCTL_SETPERM = 0x5
|
||||
KEYCTL_SET_REQKEY_KEYRING = 0xe
|
||||
KEYCTL_SET_TIMEOUT = 0xf
|
||||
KEYCTL_SUPPORTS_DECRYPT = 0x2
|
||||
KEYCTL_SUPPORTS_ENCRYPT = 0x1
|
||||
KEYCTL_SUPPORTS_SIGN = 0x4
|
||||
KEYCTL_SUPPORTS_VERIFY = 0x8
|
||||
KEYCTL_UNLINK = 0x9
|
||||
KEYCTL_UPDATE = 0x2
|
||||
KEY_REQKEY_DEFL_DEFAULT = 0x0
|
||||
|
@ -1098,6 +1109,7 @@ const (
|
|||
NETLINK_FIB_LOOKUP = 0xa
|
||||
NETLINK_FIREWALL = 0x3
|
||||
NETLINK_GENERIC = 0x10
|
||||
NETLINK_GET_STRICT_CHK = 0xc
|
||||
NETLINK_INET_DIAG = 0x4
|
||||
NETLINK_IP6_FW = 0xd
|
||||
NETLINK_ISCSI = 0x8
|
||||
|
@ -1243,6 +1255,7 @@ const (
|
|||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_IGNORE_OUTGOING = 0x17
|
||||
PACKET_KERNEL = 0x7
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
|
@ -1292,6 +1305,36 @@ const (
|
|||
PERF_EVENT_IOC_SET_FILTER = 0x80082406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
|
||||
PIPEFS_MAGIC = 0x50495045
|
||||
PPPIOCATTACH = 0x8004743d
|
||||
PPPIOCATTCHAN = 0x80047438
|
||||
PPPIOCCONNECT = 0x8004743a
|
||||
PPPIOCDETACH = 0x8004743c
|
||||
PPPIOCDISCONN = 0x20007439
|
||||
PPPIOCGASYNCMAP = 0x40047458
|
||||
PPPIOCGCHAN = 0x40047437
|
||||
PPPIOCGDEBUG = 0x40047441
|
||||
PPPIOCGFLAGS = 0x4004745a
|
||||
PPPIOCGIDLE = 0x4010743f
|
||||
PPPIOCGL2TPSTATS = 0x40487436
|
||||
PPPIOCGMRU = 0x40047453
|
||||
PPPIOCGNPMODE = 0xc008744c
|
||||
PPPIOCGRASYNCMAP = 0x40047455
|
||||
PPPIOCGUNIT = 0x40047456
|
||||
PPPIOCGXASYNCMAP = 0x40207450
|
||||
PPPIOCNEWUNIT = 0xc004743e
|
||||
PPPIOCSACTIVE = 0x80107446
|
||||
PPPIOCSASYNCMAP = 0x80047457
|
||||
PPPIOCSCOMPRESS = 0x8010744d
|
||||
PPPIOCSDEBUG = 0x80047440
|
||||
PPPIOCSFLAGS = 0x80047459
|
||||
PPPIOCSMAXCID = 0x80047451
|
||||
PPPIOCSMRRU = 0x8004743b
|
||||
PPPIOCSMRU = 0x80047452
|
||||
PPPIOCSNPMODE = 0x8008744b
|
||||
PPPIOCSPASS = 0x80107447
|
||||
PPPIOCSRASYNCMAP = 0x80047454
|
||||
PPPIOCSXASYNCMAP = 0x8020744f
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -1394,6 +1437,7 @@ const (
|
|||
PR_SPEC_DISABLE = 0x4
|
||||
PR_SPEC_ENABLE = 0x2
|
||||
PR_SPEC_FORCE_DISABLE = 0x8
|
||||
PR_SPEC_INDIRECT_BRANCH = 0x1
|
||||
PR_SPEC_NOT_AFFECTED = 0x0
|
||||
PR_SPEC_PRCTL = 0x1
|
||||
PR_SPEC_STORE_BYPASS = 0x0
|
||||
|
@ -1472,6 +1516,8 @@ const (
|
|||
PTRACE_SINGLEBLOCK = 0x100
|
||||
PTRACE_SINGLESTEP = 0x9
|
||||
PTRACE_SYSCALL = 0x18
|
||||
PTRACE_SYSEMU = 0x1d
|
||||
PTRACE_SYSEMU_SINGLESTEP = 0x1e
|
||||
PTRACE_TRACEME = 0x0
|
||||
PT_CCR = 0x26
|
||||
PT_CTR = 0x23
|
||||
|
@ -1551,6 +1597,13 @@ const (
|
|||
RLIMIT_SIGPENDING = 0xb
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0xffffffffffffffff
|
||||
RNDADDENTROPY = 0x80085203
|
||||
RNDADDTOENTCNT = 0x80045201
|
||||
RNDCLEARPOOL = 0x20005206
|
||||
RNDGETENTCNT = 0x40045200
|
||||
RNDGETPOOL = 0x40085202
|
||||
RNDRESEEDCRNG = 0x20005207
|
||||
RNDZAPENTCNT = 0x20005204
|
||||
RTAX_ADVMSS = 0x8
|
||||
RTAX_CC_ALGO = 0x10
|
||||
RTAX_CWND = 0x7
|
||||
|
@ -1752,11 +1805,14 @@ const (
|
|||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SC_LOG_FLUSH = 0x100000
|
||||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SELINUX_MAGIC = 0xf97cff8c
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1807,6 +1863,9 @@ const (
|
|||
SIOCGMIIPHY = 0x8947
|
||||
SIOCGMIIREG = 0x8948
|
||||
SIOCGPGRP = 0x8904
|
||||
SIOCGPPPCSTATS = 0x89f2
|
||||
SIOCGPPPSTATS = 0x89f0
|
||||
SIOCGPPPVER = 0x89f1
|
||||
SIOCGRARP = 0x8961
|
||||
SIOCGSKNS = 0x894c
|
||||
SIOCGSTAMP = 0x8906
|
||||
|
@ -1915,6 +1974,17 @@ const (
|
|||
SO_DETACH_FILTER = 0x1b
|
||||
SO_DOMAIN = 0x27
|
||||
SO_DONTROUTE = 0x5
|
||||
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
|
||||
SO_EE_CODE_TXTIME_MISSED = 0x2
|
||||
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
|
||||
SO_EE_ORIGIN_ICMP = 0x2
|
||||
SO_EE_ORIGIN_ICMP6 = 0x3
|
||||
SO_EE_ORIGIN_LOCAL = 0x1
|
||||
SO_EE_ORIGIN_NONE = 0x0
|
||||
SO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
SO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
SO_EE_ORIGIN_TXTIME = 0x6
|
||||
SO_EE_ORIGIN_ZEROCOPY = 0x5
|
||||
SO_ERROR = 0x4
|
||||
SO_GET_FILTER = 0x1a
|
||||
SO_INCOMING_CPU = 0x31
|
||||
|
@ -2034,7 +2104,7 @@ const (
|
|||
TASKSTATS_GENL_NAME = "TASKSTATS"
|
||||
TASKSTATS_GENL_VERSION = 0x1
|
||||
TASKSTATS_TYPE_MAX = 0x6
|
||||
TASKSTATS_VERSION = 0x8
|
||||
TASKSTATS_VERSION = 0x9
|
||||
TCFLSH = 0x2000741f
|
||||
TCGETA = 0x40147417
|
||||
TCGETS = 0x402c7413
|
||||
|
@ -2046,6 +2116,7 @@ const (
|
|||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CC_INFO = 0x1a
|
||||
TCP_CM_INQ = 0x24
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_COOKIE_IN_ALWAYS = 0x1
|
||||
TCP_COOKIE_MAX = 0x10
|
||||
|
@ -2060,6 +2131,7 @@ const (
|
|||
TCP_FASTOPEN_KEY = 0x21
|
||||
TCP_FASTOPEN_NO_COOKIE = 0x22
|
||||
TCP_INFO = 0xb
|
||||
TCP_INQ = 0x24
|
||||
TCP_KEEPCNT = 0x6
|
||||
TCP_KEEPIDLE = 0x4
|
||||
TCP_KEEPINTVL = 0x5
|
||||
|
@ -2079,6 +2151,9 @@ const (
|
|||
TCP_QUEUE_SEQ = 0x15
|
||||
TCP_QUICKACK = 0xc
|
||||
TCP_REPAIR = 0x13
|
||||
TCP_REPAIR_OFF = 0x0
|
||||
TCP_REPAIR_OFF_NO_WP = -0x1
|
||||
TCP_REPAIR_ON = 0x1
|
||||
TCP_REPAIR_OPTIONS = 0x16
|
||||
TCP_REPAIR_QUEUE = 0x14
|
||||
TCP_REPAIR_WINDOW = 0x1d
|
||||
|
@ -2093,6 +2168,7 @@ const (
|
|||
TCP_ULP = 0x1f
|
||||
TCP_USER_TIMEOUT = 0x12
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCP_ZEROCOPY_RECEIVE = 0x23
|
||||
TCSAFLUSH = 0x2
|
||||
TCSBRK = 0x2000741d
|
||||
TCSBRKP = 0x5425
|
||||
|
@ -2103,6 +2179,7 @@ const (
|
|||
TCSETSF = 0x802c7416
|
||||
TCSETSW = 0x802c7415
|
||||
TCXONC = 0x2000741e
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x541d
|
||||
TIOCEXCL = 0x540c
|
||||
|
@ -2112,6 +2189,7 @@ const (
|
|||
TIOCGETP = 0x40067408
|
||||
TIOCGEXCL = 0x40045440
|
||||
TIOCGICOUNT = 0x545d
|
||||
TIOCGISO7816 = 0x40285442
|
||||
TIOCGLCKTRMIOS = 0x5456
|
||||
TIOCGLTC = 0x40067474
|
||||
TIOCGPGRP = 0x40047477
|
||||
|
@ -2172,6 +2250,7 @@ const (
|
|||
TIOCSETN = 0x8006740a
|
||||
TIOCSETP = 0x80067409
|
||||
TIOCSIG = 0x80045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x5457
|
||||
TIOCSLTC = 0x80067475
|
||||
TIOCSPGRP = 0x80047476
|
||||
|
@ -2404,6 +2483,7 @@ const (
|
|||
XDP_UMEM_REG = 0x4
|
||||
XDP_ZEROCOPY = 0x4
|
||||
XENFS_SUPER_MAGIC = 0xabba1974
|
||||
XFS_SUPER_MAGIC = 0x58465342
|
||||
XTABS = 0xc00
|
||||
ZSMALLOC_MAGIC = 0x58295829
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x2c
|
||||
AF_MAX = 0x2d
|
||||
AF_MPLS = 0x1c
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
|
@ -638,7 +638,7 @@ const (
|
|||
IFA_F_STABLE_PRIVACY = 0x800
|
||||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x9
|
||||
IFA_MAX = 0xa
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ATTACH_QUEUE = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
|
@ -706,6 +706,7 @@ const (
|
|||
IN_ISDIR = 0x40000000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IN_MASK_ADD = 0x20000000
|
||||
IN_MASK_CREATE = 0x10000000
|
||||
IN_MODIFY = 0x2
|
||||
IN_MOVE = 0xc0
|
||||
IN_MOVED_FROM = 0x40
|
||||
|
@ -777,6 +778,7 @@ const (
|
|||
IPV6_MINHOPCOUNT = 0x49
|
||||
IPV6_MTU = 0x18
|
||||
IPV6_MTU_DISCOVER = 0x17
|
||||
IPV6_MULTICAST_ALL = 0x1d
|
||||
IPV6_MULTICAST_HOPS = 0x12
|
||||
IPV6_MULTICAST_IF = 0x11
|
||||
IPV6_MULTICAST_LOOP = 0x13
|
||||
|
@ -912,6 +914,11 @@ const (
|
|||
KEYCTL_JOIN_SESSION_KEYRING = 0x1
|
||||
KEYCTL_LINK = 0x8
|
||||
KEYCTL_NEGATE = 0xd
|
||||
KEYCTL_PKEY_DECRYPT = 0x1a
|
||||
KEYCTL_PKEY_ENCRYPT = 0x19
|
||||
KEYCTL_PKEY_QUERY = 0x18
|
||||
KEYCTL_PKEY_SIGN = 0x1b
|
||||
KEYCTL_PKEY_VERIFY = 0x1c
|
||||
KEYCTL_READ = 0xb
|
||||
KEYCTL_REJECT = 0x13
|
||||
KEYCTL_RESTRICT_KEYRING = 0x1d
|
||||
|
@ -921,6 +928,10 @@ const (
|
|||
KEYCTL_SETPERM = 0x5
|
||||
KEYCTL_SET_REQKEY_KEYRING = 0xe
|
||||
KEYCTL_SET_TIMEOUT = 0xf
|
||||
KEYCTL_SUPPORTS_DECRYPT = 0x2
|
||||
KEYCTL_SUPPORTS_ENCRYPT = 0x1
|
||||
KEYCTL_SUPPORTS_SIGN = 0x4
|
||||
KEYCTL_SUPPORTS_VERIFY = 0x8
|
||||
KEYCTL_UNLINK = 0x9
|
||||
KEYCTL_UPDATE = 0x2
|
||||
KEY_REQKEY_DEFL_DEFAULT = 0x0
|
||||
|
@ -1098,6 +1109,7 @@ const (
|
|||
NETLINK_FIB_LOOKUP = 0xa
|
||||
NETLINK_FIREWALL = 0x3
|
||||
NETLINK_GENERIC = 0x10
|
||||
NETLINK_GET_STRICT_CHK = 0xc
|
||||
NETLINK_INET_DIAG = 0x4
|
||||
NETLINK_IP6_FW = 0xd
|
||||
NETLINK_ISCSI = 0x8
|
||||
|
@ -1243,6 +1255,7 @@ const (
|
|||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_IGNORE_OUTGOING = 0x17
|
||||
PACKET_KERNEL = 0x7
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
|
@ -1292,6 +1305,36 @@ const (
|
|||
PERF_EVENT_IOC_SET_FILTER = 0x80082406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
|
||||
PIPEFS_MAGIC = 0x50495045
|
||||
PPPIOCATTACH = 0x8004743d
|
||||
PPPIOCATTCHAN = 0x80047438
|
||||
PPPIOCCONNECT = 0x8004743a
|
||||
PPPIOCDETACH = 0x8004743c
|
||||
PPPIOCDISCONN = 0x20007439
|
||||
PPPIOCGASYNCMAP = 0x40047458
|
||||
PPPIOCGCHAN = 0x40047437
|
||||
PPPIOCGDEBUG = 0x40047441
|
||||
PPPIOCGFLAGS = 0x4004745a
|
||||
PPPIOCGIDLE = 0x4010743f
|
||||
PPPIOCGL2TPSTATS = 0x40487436
|
||||
PPPIOCGMRU = 0x40047453
|
||||
PPPIOCGNPMODE = 0xc008744c
|
||||
PPPIOCGRASYNCMAP = 0x40047455
|
||||
PPPIOCGUNIT = 0x40047456
|
||||
PPPIOCGXASYNCMAP = 0x40207450
|
||||
PPPIOCNEWUNIT = 0xc004743e
|
||||
PPPIOCSACTIVE = 0x80107446
|
||||
PPPIOCSASYNCMAP = 0x80047457
|
||||
PPPIOCSCOMPRESS = 0x8010744d
|
||||
PPPIOCSDEBUG = 0x80047440
|
||||
PPPIOCSFLAGS = 0x80047459
|
||||
PPPIOCSMAXCID = 0x80047451
|
||||
PPPIOCSMRRU = 0x8004743b
|
||||
PPPIOCSMRU = 0x80047452
|
||||
PPPIOCSNPMODE = 0x8008744b
|
||||
PPPIOCSPASS = 0x80107447
|
||||
PPPIOCSRASYNCMAP = 0x80047454
|
||||
PPPIOCSXASYNCMAP = 0x8020744f
|
||||
PPPIOCXFERUNIT = 0x2000744e
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -1394,6 +1437,7 @@ const (
|
|||
PR_SPEC_DISABLE = 0x4
|
||||
PR_SPEC_ENABLE = 0x2
|
||||
PR_SPEC_FORCE_DISABLE = 0x8
|
||||
PR_SPEC_INDIRECT_BRANCH = 0x1
|
||||
PR_SPEC_NOT_AFFECTED = 0x0
|
||||
PR_SPEC_PRCTL = 0x1
|
||||
PR_SPEC_STORE_BYPASS = 0x0
|
||||
|
@ -1472,6 +1516,8 @@ const (
|
|||
PTRACE_SINGLEBLOCK = 0x100
|
||||
PTRACE_SINGLESTEP = 0x9
|
||||
PTRACE_SYSCALL = 0x18
|
||||
PTRACE_SYSEMU = 0x1d
|
||||
PTRACE_SYSEMU_SINGLESTEP = 0x1e
|
||||
PTRACE_TRACEME = 0x0
|
||||
PT_CCR = 0x26
|
||||
PT_CTR = 0x23
|
||||
|
@ -1551,6 +1597,13 @@ const (
|
|||
RLIMIT_SIGPENDING = 0xb
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0xffffffffffffffff
|
||||
RNDADDENTROPY = 0x80085203
|
||||
RNDADDTOENTCNT = 0x80045201
|
||||
RNDCLEARPOOL = 0x20005206
|
||||
RNDGETENTCNT = 0x40045200
|
||||
RNDGETPOOL = 0x40085202
|
||||
RNDRESEEDCRNG = 0x20005207
|
||||
RNDZAPENTCNT = 0x20005204
|
||||
RTAX_ADVMSS = 0x8
|
||||
RTAX_CC_ALGO = 0x10
|
||||
RTAX_CWND = 0x7
|
||||
|
@ -1752,11 +1805,14 @@ const (
|
|||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SC_LOG_FLUSH = 0x100000
|
||||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SELINUX_MAGIC = 0xf97cff8c
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1807,6 +1863,9 @@ const (
|
|||
SIOCGMIIPHY = 0x8947
|
||||
SIOCGMIIREG = 0x8948
|
||||
SIOCGPGRP = 0x8904
|
||||
SIOCGPPPCSTATS = 0x89f2
|
||||
SIOCGPPPSTATS = 0x89f0
|
||||
SIOCGPPPVER = 0x89f1
|
||||
SIOCGRARP = 0x8961
|
||||
SIOCGSKNS = 0x894c
|
||||
SIOCGSTAMP = 0x8906
|
||||
|
@ -1915,6 +1974,17 @@ const (
|
|||
SO_DETACH_FILTER = 0x1b
|
||||
SO_DOMAIN = 0x27
|
||||
SO_DONTROUTE = 0x5
|
||||
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
|
||||
SO_EE_CODE_TXTIME_MISSED = 0x2
|
||||
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
|
||||
SO_EE_ORIGIN_ICMP = 0x2
|
||||
SO_EE_ORIGIN_ICMP6 = 0x3
|
||||
SO_EE_ORIGIN_LOCAL = 0x1
|
||||
SO_EE_ORIGIN_NONE = 0x0
|
||||
SO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
SO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
SO_EE_ORIGIN_TXTIME = 0x6
|
||||
SO_EE_ORIGIN_ZEROCOPY = 0x5
|
||||
SO_ERROR = 0x4
|
||||
SO_GET_FILTER = 0x1a
|
||||
SO_INCOMING_CPU = 0x31
|
||||
|
@ -2034,7 +2104,7 @@ const (
|
|||
TASKSTATS_GENL_NAME = "TASKSTATS"
|
||||
TASKSTATS_GENL_VERSION = 0x1
|
||||
TASKSTATS_TYPE_MAX = 0x6
|
||||
TASKSTATS_VERSION = 0x8
|
||||
TASKSTATS_VERSION = 0x9
|
||||
TCFLSH = 0x2000741f
|
||||
TCGETA = 0x40147417
|
||||
TCGETS = 0x402c7413
|
||||
|
@ -2046,6 +2116,7 @@ const (
|
|||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CC_INFO = 0x1a
|
||||
TCP_CM_INQ = 0x24
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_COOKIE_IN_ALWAYS = 0x1
|
||||
TCP_COOKIE_MAX = 0x10
|
||||
|
@ -2060,6 +2131,7 @@ const (
|
|||
TCP_FASTOPEN_KEY = 0x21
|
||||
TCP_FASTOPEN_NO_COOKIE = 0x22
|
||||
TCP_INFO = 0xb
|
||||
TCP_INQ = 0x24
|
||||
TCP_KEEPCNT = 0x6
|
||||
TCP_KEEPIDLE = 0x4
|
||||
TCP_KEEPINTVL = 0x5
|
||||
|
@ -2079,6 +2151,9 @@ const (
|
|||
TCP_QUEUE_SEQ = 0x15
|
||||
TCP_QUICKACK = 0xc
|
||||
TCP_REPAIR = 0x13
|
||||
TCP_REPAIR_OFF = 0x0
|
||||
TCP_REPAIR_OFF_NO_WP = -0x1
|
||||
TCP_REPAIR_ON = 0x1
|
||||
TCP_REPAIR_OPTIONS = 0x16
|
||||
TCP_REPAIR_QUEUE = 0x14
|
||||
TCP_REPAIR_WINDOW = 0x1d
|
||||
|
@ -2093,6 +2168,7 @@ const (
|
|||
TCP_ULP = 0x1f
|
||||
TCP_USER_TIMEOUT = 0x12
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCP_ZEROCOPY_RECEIVE = 0x23
|
||||
TCSAFLUSH = 0x2
|
||||
TCSBRK = 0x2000741d
|
||||
TCSBRKP = 0x5425
|
||||
|
@ -2103,6 +2179,7 @@ const (
|
|||
TCSETSF = 0x802c7416
|
||||
TCSETSW = 0x802c7415
|
||||
TCXONC = 0x2000741e
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x541d
|
||||
TIOCEXCL = 0x540c
|
||||
|
@ -2112,6 +2189,7 @@ const (
|
|||
TIOCGETP = 0x40067408
|
||||
TIOCGEXCL = 0x40045440
|
||||
TIOCGICOUNT = 0x545d
|
||||
TIOCGISO7816 = 0x40285442
|
||||
TIOCGLCKTRMIOS = 0x5456
|
||||
TIOCGLTC = 0x40067474
|
||||
TIOCGPGRP = 0x40047477
|
||||
|
@ -2172,6 +2250,7 @@ const (
|
|||
TIOCSETN = 0x8006740a
|
||||
TIOCSETP = 0x80067409
|
||||
TIOCSIG = 0x80045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x5457
|
||||
TIOCSLTC = 0x80067475
|
||||
TIOCSPGRP = 0x80047476
|
||||
|
@ -2404,6 +2483,7 @@ const (
|
|||
XDP_UMEM_REG = 0x4
|
||||
XDP_ZEROCOPY = 0x4
|
||||
XENFS_SUPER_MAGIC = 0xabba1974
|
||||
XFS_SUPER_MAGIC = 0x58465342
|
||||
XTABS = 0xc00
|
||||
ZSMALLOC_MAGIC = 0x58295829
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x2c
|
||||
AF_MAX = 0x2d
|
||||
AF_MPLS = 0x1c
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
|
@ -638,7 +638,7 @@ const (
|
|||
IFA_F_STABLE_PRIVACY = 0x800
|
||||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x9
|
||||
IFA_MAX = 0xa
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ATTACH_QUEUE = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
|
@ -706,6 +706,7 @@ const (
|
|||
IN_ISDIR = 0x40000000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IN_MASK_ADD = 0x20000000
|
||||
IN_MASK_CREATE = 0x10000000
|
||||
IN_MODIFY = 0x2
|
||||
IN_MOVE = 0xc0
|
||||
IN_MOVED_FROM = 0x40
|
||||
|
@ -777,6 +778,7 @@ const (
|
|||
IPV6_MINHOPCOUNT = 0x49
|
||||
IPV6_MTU = 0x18
|
||||
IPV6_MTU_DISCOVER = 0x17
|
||||
IPV6_MULTICAST_ALL = 0x1d
|
||||
IPV6_MULTICAST_HOPS = 0x12
|
||||
IPV6_MULTICAST_IF = 0x11
|
||||
IPV6_MULTICAST_LOOP = 0x13
|
||||
|
@ -912,6 +914,11 @@ const (
|
|||
KEYCTL_JOIN_SESSION_KEYRING = 0x1
|
||||
KEYCTL_LINK = 0x8
|
||||
KEYCTL_NEGATE = 0xd
|
||||
KEYCTL_PKEY_DECRYPT = 0x1a
|
||||
KEYCTL_PKEY_ENCRYPT = 0x19
|
||||
KEYCTL_PKEY_QUERY = 0x18
|
||||
KEYCTL_PKEY_SIGN = 0x1b
|
||||
KEYCTL_PKEY_VERIFY = 0x1c
|
||||
KEYCTL_READ = 0xb
|
||||
KEYCTL_REJECT = 0x13
|
||||
KEYCTL_RESTRICT_KEYRING = 0x1d
|
||||
|
@ -921,6 +928,10 @@ const (
|
|||
KEYCTL_SETPERM = 0x5
|
||||
KEYCTL_SET_REQKEY_KEYRING = 0xe
|
||||
KEYCTL_SET_TIMEOUT = 0xf
|
||||
KEYCTL_SUPPORTS_DECRYPT = 0x2
|
||||
KEYCTL_SUPPORTS_ENCRYPT = 0x1
|
||||
KEYCTL_SUPPORTS_SIGN = 0x4
|
||||
KEYCTL_SUPPORTS_VERIFY = 0x8
|
||||
KEYCTL_UNLINK = 0x9
|
||||
KEYCTL_UPDATE = 0x2
|
||||
KEY_REQKEY_DEFL_DEFAULT = 0x0
|
||||
|
@ -1099,6 +1110,7 @@ const (
|
|||
NETLINK_FIB_LOOKUP = 0xa
|
||||
NETLINK_FIREWALL = 0x3
|
||||
NETLINK_GENERIC = 0x10
|
||||
NETLINK_GET_STRICT_CHK = 0xc
|
||||
NETLINK_INET_DIAG = 0x4
|
||||
NETLINK_IP6_FW = 0xd
|
||||
NETLINK_ISCSI = 0x8
|
||||
|
@ -1242,6 +1254,7 @@ const (
|
|||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_IGNORE_OUTGOING = 0x17
|
||||
PACKET_KERNEL = 0x7
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
|
@ -1291,6 +1304,36 @@ const (
|
|||
PERF_EVENT_IOC_SET_FILTER = 0x40082406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
|
||||
PIPEFS_MAGIC = 0x50495045
|
||||
PPPIOCATTACH = 0x4004743d
|
||||
PPPIOCATTCHAN = 0x40047438
|
||||
PPPIOCCONNECT = 0x4004743a
|
||||
PPPIOCDETACH = 0x4004743c
|
||||
PPPIOCDISCONN = 0x7439
|
||||
PPPIOCGASYNCMAP = 0x80047458
|
||||
PPPIOCGCHAN = 0x80047437
|
||||
PPPIOCGDEBUG = 0x80047441
|
||||
PPPIOCGFLAGS = 0x8004745a
|
||||
PPPIOCGIDLE = 0x8010743f
|
||||
PPPIOCGL2TPSTATS = 0x80487436
|
||||
PPPIOCGMRU = 0x80047453
|
||||
PPPIOCGNPMODE = 0xc008744c
|
||||
PPPIOCGRASYNCMAP = 0x80047455
|
||||
PPPIOCGUNIT = 0x80047456
|
||||
PPPIOCGXASYNCMAP = 0x80207450
|
||||
PPPIOCNEWUNIT = 0xc004743e
|
||||
PPPIOCSACTIVE = 0x40107446
|
||||
PPPIOCSASYNCMAP = 0x40047457
|
||||
PPPIOCSCOMPRESS = 0x4010744d
|
||||
PPPIOCSDEBUG = 0x40047440
|
||||
PPPIOCSFLAGS = 0x40047459
|
||||
PPPIOCSMAXCID = 0x40047451
|
||||
PPPIOCSMRRU = 0x4004743b
|
||||
PPPIOCSMRU = 0x40047452
|
||||
PPPIOCSNPMODE = 0x4008744b
|
||||
PPPIOCSPASS = 0x40107447
|
||||
PPPIOCSRASYNCMAP = 0x40047454
|
||||
PPPIOCSXASYNCMAP = 0x4020744f
|
||||
PPPIOCXFERUNIT = 0x744e
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -1392,6 +1435,7 @@ const (
|
|||
PR_SPEC_DISABLE = 0x4
|
||||
PR_SPEC_ENABLE = 0x2
|
||||
PR_SPEC_FORCE_DISABLE = 0x8
|
||||
PR_SPEC_INDIRECT_BRANCH = 0x1
|
||||
PR_SPEC_NOT_AFFECTED = 0x0
|
||||
PR_SPEC_PRCTL = 0x1
|
||||
PR_SPEC_STORE_BYPASS = 0x0
|
||||
|
@ -1483,6 +1527,13 @@ const (
|
|||
RLIMIT_SIGPENDING = 0xb
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0xffffffffffffffff
|
||||
RNDADDENTROPY = 0x40085203
|
||||
RNDADDTOENTCNT = 0x40045201
|
||||
RNDCLEARPOOL = 0x5206
|
||||
RNDGETENTCNT = 0x80045200
|
||||
RNDGETPOOL = 0x80085202
|
||||
RNDRESEEDCRNG = 0x5207
|
||||
RNDZAPENTCNT = 0x5204
|
||||
RTAX_ADVMSS = 0x8
|
||||
RTAX_CC_ALGO = 0x10
|
||||
RTAX_CWND = 0x7
|
||||
|
@ -1684,11 +1735,14 @@ const (
|
|||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SC_LOG_FLUSH = 0x100000
|
||||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SELINUX_MAGIC = 0xf97cff8c
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1739,6 +1793,9 @@ const (
|
|||
SIOCGMIIPHY = 0x8947
|
||||
SIOCGMIIREG = 0x8948
|
||||
SIOCGPGRP = 0x8904
|
||||
SIOCGPPPCSTATS = 0x89f2
|
||||
SIOCGPPPSTATS = 0x89f0
|
||||
SIOCGPPPVER = 0x89f1
|
||||
SIOCGRARP = 0x8961
|
||||
SIOCGSKNS = 0x894c
|
||||
SIOCGSTAMP = 0x8906
|
||||
|
@ -1847,6 +1904,17 @@ const (
|
|||
SO_DETACH_FILTER = 0x1b
|
||||
SO_DOMAIN = 0x27
|
||||
SO_DONTROUTE = 0x5
|
||||
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
|
||||
SO_EE_CODE_TXTIME_MISSED = 0x2
|
||||
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
|
||||
SO_EE_ORIGIN_ICMP = 0x2
|
||||
SO_EE_ORIGIN_ICMP6 = 0x3
|
||||
SO_EE_ORIGIN_LOCAL = 0x1
|
||||
SO_EE_ORIGIN_NONE = 0x0
|
||||
SO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
SO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
SO_EE_ORIGIN_TXTIME = 0x6
|
||||
SO_EE_ORIGIN_ZEROCOPY = 0x5
|
||||
SO_ERROR = 0x4
|
||||
SO_GET_FILTER = 0x1a
|
||||
SO_INCOMING_CPU = 0x31
|
||||
|
@ -1966,7 +2034,7 @@ const (
|
|||
TASKSTATS_GENL_NAME = "TASKSTATS"
|
||||
TASKSTATS_GENL_VERSION = 0x1
|
||||
TASKSTATS_TYPE_MAX = 0x6
|
||||
TASKSTATS_VERSION = 0x8
|
||||
TASKSTATS_VERSION = 0x9
|
||||
TCFLSH = 0x540b
|
||||
TCGETA = 0x5405
|
||||
TCGETS = 0x5401
|
||||
|
@ -1980,6 +2048,7 @@ const (
|
|||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CC_INFO = 0x1a
|
||||
TCP_CM_INQ = 0x24
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_COOKIE_IN_ALWAYS = 0x1
|
||||
TCP_COOKIE_MAX = 0x10
|
||||
|
@ -1994,6 +2063,7 @@ const (
|
|||
TCP_FASTOPEN_KEY = 0x21
|
||||
TCP_FASTOPEN_NO_COOKIE = 0x22
|
||||
TCP_INFO = 0xb
|
||||
TCP_INQ = 0x24
|
||||
TCP_KEEPCNT = 0x6
|
||||
TCP_KEEPIDLE = 0x4
|
||||
TCP_KEEPINTVL = 0x5
|
||||
|
@ -2013,6 +2083,9 @@ const (
|
|||
TCP_QUEUE_SEQ = 0x15
|
||||
TCP_QUICKACK = 0xc
|
||||
TCP_REPAIR = 0x13
|
||||
TCP_REPAIR_OFF = 0x0
|
||||
TCP_REPAIR_OFF_NO_WP = -0x1
|
||||
TCP_REPAIR_ON = 0x1
|
||||
TCP_REPAIR_OPTIONS = 0x16
|
||||
TCP_REPAIR_QUEUE = 0x14
|
||||
TCP_REPAIR_WINDOW = 0x1d
|
||||
|
@ -2027,6 +2100,7 @@ const (
|
|||
TCP_ULP = 0x1f
|
||||
TCP_USER_TIMEOUT = 0x12
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCP_ZEROCOPY_RECEIVE = 0x23
|
||||
TCSAFLUSH = 0x2
|
||||
TCSBRK = 0x5409
|
||||
TCSBRKP = 0x5425
|
||||
|
@ -2043,6 +2117,7 @@ const (
|
|||
TCSETXF = 0x5434
|
||||
TCSETXW = 0x5435
|
||||
TCXONC = 0x540a
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x541d
|
||||
TIOCEXCL = 0x540c
|
||||
|
@ -2050,6 +2125,7 @@ const (
|
|||
TIOCGETD = 0x5424
|
||||
TIOCGEXCL = 0x80045440
|
||||
TIOCGICOUNT = 0x545d
|
||||
TIOCGISO7816 = 0x80285442
|
||||
TIOCGLCKTRMIOS = 0x5456
|
||||
TIOCGPGRP = 0x540f
|
||||
TIOCGPKT = 0x80045438
|
||||
|
@ -2103,6 +2179,7 @@ const (
|
|||
TIOCSER_TEMT = 0x1
|
||||
TIOCSETD = 0x5423
|
||||
TIOCSIG = 0x40045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x5457
|
||||
TIOCSPGRP = 0x5410
|
||||
TIOCSPTLCK = 0x40045431
|
||||
|
@ -2332,6 +2409,7 @@ const (
|
|||
XDP_UMEM_REG = 0x4
|
||||
XDP_ZEROCOPY = 0x4
|
||||
XENFS_SUPER_MAGIC = 0xabba1974
|
||||
XFS_SUPER_MAGIC = 0x58465342
|
||||
XTABS = 0x1800
|
||||
ZSMALLOC_MAGIC = 0x58295829
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ const (
|
|||
AF_KEY = 0xf
|
||||
AF_LLC = 0x1a
|
||||
AF_LOCAL = 0x1
|
||||
AF_MAX = 0x2c
|
||||
AF_MAX = 0x2d
|
||||
AF_MPLS = 0x1c
|
||||
AF_NETBEUI = 0xd
|
||||
AF_NETLINK = 0x10
|
||||
|
@ -638,7 +638,7 @@ const (
|
|||
IFA_F_STABLE_PRIVACY = 0x800
|
||||
IFA_F_TEMPORARY = 0x1
|
||||
IFA_F_TENTATIVE = 0x40
|
||||
IFA_MAX = 0x9
|
||||
IFA_MAX = 0xa
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ATTACH_QUEUE = 0x200
|
||||
IFF_AUTOMEDIA = 0x4000
|
||||
|
@ -706,6 +706,7 @@ const (
|
|||
IN_ISDIR = 0x40000000
|
||||
IN_LOOPBACKNET = 0x7f
|
||||
IN_MASK_ADD = 0x20000000
|
||||
IN_MASK_CREATE = 0x10000000
|
||||
IN_MODIFY = 0x2
|
||||
IN_MOVE = 0xc0
|
||||
IN_MOVED_FROM = 0x40
|
||||
|
@ -777,6 +778,7 @@ const (
|
|||
IPV6_MINHOPCOUNT = 0x49
|
||||
IPV6_MTU = 0x18
|
||||
IPV6_MTU_DISCOVER = 0x17
|
||||
IPV6_MULTICAST_ALL = 0x1d
|
||||
IPV6_MULTICAST_HOPS = 0x12
|
||||
IPV6_MULTICAST_IF = 0x11
|
||||
IPV6_MULTICAST_LOOP = 0x13
|
||||
|
@ -912,6 +914,11 @@ const (
|
|||
KEYCTL_JOIN_SESSION_KEYRING = 0x1
|
||||
KEYCTL_LINK = 0x8
|
||||
KEYCTL_NEGATE = 0xd
|
||||
KEYCTL_PKEY_DECRYPT = 0x1a
|
||||
KEYCTL_PKEY_ENCRYPT = 0x19
|
||||
KEYCTL_PKEY_QUERY = 0x18
|
||||
KEYCTL_PKEY_SIGN = 0x1b
|
||||
KEYCTL_PKEY_VERIFY = 0x1c
|
||||
KEYCTL_READ = 0xb
|
||||
KEYCTL_REJECT = 0x13
|
||||
KEYCTL_RESTRICT_KEYRING = 0x1d
|
||||
|
@ -921,6 +928,10 @@ const (
|
|||
KEYCTL_SETPERM = 0x5
|
||||
KEYCTL_SET_REQKEY_KEYRING = 0xe
|
||||
KEYCTL_SET_TIMEOUT = 0xf
|
||||
KEYCTL_SUPPORTS_DECRYPT = 0x2
|
||||
KEYCTL_SUPPORTS_ENCRYPT = 0x1
|
||||
KEYCTL_SUPPORTS_SIGN = 0x4
|
||||
KEYCTL_SUPPORTS_VERIFY = 0x8
|
||||
KEYCTL_UNLINK = 0x9
|
||||
KEYCTL_UPDATE = 0x2
|
||||
KEY_REQKEY_DEFL_DEFAULT = 0x0
|
||||
|
@ -1099,6 +1110,7 @@ const (
|
|||
NETLINK_FIB_LOOKUP = 0xa
|
||||
NETLINK_FIREWALL = 0x3
|
||||
NETLINK_GENERIC = 0x10
|
||||
NETLINK_GET_STRICT_CHK = 0xc
|
||||
NETLINK_INET_DIAG = 0x4
|
||||
NETLINK_IP6_FW = 0xd
|
||||
NETLINK_ISCSI = 0x8
|
||||
|
@ -1242,6 +1254,7 @@ const (
|
|||
PACKET_FASTROUTE = 0x6
|
||||
PACKET_HDRLEN = 0xb
|
||||
PACKET_HOST = 0x0
|
||||
PACKET_IGNORE_OUTGOING = 0x17
|
||||
PACKET_KERNEL = 0x7
|
||||
PACKET_LOOPBACK = 0x5
|
||||
PACKET_LOSS = 0xe
|
||||
|
@ -1291,6 +1304,36 @@ const (
|
|||
PERF_EVENT_IOC_SET_FILTER = 0x40082406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
|
||||
PIPEFS_MAGIC = 0x50495045
|
||||
PPPIOCATTACH = 0x4004743d
|
||||
PPPIOCATTCHAN = 0x40047438
|
||||
PPPIOCCONNECT = 0x4004743a
|
||||
PPPIOCDETACH = 0x4004743c
|
||||
PPPIOCDISCONN = 0x7439
|
||||
PPPIOCGASYNCMAP = 0x80047458
|
||||
PPPIOCGCHAN = 0x80047437
|
||||
PPPIOCGDEBUG = 0x80047441
|
||||
PPPIOCGFLAGS = 0x8004745a
|
||||
PPPIOCGIDLE = 0x8010743f
|
||||
PPPIOCGL2TPSTATS = 0x80487436
|
||||
PPPIOCGMRU = 0x80047453
|
||||
PPPIOCGNPMODE = 0xc008744c
|
||||
PPPIOCGRASYNCMAP = 0x80047455
|
||||
PPPIOCGUNIT = 0x80047456
|
||||
PPPIOCGXASYNCMAP = 0x80207450
|
||||
PPPIOCNEWUNIT = 0xc004743e
|
||||
PPPIOCSACTIVE = 0x40107446
|
||||
PPPIOCSASYNCMAP = 0x40047457
|
||||
PPPIOCSCOMPRESS = 0x4010744d
|
||||
PPPIOCSDEBUG = 0x40047440
|
||||
PPPIOCSFLAGS = 0x40047459
|
||||
PPPIOCSMAXCID = 0x40047451
|
||||
PPPIOCSMRRU = 0x4004743b
|
||||
PPPIOCSMRU = 0x40047452
|
||||
PPPIOCSNPMODE = 0x4008744b
|
||||
PPPIOCSPASS = 0x40107447
|
||||
PPPIOCSRASYNCMAP = 0x40047454
|
||||
PPPIOCSXASYNCMAP = 0x4020744f
|
||||
PPPIOCXFERUNIT = 0x744e
|
||||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
|
@ -1392,6 +1435,7 @@ const (
|
|||
PR_SPEC_DISABLE = 0x4
|
||||
PR_SPEC_ENABLE = 0x2
|
||||
PR_SPEC_FORCE_DISABLE = 0x8
|
||||
PR_SPEC_INDIRECT_BRANCH = 0x1
|
||||
PR_SPEC_NOT_AFFECTED = 0x0
|
||||
PR_SPEC_PRCTL = 0x1
|
||||
PR_SPEC_STORE_BYPASS = 0x0
|
||||
|
@ -1556,6 +1600,13 @@ const (
|
|||
RLIMIT_SIGPENDING = 0xb
|
||||
RLIMIT_STACK = 0x3
|
||||
RLIM_INFINITY = 0xffffffffffffffff
|
||||
RNDADDENTROPY = 0x40085203
|
||||
RNDADDTOENTCNT = 0x40045201
|
||||
RNDCLEARPOOL = 0x5206
|
||||
RNDGETENTCNT = 0x80045200
|
||||
RNDGETPOOL = 0x80085202
|
||||
RNDRESEEDCRNG = 0x5207
|
||||
RNDZAPENTCNT = 0x5204
|
||||
RTAX_ADVMSS = 0x8
|
||||
RTAX_CC_ALGO = 0x10
|
||||
RTAX_CWND = 0x7
|
||||
|
@ -1757,11 +1808,14 @@ const (
|
|||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SC_LOG_FLUSH = 0x100000
|
||||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SELINUX_MAGIC = 0xf97cff8c
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1812,6 +1866,9 @@ const (
|
|||
SIOCGMIIPHY = 0x8947
|
||||
SIOCGMIIREG = 0x8948
|
||||
SIOCGPGRP = 0x8904
|
||||
SIOCGPPPCSTATS = 0x89f2
|
||||
SIOCGPPPSTATS = 0x89f0
|
||||
SIOCGPPPVER = 0x89f1
|
||||
SIOCGRARP = 0x8961
|
||||
SIOCGSKNS = 0x894c
|
||||
SIOCGSTAMP = 0x8906
|
||||
|
@ -1920,6 +1977,17 @@ const (
|
|||
SO_DETACH_FILTER = 0x1b
|
||||
SO_DOMAIN = 0x27
|
||||
SO_DONTROUTE = 0x5
|
||||
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
|
||||
SO_EE_CODE_TXTIME_MISSED = 0x2
|
||||
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
|
||||
SO_EE_ORIGIN_ICMP = 0x2
|
||||
SO_EE_ORIGIN_ICMP6 = 0x3
|
||||
SO_EE_ORIGIN_LOCAL = 0x1
|
||||
SO_EE_ORIGIN_NONE = 0x0
|
||||
SO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
SO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
SO_EE_ORIGIN_TXTIME = 0x6
|
||||
SO_EE_ORIGIN_ZEROCOPY = 0x5
|
||||
SO_ERROR = 0x4
|
||||
SO_GET_FILTER = 0x1a
|
||||
SO_INCOMING_CPU = 0x31
|
||||
|
@ -2039,7 +2107,7 @@ const (
|
|||
TASKSTATS_GENL_NAME = "TASKSTATS"
|
||||
TASKSTATS_GENL_VERSION = 0x1
|
||||
TASKSTATS_TYPE_MAX = 0x6
|
||||
TASKSTATS_VERSION = 0x8
|
||||
TASKSTATS_VERSION = 0x9
|
||||
TCFLSH = 0x540b
|
||||
TCGETA = 0x5405
|
||||
TCGETS = 0x5401
|
||||
|
@ -2053,6 +2121,7 @@ const (
|
|||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_CC_INFO = 0x1a
|
||||
TCP_CM_INQ = 0x24
|
||||
TCP_CONGESTION = 0xd
|
||||
TCP_COOKIE_IN_ALWAYS = 0x1
|
||||
TCP_COOKIE_MAX = 0x10
|
||||
|
@ -2067,6 +2136,7 @@ const (
|
|||
TCP_FASTOPEN_KEY = 0x21
|
||||
TCP_FASTOPEN_NO_COOKIE = 0x22
|
||||
TCP_INFO = 0xb
|
||||
TCP_INQ = 0x24
|
||||
TCP_KEEPCNT = 0x6
|
||||
TCP_KEEPIDLE = 0x4
|
||||
TCP_KEEPINTVL = 0x5
|
||||
|
@ -2086,6 +2156,9 @@ const (
|
|||
TCP_QUEUE_SEQ = 0x15
|
||||
TCP_QUICKACK = 0xc
|
||||
TCP_REPAIR = 0x13
|
||||
TCP_REPAIR_OFF = 0x0
|
||||
TCP_REPAIR_OFF_NO_WP = -0x1
|
||||
TCP_REPAIR_ON = 0x1
|
||||
TCP_REPAIR_OPTIONS = 0x16
|
||||
TCP_REPAIR_QUEUE = 0x14
|
||||
TCP_REPAIR_WINDOW = 0x1d
|
||||
|
@ -2100,6 +2173,7 @@ const (
|
|||
TCP_ULP = 0x1f
|
||||
TCP_USER_TIMEOUT = 0x12
|
||||
TCP_WINDOW_CLAMP = 0xa
|
||||
TCP_ZEROCOPY_RECEIVE = 0x23
|
||||
TCSAFLUSH = 0x2
|
||||
TCSBRK = 0x5409
|
||||
TCSBRKP = 0x5425
|
||||
|
@ -2116,6 +2190,7 @@ const (
|
|||
TCSETXF = 0x5434
|
||||
TCSETXW = 0x5435
|
||||
TCXONC = 0x540a
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x541d
|
||||
TIOCEXCL = 0x540c
|
||||
|
@ -2123,6 +2198,7 @@ const (
|
|||
TIOCGETD = 0x5424
|
||||
TIOCGEXCL = 0x80045440
|
||||
TIOCGICOUNT = 0x545d
|
||||
TIOCGISO7816 = 0x80285442
|
||||
TIOCGLCKTRMIOS = 0x5456
|
||||
TIOCGPGRP = 0x540f
|
||||
TIOCGPKT = 0x80045438
|
||||
|
@ -2176,6 +2252,7 @@ const (
|
|||
TIOCSER_TEMT = 0x1
|
||||
TIOCSETD = 0x5423
|
||||
TIOCSIG = 0x40045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x5457
|
||||
TIOCSPGRP = 0x5410
|
||||
TIOCSPTLCK = 0x40045431
|
||||
|
@ -2405,6 +2482,7 @@ const (
|
|||
XDP_UMEM_REG = 0x4
|
||||
XDP_ZEROCOPY = 0x4
|
||||
XENFS_SUPER_MAGIC = 0xabba1974
|
||||
XFS_SUPER_MAGIC = 0x58465342
|
||||
XTABS = 0x1800
|
||||
ZSMALLOC_MAGIC = 0x58295829
|
||||
)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
// mksyscall_aix_ppc.pl -aix -tags aix,ppc syscall_aix.go syscall_aix_ppc.go
|
||||
// go run mksyscall_aix_ppc.go -aix -tags aix,ppc syscall_aix.go syscall_aix_ppc.go
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build aix,ppc
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// mksyscall_aix_ppc64.pl -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go
|
||||
// go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build aix,ppc64
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// mksyscall_aix_ppc64.pl -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go
|
||||
// go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build aix,ppc64
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// mksyscall_aix_ppc64.pl -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go
|
||||
// go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build aix,ppc64
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,284 @@
|
|||
// go run mkasm_darwin.go 386
|
||||
// Code generated by the command above; DO NOT EDIT.
|
||||
|
||||
// +build go1.12
|
||||
|
||||
#include "textflag.h"
|
||||
TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getgroups(SB)
|
||||
TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setgroups(SB)
|
||||
TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_wait4(SB)
|
||||
TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_accept(SB)
|
||||
TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_bind(SB)
|
||||
TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_connect(SB)
|
||||
TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_socket(SB)
|
||||
TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getsockopt(SB)
|
||||
TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setsockopt(SB)
|
||||
TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpeername(SB)
|
||||
TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getsockname(SB)
|
||||
TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_shutdown(SB)
|
||||
TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_socketpair(SB)
|
||||
TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_recvfrom(SB)
|
||||
TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_sendto(SB)
|
||||
TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_recvmsg(SB)
|
||||
TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_sendmsg(SB)
|
||||
TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_kevent(SB)
|
||||
TEXT ·libc___sysctl_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc___sysctl(SB)
|
||||
TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_utimes(SB)
|
||||
TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_futimes(SB)
|
||||
TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fcntl(SB)
|
||||
TEXT ·libc_poll_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_poll(SB)
|
||||
TEXT ·libc_madvise_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_madvise(SB)
|
||||
TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mlock(SB)
|
||||
TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mlockall(SB)
|
||||
TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mprotect(SB)
|
||||
TEXT ·libc_msync_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_msync(SB)
|
||||
TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_munlock(SB)
|
||||
TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_munlockall(SB)
|
||||
TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_ptrace(SB)
|
||||
TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getattrlist(SB)
|
||||
TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_pipe(SB)
|
||||
TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getxattr(SB)
|
||||
TEXT ·libc_fgetxattr_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fgetxattr(SB)
|
||||
TEXT ·libc_setxattr_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setxattr(SB)
|
||||
TEXT ·libc_fsetxattr_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fsetxattr(SB)
|
||||
TEXT ·libc_removexattr_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_removexattr(SB)
|
||||
TEXT ·libc_fremovexattr_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fremovexattr(SB)
|
||||
TEXT ·libc_listxattr_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_listxattr(SB)
|
||||
TEXT ·libc_flistxattr_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_flistxattr(SB)
|
||||
TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setattrlist(SB)
|
||||
TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_kill(SB)
|
||||
TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_ioctl(SB)
|
||||
TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_sendfile(SB)
|
||||
TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_access(SB)
|
||||
TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_adjtime(SB)
|
||||
TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_chdir(SB)
|
||||
TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_chflags(SB)
|
||||
TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_chmod(SB)
|
||||
TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_chown(SB)
|
||||
TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_chroot(SB)
|
||||
TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_close(SB)
|
||||
TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_dup(SB)
|
||||
TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_dup2(SB)
|
||||
TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_exchangedata(SB)
|
||||
TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_exit(SB)
|
||||
TEXT ·libc_faccessat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_faccessat(SB)
|
||||
TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchdir(SB)
|
||||
TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchflags(SB)
|
||||
TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchmod(SB)
|
||||
TEXT ·libc_fchmodat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchmodat(SB)
|
||||
TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchown(SB)
|
||||
TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchownat(SB)
|
||||
TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_flock(SB)
|
||||
TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fpathconf(SB)
|
||||
TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fsync(SB)
|
||||
TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_ftruncate(SB)
|
||||
TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getdtablesize(SB)
|
||||
TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getegid(SB)
|
||||
TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_geteuid(SB)
|
||||
TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getgid(SB)
|
||||
TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpgid(SB)
|
||||
TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpgrp(SB)
|
||||
TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpid(SB)
|
||||
TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getppid(SB)
|
||||
TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpriority(SB)
|
||||
TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getrlimit(SB)
|
||||
TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getrusage(SB)
|
||||
TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getsid(SB)
|
||||
TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getuid(SB)
|
||||
TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_issetugid(SB)
|
||||
TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_kqueue(SB)
|
||||
TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_lchown(SB)
|
||||
TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_link(SB)
|
||||
TEXT ·libc_linkat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_linkat(SB)
|
||||
TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_listen(SB)
|
||||
TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mkdir(SB)
|
||||
TEXT ·libc_mkdirat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mkdirat(SB)
|
||||
TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mkfifo(SB)
|
||||
TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mknod(SB)
|
||||
TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_open(SB)
|
||||
TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_openat(SB)
|
||||
TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_pathconf(SB)
|
||||
TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_pread(SB)
|
||||
TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_pwrite(SB)
|
||||
TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_read(SB)
|
||||
TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_readlink(SB)
|
||||
TEXT ·libc_readlinkat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_readlinkat(SB)
|
||||
TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_rename(SB)
|
||||
TEXT ·libc_renameat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_renameat(SB)
|
||||
TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_revoke(SB)
|
||||
TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_rmdir(SB)
|
||||
TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_lseek(SB)
|
||||
TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_select(SB)
|
||||
TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setegid(SB)
|
||||
TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_seteuid(SB)
|
||||
TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setgid(SB)
|
||||
TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setlogin(SB)
|
||||
TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setpgid(SB)
|
||||
TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setpriority(SB)
|
||||
TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setprivexec(SB)
|
||||
TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setregid(SB)
|
||||
TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setreuid(SB)
|
||||
TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setrlimit(SB)
|
||||
TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setsid(SB)
|
||||
TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_settimeofday(SB)
|
||||
TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setuid(SB)
|
||||
TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_symlink(SB)
|
||||
TEXT ·libc_symlinkat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_symlinkat(SB)
|
||||
TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_sync(SB)
|
||||
TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_truncate(SB)
|
||||
TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_umask(SB)
|
||||
TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_undelete(SB)
|
||||
TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_unlink(SB)
|
||||
TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_unlinkat(SB)
|
||||
TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_unmount(SB)
|
||||
TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_write(SB)
|
||||
TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mmap(SB)
|
||||
TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_munmap(SB)
|
||||
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_gettimeofday(SB)
|
||||
TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fstat64(SB)
|
||||
TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fstatat64(SB)
|
||||
TEXT ·libc_fstatfs64_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fstatfs64(SB)
|
||||
TEXT ·libc___getdirentries64_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc___getdirentries64(SB)
|
||||
TEXT ·libc_getfsstat64_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getfsstat64(SB)
|
||||
TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_lstat64(SB)
|
||||
TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_stat64(SB)
|
||||
TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_statfs64(SB)
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue