Subject : Process Resource Limit

Desccription :

´ÙÀ½Àº Process Resource limit¸¦ º¯°æÇÏ´Â Program Source¸¦ ±â¼úÇÏ¿´´Ù.
¿øÇÏ´Â ´ë·Î ¼öÁ¤ÇÏ¿© »ç¿ëÇϽÿÀ.
¾Æ·¡ÀÇ ¿¹´Â file descripter limit¸¦ ¼öÁ¤ÇÏ´Â ¹æ¹ýÀ» ±â¼úÇÏ¿´´Ù.

# vi test-limit
   ...
#include 
#include 
#include 

main (argc, argv)
int     argc;
char     **argv;
{
     struct rlimit     rl;
          
     if (argc < 3) {
 fprintf (stderr, "Usage: %s soft_limit hard_limit prog [args...]\n", argv[0]);
          exit (1);
     }

     rl.rlim_cur = atoi (argv[1]);   /* soft limit */
     rl.rlim_max = atoi (argv[2]);   /* hard limit */

     if (setrlimit (RLIMIT_CPU, &rl) == -1) {
          perror ("setrlimit");
  exit (1);
     }

     argv+=3; argc-=3;

     execvp (argv[0], argv);

     perror ("exec");

     exit (1);
}

...

# cc -o test-limit test-limit.c 
# test-limit 64 128 csh  <--- Process
             ^   ^
             |   |
   -----------   -----------
    soft limit    hard limit

À§ÀÇ ¿¹´Â file descripter¸¦ ¿¹¸¦ µé¾ú´Ù.
/usr/include/sys/resource.h fileÀ» º¸¸é

 RLIMIT_CPU                     /* cpu time in milliseconds */
 RLIMIT_FSIZE                   /* maximum file size */
 RLIMIT_DATA                    /* data size */
 RLIMIT_STACK                   /* stack size */
 RLIMIT_CORE                    /* core file size */
 RLIMIT_NOFILE                  /* file descriptors */
 RLIMIT_VMEM                    /* maximum mapped memory */

Revision History

ÀÛ¼ºÀÏÀÚ : 96.11.13
ÀÛ¼ºÀÚ : À̹ÎÈ£
¼öÁ¤ÀÏÀÚ :
¼öÁ¤ÀÚ :