resource limits does not work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux