set_limit.c
changeset 3 820ed7fb9314
child 8 96d16dfe787a
equal deleted inserted replaced
2:97beb75e5ac7 3:820ed7fb9314
       
     1 /**
       
     2  * $Id: set_limit.c,v 1.1.1.1 2008-04-28 17:32:53 mbroeker Exp $
       
     3  * $Source: /development/c/mem2swap/set_limit.c,v $
       
     4  *
       
     5  */
       
     6 
       
     7 #include <sys/time.h>
       
     8 #include <sys/resource.h>
       
     9 
       
    10 int set_limit (int megs)
       
    11 {
       
    12     struct rlimit rlim;
       
    13 
       
    14     rlim.rlim_cur = megs;
       
    15     rlim.rlim_max = 1.25 * megs;
       
    16     if (megs > (4 * 1024 * 1024))
       
    17         return setrlimit (RLIMIT_AS, &rlim);
       
    18     return -1;
       
    19 }