#include #include #include #include #include int main(int argc, char **argv) { struct rlimit r; char ch; printf("pid %jd\n", (intmax_t)getpid()); if (getrlimit(RLIMIT_STACK, &r) == -1) err(1, "getrlimit"); printf("cur %jd\n", (uintmax_t)r.rlim_cur); printf("max %jd\n", (uintmax_t)r.rlim_max); fflush(stdout); if (ferror(stdout)) err(1, "stdout"); read(STDIN_FILENO, &ch, 1); r.rlim_cur = 128*128; if (setrlimit(RLIMIT_STACK, &r) == -1) err(1, "setrlimit"); return 0; }