Created
June 12, 2020 21:55
-
-
Save alexcrichton/98c260bb94482fc34de2396f6008192f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// #include <assert.h> | |
// #include <signal.h> | |
// #include <sys/mman.h> | |
// | |
// #define ALT_STACK_SIZE (16 * 4096) | |
// | |
// void my_run() { | |
// void *stack = mmap(NULL, ALT_STACK_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); | |
// assert(stack != MAP_FAILED); | |
// | |
// stack_t new_stack; | |
// new_stack.ss_sp = stack; | |
// new_stack.ss_flags = 0; | |
// new_stack.ss_size = ALT_STACK_SIZE; | |
// int r = sigaltstack(&new_stack, NULL); | |
// assert(r == 0); | |
// } | |
import "C" | |
import "runtime" | |
func main() { | |
C.my_run() | |
runtime.GC() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment