From: Thomas Weißschuh Date: Sun, 12 Apr 2026 06:08:26 +0000 (+0200) Subject: lib/procfs: return uint64_t from procfs_process_get_stat_nth() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=34625df4ee63fdc5c851902c94e13b56bcdef6cb;p=thirdparty%2Futil-linux.git lib/procfs: return uint64_t from procfs_process_get_stat_nth() This functions uses ul_strtoul64() to parse the number. As indicated by the name that can only handle uint64_t values. Passing it a pointer to uintmax_t can produce a compiler warning. Signed-off-by: Thomas Weißschuh --- diff --git a/include/procfs.h b/include/procfs.h index d90146fc5..4b238cd70 100644 --- a/include/procfs.h +++ b/include/procfs.h @@ -34,7 +34,7 @@ extern ssize_t procfs_process_get_cmdname(struct path_cxt *pc, char *buf, size_t 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); +extern int procfs_process_get_stat_nth(struct path_cxt *pc, int n, uint64_t *re); static inline ssize_t procfs_process_get_exe(struct path_cxt *pc, char *buf, size_t bufsz) { diff --git a/lib/procfs.c b/lib/procfs.c index 744c2141f..66e1eedcc 100644 --- a/lib/procfs.c +++ b/lib/procfs.c @@ -172,7 +172,7 @@ 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) +int procfs_process_get_stat_nth(struct path_cxt *pc, int n, uint64_t *re) { ssize_t rc; char *key = NULL, *tok, *p; @@ -587,7 +587,7 @@ static int test_process_stat_nth(int argc, char *argv[], const char *prefix) { pid_t pid; struct path_cxt *pc; - uintmax_t num = 0; + uint64_t num = 0; int n, ret; if (argc != 3) @@ -603,7 +603,7 @@ static int test_process_stat_nth(int argc, char *argv[], const char *prefix) if (ret) errx(EXIT_FAILURE, "read %dth number failed: %s", n, strerror(-ret)); - printf("%d: %dth %ju\n", (int) pid, n, num); + printf("%d: %dth %"PRIu64"\n", (int) pid, n, num); ul_unref_path(pc); return EXIT_SUCCESS; } diff --git a/misc-utils/kill.c b/misc-utils/kill.c index dd6eab938..e5da434b6 100644 --- a/misc-utils/kill.c +++ b/misc-utils/kill.c @@ -602,7 +602,7 @@ static int kill_verbose(const struct kill_control *ctl) static int check_signal_handler(const struct kill_control *ctl) { - uintmax_t sigcgt = 0; + uint64_t sigcgt = 0; int rc = 0, has_hnd = 0; struct path_cxt *pc; diff --git a/schedutils/taskset.c b/schedutils/taskset.c index 7e2ecc336..ac87fc822 100644 --- a/schedutils/taskset.c +++ b/schedutils/taskset.c @@ -131,7 +131,7 @@ static void do_taskset(struct taskset *ts, size_t setsize, cpu_set_t *set) /* set new mask */ if (sched_setaffinity(ts->pid, setsize, set) < 0) { - uintmax_t flags = 0; + uint64_t flags = 0; struct path_cxt *pc; int errsv = errno;