From f8f67d67d3daa783c2bb7c9993c0ccb637af1a0e Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 22 Dec 2020 12:01:52 +0100 Subject: executor: remove hardcoded timeouts In preparation for making timeouts tunable based on OS/arch/VM/etc de-hardcode all (almost) timeouts in executor. --- pkg/csource/csource.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pkg/csource/csource.go') diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go index 49babbf41..b53b3b97f 100644 --- a/pkg/csource/csource.go +++ b/pkg/csource/csource.go @@ -93,13 +93,14 @@ func Write(p *prog.Prog, opts Options) ([]byte, error) { replacements["SANDBOX_FUNC"] = replacements["SYSCALLS"] replacements["SYSCALLS"] = "unused" } + replacements["PROGRAM_TIMEOUT_MS"] = "5000" timeoutExpr := "45" for i, call := range p.Calls { if timeout := call.Meta.Attrs.Timeout; timeout != 0 { timeoutExpr += fmt.Sprintf(" + (call == %d ? %d : 0)", i, timeout) } } - replacements["CALL_TIMEOUT"] = timeoutExpr + replacements["CALL_TIMEOUT_MS"] = timeoutExpr result, err := createCommonHeader(p, mmapProg, replacements, opts) if err != nil { return nil, err -- cgit mrf-deployment