#include #include #include static void show_stack(void) { FILE *map; char buf[1000]; map = fopen("/proc/self/maps", "r"); if (!map) return; while (fgets(buf, 1000, map)) { if (!strstr(buf, "[stack]")) continue; fputs(buf, stdout); } fclose(map); } int main(void) { show_stack(); mlockall(MCL_CURRENT | MCL_FUTURE); show_stack(); return 0; }