/usr/share/systemtap/tapset/linux/rlimit.stp is in systemtap-common 2.9-2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | %{
#include <linux/version.h>
%}
/**
* sfunction rlimit_from_str - Symbolic string associated with resource limit code
*
* @lim_str: The string representation of limit
*
* Description: This function returns the number associated
* with the given string, such as 0 for the string RLIMIT_CPU, or
* -1 for an out-of-range value.
*/
function rlimit_from_str:long (lim_str:string)
%{ /* pure */ /* unmodified-fnargs */
#define aux_rlimit(limit_arg) \
if (strncmp(STAP_ARG_lim_str, #limit_arg, MAXSTRINGLEN) == 0) { \
STAP_RETVALUE = limit_arg; \
return; \
}
/* Little kernel history digging */
/* This set is stable from 2.6.1 kernel version */
aux_rlimit(RLIMIT_CPU);
aux_rlimit(RLIMIT_FSIZE);
aux_rlimit(RLIMIT_DATA);
aux_rlimit(RLIMIT_STACK);
aux_rlimit(RLIMIT_CORE);
aux_rlimit(RLIMIT_RSS);
aux_rlimit(RLIMIT_NPROC);
aux_rlimit(RLIMIT_NOFILE);
aux_rlimit(RLIMIT_MEMLOCK);
aux_rlimit(RLIMIT_AS);
aux_rlimit(RLIMIT_LOCKS);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8)
aux_rlimit(RLIMIT_SIGPENDING);
aux_rlimit(RLIMIT_MSGQUEUE);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
aux_rlimit(RLIMIT_NICE);
aux_rlimit(RLIMIT_RTPRIO);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
aux_rlimit(RLIMIT_RTTIME);
#endif
STAP_RETVALUE = -1;
#undef aux_rlimit
%}
|