[RFC PATCH v3 0/5] Proposal to add eventfd option to --decode-fds

Sahil Siddiq icegambit91 at gmail.com
Fri May 10 05:14:06 UTC 2024


Hi,

Currently, the --decode-fds option hasn't been implemented for
eventfd file descriptors. Having this option can help examine
eventfd object details that are associated with an eventfd file
descriptor. This is especially useful when multiple threads or
processes utilise (reading, writing, etc.) file descriptors
corresponding to the same eventfd object.

This proposal also includes a patch to implement this option.

I am not sure if commit #1 should be dropped given that I am
not using "string_to_uint_ex" anymore. I have included it for
now since the "base" parameter makes it more flexible. Let me
know if I should drop this commit.

Thanks,
Sahil

Changes v2 -> v3:
- src/util.c
  (fdinfo): New struct.
  (scan_fdinfo): Use this struct.
  (get_finfo_for_dev): Likewise.
  (pidfd_get_pid): Likewise.
  (printsignalfd): Likewise.
  (parse_fdinfo_efd_semaphore): New function.
  (parse_fdinfo_efd_counter): Treat efd_counter as string.
  (printeventfd): Refactor to use "struct fdinfo".
- tests/eventfd-yy.c:
  (fdinfo): New struct.
  (parse_fdinfo_efd_id): Use strtol instead of atoi.
  (procfs_get_efd_id): Remove function.
  (procfs_check_avail_efd_data): New function. Use "struct fdinfo".
  (print_eventfd_details): New function.
  (main):
  - Remove "poll.h"
  - Use "struct fdinfo".
  - Use "read" instead of "write" to test efd_counter.
  - Test EFD_SEMAPHORE.
- NEWS: Change description.
- doc/strace.1.in: Likewise.

Sahil Siddiq (5):
  Add "base" parameter to string_to_uint_ex
  Refactor scan_fdinfo and decode-fd functions
  Add eventfd option to --decode-fds
  Add test for --decode-fds=eventfd
  Document --decode-fds=eventfd implementation

 NEWS                 |   2 +
 doc/strace.1.in      |   5 +-
 src/filter_qualify.c |   5 +-
 src/number_set.h     |   1 +
 src/strace.c         |   7 +-
 src/string_to_uint.c |   4 +-
 src/string_to_uint.h |   4 +-
 src/util.c           | 187 ++++++++++++++++++++++++++++++++++++-----
 tests/.gitignore     |   1 +
 tests/Makefile.am    |   1 +
 tests/eventfd-yy.c   | 196 +++++++++++++++++++++++++++++++++++++++++++
 tests/gen_tests.in   |   1 +
 12 files changed, 385 insertions(+), 29 deletions(-)
 create mode 100644 tests/eventfd-yy.c

-- 
2.45.0



More information about the Strace-devel mailing list