]> git.ipfire.org Git - thirdparty/util-linux.git/commit
waitpid: refactor to improve maintainability
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Wed, 14 Jan 2026 00:02:47 +0000 (19:02 -0500)
committerChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Sun, 1 Feb 2026 20:08:29 +0000 (15:08 -0500)
commitaa4b4c28e94226b0a9790d1a4fbdb7d8d1365daa
tree307feec335f3de2770cc0599d8f3aee91cfb75b2
parent00b4753502f280d09e7426c82f4a7853fb3f95a1
waitpid: refactor to improve maintainability

This refactor introduces 'struct waitpid_control' which is
used to control the program state, e.g. option flags, to
create context for internal routines that can adapt their
execution flow accordingly. It has as goal to make the code
easier to understand and reduces the scope of variables.

It also adds 'struct process_info' which stores information
on a process, specified by the PID passed on the command line,
such as the PID, process file descriptor and pidfd inode number.

An array of process_info is used to store information on all
specified PIDs on the command line and is used to create the
event poll list that is integral to the waitpid(1) logic.

This refactor lays the ground work to introduce support for
the 'PID:inode' process addressing format.

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
misc-utils/waitpid.c