set_limit.c
changeset 3 820ed7fb9314
child 8 96d16dfe787a
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 <sys/time.h>
+#include <sys/resource.h>
+
+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;
+}