modular session management daemon
Something went wrong. Try again.
13 kB · 315 lines
at master
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316<?xml version="1.0" encoding="UTF-8"?><protocol name="session_core_v1" version="1"> <copyright> Copyright (c) 2026 Oskar Rochowiak
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. </copyright>
<object name="session_core_manager" version="1"> <description summary="session and user observer"> Unprivileged read-only interface for observing sessions and users. </description> <s2c name="session_added"> <description summary="a new session was created"> Sent when a session is created, and once for each existing active session when the manager is created. </description> <arg name="session_id" type="uint" summary="new session identifier"/> </s2c> <s2c name="done"> <description summary="initial field dump complete"/> </s2c> <s2c name="user_added"> <description summary="a user became known"> Sent when a user becomes known, and once for each known user when the manager is created. Includes users that are lingering without an active session. </description> <arg name="uid" type="uint" summary="user identifier"/> </s2c> <s2c name="inhibitor_added"> <arg name="inhibitor_id" type="uint" summary="inhibitor identifier"/> </s2c> <s2c name="inhibitor_removed"> <arg name="inhibitor_id" type="uint" summary="inhibitor identifier"/> </s2c> <c2s name="get_session_by_id"> <description summary="create a per-session info object"> Initial fields are followed by done. If the session does not exist, destroyed is sent instead. </description> <arg name="session_id" type="uint" summary="session to query"/> <returns iface="session_core_session"/> </c2s> <c2s name="get_session_by_pid"> <description summary="create a per-session info object by process PID"> Selects the session containing the process. Initial fields are followed by done. If no matching session exists, destroyed is sent instead. </description> <arg name="pid" type="uint" summary="process PID of the session to query"/> <returns iface="session_core_session"/> </c2s> <c2s name="get_session"> <description summary="create a per-session info object for the calling process"> Selects the session containing the connecting client, identified from the connection's peer credentials rather than a client-supplied PID. Initial fields are followed by done. If no matching session exists, destroyed is sent instead. </description> <returns iface="session_core_session"/> </c2s> <c2s name="get_display_session_by_uid"> <description summary="create an info object for a user's preferred active session"> Selects the oldest active session of class user belonging to the given UID. Age is determined by the session start timestamp, with the lowest session ID breaking ties. The selected session may be graphical or a TTY session. Initial fields are followed by done. If no matching session exists, destroyed is sent instead. </description> <arg name="uid" type="uint" summary="user ID of the session to query"/> <returns iface="session_core_session"/> </c2s> <c2s name="get_user"> <description summary="create a per-user info object"> Initial fields are followed by done. If the UID does not correspond to a known user, failed is sent and no user fields follow. </description> <arg name="uid" type="uint" summary="user ID to query"/> <returns iface="session_core_user"/> </c2s> <c2s name="destroy" destructor="true"></c2s> <c2s name="get_inhibitor"> <arg name="inhibitor_id" type="uint" summary="inhibitor identifier"/> <returns iface="session_core_inhibitor"/> </c2s> </object> <object name="session_core_session" version="1"> <description summary="per-session information"> Provides information about a single session. All fields are pushed immediately on creation and re-sent if they change. </description> <s2c name="session_id"> <arg name="session_id" type="uint" summary="session identifier"/> </s2c> <s2c name="uid"> <arg name="uid" type="uint" summary="user id"/> </s2c> <s2c name="class"> <arg name="class" type="enum" interface="session_class" summary="session class"/> </s2c> <s2c name="vt"> <arg name="vt" type="uint" summary="virtual terminal number"/> </s2c> <s2c name="tty"> <arg name="tty" type="varchar" summary="TTY device name"/> </s2c> <s2c name="leader"> <arg name="leader" type="uint" summary="PID of the session-creating process, or 0 if unknown"/> </s2c> <s2c name="timestamp"> <arg name="timestamp" type="uint" summary="session start time (seconds since Unix epoch)"/> </s2c> <s2c name="is_local"> <arg name="is_local" type="uint" summary="non-zero if the session originates from the local machine, zero if remote"/> </s2c> <s2c name="remote_host"> <arg name="remote_host" type="varchar" summary="remote host name, empty for local sessions"/> </s2c> <s2c name="state"> <description summary="session state"/> <arg name="state" type="enum" interface="session_state" summary="session state"/> </s2c> <s2c name="locked"> <description summary="session is locked"/> </s2c> <s2c name="unlocked"> <description summary="session is unlocked"/> </s2c> <s2c name="done"> <description summary="initial field dump complete"/> </s2c> <s2c name="destroyed"> <description summary="session has ended or did not exist"/> </s2c> <s2c name="terminate_failed"> <description summary="session termination request failed"> Sent when the caller does not have permission to terminate this session. </description> </s2c> <s2c name="kill_failed"> <description summary="session kill request failed"> Sent when the caller does not have permission to kill this session. </description> </s2c> <s2c name="lock_failed"> <description summary="session lock request failed"> Sent when the caller does not have permission to lock this session. </description> </s2c> <s2c name="unlock_failed"> <description summary="session unlock request failed"> Sent when the caller does not have permission to unlock this session. </description> </s2c> <c2s name="lock"> <description summary="lock the session"/> </c2s> <c2s name="unlock"> <description summary="unlock the session"/> </c2s> <c2s name="terminate"> <description summary="send SIGTERM to all processes in the session"/> </c2s> <c2s name="kill"> <description summary="forcibly kill all processes in the session via cgroup.kill"/> </c2s> <c2s name="destroy" destructor="true"></c2s> <s2c name="can_modify"> <description summary="client may modify this session"> Non-zero if this client may lock, unlock, terminate, or kill this session. </description> <arg name="can_modify" type="uint" summary="non-zero if mutating requests are allowed"/> </s2c> </object>
<object name="session_core_inhibitor" version="1"> <description summary="per-inhibitor information"/> <s2c name="inhibitor_id"> <arg name="inhibitor_id" type="uint" summary="inhibitor identifier"/> </s2c> <s2c name="who"> <arg name="who" type="varchar" summary="application or component holding the inhibitor"/> </s2c> <s2c name="uid"> <arg name="uid" type="uint" summary="owner user identifier"/> </s2c> <s2c name="pid"> <arg name="pid" type="uint" summary="owner process identifier"/> </s2c> <s2c name="comm"> <arg name="comm" type="varchar" summary="owner process name"/> </s2c> <s2c name="what"> <arg name="what" type="uint" summary="inhibitor type bitmask"/> </s2c> <s2c name="why"> <arg name="why" type="varchar" summary="inhibitor reason"/> </s2c> <s2c name="mode"> <arg name="mode" type="enum" interface="inhibitor_mode" summary="inhibitor mode"/> </s2c> <s2c name="active"> <arg name="active" type="uint" summary="non-zero while active"/> </s2c> <s2c name="done"> <description summary="initial field dump complete"/> </s2c> <s2c name="destroyed"> <description summary="inhibitor was released or did not exist"/> </s2c> <c2s name="destroy" destructor="true"></c2s> </object>
<object name="session_core_user" version="1"> <description summary="per-user information"> Provides information about a single user, identified by uid. All fields are pushed immediately on creation, followed by done. </description> <s2c name="uid"> <arg name="uid" type="uint" summary="user id"/> </s2c> <s2c name="lingering"> <arg name="lingering" type="uint" summary="non-zero if the user has lingering enabled"/> </s2c> <s2c name="state"> <description summary="aggregate user state"> Reflects whether the user currently has sessions and whether any of them is in the foreground, combined with the lingering flag. Re-sent whenever it changes. </description> <arg name="state" type="enum" interface="user_state" summary="user state"/> </s2c> <s2c name="done"> <description summary="initial field dump complete"/> </s2c> <s2c name="failed"> <description summary="user lookup failed"> Sent when the UID passed to get_user does not correspond to a known user.
No further events will be sent. </description> </s2c> <s2c name="terminate_failed"> <description summary="user termination request failed"> Sent when the caller does not have permission to terminate this user. </description> </s2c> <s2c name="kill_failed"> <description summary="user kill request failed"> Sent when the caller does not have permission to kill this user. </description> </s2c> <c2s name="terminate"> <description summary="terminate the user"/> </c2s> <c2s name="kill"> <description summary="kill the user"/> </c2s> <c2s name="destroy" destructor="true"></c2s> <s2c name="can_modify"> <description summary="client may modify this user"> Non-zero if this client may terminate or kill this user's sessions. </description> <arg name="can_modify" type="uint" summary="non-zero if mutating requests are allowed"/> </s2c> </object>
<enum name="user_state"> <value idx="0" name="offline" summary="no sessions and lingering disabled"/> <value idx="1" name="lingering" summary="no sessions but lingering enabled"/> <value idx="2" name="online" summary="has a session, none in the foreground"/> <value idx="3" name="active" summary="has a session in the foreground"/> <value idx="4" name="closing" summary="has sessions, all of them closing"/> </enum>
<enum name="session_state"> <value idx="0" name="online" summary="session is logged in but not in the foreground"/> <value idx="1" name="active" summary="session is in the foreground"/> <value idx="2" name="closing" summary="session is being destroyed"/> <value idx="3" name="opening" summary="session is being created"/> </enum>
<enum name="session_class"> <value idx="0" name="user" summary="interactive login session owned by a user"/> <value idx="1" name="greeter" summary="login prompt or display manager session"/> <value idx="2" name="lock_screen" summary="screen locker session associated with an existing login"/> <value idx="3" name="background" summary="non-interactive user session without an attached seat or VT"/> <value idx="4" name="background_light" summary="lightweight background session excluded from idle shutdown accounting"/> <value idx="5" name="manager" summary="per-user service manager session"/> <value idx="6" name="manager_early" summary="early per-user service manager session created before a regular login"/> <value idx="7" name="unkown" summary="session whose type could not be determined"/> </enum>
<enum name="inhibitor_mode"> <value idx="0" name="block" summary="block the operation"/> <value idx="1" name="block_weak" summary="block unprivileged operations requested by other users"/> <value idx="2" name="delay" summary="delay the operation"/> </enum></protocol>