.\" 2008-05-07, mtk / Peter Zijlstra, Added description of RLIMIT_RTTIME
.\" 2010-11-06, mtk: Added documentation of prlimit()
.\"
-.TH GETRLIMIT 2 2010-12-03 "Linux" "Linux Programmer's Manual"
+.TH GETRLIMIT 2 2011-09-10 "Linux" "Linux Programmer's Manual"
.SH NAME
getrlimit, setrlimit, prlimit \- get/set resource limits
.SH SYNOPSIS
.in
.sp
.BR prlimit ():
-_GNU_SOURCE
+_GNU_SOURCE && _FILE_OFFSET_BITS == 64
.SH DESCRIPTION
The
.BR getrlimit ()
once per second until the hard limit is reached, at which time
it is sent
.BR SIGKILL .
-(This latter point describes Linux 2.2 through 2.6 behavior.
+(This latter point describes Linux behavior.
Implementations vary in how they treat processes which continue to
consume CPU time after reaching the soft limit.
Portable applications that need to catch this signal should
Both standard and real-time signals are counted for the purpose of
checking this limit.
However, the limit is only enforced for
-.BR sigqueue (2);
+.BR sigqueue (3);
it is always possible to use
.BR kill (2)
to queue one instance of any of the signals that are not already
.PP
.nf
#define _GNU_SOURCE
+#define _FILE_OFFSET_BITS 64
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/resource.h>
+#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \\
+ } while (0)
+
int
main(int argc, char *argv[])
{
- struct rlimit64 old, new;
- struct rlimit64 *newp;
+ struct rlimit old, new;
+ struct rlimit *newp;
pid_t pid;
if (!(argc == 2 || argc == 4)) {
newp = &new;
}
- /* Set CPU time limit of target prcess; retrieve and display
+ /* Set CPU time limit of target process; retrieve and display
previous limit */
if (prlimit(pid, RLIMIT_CPU, newp, &old) == \-1)
.BR quotactl (2),
.BR sbrk (2),
.BR shmctl (2),
-.BR sigqueue (2),
.BR malloc (3),
+.BR sigqueue (3),
.BR ulimit (3),
.BR core (5),
.BR capabilities (7),