From: Masatake YAMATO Date: Thu, 27 Jul 2023 15:30:16 +0000 (+0900) Subject: procfs: add a helper function to access /proc/$pid/syscall X-Git-Tag: v2.40-rc1~244^2~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=41f2a5088b393553d28033f1787d777ef50087ea;p=thirdparty%2Futil-linux.git procfs: add a helper function to access /proc/$pid/syscall Signed-off-by: Masatake YAMATO --- diff --git a/include/procfs.h b/include/procfs.h index 25be51357d..14625e0ba4 100644 --- a/include/procfs.h +++ b/include/procfs.h @@ -32,6 +32,7 @@ extern int procfs_process_get_uid(struct path_cxt *pc, uid_t *uid); extern ssize_t procfs_process_get_cmdline(struct path_cxt *pc, char *buf, size_t bufsz); extern ssize_t procfs_process_get_cmdname(struct path_cxt *pc, char *buf, size_t bufsz); extern ssize_t procfs_process_get_stat(struct path_cxt *pc, char *buf, size_t bufsz); +extern ssize_t procfs_process_get_syscall(struct path_cxt *pc, char *buf, size_t bufsz); extern int procfs_process_get_stat_nth(struct path_cxt *pc, int n, uintmax_t *re); diff --git a/lib/procfs.c b/lib/procfs.c index aff20fb660..59f40ffbb0 100644 --- a/lib/procfs.c +++ b/lib/procfs.c @@ -169,6 +169,11 @@ ssize_t procfs_process_get_stat(struct path_cxt *pc, char *buf, size_t bufsz) return procfs_process_get_data_for(pc, buf, bufsz, "stat"); } +ssize_t procfs_process_get_syscall(struct path_cxt *pc, char *buf, size_t bufsz) +{ + return procfs_process_get_data_for(pc, buf, bufsz, "syscall"); +} + int procfs_process_get_stat_nth(struct path_cxt *pc, int n, uintmax_t *re) { ssize_t rc;