Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Created June 12, 2020 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexcrichton/98c260bb94482fc34de2396f6008192f to your computer and use it in GitHub Desktop.
Save alexcrichton/98c260bb94482fc34de2396f6008192f to your computer and use it in GitHub Desktop.
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