selftests/seccomp: Refactor get_proc_stat to split out file reading code
authorSargun Dhillon <sargun@sargun.me>
Tue, 3 May 2022 08:09:57 +0000 (01:09 -0700)
committerKees Cook <keescook@chromium.org>
Tue, 3 May 2022 21:20:49 +0000 (14:20 -0700)
commit922a1b520c5ffb09079dddeb0c686f9c008a9923
treea68345f286130a12e8679a301a83c5a5d0b987a7
parentc2aa2dfef243efe213a480a1ee8566507a5152f4
selftests/seccomp: Refactor get_proc_stat to split out file reading code

This splits up the get_proc_stat function to make it so we can use it as a
generic helper to read the nth field from multiple different files, versus
replicating the logic in multiple places.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
Cc: linux-kselftest@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220503080958.20220-3-sargun@sargun.me
tools/testing/selftests/seccomp/seccomp_bpf.c