mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-12 15:06:44 +02:00
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.
This commit is contained in:
committed by
Pádraig Brady
parent
ad82336026
commit
d70d55c0a4
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user