• Leo Yan's avatar
    perf namespaces: Add helper nsinfo__is_in_root_namespace() · 5d28a17c
    Leo Yan authored
    Refactors code for gathering PID infos, it creates the function
    nsinfo__get_nspid() to parse process 'status' node in folder '/proc'.
    
    Base on the refactoring, this patch introduces a new helper
    nsinfo__is_in_root_namespace(), it returns true when the caller runs in
    the root PID namespace.
    Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Alexei Starovoitov <ast@kernel.org>
    Cc: Andrii Nakryiko <andrii@kernel.org>
    Cc: Daniel Borkmann <daniel@iogearbox.net>
    Cc: Jin Yao <yao.jin@linux.intel.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: John Fastabend <john.fastabend@gmail.com>
    Cc: John Garry <john.garry@huawei.com>
    Cc: KP Singh <kpsingh@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Martin KaFai Lau <kafai@fb.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Song Liu <songliubraving@fb.com>
    Cc: Yonatan Goldschmidt <yonatan.goldschmidt@granulate.io>
    Cc: Yonghong Song <yhs@fb.com>
    Cc: bpf@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Link: http://lore.kernel.org/lkml/20211212134721.1721245-2-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    5d28a17c
namespaces.h 1.62 KB