[Crash-utility] [PATCH] Make vm -p work without swap
Dave Anderson
anderson at redhat.com
Fri Apr 22 13:54:46 UTC 2016
----- Original Message -----
> Rabin Vincent <rabin.vincent at axis.com> writes:
>
> 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.
Thanks Rabin -- queued for crash-7.1.5:
https://github.com/crash-utility/crash/commit/3064aad3879a59de92a6ac37aee826510e6147d9
Dave
> ---
> 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
More information about the Crash-utility
mailing list