From: Masatake YAMATO Date: Tue, 25 Mar 2025 19:44:14 +0000 (+0900) Subject: procfs: add a helper function to access /proc/$pid/personality X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3310fc880ee8d3fa79d928199bbae739d12041e6;p=thirdparty%2Futil-linux.git procfs: add a helper function to access /proc/$pid/personality Signed-off-by: Masatake YAMATO --- diff --git a/include/procfs.h b/include/procfs.h index 14625e0ba..fdfe1455b 100644 --- a/include/procfs.h +++ b/include/procfs.h @@ -64,5 +64,6 @@ extern int procfs_dirent_match_name(DIR *procfs, struct dirent *d, const char *n extern int fd_is_procfs(int fd); extern char *pid_get_cmdname(pid_t pid); extern char *pid_get_cmdline(pid_t pid); +extern char *pid_get_personality(pid_t pid); #endif /* UTIL_LINUX_PROCFS_H */ diff --git a/lib/procfs.c b/lib/procfs.c index 59f40ffbb..136ec7c05 100644 --- a/lib/procfs.c +++ b/lib/procfs.c @@ -449,6 +449,11 @@ char *pid_get_cmdline(pid_t pid) return strdup_procfs_file(pid, "cmdline"); } +char *pid_get_personality(pid_t pid) +{ + return strdup_procfs_file(pid, "personality"); +} + #ifdef TEST_PROGRAM_PROCFS static int test_tasks(int argc, char *argv[], const char *prefix)