@node getrlimit, unix @subheading Syntax @example #include int getrlimit (int rltype, struct rlimit *rlimitp); @end example @subheading Description This function gets the resource limit specified by @var{rltype} and stores it in the buffer pointed to by @var{rlimitp}. The @code{rlimit} structure is defined on @file{sys/resource.h} as follows: @example struct rlimit @{ long rlim_cur; /* current (soft) limit */ long rlim_max; /* maximum value for rlim_cur */ @}; @end example The following resource types can be passed in @var{rltype}: @table @code @item RLIMIT_CPU CPU time in milliseconds. @item RLIMIT_FSIZE Maximum file size. @item RLIMIT_DATA Data size. @item RLIMIT_STACK Stack size. @item RLIMIT_CORE Core file size. @item RLIMIT_RSS Resident set size. @item RLIMIT_MEMLOCK Locked-in-memory address space. @item RLIMIT_NPROC Number of processes. @item RLIMIT_NOFILE Number of open files. @end table Currently, only the @code{RLIMIT_STACK} and @code{RLIMIT_NOFILE} are meaningful: the first returns the value of @code{_stklen} (@pxref{_stklen}), the second the value returned by @code{sysconf(_SC_OPEN_MAX)} (@pxref{sysconf}). All other members of the @code{rlimit} structure are set to @code{RLIM_INFINITY}, defined in @file{sys/resource.h} as @code{2^31 - 1}. @subheading Return Value Zero on success, nonzero on failure. @subheading Portability @portability !ansi, !posix @subheading Example @example struct rlimit rlimitbuf; int rc = getrlimit (RLIMIT_STACK, &rlimitbuf); @end example