[CRIU] Rework open_proc() and friends

Kir Kolyshkin kir at openvz.org
Thu Feb 16 16:39:31 EST 2012


This epic series tries to simplify the way we work with /proc/PID files,
and it tries to do that gradually. That essentially means that if you
do not like the last patch, you can still enjoy the first four.

DISCLAIMER: while the code looks correct, it has only been
tested by gcc and my eyes; i.e. I haven't run it.

Patches are:

* [PATCH 1/5] dump_one_task(): do not leak opened pid_dir fd
Just a bug fix, must have.

* [PATCH 2/5] util.c: introduce open_proc_rw()
Adds open_proc_rw() in addition to open_proc() so
they both will reuse the same goodies coming in later patches

* [PATCH 3/5] parasite_infect_seized(): use open_proc_rw()
Makes use of open_proc_rw()

* [PATCH 4/5] Move error reporting to inside open_proc and friends
Main patch in the series, it unifies error reporting and makes
all functions to pass both pid and pid_dir. pid is needed for error
reporting, pid_dir for openat() optimization.

* [PATCH 5/5] open_proc() and friends: hide pid_dir
This one is pretty controversial, it removes pid_dir from everywhere
but the openat() optimization is still there. I am not sure it is
worth merging (eager to hear your thoughts), but hey it looks pretty.


More information about the CRIU mailing list