Debian Codegraph @

tapset/linux/rlimit.stp

raw
1 %{
2 #include <linux/version.h>
3 %}
4
5 /**
6 * sfunction rlimit_from_str - Symbolic string associated with resource limit code
7 *
8 * @lim_str: The string representation of limit
9 *
10 * Description: This function returns the number associated
11 * with the given string, such as 0 for the string RLIMIT_CPU, or
12 * -1 for an out-of-range value.
13 */
14 function rlimit_from_str:long (lim_str:string)
15 %{ /* pure */ /* unmodified-fnargs */
16 #define aux_rlimit(limit_arg) \
17 if (strncmp(STAP_ARG_lim_str, #limit_arg, MAXSTRINGLEN) == 0) { \
18 STAP_RETVALUE = limit_arg; \
19 return; \
20 }
21
22 /* Little kernel history digging */
23 /* This set is stable from 2.6.1 kernel version */
24 aux_rlimit(RLIMIT_CPU);
25 aux_rlimit(RLIMIT_FSIZE);
26 aux_rlimit(RLIMIT_DATA);
27 aux_rlimit(RLIMIT_STACK);
28 aux_rlimit(RLIMIT_CORE);
29 aux_rlimit(RLIMIT_RSS);
30 aux_rlimit(RLIMIT_NPROC);
31 aux_rlimit(RLIMIT_NOFILE);
32 aux_rlimit(RLIMIT_MEMLOCK);
33 aux_rlimit(RLIMIT_AS);
34 aux_rlimit(RLIMIT_LOCKS);
35
36 aux_rlimit(RLIMIT_SIGPENDING);
37 aux_rlimit(RLIMIT_MSGQUEUE);
38
39 aux_rlimit(RLIMIT_NICE);
40 aux_rlimit(RLIMIT_RTPRIO);
41
42 aux_rlimit(RLIMIT_RTTIME);
43
44 STAP_RETVALUE = -1;
45
46 #undef aux_rlimit
47 %}