delorie.com/djgpp/doc/libc/libc_415.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

getrlimit

Syntax

 
#include <sys/resource.h>

int getrlimit (int rltype, struct rlimit *rlimitp);

Description

This function gets the resource limit specified by rltype and stores it in the buffer pointed to by rlimitp. The rlimit structure is defined on `sys/resource.h' as follows:

 
struct rlimit {
  long rlim_cur;  /* current (soft) limit */
  long rlim_max;  /* maximum value for rlim_cur */
};

The following resource types can be passed in rltype:

RLIMIT_CPU
CPU time in milliseconds.

RLIMIT_FSIZE
Maximum file size.

RLIMIT_DATA
Data size.

RLIMIT_STACK
Stack size.

RLIMIT_CORE
Core file size.

RLIMIT_RSS
Resident set size.

RLIMIT_MEMLOCK
Locked-in-memory address space.

RLIMIT_NPROC
Number of processes.

RLIMIT_NOFILE
Number of open files.

Currently, only the RLIMIT_STACK and RLIMIT_NOFILE are meaningful: the first returns the value of _stklen (see section _stklen), the second the value returned by sysconf(_SC_OPEN_MAX) (see section sysconf). All other members of the rlimit structure are set to RLIM_INFINITY, defined in `sys/resource.h' as 2^31 - 1.

Return Value

Zero on success, nonzero on failure.

Portability

ANSI/ISO C No
POSIX No

Example

 
struct rlimit rlimitbuf;
int rc = getrlimit (RLIMIT_STACK, &rlimitbuf);


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004