Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
velero-plugin
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
velero-plugin
Commits
55188db2
Commit
55188db2
authored
Sep 03, 2019
by
流生
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix issue6 to convert volumeId to VolumeId
parent
32b48cc3
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
493 additions
and
358 deletions
+493
-358
Gopkg.lock
+7
-7
install/01-velero.yaml
+1
-1
pkg/alibabacloud/object_store.go
+259
-4
pkg/alibabacloud/volume_snapshotter.go
+10
-6
vendor/github.com/gogo/protobuf/proto/extensions.go
+1
-0
vendor/github.com/gogo/protobuf/proto/extensions_gogo.go
+21
-0
vendor/github.com/gogo/protobuf/proto/lib.go
+13
-7
vendor/github.com/gogo/protobuf/proto/properties.go
+39
-27
vendor/github.com/gogo/protobuf/proto/table_marshal.go
+7
-6
vendor/github.com/gogo/protobuf/proto/table_merge.go
+19
-0
vendor/github.com/gogo/protobuf/proto/table_unmarshal.go
+13
-9
vendor/golang.org/x/sys/unix/ioctl.go
+38
-3
vendor/golang.org/x/sys/unix/syscall_aix.go
+1
-38
vendor/golang.org/x/sys/unix/syscall_darwin.go
+0
-37
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
+0
-37
vendor/golang.org/x/sys/unix/syscall_freebsd.go
+0
-37
vendor/golang.org/x/sys/unix/syscall_linux.go
+11
-34
vendor/golang.org/x/sys/unix/syscall_netbsd.go
+0
-37
vendor/golang.org/x/sys/unix/syscall_openbsd.go
+0
-37
vendor/golang.org/x/sys/unix/syscall_solaris.go
+0
-30
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
+4
-0
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
+4
-0
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
+4
-0
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
+4
-0
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
+4
-0
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
+4
-0
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
+4
-0
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
+4
-0
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
+4
-0
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
+4
-0
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
+4
-0
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
+4
-0
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
+4
-0
vendor/golang.org/x/sys/windows/security_windows.go
+1
-1
No files found.
Gopkg.lock
View file @
55188db2
...
...
@@ -41,8 +41,8 @@
"services/ecs",
]
pruneopts = "NUT"
revision = "
02bfe7fbce66b3b7cd16b8640a95b5316e5ab4ed
"
version = "1.60.13
1
"
revision = "
7a807875136654e7ca7fcdd5511cd72b14cc25ba
"
version = "1.60.13
2
"
[[projects]]
digest = "1:918521e77b229a961b2011082ee9c026d5077cab825be142f6e9771b61d03238"
...
...
@@ -77,15 +77,15 @@
version = "v4.5.0"
[[projects]]
digest = "1:
a1b2a5e38f79688ee8250942d5fa960525fceb1024c855c7bc76fa77b0f3cca2
"
digest = "1:
633dde05baa7afd3544cfe4ac16fe3c5450b868cfc6b1558621ee39ebf2273ea
"
name = "github.com/gogo/protobuf"
packages = [
"proto",
"sortkeys",
]
pruneopts = "NUT"
revision = "
ba06b47c162d49f2af050fb4c75bcbc86a159d5c
"
version = "v1.
2.1
"
revision = "
0ca988a254f991240804bf9821f3450d87ccbb1b
"
version = "v1.
3.0
"
[[projects]]
digest = "1:796f9c63c68774a89eade387a8476e45ec2b34f5649b0726983204202c3649d6"
...
...
@@ -378,14 +378,14 @@
[[projects]]
branch = "master"
digest = "1:
25afefcce84027a47ec93143dba3fd60e4d0e7b66ada0e16b0b54b7fafc5091c
"
digest = "1:
3589c63c3a3f0a6236ad09f8b227a2c4b28791001d4b934e8f33ac8b107391ef
"
name = "golang.org/x/sys"
packages = [
"unix",
"windows",
]
pruneopts = "NUT"
revision = "
19e00faab6ad547203cd66b19e1281807329cf65
"
revision = "
9109b7679e13aa34a54834cfb4949cac4b96e576
"
[[projects]]
digest = "1:8d8faad6b12a3a4c819a3f9618cb6ee1fa1cfc33253abeeea8b55336721e3405"
...
...
install/01-velero.yaml
View file @
55188db2
...
...
@@ -94,7 +94,7 @@ spec:
-
mountPath
:
/credentials
name
:
cloud-credentials
initContainers
:
-
image
:
registry.cn-hangzhou.aliyuncs.com/acs/velero-plugin-alibabacloud:v1.
1
-
image
:
registry.cn-hangzhou.aliyuncs.com/acs/velero-plugin-alibabacloud:v1.
2
imagePullPolicy
:
IfNotPresent
name
:
velero-plugin-alibabacloud
volumeMounts
:
...
...
pkg/alibabacloud/object_store.go
View file @
55188db2
...
...
@@ -23,11 +23,24 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"archive/tar"
"bufio"
"bytes"
"compress/gzip"
"fmt"
"github.com/heptio/velero/pkg/cloudprovider"
"io/ioutil"
"math/rand"
"path/filepath"
"regexp"
"strings"
)
const
(
regionKey
=
"region"
RegionKey
=
"region"
OriginStr
=
"volumeId"
TargetStr
=
"VolumeId"
Workspace
=
"/tmp/velero-restore/"
)
type
bucketGetter
interface
{
...
...
@@ -144,12 +157,12 @@ func (o *ObjectStore) PutObject(bucket, key string, body io.Reader) error {
if
err
!=
nil
{
return
err
}
if
o
.
encryptionKeyID
!=
""
{
err
=
bucketObj
.
PutObject
(
key
,
body
,
oss
.
ServerSideEncryption
(
"KMS"
),
oss
.
ServerSideEncryptionKeyID
(
o
.
encryptionKeyID
))
}
else
{
err
=
bucketObj
.
PutObject
(
key
,
body
)
}
...
...
@@ -172,8 +185,16 @@ func (o *ObjectStore) GetObject(bucket, key string) (io.ReadCloser, error) {
return
nil
,
err
}
return
bucketObj
.
GetObject
(
key
)
if
strings
.
HasSuffix
(
key
,
".tar.gz"
)
{
body
,
err
:=
bucketObj
.
GetObject
(
key
)
if
err
!=
nil
{
return
nil
,
err
}
return
CheckAndConvertVolumeId
(
body
)
}
return
bucketObj
.
GetObject
(
key
)
}
// ListCommonPrefixes interface
...
...
@@ -204,7 +225,6 @@ func (o *ObjectStore) ListCommonPrefixes(bucket, prefix, delimiter string) ([]st
// ListObjects list objects of a bucket
func
(
o
*
ObjectStore
)
ListObjects
(
bucket
,
prefix
string
)
([]
string
,
error
)
{
bucketObj
,
err
:=
o
.
getBucket
(
bucket
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -249,3 +269,238 @@ func (o *ObjectStore) CreateSignedURL(bucket, key string, ttl time.Duration) (st
return
bucketObj
.
SignURL
(
key
,
oss
.
HTTPGet
,
int64
(
ttl
.
Seconds
()))
}
// CheckAndConvertVolumeId convert volumeId to VolumeId in persistentvolumes json files
func
CheckAndConvertVolumeId
(
body
io
.
ReadCloser
)
(
io
.
ReadCloser
,
error
)
{
randStr
:=
CreateCaptcha
()
tmpWorkspace
:=
filepath
.
Join
(
Workspace
,
randStr
)
tmpFileName
:=
fmt
.
Sprintf
(
"%s.tar.gz"
,
randStr
)
if
_
,
err
:=
CheckPathExistsAndCreate
(
tmpWorkspace
);
err
!=
nil
{
return
nil
,
err
}
if
err
:=
os
.
Chdir
(
tmpWorkspace
);
err
!=
nil
{
return
nil
,
err
}
fd
,
err
:=
os
.
OpenFile
(
tmpFileName
,
os
.
O_WRONLY
|
os
.
O_CREATE
,
0660
)
if
err
!=
nil
{
return
nil
,
err
}
defer
fd
.
Close
()
if
_
,
err
:=
io
.
Copy
(
fd
,
body
);
err
!=
nil
{
return
nil
,
err
}
if
err
:=
DeCompress
(
tmpFileName
,
""
);
err
!=
nil
{
return
nil
,
err
}
if
err
:=
os
.
Remove
(
tmpFileName
);
err
!=
nil
{
return
nil
,
err
}
tmpFiles
:=
make
([]
string
,
0
)
err
=
filepath
.
Walk
(
tmpWorkspace
,
func
(
path
string
,
info
os
.
FileInfo
,
err
error
)
error
{
if
err
!=
nil
{
return
err
}
if
f
,
_
:=
os
.
Stat
(
path
);
!
f
.
IsDir
()
{
if
strings
.
Index
(
path
,
"resources/persistentvolumes/cluster"
)
>
0
{
tmpFiles
=
append
(
tmpFiles
,
path
)
}
}
return
nil
})
if
err
!=
nil
{
return
nil
,
err
}
for
_
,
f
:=
range
tmpFiles
{
fmt
.
Println
(
f
)
if
err
:=
ReplaceVolumeId
(
f
);
err
!=
nil
{
return
nil
,
err
}
}
if
err
:=
Compress
(
"."
,
tmpFileName
);
err
!=
nil
{
return
nil
,
err
}
f1
,
err
:=
ioutil
.
ReadFile
(
tmpFileName
)
if
err
!=
nil
{
return
nil
,
err
}
f2
:=
ioutil
.
NopCloser
(
bytes
.
NewReader
(
f1
))
if
err
:=
os
.
RemoveAll
(
tmpWorkspace
);
err
!=
nil
{
return
nil
,
err
}
return
f2
,
nil
}
// CheckPathExistsAndCreate
func
CheckPathExistsAndCreate
(
path
string
)
(
bool
,
error
)
{
_
,
err
:=
os
.
Stat
(
path
)
if
err
==
nil
{
return
true
,
nil
}
if
os
.
IsNotExist
(
err
)
{
err
=
os
.
MkdirAll
(
path
,
os
.
ModePerm
)
if
err
!=
nil
{
return
false
,
err
}
else
{
return
true
,
nil
}
}
return
false
,
nil
}
// CreateCaptcha
func
CreateCaptcha
()
string
{
return
fmt
.
Sprintf
(
"%08v"
,
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
.
Int31n
(
1000000
))
}
// DeCompress
func
DeCompress
(
tarFile
,
dest
string
)
error
{
srcFile
,
err
:=
os
.
Open
(
tarFile
)
if
err
!=
nil
{
return
err
}
defer
srcFile
.
Close
()
gr
,
err
:=
gzip
.
NewReader
(
srcFile
)
if
err
!=
nil
{
return
err
}
defer
gr
.
Close
()
tr
:=
tar
.
NewReader
(
gr
)
for
{
hdr
,
err
:=
tr
.
Next
()
if
err
!=
nil
{
if
err
==
io
.
EOF
{
break
}
else
{
return
err
}
}
filename
:=
dest
+
hdr
.
Name
file
,
err
:=
CreateFile
(
filename
)
if
err
!=
nil
{
return
err
}
io
.
Copy
(
file
,
tr
)
}
return
nil
}
// CreateFile
func
CreateFile
(
name
string
)
(
*
os
.
File
,
error
)
{
err
:=
os
.
MkdirAll
(
string
([]
rune
(
name
)[
0
:
strings
.
LastIndex
(
name
,
"/"
)]),
0755
)
if
err
!=
nil
{
return
nil
,
err
}
return
os
.
Create
(
name
)
}
// ReplaceVolumeId
func
ReplaceVolumeId
(
filePath
string
)
error
{
f
,
err
:=
os
.
OpenFile
(
filePath
,
os
.
O_RDONLY
,
0644
)
if
err
!=
nil
{
return
err
}
defer
f
.
Close
()
reader
:=
bufio
.
NewReader
(
f
)
output
:=
make
([]
byte
,
0
)
for
{
line
,
_
,
err
:=
reader
.
ReadLine
()
if
err
!=
nil
{
if
err
==
io
.
EOF
{
break
}
return
err
}
if
ok
,
_
:=
regexp
.
Match
(
OriginStr
,
line
);
ok
{
reg
:=
regexp
.
MustCompile
(
OriginStr
)
newByte
:=
reg
.
ReplaceAll
(
line
,
[]
byte
(
TargetStr
))
output
=
append
(
output
,
newByte
...
)
output
=
append
(
output
,
[]
byte
(
"
\n
"
)
...
)
}
else
{
output
=
append
(
output
,
line
...
)
output
=
append
(
output
,
[]
byte
(
"
\n
"
)
...
)
}
}
if
err
:=
writeToFile
(
filePath
,
output
);
err
!=
nil
{
return
err
}
return
nil
}
// writeToFile
func
writeToFile
(
filePath
string
,
outPut
[]
byte
)
error
{
f
,
err
:=
os
.
OpenFile
(
filePath
,
os
.
O_WRONLY
|
os
.
O_TRUNC
,
0600
)
defer
f
.
Close
()
if
err
!=
nil
{
return
err
}
writer
:=
bufio
.
NewWriter
(
f
)
_
,
err
=
writer
.
Write
(
outPut
)
if
err
!=
nil
{
return
err
}
writer
.
Flush
()
return
nil
}
// Compress
func
Compress
(
src
,
dst
string
)
error
{
fw
,
err
:=
os
.
Create
(
dst
)
if
err
!=
nil
{
return
err
}
defer
fw
.
Close
()
gw
:=
gzip
.
NewWriter
(
fw
)
defer
gw
.
Close
()
tw
:=
tar
.
NewWriter
(
gw
)
defer
tw
.
Close
()
return
filepath
.
Walk
(
src
,
func
(
fileName
string
,
fi
os
.
FileInfo
,
err
error
)
error
{
if
err
!=
nil
{
return
err
}
if
strings
.
Index
(
fileName
,
dst
)
>
-
1
{
return
nil
}
hdr
,
err
:=
tar
.
FileInfoHeader
(
fi
,
""
)
if
err
!=
nil
{
return
err
}
hdr
.
Name
=
strings
.
TrimPrefix
(
fileName
,
string
(
filepath
.
Separator
))
if
err
:=
tw
.
WriteHeader
(
hdr
);
err
!=
nil
{
return
err
}
if
!
fi
.
Mode
()
.
IsRegular
()
{
return
nil
}
fr
,
err
:=
os
.
Open
(
fileName
)
defer
fr
.
Close
()
if
err
!=
nil
{
return
err
}
if
_
,
err
:=
io
.
Copy
(
tw
,
fr
);
err
!=
nil
{
return
err
}
return
nil
})
}
pkg/alibabacloud/volume_snapshotter.go
View file @
55188db2
...
...
@@ -50,7 +50,7 @@ func NewVolumeSnapshotter(logger logrus.FieldLogger) *VolumeSnapshotter {
// Init init ecs client with os env
func
(
b
*
VolumeSnapshotter
)
Init
(
config
map
[
string
]
string
)
error
{
if
err
:=
cloudprovider
.
ValidateVolumeSnapshotterConfigKeys
(
config
,
r
egionKey
);
err
!=
nil
{
if
err
:=
cloudprovider
.
ValidateVolumeSnapshotterConfigKeys
(
config
,
R
egionKey
);
err
!=
nil
{
return
err
}
...
...
@@ -58,9 +58,9 @@ func (b *VolumeSnapshotter) Init(config map[string]string) error {
return
err
}
region
:=
config
[
r
egionKey
]
region
:=
config
[
R
egionKey
]
if
region
==
""
{
return
errors
.
Errorf
(
"missing %s in Alibaba Cloud configuration"
,
r
egionKey
)
return
errors
.
Errorf
(
"missing %s in Alibaba Cloud configuration"
,
R
egionKey
)
}
accessKeyID
:=
os
.
Getenv
(
"ALIBABA_CLOUD_ACCESS_KEY_ID"
)
...
...
@@ -296,10 +296,14 @@ func getEBSDiskID(pv *v1.PersistentVolume) (string, error) {
return
""
,
err
}
options
:=
pv
.
Spec
.
FlexVolume
.
Options
if
options
==
nil
||
options
[
"VolumeId"
]
==
""
{
return
""
,
errors
.
New
(
"spec.FlexVolume.Options['VolumeId'] not found"
)
if
options
==
nil
||
(
options
[
"VolumeId"
]
==
""
&&
options
[
"volumeId"
]
==
""
)
{
return
""
,
errors
.
New
(
"spec.FlexVolume.Options['VolumeId'] or spec.FlexVolume.Options['volumeId'] not found"
)
}
else
if
options
[
"VolumeId"
]
!=
""
{
return
options
[
"VolumeId"
],
nil
}
else
{
return
options
[
"volumeId"
],
nil
}
return
options
[
"VolumeId"
],
nil
}
return
""
,
nil
}
...
...
vendor/github.com/gogo/protobuf/proto/extensions.go
View file @
55188db2
...
...
@@ -527,6 +527,7 @@ func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) {
// SetExtension sets the specified extension of pb to the specified value.
func
SetExtension
(
pb
Message
,
extension
*
ExtensionDesc
,
value
interface
{})
error
{
if
epb
,
ok
:=
pb
.
(
extensionsBytes
);
ok
{
ClearExtension
(
pb
,
extension
)
newb
,
err
:=
encodeExtension
(
extension
,
value
)
if
err
!=
nil
{
return
err
...
...
vendor/github.com/gogo/protobuf/proto/extensions_gogo.go
View file @
55188db2
...
...
@@ -154,6 +154,10 @@ func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error)
return
EncodeExtensionMap
(
m
.
extensionsWrite
(),
data
)
}
func
EncodeInternalExtensionBackwards
(
m
extendableProto
,
data
[]
byte
)
(
n
int
,
err
error
)
{
return
EncodeExtensionMapBackwards
(
m
.
extensionsWrite
(),
data
)
}
func
EncodeExtensionMap
(
m
map
[
int32
]
Extension
,
data
[]
byte
)
(
n
int
,
err
error
)
{
o
:=
0
for
_
,
e
:=
range
m
{
...
...
@@ -169,6 +173,23 @@ func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) {
return
o
,
nil
}
func
EncodeExtensionMapBackwards
(
m
map
[
int32
]
Extension
,
data
[]
byte
)
(
n
int
,
err
error
)
{
o
:=
0
end
:=
len
(
data
)
for
_
,
e
:=
range
m
{
if
err
:=
e
.
Encode
();
err
!=
nil
{
return
0
,
err
}
n
:=
copy
(
data
[
end
-
len
(
e
.
enc
)
:
],
e
.
enc
)
if
n
!=
len
(
e
.
enc
)
{
return
0
,
io
.
ErrShortBuffer
}
end
-=
n
o
+=
n
}
return
o
,
nil
}
func
GetRawExtension
(
m
map
[
int32
]
Extension
,
id
int32
)
([]
byte
,
error
)
{
e
:=
m
[
id
]
if
err
:=
e
.
Encode
();
err
!=
nil
{
...
...
vendor/github.com/gogo/protobuf/proto/lib.go
View file @
55188db2
...
...
@@ -948,13 +948,19 @@ func isProto3Zero(v reflect.Value) bool {
return
false
}
// ProtoPackageIsVersion2 is referenced from generated protocol buffer files
// to assert that that code is compatible with this version of the proto package.
const
GoGoProtoPackageIsVersion2
=
true
// ProtoPackageIsVersion1 is referenced from generated protocol buffer files
// to assert that that code is compatible with this version of the proto package.
const
GoGoProtoPackageIsVersion1
=
true
const
(
// ProtoPackageIsVersion3 is referenced from generated protocol buffer files
// to assert that that code is compatible with this version of the proto package.
GoGoProtoPackageIsVersion3
=
true
// ProtoPackageIsVersion2 is referenced from generated protocol buffer files
// to assert that that code is compatible with this version of the proto package.
GoGoProtoPackageIsVersion2
=
true
// ProtoPackageIsVersion1 is referenced from generated protocol buffer files
// to assert that that code is compatible with this version of the proto package.
GoGoProtoPackageIsVersion1
=
true
)
// InternalMessageInfo is a type used internally by generated .pb.go files.
// This type is not intended to be used by non-generated code.
...
...
vendor/github.com/gogo/protobuf/proto/properties.go
View file @
55188db2
...
...
@@ -400,6 +400,15 @@ func GetProperties(t reflect.Type) *StructProperties {
return
sprop
}
type
(
oneofFuncsIface
interface
{
XXX_OneofFuncs
()
(
func
(
Message
,
*
Buffer
)
error
,
func
(
Message
,
int
,
int
,
*
Buffer
)
(
bool
,
error
),
func
(
Message
)
int
,
[]
interface
{})
}
oneofWrappersIface
interface
{
XXX_OneofWrappers
()
[]
interface
{}
}
)
// getPropertiesLocked requires that propertiesMu is held.
func
getPropertiesLocked
(
t
reflect
.
Type
)
*
StructProperties
{
if
prop
,
ok
:=
propertiesMap
[
t
];
ok
{
...
...
@@ -441,37 +450,40 @@ func getPropertiesLocked(t reflect.Type) *StructProperties {
// Re-order prop.order.
sort
.
Sort
(
prop
)
type
oneofMessage
interface
{
XXX_OneofFuncs
()
(
func
(
Message
,
*
Buffer
)
error
,
func
(
Message
,
int
,
int
,
*
Buffer
)
(
bool
,
error
),
func
(
Message
)
int
,
[]
interface
{})
}
if
om
,
ok
:=
reflect
.
Zero
(
reflect
.
PtrTo
(
t
))
.
Interface
()
.
(
oneofMessage
);
isOneofMessage
&&
ok
{
if
isOneofMessage
{
var
oots
[]
interface
{}
_
,
_
,
_
,
oots
=
om
.
XXX_OneofFuncs
()
// Interpret oneof metadata.
prop
.
OneofTypes
=
make
(
map
[
string
]
*
OneofProperties
)
for
_
,
oot
:=
range
oots
{
oop
:=
&
OneofProperties
{
Type
:
reflect
.
ValueOf
(
oot
)
.
Type
(),
// *T
Prop
:
new
(
Properties
),
}
sft
:=
oop
.
Type
.
Elem
()
.
Field
(
0
)
oop
.
Prop
.
Name
=
sft
.
Name
oop
.
Prop
.
Parse
(
sft
.
Tag
.
Get
(
"protobuf"
))
// There will be exactly one interface field that
// this new value is assignable to.
for
i
:=
0
;
i
<
t
.
NumField
();
i
++
{
f
:=
t
.
Field
(
i
)
if
f
.
Type
.
Kind
()
!=
reflect
.
Interface
{
continue
switch
m
:=
reflect
.
Zero
(
reflect
.
PtrTo
(
t
))
.
Interface
()
.
(
type
)
{
case
oneofFuncsIface
:
_
,
_
,
_
,
oots
=
m
.
XXX_OneofFuncs
()
case
oneofWrappersIface
:
oots
=
m
.
XXX_OneofWrappers
()
}
if
len
(
oots
)
>
0
{
// Interpret oneof metadata.
prop
.
OneofTypes
=
make
(
map
[
string
]
*
OneofProperties
)
for
_
,
oot
:=
range
oots
{
oop
:=
&
OneofProperties
{
Type
:
reflect
.
ValueOf
(
oot
)
.
Type
(),
// *T
Prop
:
new
(
Properties
),
}
if
!
oop
.
Type
.
AssignableTo
(
f
.
Type
)
{
continue
sft
:=
oop
.
Type
.
Elem
()
.
Field
(
0
)
oop
.
Prop
.
Name
=
sft
.
Name
oop
.
Prop
.
Parse
(
sft
.
Tag
.
Get
(
"protobuf"
))
// There will be exactly one interface field that
// this new value is assignable to.
for
i
:=
0
;
i
<
t
.
NumField
();
i
++
{
f
:=
t
.
Field
(
i
)
if
f
.
Type
.
Kind
()
!=
reflect
.
Interface
{
continue
}
if
!
oop
.
Type
.
AssignableTo
(
f
.
Type
)
{
continue
}
oop
.
Field
=
i
break
}
oop
.
Field
=
i
break
prop
.
OneofTypes
[
oop
.
Prop
.
OrigName
]
=
oop
}
prop
.
OneofTypes
[
oop
.
Prop
.
OrigName
]
=
oop
}
}
...
...
vendor/github.com/gogo/protobuf/proto/table_marshal.go
View file @
55188db2
...
...
@@ -389,8 +389,13 @@ func (u *marshalInfo) computeMarshalInfo() {
// get oneof implementers
var
oneofImplementers
[]
interface
{}
// gogo: isOneofMessage is needed for embedded oneof messages, without a marshaler and unmarshaler
if
m
,
ok
:=
reflect
.
Zero
(
reflect
.
PtrTo
(
t
))
.
Interface
()
.
(
oneofMessage
);
ok
&&
isOneofMessage
{
_
,
_
,
_
,
oneofImplementers
=
m
.
XXX_OneofFuncs
()
if
isOneofMessage
{
switch
m
:=
reflect
.
Zero
(
reflect
.
PtrTo
(
t
))
.
Interface
()
.
(
type
)
{
case
oneofFuncsIface
:
_
,
_
,
_
,
oneofImplementers
=
m
.
XXX_OneofFuncs
()
case
oneofWrappersIface
:
oneofImplementers
=
m
.
XXX_OneofWrappers
()
}
}
// normal fields
...
...
@@ -519,10 +524,6 @@ func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofI
}
}
type
oneofMessage
interface
{
XXX_OneofFuncs
()
(
func
(
Message
,
*
Buffer
)
error
,
func
(
Message
,
int
,
int
,
*
Buffer
)
(
bool
,
error
),
func
(
Message
)
int
,
[]
interface
{})
}
// wiretype returns the wire encoding of the type.
func
wiretype
(
encoding
string
)
uint64
{
switch
encoding
{
...
...
vendor/github.com/gogo/protobuf/proto/table_merge.go
View file @
55188db2
...
...
@@ -530,6 +530,25 @@ func (mi *mergeInfo) computeMergeInfo() {
}
case
reflect
.
Struct
:
switch
{
case
isSlice
&&
!
isPointer
:
// E.g. []pb.T
mergeInfo
:=
getMergeInfo
(
tf
)
zero
:=
reflect
.
Zero
(
tf
)
mfi
.
merge
=
func
(
dst
,
src
pointer
)
{
// TODO: Make this faster?
dstsp
:=
dst
.
asPointerTo
(
f
.
Type
)
dsts
:=
dstsp
.
Elem
()
srcs
:=
src
.
asPointerTo
(
f
.
Type
)
.
Elem
()
for
i
:=
0
;
i
<
srcs
.
Len
();
i
++
{
dsts
=
reflect
.
Append
(
dsts
,
zero
)
srcElement
:=
srcs
.
Index
(
i
)
.
Addr
()
dstElement
:=
dsts
.
Index
(
dsts
.
Len
()
-
1
)
.
Addr
()
mergeInfo
.
merge
(
valToPointer
(
dstElement
),
valToPointer
(
srcElement
))
}
if
dsts
.
IsNil
()
{
dsts
=
reflect
.
MakeSlice
(
f
.
Type
,
0
,
0
)
}
dstsp
.
Elem
()
.
Set
(
dsts
)
}
case
!
isPointer
:
mergeInfo
:=
getMergeInfo
(
tf
)
mfi
.
merge
=
func
(
dst
,
src
pointer
)
{
...
...
vendor/github.com/gogo/protobuf/proto/table_unmarshal.go
View file @
55188db2
...
...
@@ -371,15 +371,18 @@ func (u *unmarshalInfo) computeUnmarshalInfo() {
}
// Find any types associated with oneof fields.
// TODO: XXX_OneofFuncs returns more info than we need. Get rid of some of it?
fn
:=
reflect
.
Zero
(
reflect
.
PtrTo
(
t
))
.
MethodByName
(
"XXX_OneofFuncs"
)
// gogo: len(oneofFields) > 0 is needed for embedded oneof messages, without a marshaler and unmarshaler
if
fn
.
IsValid
()
&&
len
(
oneofFields
)
>
0
{
res
:=
fn
.
Call
(
nil
)[
3
]
// last return value from XXX_OneofFuncs: []interface{}
for
i
:=
res
.
Len
()
-
1
;
i
>=
0
;
i
--
{
v
:=
res
.
Index
(
i
)
// interface{}
tptr
:=
reflect
.
ValueOf
(
v
.
Interface
())
.
Type
()
// *Msg_X
typ
:=
tptr
.
Elem
()
// Msg_X
if
len
(
oneofFields
)
>
0
{
var
oneofImplementers
[]
interface
{}
switch
m
:=
reflect
.
Zero
(
reflect
.
PtrTo
(
t
))
.
Interface
()
.
(
type
)
{
case
oneofFuncsIface
:
_
,
_
,
_
,
oneofImplementers
=
m
.
XXX_OneofFuncs
()
case
oneofWrappersIface
:
oneofImplementers
=
m
.
XXX_OneofWrappers
()
}
for
_
,
v
:=
range
oneofImplementers
{
tptr
:=
reflect
.
TypeOf
(
v
)
// *Msg_X
typ
:=
tptr
.
Elem
()
// Msg_X
f
:=
typ
.
Field
(
0
)
// oneof implementers have one field
baseUnmarshal
:=
fieldUnmarshaler
(
&
f
)
...
...
@@ -407,11 +410,12 @@ func (u *unmarshalInfo) computeUnmarshalInfo() {
u
.
setTag
(
fieldNum
,
of
.
field
,
unmarshal
,
0
,
name
)
}
}
}
}
// Get extension ranges, if any.
fn
=
reflect
.
Zero
(
reflect
.
PtrTo
(
t
))
.
MethodByName
(
"ExtensionRangeArray"
)
fn
:
=
reflect
.
Zero
(
reflect
.
PtrTo
(
t
))
.
MethodByName
(
"ExtensionRangeArray"
)
if
fn
.
IsValid
()
{
if
!
u
.
extensions
.
IsValid
()
&&
!
u
.
oldExtensions
.
IsValid
()
&&
!
u
.
bytesExtensions
.
IsValid
()
{
panic
(
"a message with extensions, but no extensions field in "
+
t
.
Name
())
...
...
vendor/golang.org/x/sys/unix/ioctl.go
View file @
55188db2
...
...
@@ -6,7 +6,19 @@
package
unix
import
"runtime"
import
(
"runtime"
"unsafe"
)
// ioctl itself should not be exposed directly, but additional get/set
// functions for specific types are permissible.
// 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
{
return
ioctl
(
fd
,
req
,
uintptr
(
value
))
}
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
//
...
...
@@ -14,7 +26,7 @@ import "runtime"
func
IoctlSetWinsize
(
fd
int
,
req
uint
,
value
*
Winsize
)
error
{
// TODO: if we get the chance, remove the req parameter and
// hardcode TIOCSWINSZ.
err
:=
ioctl
SetWinsize
(
fd
,
req
,
value
)
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
))
)
runtime
.
KeepAlive
(
value
)
return
err
}
...
...
@@ -24,7 +36,30 @@ func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
// The req value will usually be TCSETA or TIOCSETA.
func
IoctlSetTermios
(
fd
int
,
req
uint
,
value
*
Termios
)
error
{
// TODO: if we get the chance, remove the req parameter.
err
:=
ioctl
SetTermios
(
fd
,
req
,
value
)
err
:=
ioctl
(
fd
,
req
,
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.
//
// A few ioctl requests use the return value as an output parameter;
// for those, IoctlRetInt should be used instead of this function.
func
IoctlGetInt
(
fd
int
,
req
uint
)
(
int
,
error
)
{
var
value
int
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
value
,
err
}
func
IoctlGetWinsize
(
fd
int
,
req
uint
)
(
*
Winsize
,
error
)
{
var
value
Winsize
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
IoctlGetTermios
(
fd
int
,
req
uint
)
(
*
Termios
,
error
)
{
var
value
Termios
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
vendor/golang.org/x/sys/unix/syscall_aix.go
View file @
55188db2
...
...
@@ -350,49 +350,12 @@ func (w WaitStatus) Signal() Signal {
func
(
w
WaitStatus
)
Continued
()
bool
{
return
w
&
0x01000000
!=
0
}
func
(
w
WaitStatus
)
CoreDump
()
bool
{
return
w
&
0x
200
!=
0
}
func
(
w
WaitStatus
)
CoreDump
()
bool
{
return
w
&
0x
80
==
0x8
0
}
func
(
w
WaitStatus
)
TrapCause
()
int
{
return
-
1
}
//sys ioctl(fd int, req uint, arg uintptr) (err error)
// ioctl itself should not be exposed directly, but additional get/set
// functions for specific types are permissible.
// 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
{
return
ioctl
(
fd
,
req
,
uintptr
(
value
))
}
func
ioctlSetWinsize
(
fd
int
,
req
uint
,
value
*
Winsize
)
error
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
func
ioctlSetTermios
(
fd
int
,
req
uint
,
value
*
Termios
)
error
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
// 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
)
{
var
value
int
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
value
,
err
}
func
IoctlGetWinsize
(
fd
int
,
req
uint
)
(
*
Winsize
,
error
)
{
var
value
Winsize
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
IoctlGetTermios
(
fd
int
,
req
uint
)
(
*
Termios
,
error
)
{
var
value
Termios
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
// fcntl must never be called with cmd=F_DUP2FD because it doesn't work on AIX
// There is no way to create a custom fcntl and to keep //sys fcntl easily,
// Therefore, the programmer must call dup2 instead of fcntl in this case.
...
...
vendor/golang.org/x/sys/unix/syscall_darwin.go
View file @
55188db2
...
...
@@ -339,43 +339,6 @@ func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(sig
//sys ioctl(fd int, req uint, arg uintptr) (err error)
// ioctl itself should not be exposed directly, but additional get/set
// functions for specific types are permissible.
// 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
{
return
ioctl
(
fd
,
req
,
uintptr
(
value
))
}
func
ioctlSetWinsize
(
fd
int
,
req
uint
,
value
*
Winsize
)
error
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
func
ioctlSetTermios
(
fd
int
,
req
uint
,
value
*
Termios
)
error
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
// 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
)
{
var
value
int
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
value
,
err
}
func
IoctlGetWinsize
(
fd
int
,
req
uint
)
(
*
Winsize
,
error
)
{
var
value
Winsize
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
IoctlGetTermios
(
fd
int
,
req
uint
)
(
*
Termios
,
error
)
{
var
value
Termios
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
Uname
(
uname
*
Utsname
)
error
{
mib
:=
[]
_C_int
{
CTL_KERN
,
KERN_OSTYPE
}
n
:=
unsafe
.
Sizeof
(
uname
.
Sysname
)
...
...
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
View file @
55188db2
...
...
@@ -150,43 +150,6 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
//sys ioctl(fd int, req uint, arg uintptr) (err error)
// ioctl itself should not be exposed directly, but additional get/set
// functions for specific types are permissible.
// 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
{
return
ioctl
(
fd
,
req
,
uintptr
(
value
))
}
func
ioctlSetWinsize
(
fd
int
,
req
uint
,
value
*
Winsize
)
error
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
func
ioctlSetTermios
(
fd
int
,
req
uint
,
value
*
Termios
)
error
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
// 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
)
{
var
value
int
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
value
,
err
}
func
IoctlGetWinsize
(
fd
int
,
req
uint
)
(
*
Winsize
,
error
)
{
var
value
Winsize
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
IoctlGetTermios
(
fd
int
,
req
uint
)
(
*
Termios
,
error
)
{
var
value
Termios
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
sysctlUname
(
mib
[]
_C_int
,
old
*
byte
,
oldlen
*
uintptr
)
error
{
err
:=
sysctl
(
mib
,
old
,
oldlen
,
nil
,
0
)
if
err
!=
nil
{
...
...
vendor/golang.org/x/sys/unix/syscall_freebsd.go
View file @
55188db2
...
...
@@ -201,43 +201,6 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
//sys ioctl(fd int, req uint, arg uintptr) (err error)
// ioctl itself should not be exposed directly, but additional get/set
// functions for specific types are permissible.
// 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
{
return
ioctl
(
fd
,
req
,
uintptr
(
value
))
}
func
ioctlSetWinsize
(
fd
int
,
req
uint
,
value
*
Winsize
)
error
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
func
ioctlSetTermios
(
fd
int
,
req
uint
,
value
*
Termios
)
error
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
// 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
)
{
var
value
int
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
value
,
err
}
func
IoctlGetWinsize
(
fd
int
,
req
uint
)
(
*
Winsize
,
error
)
{
var
value
Winsize
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
IoctlGetTermios
(
fd
int
,
req
uint
)
(
*
Termios
,
error
)
{
var
value
Termios
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
Uname
(
uname
*
Utsname
)
error
{
mib
:=
[]
_C_int
{
CTL_KERN
,
KERN_OSTYPE
}
n
:=
unsafe
.
Sizeof
(
uname
.
Sysname
)
...
...
vendor/golang.org/x/sys/unix/syscall_linux.go
View file @
55188db2
...
...
@@ -71,6 +71,17 @@ 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.
// IoctlRetInt performs an ioctl operation specified by req on a device
// associated with opened file descriptor fd, and returns a non-negative
// integer that is returned by the ioctl syscall.
func
IoctlRetInt
(
fd
int
,
req
uint
)
(
int
,
error
)
{
ret
,
_
,
err
:=
Syscall
(
SYS_IOCTL
,
uintptr
(
fd
),
uintptr
(
req
),
0
)
if
err
!=
0
{
return
0
,
err
}
return
int
(
ret
),
nil
}
// 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
...
...
@@ -80,52 +91,18 @@ func IoctlSetPointerInt(fd int, req uint, value int) error {
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
{
return
ioctl
(
fd
,
req
,
uintptr
(
value
))
}
func
ioctlSetWinsize
(
fd
int
,
req
uint
,
value
*
Winsize
)
error
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
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
)
{
var
value
int
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
value
,
err
}
func
IoctlGetUint32
(
fd
int
,
req
uint
)
(
uint32
,
error
)
{
var
value
uint32
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
value
,
err
}
func
IoctlGetWinsize
(
fd
int
,
req
uint
)
(
*
Winsize
,
error
)
{
var
value
Winsize
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
IoctlGetTermios
(
fd
int
,
req
uint
)
(
*
Termios
,
error
)
{
var
value
Termios
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
IoctlGetRTCTime
(
fd
int
)
(
*
RTCTime
,
error
)
{
var
value
RTCTime
err
:=
ioctl
(
fd
,
RTC_RD_TIME
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
...
...
vendor/golang.org/x/sys/unix/syscall_netbsd.go
View file @
55188db2
...
...
@@ -187,43 +187,6 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
//sys ioctl(fd int, req uint, arg uintptr) (err error)
// ioctl itself should not be exposed directly, but additional get/set
// functions for specific types are permissible.
// 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
{
return
ioctl
(
fd
,
req
,
uintptr
(
value
))
}
func
ioctlSetWinsize
(
fd
int
,
req
uint
,
value
*
Winsize
)
error
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
func
ioctlSetTermios
(
fd
int
,
req
uint
,
value
*
Termios
)
error
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
// 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
)
{
var
value
int
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
value
,
err
}
func
IoctlGetWinsize
(
fd
int
,
req
uint
)
(
*
Winsize
,
error
)
{
var
value
Winsize
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
IoctlGetTermios
(
fd
int
,
req
uint
)
(
*
Termios
,
error
)
{
var
value
Termios
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
IoctlGetPtmget
(
fd
int
,
req
uint
)
(
*
Ptmget
,
error
)
{
var
value
Ptmget
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
...
...
vendor/golang.org/x/sys/unix/syscall_openbsd.go
View file @
55188db2
...
...
@@ -178,43 +178,6 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
//sys ioctl(fd int, req uint, arg uintptr) (err error)
// ioctl itself should not be exposed directly, but additional get/set
// functions for specific types are permissible.
// 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
{
return
ioctl
(
fd
,
req
,
uintptr
(
value
))
}
func
ioctlSetWinsize
(
fd
int
,
req
uint
,
value
*
Winsize
)
error
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
func
ioctlSetTermios
(
fd
int
,
req
uint
,
value
*
Termios
)
error
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
// 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
)
{
var
value
int
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
value
,
err
}
func
IoctlGetWinsize
(
fd
int
,
req
uint
)
(
*
Winsize
,
error
)
{
var
value
Winsize
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
IoctlGetTermios
(
fd
int
,
req
uint
)
(
*
Termios
,
error
)
{
var
value
Termios
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
func
Ppoll
(
fds
[]
PollFd
,
timeout
*
Timespec
,
sigmask
*
Sigset_t
)
(
n
int
,
err
error
)
{
...
...
vendor/golang.org/x/sys/unix/syscall_solaris.go
View file @
55188db2
...
...
@@ -553,40 +553,10 @@ func Minor(dev uint64) uint32 {
//sys ioctl(fd int, req uint, arg uintptr) (err error)
func
IoctlSetInt
(
fd
int
,
req
uint
,
value
int
)
(
err
error
)
{
return
ioctl
(
fd
,
req
,
uintptr
(
value
))
}
func
ioctlSetWinsize
(
fd
int
,
req
uint
,
value
*
Winsize
)
(
err
error
)
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
func
ioctlSetTermios
(
fd
int
,
req
uint
,
value
*
Termios
)
(
err
error
)
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
func
IoctlSetTermio
(
fd
int
,
req
uint
,
value
*
Termio
)
(
err
error
)
{
return
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
value
)))
}
func
IoctlGetInt
(
fd
int
,
req
uint
)
(
int
,
error
)
{
var
value
int
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
value
,
err
}
func
IoctlGetWinsize
(
fd
int
,
req
uint
)
(
*
Winsize
,
error
)
{
var
value
Winsize
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
IoctlGetTermios
(
fd
int
,
req
uint
)
(
*
Termios
,
error
)
{
var
value
Termios
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
return
&
value
,
err
}
func
IoctlGetTermio
(
fd
int
,
req
uint
)
(
*
Termio
,
error
)
{
var
value
Termio
err
:=
ioctl
(
fd
,
req
,
uintptr
(
unsafe
.
Pointer
(
&
value
)))
...
...
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
View file @
55188db2
...
...
@@ -1408,6 +1408,10 @@ const (
NLM_F_ROOT
=
0x100
NOFLSH
=
0x80
NSFS_MAGIC
=
0x6e736673
NS_GET_NSTYPE
=
0xb703
NS_GET_OWNER_UID
=
0xb704
NS_GET_PARENT
=
0xb702
NS_GET_USERNS
=
0xb701
OCFS2_SUPER_MAGIC
=
0x7461636f
OCRNL
=
0x8
OFDEL
=
0x80
...
...
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
View file @
55188db2
...
...
@@ -1408,6 +1408,10 @@ const (
NLM_F_ROOT
=
0x100
NOFLSH
=
0x80
NSFS_MAGIC
=
0x6e736673
NS_GET_NSTYPE
=
0xb703
NS_GET_OWNER_UID
=
0xb704
NS_GET_PARENT
=
0xb702
NS_GET_USERNS
=
0xb701
OCFS2_SUPER_MAGIC
=
0x7461636f
OCRNL
=
0x8
OFDEL
=
0x80
...
...
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
View file @
55188db2
...
...
@@ -1406,6 +1406,10 @@ const (
NLM_F_ROOT
=
0x100
NOFLSH
=
0x80
NSFS_MAGIC
=
0x6e736673
NS_GET_NSTYPE
=
0xb703
NS_GET_OWNER_UID
=
0xb704
NS_GET_PARENT
=
0xb702
NS_GET_USERNS
=
0xb701
OCFS2_SUPER_MAGIC
=
0x7461636f
OCRNL
=
0x8
OFDEL
=
0x80
...
...
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
View file @
55188db2
...
...
@@ -1409,6 +1409,10 @@ const (
NLM_F_ROOT
=
0x100
NOFLSH
=
0x80
NSFS_MAGIC
=
0x6e736673
NS_GET_NSTYPE
=
0xb703
NS_GET_OWNER_UID
=
0xb704
NS_GET_PARENT
=
0xb702
NS_GET_USERNS
=
0xb701
OCFS2_SUPER_MAGIC
=
0x7461636f
OCRNL
=
0x8
OFDEL
=
0x80
...
...
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
View file @
55188db2
...
...
@@ -1406,6 +1406,10 @@ const (
NLM_F_ROOT
=
0x100
NOFLSH
=
0x80
NSFS_MAGIC
=
0x6e736673
NS_GET_NSTYPE
=
0x2000b703
NS_GET_OWNER_UID
=
0x2000b704
NS_GET_PARENT
=
0x2000b702
NS_GET_USERNS
=
0x2000b701
OCFS2_SUPER_MAGIC
=
0x7461636f
OCRNL
=
0x8
OFDEL
=
0x80
...
...
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
View file @
55188db2
...
...
@@ -1406,6 +1406,10 @@ const (
NLM_F_ROOT
=
0x100
NOFLSH
=
0x80
NSFS_MAGIC
=
0x6e736673
NS_GET_NSTYPE
=
0x2000b703
NS_GET_OWNER_UID
=
0x2000b704
NS_GET_PARENT
=
0x2000b702
NS_GET_USERNS
=
0x2000b701
OCFS2_SUPER_MAGIC
=
0x7461636f
OCRNL
=
0x8
OFDEL
=
0x80
...
...
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
View file @
55188db2
...
...
@@ -1406,6 +1406,10 @@ const (
NLM_F_ROOT
=
0x100
NOFLSH
=
0x80
NSFS_MAGIC
=
0x6e736673
NS_GET_NSTYPE
=
0x2000b703
NS_GET_OWNER_UID
=
0x2000b704
NS_GET_PARENT
=
0x2000b702
NS_GET_USERNS
=
0x2000b701
OCFS2_SUPER_MAGIC
=
0x7461636f
OCRNL
=
0x8
OFDEL
=
0x80
...
...
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
View file @
55188db2
...
...
@@ -1406,6 +1406,10 @@ const (
NLM_F_ROOT
=
0x100
NOFLSH
=
0x80
NSFS_MAGIC
=
0x6e736673
NS_GET_NSTYPE
=
0x2000b703
NS_GET_OWNER_UID
=
0x2000b704
NS_GET_PARENT
=
0x2000b702
NS_GET_USERNS
=
0x2000b701
OCFS2_SUPER_MAGIC
=
0x7461636f
OCRNL
=
0x8
OFDEL
=
0x80
...
...
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
View file @
55188db2
...
...
@@ -1407,6 +1407,10 @@ const (
NLM_F_ROOT
=
0x100
NOFLSH
=
0x80000000
NSFS_MAGIC
=
0x6e736673
NS_GET_NSTYPE
=
0x2000b703
NS_GET_OWNER_UID
=
0x2000b704
NS_GET_PARENT
=
0x2000b702
NS_GET_USERNS
=
0x2000b701
OCFS2_SUPER_MAGIC
=
0x7461636f
OCRNL
=
0x8
OFDEL
=
0x80
...
...
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
View file @
55188db2
...
...
@@ -1407,6 +1407,10 @@ const (
NLM_F_ROOT
=
0x100
NOFLSH
=
0x80000000
NSFS_MAGIC
=
0x6e736673
NS_GET_NSTYPE
=
0x2000b703
NS_GET_OWNER_UID
=
0x2000b704
NS_GET_PARENT
=
0x2000b702
NS_GET_USERNS
=
0x2000b701
OCFS2_SUPER_MAGIC
=
0x7461636f
OCRNL
=
0x8
OFDEL
=
0x80
...
...
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
View file @
55188db2
...
...
@@ -1406,6 +1406,10 @@ const (
NLM_F_ROOT
=
0x100
NOFLSH
=
0x80
NSFS_MAGIC
=
0x6e736673
NS_GET_NSTYPE
=
0xb703
NS_GET_OWNER_UID
=
0xb704
NS_GET_PARENT
=
0xb702
NS_GET_USERNS
=
0xb701
OCFS2_SUPER_MAGIC
=
0x7461636f
OCRNL
=
0x8
OFDEL
=
0x80
...
...
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
View file @
55188db2
...
...
@@ -1406,6 +1406,10 @@ const (
NLM_F_ROOT
=
0x100
NOFLSH
=
0x80
NSFS_MAGIC
=
0x6e736673
NS_GET_NSTYPE
=
0xb703
NS_GET_OWNER_UID
=
0xb704
NS_GET_PARENT
=
0xb702
NS_GET_USERNS
=
0xb701
OCFS2_SUPER_MAGIC
=
0x7461636f
OCRNL
=
0x8
OFDEL
=
0x80
...
...
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
View file @
55188db2
...
...
@@ -1410,6 +1410,10 @@ const (
NLM_F_ROOT
=
0x100
NOFLSH
=
0x80
NSFS_MAGIC
=
0x6e736673
NS_GET_NSTYPE
=
0x2000b703
NS_GET_OWNER_UID
=
0x2000b704
NS_GET_PARENT
=
0x2000b702
NS_GET_USERNS
=
0x2000b701
OCFS2_SUPER_MAGIC
=
0x7461636f
OCRNL
=
0x8
OFDEL
=
0x80
...
...
vendor/golang.org/x/sys/windows/security_windows.go
View file @
55188db2
...
...
@@ -666,7 +666,7 @@ func OpenCurrentProcessToken() (Token, error) {
return
0
,
e
}
var
t
Token
e
=
OpenProcessToken
(
p
,
TOKEN_QUERY
,
&
t
)
e
=
OpenProcessToken
(
p
,
TOKEN_QUERY
|
TOKEN_DUPLICATE
,
&
t
)
if
e
!=
nil
{
return
0
,
e
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment