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.

netlink_kobject_uevent.c 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2018 Harsha Sharma <harshasharmaiitr@gmail.com>
  3. * Copyright (c) 2018 The strace developers.
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: LGPL-2.1-or-later
  7. */
  8. #include "defs.h"
  9. #include "print_fields.h"
  10. #include "netlink_kobject_uevent.h"
  11. #include <arpa/inet.h>
  12. void
  13. decode_netlink_kobject_uevent(struct tcb *tcp, kernel_ulong_t addr,
  14. kernel_ulong_t len)
  15. {
  16. struct udev_monitor_netlink_header uh;
  17. const char *prefix = "libudev";
  18. unsigned int offset = sizeof(uh);
  19. if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)) ||
  20. !addr || len < offset || umove(tcp, addr, &uh) ||
  21. strcmp(uh.prefix, prefix) != 0) {
  22. printstrn(tcp, addr, len);
  23. return;
  24. }
  25. PRINT_FIELD_CSTRING("{{", uh, prefix);
  26. tprintf(", magic=htonl(%#x)", ntohl(uh.magic));
  27. PRINT_FIELD_U(", ", uh, header_size);
  28. PRINT_FIELD_U(", ", uh, properties_off);
  29. PRINT_FIELD_U(", ", uh, properties_len);
  30. tprintf(", filter_subsystem_hash=htonl(%#x)", ntohl(uh.filter_subsystem_hash));
  31. tprintf(", filter_devtype_hash=htonl(%#x)", ntohl(uh.filter_devtype_hash));
  32. tprintf(", filter_tag_bloom_hi=htonl(%#x)", ntohl(uh.filter_tag_bloom_hi));
  33. tprintf(", filter_tag_bloom_lo=htonl(%#x)", ntohl(uh.filter_tag_bloom_lo));
  34. tprints("}");
  35. if (len > offset) {
  36. tprints(", ");
  37. printstrn(tcp, addr + offset, len - offset);
  38. }
  39. tprints("}");
  40. }