aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/flatrpc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-05-17 17:20:45 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-05-21 09:46:36 +0000
commit1d3c25e7679384c386e7710ea11e364ce9f9e028 (patch)
treec154a9578f63037babef096e85fe9a34183ee640 /pkg/flatrpc
parenta38fb99b3fbff0c988e64bf4bf277071e18b18af (diff)
pkg/ipc: remove ProgInfo
Switch to flatrpc.ProgInfo. Note: this disables syz-runtest and syz-verifier.
Diffstat (limited to 'pkg/flatrpc')
-rw-r--r--pkg/flatrpc/helpers.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/pkg/flatrpc/helpers.go b/pkg/flatrpc/helpers.go
index 92e583400..843b281d3 100644
--- a/pkg/flatrpc/helpers.go
+++ b/pkg/flatrpc/helpers.go
@@ -3,6 +3,11 @@
package flatrpc
+import (
+ "slices"
+ "syscall"
+)
+
const AllFeatures = ^Feature(0)
// Flatbuffers compiler adds T suffix to object API types, which are actual structs representing types.
@@ -26,3 +31,40 @@ type CallInfo = CallInfoRawT
type Comparison = ComparisonRawT
type ProgInfo = ProgInfoRawT
type ExecResult = ExecResultRawT
+
+func (pi *ProgInfo) Clone() *ProgInfo {
+ if pi == nil {
+ return nil
+ }
+ ret := *pi
+ ret.Extra = ret.Extra.clone()
+ ret.Calls = make([]*CallInfo, len(pi.Calls))
+ for i, call := range pi.Calls {
+ ret.Calls[i] = call.clone()
+ }
+ return &ret
+}
+
+func (ci *CallInfo) clone() *CallInfo {
+ if ci == nil {
+ return nil
+ }
+ ret := *ci
+ ret.Signal = slices.Clone(ret.Signal)
+ ret.Cover = slices.Clone(ret.Cover)
+ ret.Comps = slices.Clone(ret.Comps)
+ return &ret
+}
+
+func EmptyProgInfo(calls int) *ProgInfo {
+ info := &ProgInfo{}
+ for i := 0; i < calls; i++ {
+ info.Calls = append(info.Calls, &CallInfo{
+ // Store some unsuccessful errno in the case we won't get any result.
+ // It also won't have CallExecuted flag, but it's handy to make it
+ // look failed based on errno as well.
+ Error: int32(syscall.ENOSYS),
+ })
+ }
+ return info
+}