On Thu, Oct 03, 2013 at 05:20:46PM +0400, niXman wrote:
> Hi,
> 
> I'm trying to port some code from Linux to OpenBSD.
> In Linux, for getrlimit() there is the RLIMIT_AS parameter, which does
> not exist in OpenBSD.
> 
> From manpages:
> "RLIMIT_AS: The maximum size of the process's virtual memory (address space) 
> in
> bytes. This limit affects calls to brk(2), mmap(2) and mremap(2),
> which fail with the error ENOMEM upon exceeding this limit. Also
> automatic stack expansion will fail (and generate a SIGSEGV that kills
> the process if no alternate stack has been made available via
> sigaltstack(2)). Since the value is a long, on machines with a 32-bit
> long either this limit is at most 2 GiB, or this resource is
> unlimited."
> 
> Tell me please, what parameter should I use instead RLIMIT_AS, or how
> else can I get the information similar to 'getrlimit(RLIMIT_AS, ...)'?

What is usually done in the ports tree depending on the context and the code is:
(from memory)

#if defined (RLIMIT_AS)
   setrlimit (RLIMIT_AS, ...);
#endif

OR

#ifndef (RLIMIT_AS)
#  define RLIMIT_AS RLIMIT_DATA
#endif

-- 
Antoine

Reply via email to