Subject: getrlimit() bogus results
To: netbsd-macppc <port-macppc@NetBSD.ORG>
From: Riccardo Mottola <rollei@tiscalinet.it>
List: port-macppc
Date: 05/25/2004 22:34:43
Hello,

on netbsd 2-0 I have problem detecting the stack limit.  The program
attached at bottom returns a bogus result:
cur=0  max=0
infinity=1

while "limit" shows
stacksize       2048 kbytes

Interestingly enough, running the program on NetBSD 1.6.2 on sparc,
works fine.
So I wonder if it is a 2-0 problem, a ppc problem or both. In case maybe
I should send a PR, but I prefered asking here first.

-Riccardo

--- limit test program ---
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#include <errno.h>

int main(int argc, char **argv)
{
        struct rlimit rlim;

        if (getrlimit(RLIMIT_STACK, &rlim) < 0)
                perror("getrlimit");

        printf("cur=%d  max=%d\n", rlim.rlim_cur, rlim.rlim_max);
        printf("infinity=%d\n", RLIM_INFINITY);

        return 0;
}