From 1d3c25e7679384c386e7710ea11e364ce9f9e028 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 17 May 2024 17:20:45 +0200 Subject: pkg/ipc: remove ProgInfo Switch to flatrpc.ProgInfo. Note: this disables syz-runtest and syz-verifier. --- pkg/flatrpc/helpers.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'pkg/flatrpc') 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 +} -- cgit mrf-deployment