forked from kata-containers/agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpause.go
More file actions
39 lines (31 loc) · 684 Bytes
/
pause.go
File metadata and controls
39 lines (31 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// Copyright (c) 2017 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
package main
/*
#cgo CFLAGS: -Wall
#define _GNU_SOURCE
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define PAUSE_BIN_KEY "pause-bin-key"
#define PAUSE_BIN_VALUE "pause-bin-value"
void __attribute__((constructor)) sandbox_pause() {
char *value = getenv(PAUSE_BIN_KEY);
if (value == NULL || strcmp(value, PAUSE_BIN_VALUE)) {
return;
}
for (;;) pause();
fprintf(stderr, "error: infinite loop terminated\n");
exit(42);
}
*/
import "C"
const (
pauseBinKey = string(C.PAUSE_BIN_KEY)
pauseBinValue = string(C.PAUSE_BIN_VALUE)
)