On Mon, 2026-03-02 at 11:32 -0500, Adrian Vovk wrote:
> Hello,
>
> You mentioned up the email chain that there is no misconception.
> There _is_ a misconception. That is becoming increasingly clear.
Yes, so lets speak in code.
> A logind session is not a service. It is not a program that runs. You
> can't talk to it via PID because there's nothing logind related on
> that PID. There's no such thing as connecting to a logind session.
Code says otherwise.
ret = sd_pid_get_session(pid, &session_id);
if (ret < 0)
{
PT("Failed to get session for PID %d: %s", pid, strerror(-
ret));
return NULL;
}
session = calloc(1, sizeof(Entrance_Logind_Session));
if (!session)
{
free(session_id);
return NULL;
}
/* Get session seat */
ret = sd_session_get_seat(session_id, &seat);
if (ret >= 0)
session->seat = seat;
/* Get VT number */
ret = sd_session_get_vt(session_id, &vtnr);
if (ret >= 0)
session->vtnr = vtnr;
/* Get UID */
ret = sd_session_get_uid(session_id, &uid);
if (ret >= 0)
session->uid = uid;
https://github.com/wltjr/entrance/blob/master/src/daemon/entrance_logind.c#L68
Again, this is NOT my code, this is another's contribution. I am simply
trying to understand how the function calls are intended to work. That
code clearly seems to imply it is possible to interact with logind
sessions via PID.
GDM is doing this as well, calling
ret = sd_pid_get_session (pid, &session_id);
https://github.com/GNOME/gdm/blob/main/libgdm/gdm-sessions.c#L80
Please explain misconception.
Thank you!
P.S.
I know next to nothing about consolekit, that code existed when I took
over the entrance codebase long ago. I just removed it when consolekit
was no longer used, removed from gentoo. I never had the need to get
into consolekit functionality. I have spent WAY more time over the
years trying to learn about logind via D-Bus and now C-API. I have no
bias or influence from consolekit, which I am unfamiliar with.
--
Sincerely,
William L. Thomson Jr.