aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ipc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-04-30 13:41:36 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-05-02 16:24:59 +0000
commitcf02e61c441d38e1eea04df5168aab7aee13f88f (patch)
tree2dbd664d34e068d7ae9d362748278a25905b2e83 /pkg/ipc
parent3ba885bcb66dec1678d8842ddeb6805786d32a3f (diff)
pkg/ipc: consistently set ENOSYS for non-executed syscalls
Currently we set errno=999 in executor for non-finished syscalls, but syscalls that were not even started still have errno=0. They also don't have Executed flag, but it's still handy to have a non-0 errno when the call is not successful.
Diffstat (limited to 'pkg/ipc')
-rw-r--r--pkg/ipc/ipc.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/ipc/ipc.go b/pkg/ipc/ipc.go
index 818c88a84..6185a6181 100644
--- a/pkg/ipc/ipc.go
+++ b/pkg/ipc/ipc.go
@@ -12,6 +12,7 @@ import (
"slices"
"strings"
"sync"
+ "syscall"
"time"
"unsafe"
@@ -382,6 +383,12 @@ func (env *Env) parseOutput(opts *ExecOpts, ncalls int) (*ProgInfo, error) {
return nil, fmt.Errorf("failed to read number of calls")
}
info := &ProgInfo{Calls: make([]CallInfo, ncalls)}
+ for i := range info.Calls {
+ // 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.
+ info.Calls[i].Errno = int(syscall.ENOSYS)
+ }
extraParts := make([]CallInfo, 0)
for i := uint32(0); i < ncmd; i++ {
if len(out) < int(unsafe.Sizeof(callReply{})) {