Re: [RFC] w using logind instead of utmp
"Thorsten Kukuk" <[email protected]> ("kukuk") Wed, 21 Jun 2023 11:31:35 +0000
| Newsgroups | gmane.linux.procps.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jun 21, Craig Small wrote:
> Hi,
> That all seems fine. I can either commit this change or if you have an
> updated version that version, let me know if there is anything else to add.
No, I'm fine with that version.
Thanks,
Thorsten
>
> - Craig
>
>
> On Tue, 13 Jun 2023 at 17:16, Thorsten Kukuk <[email protected]>
> wrote:
>
>
> Hi,
>
> On Tue, Jun 13, Craig Small wrote:
>
> > On Fri, 9 Jun 2023 at 23:27, Thorsten Kukuk <[email protected]>
> > wrote:
> >
> >
> > with w there is one binary left which only uses utmp, here is a patch
> to
> > add logind support, too.
> >
> > OK, thanks for looking into this.
> >
> >
> > systemd-logind v245 (or current git) will be necessary for this, as
> only
> > this version has all the APIs to access the data.
> >
> > The autoconf only checks for sd_session_get_leader() but I see that you
> have
> > ringfenced a few systemd functions with that define. That would imply to
> me
> > that either
> > 1) You can't use those functions without the information from the
> > sd_session_get_leader(); or
> > 2) They are introduced at the same time (e.g. in v254
>
> sd_session_get_leader() was the last added function, all other functions
> are older. So if sd_session_get_leader() is present, all other functions
> should be present, too. I doubt that anybody builds a systemd version
> and manually removes single, older functions.
>
> > What I'm concerned here is the compile time works but those functions are
> not
> > present. What happens then? It looks like its doing the right thing here
> but
> > confirming it would be great.
>
> This are libsystemd functions. They use the same symbol versioning as
> glibc is using. So if you compile with a newer libsystemd and run it
> with an older libsystemd, you will get the same function not found errors.
>
> If you use a newer libsystemd with an older systemd-logind: also no
> problem, it will continue to work. systemd-logind provides the data
> since the beginning, only the libsystemd API was missing.
>
> > Also, I think what you're doing here is iterating through what
> sd_get_sessions
> > returns which is an array of sessions. For all the subsequent functions,
> > session==NULL means that sd_get_sessions didn't
> > have any sessions so we're not running on a systemd system?
>
> No, it means nobody is logged in.
> sd_booted() determines, if systemd is running or not.
>
> > Not sure about all the conditional function calls/definitions, it might
> be
> > better always to pass the session even when it's NULL (e.g. not compiled
> with
> > systemd). On the one hand, it means we aren't meaninglessly passing that
> > pointer, on the other it makes all the function definitions messier.
>
> That what I was thinking about, too, but was unsure. And you would get
> "unused arguments" warnings/errors.
>
> Thorsten
>
> > I'll compile it in soon and let you know.
> >
> > - Craig
> >
> >
> >
> > Would it be Ok this way? Or what to change?
> >
> > 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)
> >
>
> --
> 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)
>
>
--
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)