]> granicus.if.org Git - strace/blob - print_kernel_version.c
evdev: decode struct input_absinfo regardless of in-kernel definitions
[strace] / print_kernel_version.c
1 /*
2  * Kernel version printing routine.
3  *
4  * Copyright (c) 2018 The strace developers.
5  * All rights reserved.
6  *
7  * SPDX-License-Identifier: LGPL-2.1-or-later
8  */
9
10 #include "defs.h"
11
12 void
13 print_kernel_version(const unsigned long version)
14 {
15         if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV)
16                 tprintf("%#lx", version);
17
18         if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW)
19                 return;
20
21         if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
22                 tprints(" /* ");
23
24         tprintf("KERNEL_VERSION(%lu, %lu, %lu)",
25                         version >> 16,
26                         (version >> 8) & 0xFF,
27                         version & 0xFF);
28
29         if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
30                 tprints(" */");
31 }