]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/procfs: return uint64_t from procfs_process_get_stat_nth()
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 12 Apr 2026 06:08:26 +0000 (08:08 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Sun, 12 Apr 2026 07:03:34 +0000 (09:03 +0200)
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 <thomas@t-8ch.de>
include/procfs.h
lib/procfs.c
misc-utils/kill.c
schedutils/taskset.c

index d90146fc51edde24484dfebd1539645aeefa6194..4b238cd70eb0e661a791886a0ab5be6026a365a5 100644 (file)
@@ -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)
 {
index 744c2141f4a3db6715442b1689cf238df81ec345..66e1eedccdb949f810e69409ced5a6d5035b721c 100644 (file)
@@ -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;
 }
index dd6eab938254f0c8ff71bc9ec5d33a48342fcb03..e5da434b664043b97aae21e77ad151e7d11c1e6d 100644 (file)
@@ -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;
 
index 7e2ecc33652912b158074dd5095a954bcbddb03f..ac87fc822a34fcc6c67ee9744f9d32dfacc3c4fb 100644 (file)
@@ -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;