summaryrefslogtreecommitdiffstats
path: root/etc/latrace.d/headers/resource.h
blob: a5487404c233bdff8ccc9b2294a3ee2042cc11c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

/* /usr/include/sys/resource.h */

/* Kinds of resource limit.  */
enum rlimit_resource
{
  /* Per-process CPU limit, in seconds.  */
  RLIMIT_CPU = 0,
  /* Largest file that can be created, in bytes.  */
  RLIMIT_FSIZE = 1,
  /* Maximum size of data segment, in bytes.  */
  RLIMIT_DATA = 2,
  /* Maximum size of stack segment, in bytes.  */
  RLIMIT_STACK = 3,
  /* Largest core file that can be created, in bytes.  */
  RLIMIT_CORE = 4,
  /* Largest resident set size, in bytes.
     This affects swapping; processes that are exceeding their
     resident set size will be more likely to have physical memory
     taken from them.  */
  RLIMIT_RSS = 5,
  /* Number of open files.  */
  RLIMIT_NOFILE = 7,
  RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same.  */
  /* Address space limit.  */
  RLIMIT_AS = 9,
  /* Number of processes.  */
  RLIMIT_NPROC = 6,
  /* Locked-in-memory address space.  */
  RLIMIT_MEMLOCK = 8,
  /* Maximum number of file locks.  */
  RLIMIT_LOCKS = 10,
  /* Maximum number of pending signals.  */
  RLIMIT_SIGPENDING = 11,
  /* Maximum bytes in POSIX message queues.  */
  RLIMIT_MSGQUEUE = 12,
  /* Maximum nice priority allowed to raise to.
     Nice levels 19 .. -20 correspond to 0 .. 39
     values of this resource limit.  */
  RLIMIT_NICE = 13,
  /* Maximum realtime priority allowed for non-priviledged
     processes.  */
  LIMIT_RTPRIO = 14,
  RLIMIT_NLIMITS = 15
};

/* Whose usage statistics do you want?  */
enum rusage_who
{
  /* The calling process.  */
  RUSAGE_SELF = 0,
  /* All of its terminated child processes.  */
  RUSAGE_CHILDREN = -1,
  /* The calling thread.  */
  RUSAGE_THREAD = 1
};

enum priority_which
{
  PRIO_PROCESS = 0,		/* WHO is a process ID.  */
  PRIO_PGRP = 1,		/* WHO is a process group ID.  */
  PRIO_USER = 2			/* WHO is a user ID.  */
};

extern int getrlimit(int resource = rlimit_resource, void *rlimits);
extern int getrlimit64(int resource = rlimit_resource, void *rlimits);
extern int setrlimit(int resource = rlimit_resource, void *rlimits);
extern int setrlimit64(int resource = rlimit_resource, void *rlimits);

extern int getrusage(int who = rusage_who, void *usage);

extern int getpriority(int which = priority_which, int who);
extern int setpriority (int which = priority_which, int who, int prio);