Adrian, On Mon, 2026-03-02 at 19:09 -0500, Adrian Vovk wrote: > > > It does not. This is the root of the misconception.
GDM has a lot of the same code. > > Processes can exist inside of a logind session. Namely, the > aforementioned "session leader" and its entire tree of descendents. > The `sd_pid_get_session` function lets you look up the logind session > that the specified process is a part of. This does not mean > that that PID has anything to do with the existence of the logind > session, or that the PID is somehow being used to communicate > with logind. No. You're just looking up the session ID of the session > that contains the process you're querying. The PID is bound to the existence of active logind session, otherwise, that function will return an error. My issue is the PID being known before the logind session exists. The PID belongs to the shell that logind session exists in and the desktop is running in; all under samd PID. The PID is associated to a logind session once the shell session is active. I just need another process or thread to use that PID to obtain the session, as my primary process is waiting for that PID to exit. But the the desktop is already started. > > 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 > > > This is called from _inside_ of the session, not by the display > manager. > The process linking against libgdm here (namely: gnome-shell) > uses these functions to find its own seat. So this happening inside a session? /* First try to look up the session using the pid. We need this * at least for the greeter, because it currently runs multiple * sessions under the same user. * See also commit 2b52d8933c8ab38e7ee83318da2363d00d8c5581 * which added an explicit dbus-run-session for all but seat0. */ https://github.com/GNOME/gdm/blob/master/common/gdm-common.c#L823 Pretty sure that is the DM they are talking about, greeter. Going further, this commit seems to make it clear they are looking up the session, which you are saying is happening inside a session? https://github.com/GNOME/gdm/commit/32646105196ed7a687f3684b69ea544dd01d2ade Clearly talking about the DM, commit comment prefix "manager:". There are 3 different usages of sd_pid_get_session https://github.com/search?q=repo%3AGNOME%2Fgdm%20sd_pid_get_session&type=code This further confirms my remarks that multi-seat is more theory than reality, this still seems like a WIP... https://github.com/GNOME/gdm/commit/2b52d8933c8ab38e7ee83318da2363d00d8c5581 Seems to be starting a session there, not calling something from within a session. Cheers! -- Sincerely, William L. Thomson Jr.
