#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/sched.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <linux/sched/signal.h>
#include <linux/sched/cputime.h>
+#endif
#include <linux/mm.h>
#include <linux/pid_namespace.h>
#include <asm/uaccess.h>
return div64_ul(ktime_get_boot_ns(), NSEC_PER_USEC);
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
static inline u64 cputime_to_usecs(const u64 cputime)
{
// return cputime >> 12;
return div64_ul(cputime, NSEC_PER_USEC);
}
+#endif
static unsigned int count_open_files(struct files_struct *files)
{
struct task_struct *task, *t;
struct pid *pid = NULL;
pid_t ppid = 0;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
u64 uptime, utime, stime, ut, st;
+#else
+ cputime_t uptime, utime, stime, ut, st;
+#endif
unsigned long long vm_rss, total_ram;
struct task_io_accounting task_ioac;
unsigned int open_fds;