/*-------------------------------------------------------------------*/ /* testsetrlimit.c */ /* The setrlimit system call. */ /*-------------------------------------------------------------------*/ #include #include #include int main(int argc, char *argv[]) { struct rlimit sRlimit; /* Set the process's CPU limit. */ sRlimit.rlim_cur = 5; sRlimit.rlim_max = 5; setrlimit(RLIMIT_CPU, &sRlimit); printf("Entering an infinite loop\n"); fflush(stdout); for (;;) ; return 0; } /**************** Sample execution ****************/ /* $ gcc217 testsetrlimit.c -o testsetrlimit $ ./testsetrlimit Entering an infinite loop Killed */