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

Re: getrlimit( RLIMIT_STACK, ... )



What you wrote:
> Seems like you are on the wrong track. The kernel does not know
> anything about _stksize :-( (It does not even load the symbol tables)

I realized that this morning; I was reading the MiNTlibs startup code,
not the MiNT kernel code.

> The global variable _stksize is just a feature of the MiNT Libs to
> determine the size of the stack a program initialization. Also it is
> quite tricky to determine the actual maximum size of the stack, as
> there are configurations where the heap and the stack share the same
> memory (heap growing up and stack growing down), so your maxmimum size
> would change dynamically, depending on your current heap usage.

_stksize is the stack size limit though, when it's not negative or 0,
right?

> Actually RLIMIT_STACK makes sense in an environment where the stack
> can grow dynamically. Un*x operating systems use virtual memory to
> initialize the stack pointer to some high point in memory and just add
> VM pages to the process while the stack is growing down. RLIMIT_STACK
> just gives you a way to stop the stack from growing indefinitely.

The app I'm porting (elk) doesn't actually want to limit the stack, it's
just querying the size.

-- 
----------========================================================----------
Chris Herborth, R&D Technical Writer       Arcane  Dragon     chrish@qnx.com
QNX Software Systems, Ltd.                  -==(UDIC)==-         |||  JAGUAR
http://www.qnx.com/~chrish/                     DNRC            / | \ 64-bit