In the past, coreutils did not need to pass the option READ_UTMP_USER_PROCESS to read_utmp(), since it was testing IS_USER_PROCESS of each entry anyway. The only effect would have been to save some amount of memory allocation.
But now, it also saves from making extra system calls to determine the boot time. Thus it is worth using now. Find attached a patch. Bruno
>From bb38f6e5cc9fbf600f698866e268cdcfba636ea6 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Thu, 10 Aug 2023 13:50:57 +0200 Subject: [PATCH] pinky,users,who: Optimize read_utmp invocation When we are only interested in entries of type USER_PROCESS, tell read_utmp that it does not need to determine the boot time. * src/pinky.c (short_pinky): Pass option READ_UTMP_USER_PROCESS. * src/users.c (users): Likewise. * src/who.c (who): Likewise, if calling list_entries_who. --- src/pinky.c | 2 +- src/users.c | 1 + src/who.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pinky.c b/src/pinky.c index 5ad05e553..3427fb12b 100644 --- a/src/pinky.c +++ b/src/pinky.c @@ -466,7 +466,7 @@ short_pinky (char const *filename, { idx_t n_users; struct gl_utmp *utmp_buf; - if (read_utmp (filename, &n_users, &utmp_buf, 0) != 0) + if (read_utmp (filename, &n_users, &utmp_buf, READ_UTMP_USER_PROCESS) != 0) error (EXIT_FAILURE, errno, "%s", quotef (filename)); scan_entries (n_users, utmp_buf, argc_names, argv_names); diff --git a/src/users.c b/src/users.c index cdb766004..f89fe65f1 100644 --- a/src/users.c +++ b/src/users.c @@ -84,6 +84,7 @@ users (char const *filename, int options) { idx_t n_users; struct gl_utmp *utmp_buf; + options |= READ_UTMP_USER_PROCESS; if (read_utmp (filename, &n_users, &utmp_buf, options) != 0) error (EXIT_FAILURE, errno, "%s", quotef (filename)); diff --git a/src/who.c b/src/who.c index 293e3b770..c235f943d 100644 --- a/src/who.c +++ b/src/who.c @@ -619,6 +619,8 @@ who (char const *filename, int options) { idx_t n_users; struct gl_utmp *utmp_buf; + if (short_list) + options |= READ_UTMP_USER_PROCESS; if (read_utmp (filename, &n_users, &utmp_buf, options) != 0) error (EXIT_FAILURE, errno, "%s", quotef (filename)); -- 2.34.1