[PATCH v1] print the raw kernel version when using -Xraw

shankarapailoor shankarapailoor at gmail.com
Sat Dec 1 20:14:59 UTC 2018


Sorry, it seems gmail converts tabs to spaces. Making this an attachment
On Sat, Dec 1, 2018 at 11:50 AM shankarapailoor
<shankarapailoor at gmail.com> wrote:
>
> From 06b32228156338edc9958fb4f86a2bdd188abc48 Mon Sep 17 00:00:00 2001
> From: Shankara Pailoor <shankarapailoor at gmail.com>
> Date: Sat, 1 Dec 2018 11:47:27 -0800
> Subject: [PATCH v1] print the raw kernel version when using -Xraw
>
> ---
>  bpf.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/bpf.c b/bpf.c
> index e5dc4eeb..261c68be 100644
> --- a/bpf.c
> +++ b/bpf.c
> @@ -292,10 +292,22 @@ BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)
>      /* kern_version field was added in Linux commit v4.1-rc1~84^2~50.  */
>      if (len <= offsetof(struct BPF_PROG_LOAD_struct, kern_version))
>          break;
> -    tprintf(", kern_version=KERNEL_VERSION(%u, %u, %u)",
> -        attr.kern_version >> 16,
> -        (attr.kern_version >> 8) & 0xFF,
> -        attr.kern_version & 0xFF);
> +    if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV) {
> +        tprintf(", kernel_version=%u", attr.kern_version);
> +        if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE) {
> +            tprints(" /* ");
> +            tprintf("KERNEL_VERSION(%u, %u, %u)",
> +                attr.kern_version >> 16,
> +                (attr.kern_version >> 8) & 0xFF,
> +                attr.kern_version & 0xFF);
> +            tprints("*/");
> +        }
> +    } else {
> +        tprintf(", kern_version=KERNEL_VERSION(%u, %u, %u)",
> +            attr.kern_version >> 16,
> +            (attr.kern_version >> 8) & 0xFF,
> +            attr.kern_version & 0xFF);
> +    }
>
>      /* prog_flags field was added in Linux commit v4.12-rc2~34^2~29^2~2.  */
>      if (len <= offsetof(struct BPF_PROG_LOAD_struct, prog_flags))
> --
> 2.17.1



-- 
Regards,
Shankara Pailoor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v1-0001-print-the-raw-kernel-version-when-using-Xraw.patch
Type: text/x-patch
Size: 1435 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20181201/538a33bd/attachment.bin>


More information about the Strace-devel mailing list