Lines Matching refs:ker
29 pm_kernel_t *ker;
35 ker = calloc(1, sizeof(*ker));
36 if (!ker)
39 ker->kpagecount_fd = open("/proc/kpagecount", O_RDONLY);
40 if (ker->kpagecount_fd < 0) {
42 free(ker);
46 ker->kpageflags_fd = open("/proc/kpageflags", O_RDONLY);
47 if (ker->kpageflags_fd < 0) {
49 close(ker->kpagecount_fd);
50 free(ker);
54 ker->pagesize = getpagesize();
56 *ker_out = ker;
62 int pm_kernel_pids(pm_kernel_t *ker, pid_t **pids_out, size_t *len) {
116 int pm_kernel_count(pm_kernel_t *ker, unsigned long pfn, uint64_t *count_out) {
119 if (!ker || !count_out)
122 off = lseek(ker->kpagecount_fd, pfn * sizeof(uint64_t), SEEK_SET);
125 if (read(ker->kpagecount_fd, count_out, sizeof(uint64_t)) <
132 int pm_kernel_flags(pm_kernel_t *ker, unsigned long pfn, uint64_t *flags_out) {
135 if (!ker || !flags_out)
138 off = lseek(ker->kpageflags_fd, pfn * sizeof(uint64_t), SEEK_SET);
141 if (read(ker->kpageflags_fd, flags_out, sizeof(uint64_t)) <
148 int pm_kernel_destroy(pm_kernel_t *ker) {
149 if (!ker)
152 close(ker->kpagecount_fd);
153 close(ker->kpageflags_fd);
155 free(ker);