resource limits does not work?

From: Lukasz Stelmach
Date: Fri Sep 16 2005 - 03:42:35 EST


Greetings All.

Is there anything you think I should know about setrlimit that is not
mentioned in setrlimit(2) manual that makes the malloc(3) succeed
in the code below? It fails when r.rlim_cur is less than 137840.

#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>

int main(int ac, char* av[]) {
struct rlimit r;
r.rlim_cur = 137840;
r.rlim_max = RLIM_INFINITY;
setrlimit(RLIMIT_DATA, &r);

char* a=malloc(6000000);
perror("malloc");
return 0;
}

What is more interesting is that dnscache from djbdnspackage succeeds to start
up with rlim_cur to be 0.

$ uname -a
Linux vlana 2.6.11 #1 SMP Fri Mar 4 17:35:07 CET 2005 i686 unknown unknown GNU/Linux

cheers.
PS. please CC, not a subscriber.
--
MiÅego dnia
>Åukasz<
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/