diff --git a/set_limit.c b/set_limit.c new file mode 100644 --- /dev/null +++ b/set_limit.c @@ -0,0 +1,19 @@ +/** + * $Id: set_limit.c,v 1.1.1.1 2008-04-28 17:32:53 mbroeker Exp $ + * $Source: /development/c/mem2swap/set_limit.c,v $ + * + */ + +#include +#include + +int set_limit (int megs) +{ + struct rlimit rlim; + + rlim.rlim_cur = megs; + rlim.rlim_max = 1.25 * megs; + if (megs > (4 * 1024 * 1024)) + return setrlimit (RLIMIT_AS, &rlim); + return -1; +}