From: Rabin Vincent <rabinv@xxxxxxxx> On kernels without swap, vm -p currently errors out with the message "nr_swapfiles doesn't exist in this kernel". By handling this case gracefully instead of erroring out, we make it work on such kernels. --- memory.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/memory.c b/memory.c index b0ecb05..693516e 100644 --- a/memory.c +++ b/memory.c @@ -15550,6 +15550,9 @@ swap_location(ulonglong pte, char *buf) if (!pte) return NULL; + if (!symbol_exists("nr_swapfiles") || !symbol_exists("swap_info")) + return NULL; + if (THIS_KERNEL_VERSION >= LINUX(2,6,0)) sprintf(buf, "%s OFFSET: %lld", get_swapdev(__swp_type(pte), swapdev), (ulonglong)__swp_offset(pte)); @@ -15570,12 +15573,6 @@ get_swapdev(ulong type, char *buf) ulong swap_info, swap_info_ptr, swap_file; ulong vfsmnt; - if (!symbol_exists("nr_swapfiles")) - error(FATAL, "nr_swapfiles doesn't exist in this kernel!\n"); - - if (!symbol_exists("swap_info")) - error(FATAL, "swap_info doesn't exist in this kernel!\n"); - swap_info_init(); swap_info = symbol_value("swap_info"); -- 2.7.0 -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility