Re: [PATCH] query logind/elogind for number of users
"Thorsten Kukuk" <[email protected]> ("kukuk") Thu, 9 Mar 2023 11:07:40 +0100
| Newsgroups | gmane.linux.procps.devel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Mar 09, Craig Small wrote: > On Thu, 9 Mar 2023 at 00:48, Thorsten Kukuk <[email protected]> > wrote: > > 1. long or short term glibc developers want to deprecate and remove the > utmp/wtmp/lastlog interfaces from glibc because they say it's legacy, > > I'd agree with them, the API is awful. > What's their view on how to get a list of users? I looked at the coreutils > package and they either use the functions or directly read the file. The glibc developers doesn't have a clear preference (except should not longer be handled by glibc), but at least the RedHat glibc developer seems to like the logind idea, at least he did send other developer to me to implement that in their code. I made some few patches for coreutils, but neither finished them nor spoke with them yet, but Linux-PAM liked and accepted my patches, util-linux approved the PR, but didn't merged it yet. The necessary systemd patches got approved and merged. > So probably the idea is: > If systemd or elogind is enabled: > * call sd_get_sessions, >= 0 OR is not -ENOENT return that value > * otherwise (returned -ENOENT) fallback to the old utmp functions > If systemd or elogind not enabled: > * use the old utmp functions > Also, update procps_uptime_sprint() so if count_users return negative, print "? > users" not "<random negative> users". > That way I'm not going to have to deal with getting emails for the next decade > from users asking "why does w display -2 users". Ok, I will adjust my patch later today or tomorrow. w itself will be more work... Thorsten -- Thorsten Kukuk, Distinguished Engineer, Senior Architect, Future Technologies SUSE Software Solutions Germany GmbH, Frankenstraße 146, 90461 Nuernberg, Germany Managing Director: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman (HRB 36809, AG Nürnberg)