aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-execprog/execprog_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'tools/syz-execprog/execprog_linux.go')
-rw-r--r--tools/syz-execprog/execprog_linux.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/syz-execprog/execprog_linux.go b/tools/syz-execprog/execprog_linux.go
new file mode 100644
index 000000000..01e74cec5
--- /dev/null
+++ b/tools/syz-execprog/execprog_linux.go
@@ -0,0 +1,23 @@
+// Copyright 2017 syzkaller project authors. All rights reserved.
+// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+
+package main
+
+import (
+ "os"
+ "os/signal"
+ "sync/atomic"
+ "syscall"
+
+ "github.com/google/syzkaller/pkg/log"
+)
+
+func handleInterrupt(shutdown *uint32) {
+ c := make(chan os.Signal, 2)
+ signal.Notify(c, syscall.SIGINT)
+ <-c
+ log.Logf(0, "shutting down...")
+ atomic.StoreUint32(shutdown, 1)
+ <-c
+ log.Fatalf("terminating")
+}