Build and install from GOPATH
* Rename 'vendor/src' -> 'vendor' * Ignore vendor/ instead of vendor/src/ for lint * Rename 'cmd/client' -> 'cmd/ocic' to make it 'go install'able * Rename 'cmd/server' -> 'cmd/ocid' to make it 'go install'able * Update Makefile to build and install from GOPATH * Update tests to locate ocid/ocic in GOPATH/bin * Search for binaries in GOPATH/bin instead of PATH * Install tools using `go get -u`, so they are updated on each run Signed-off-by: Jonathan Yu <jawnsy@redhat.com>
This commit is contained in:
parent
9da2882d49
commit
6c9628cdb1
1111 changed files with 70 additions and 61 deletions
73
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/parse_arguments.go
generated
vendored
Normal file
73
vendor/github.com/opencontainers/runtime-tools/generate/seccomp/parse_arguments.go
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
package seccomp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
rspec "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
||||
|
||||
// parseArguments takes a list of arguments (delimArgs). It parses and fills out
|
||||
// the argument information and returns a slice of arg structs
|
||||
func parseArguments(delimArgs []string) ([]rspec.Arg, error) {
|
||||
nilArgSlice := []rspec.Arg{}
|
||||
numberOfArgs := len(delimArgs)
|
||||
|
||||
// No parameters passed with syscall
|
||||
if numberOfArgs == 1 {
|
||||
return nilArgSlice, nil
|
||||
}
|
||||
|
||||
// Correct number of parameters passed with syscall
|
||||
if numberOfArgs == 5 {
|
||||
syscallIndex, err := strconv.ParseUint(delimArgs[1], 10, 0)
|
||||
if err != nil {
|
||||
return nilArgSlice, err
|
||||
}
|
||||
|
||||
syscallValue, err := strconv.ParseUint(delimArgs[2], 10, 64)
|
||||
if err != nil {
|
||||
return nilArgSlice, err
|
||||
}
|
||||
|
||||
syscallValueTwo, err := strconv.ParseUint(delimArgs[3], 10, 64)
|
||||
if err != nil {
|
||||
return nilArgSlice, err
|
||||
}
|
||||
|
||||
syscallOp, err := parseOperator(delimArgs[4])
|
||||
if err != nil {
|
||||
return nilArgSlice, err
|
||||
}
|
||||
|
||||
argStruct := rspec.Arg{
|
||||
Index: uint(syscallIndex),
|
||||
Value: syscallValue,
|
||||
ValueTwo: syscallValueTwo,
|
||||
Op: syscallOp,
|
||||
}
|
||||
|
||||
argSlice := []rspec.Arg{}
|
||||
argSlice = append(argSlice, argStruct)
|
||||
return argSlice, nil
|
||||
}
|
||||
|
||||
return nilArgSlice, fmt.Errorf("incorrect number of arguments passed with syscall: %d", numberOfArgs)
|
||||
}
|
||||
|
||||
func parseOperator(operator string) (rspec.Operator, error) {
|
||||
operators := map[string]rspec.Operator{
|
||||
"NE": rspec.OpNotEqual,
|
||||
"LT": rspec.OpLessThan,
|
||||
"LE": rspec.OpLessEqual,
|
||||
"EQ": rspec.OpEqualTo,
|
||||
"GE": rspec.OpGreaterEqual,
|
||||
"GT": rspec.OpGreaterThan,
|
||||
"ME": rspec.OpMaskedEqual,
|
||||
}
|
||||
o, ok := operators[operator]
|
||||
if !ok {
|
||||
return "", fmt.Errorf("unrecognized operator: %s", operator)
|
||||
}
|
||||
return o, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue