set_limit.c
changeset 51 a03372ef9714
parent 9 c3fecc82ade6
child 60 47c13ca8c4d0
equal deleted inserted replaced
50:a38f102556e5 51:a03372ef9714
     8 
     8 
     9 int set_limit (int megs)
     9 int set_limit (int megs)
    10 {
    10 {
    11     struct rlimit rlim;
    11     struct rlimit rlim;
    12 
    12 
       
    13     megs *= 1024 * 1024;
       
    14 
    13     rlim.rlim_cur = megs;
    15     rlim.rlim_cur = megs;
    14     rlim.rlim_max = 1.25 * megs;
    16     rlim.rlim_max = 1.25 * megs;
    15     if (megs > (4 * 1024 * 1024))
    17     if (megs > (4 * 1024 * 1024))
    16         return setrlimit (RLIMIT_AS, &rlim);
    18         return setrlimit (RLIMIT_AS, &rlim);
    17 
    19