| 4 |
- |
1 |
|
|
|
2 |
/* /usr/include/sys/resource.h */
|
|
|
3 |
|
|
|
4 |
/* Kinds of resource limit. */
|
|
|
5 |
enum rlimit_resource
|
|
|
6 |
{
|
|
|
7 |
/* Per-process CPU limit, in seconds. */
|
|
|
8 |
RLIMIT_CPU = 0,
|
|
|
9 |
/* Largest file that can be created, in bytes. */
|
|
|
10 |
RLIMIT_FSIZE = 1,
|
|
|
11 |
/* Maximum size of data segment, in bytes. */
|
|
|
12 |
RLIMIT_DATA = 2,
|
|
|
13 |
/* Maximum size of stack segment, in bytes. */
|
|
|
14 |
RLIMIT_STACK = 3,
|
|
|
15 |
/* Largest core file that can be created, in bytes. */
|
|
|
16 |
RLIMIT_CORE = 4,
|
|
|
17 |
/* Largest resident set size, in bytes.
|
|
|
18 |
This affects swapping; processes that are exceeding their
|
|
|
19 |
resident set size will be more likely to have physical memory
|
|
|
20 |
taken from them. */
|
|
|
21 |
RLIMIT_RSS = 5,
|
|
|
22 |
/* Number of open files. */
|
|
|
23 |
RLIMIT_NOFILE = 7,
|
|
|
24 |
RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */
|
|
|
25 |
/* Address space limit. */
|
|
|
26 |
RLIMIT_AS = 9,
|
|
|
27 |
/* Number of processes. */
|
|
|
28 |
RLIMIT_NPROC = 6,
|
|
|
29 |
/* Locked-in-memory address space. */
|
|
|
30 |
RLIMIT_MEMLOCK = 8,
|
|
|
31 |
/* Maximum number of file locks. */
|
|
|
32 |
RLIMIT_LOCKS = 10,
|
|
|
33 |
/* Maximum number of pending signals. */
|
|
|
34 |
RLIMIT_SIGPENDING = 11,
|
|
|
35 |
/* Maximum bytes in POSIX message queues. */
|
|
|
36 |
RLIMIT_MSGQUEUE = 12,
|
|
|
37 |
/* Maximum nice priority allowed to raise to.
|
|
|
38 |
Nice levels 19 .. -20 correspond to 0 .. 39
|
|
|
39 |
values of this resource limit. */
|
|
|
40 |
RLIMIT_NICE = 13,
|
|
|
41 |
/* Maximum realtime priority allowed for non-priviledged
|
|
|
42 |
processes. */
|
|
|
43 |
LIMIT_RTPRIO = 14,
|
|
|
44 |
RLIMIT_NLIMITS = 15
|
|
|
45 |
};
|
|
|
46 |
|
|
|
47 |
/* Whose usage statistics do you want? */
|
|
|
48 |
enum rusage_who
|
|
|
49 |
{
|
|
|
50 |
/* The calling process. */
|
|
|
51 |
RUSAGE_SELF = 0,
|
|
|
52 |
/* All of its terminated child processes. */
|
|
|
53 |
RUSAGE_CHILDREN = -1,
|
|
|
54 |
/* The calling thread. */
|
|
|
55 |
RUSAGE_THREAD = 1
|
|
|
56 |
};
|
|
|
57 |
|
|
|
58 |
enum priority_which
|
|
|
59 |
{
|
|
|
60 |
PRIO_PROCESS = 0, /* WHO is a process ID. */
|
|
|
61 |
PRIO_PGRP = 1, /* WHO is a process group ID. */
|
|
|
62 |
PRIO_USER = 2 /* WHO is a user ID. */
|
|
|
63 |
};
|
|
|
64 |
|
|
|
65 |
extern int getrlimit(int resource = rlimit_resource, void *rlimits);
|
|
|
66 |
extern int getrlimit64(int resource = rlimit_resource, void *rlimits);
|
|
|
67 |
extern int setrlimit(int resource = rlimit_resource, void *rlimits);
|
|
|
68 |
extern int setrlimit64(int resource = rlimit_resource, void *rlimits);
|
|
|
69 |
|
|
|
70 |
extern int getrusage(int who = rusage_who, void *usage);
|
|
|
71 |
|
|
|
72 |
extern int getpriority(int which = priority_which, int who);
|
|
|
73 |
extern int setpriority (int which = priority_which, int who, int prio);
|