Mirror of strace – the linux syscall tracer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xlat.h 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (c) 2016-2018 The strace developers.
  3. * All rights reserved.
  4. *
  5. * SPDX-License-Identifier: LGPL-2.1-or-later
  6. */
  7. #ifndef STRACE_XLAT_H
  8. # define STRACE_XLAT_H
  9. # include <stdint.h>
  10. enum xlat_type {
  11. XT_NORMAL,
  12. XT_SORTED,
  13. XT_INDEXED,
  14. };
  15. enum xlat_style {
  16. /**
  17. * Special value that is used for passing to *print{xval,flags}*_ex
  18. * routines that indicates that no overriding of user-supplied xlat
  19. * verbosity/formatting configuration is intended.
  20. */
  21. XLAT_STYLE_DEFAULT = 0,
  22. /** Print xlat value as is without xlat processing */
  23. XLAT_STYLE_RAW = 1 << 0,
  24. /**
  25. * Historic strace style, process xlat and print the result (xlat
  26. * constant name/combination of flags), raw number only if nothing is
  27. * found.
  28. */
  29. XLAT_STYLE_ABBREV = 1 << 1,
  30. /** Always print both raw number and xlat processing result. */
  31. XLAT_STYLE_VERBOSE = XLAT_STYLE_RAW | XLAT_STYLE_ABBREV,
  32. # define XLAT_STYLE_FORMAT_SHIFT 2
  33. # define XLAT_STYLE_VERBOSITY_MASK ((1 << XLAT_STYLE_FORMAT_SHIFT) - 1)
  34. XLAT_STYLE_FMT_X = 0 << XLAT_STYLE_FORMAT_SHIFT,
  35. XLAT_STYLE_FMT_U = 1 << XLAT_STYLE_FORMAT_SHIFT,
  36. XLAT_STYLE_FMT_D = 2 << XLAT_STYLE_FORMAT_SHIFT,
  37. # define XLAT_STYLE_FORMAT_MASK (3 << XLAT_STYLE_FORMAT_SHIFT)
  38. # define XLAT_STYLE_SPEC_BITS (XLAT_STYLE_FORMAT_SHIFT + 2)
  39. # define XLAT_STYLE_MASK ((1 << XLAT_STYLE_SPEC_BITS) - 1)
  40. };
  41. struct xlat_data {
  42. uint64_t val;
  43. const char *str;
  44. };
  45. struct xlat {
  46. const struct xlat_data *data;
  47. uint32_t size;
  48. enum xlat_type type;
  49. };
  50. # define XLAT(val) { (unsigned)(val), #val }
  51. # define XLAT_PAIR(val, str) { (unsigned)(val), str }
  52. # define XLAT_TYPE(type, val) { (type)(val), #val }
  53. # define XLAT_TYPE_PAIR(type, val, str) { (type)(val), str }
  54. #endif /* !STRACE_XLAT_H */