logind: migrate to Varlink (phase1) (#41561)

This implements phase 1 of #41560.

Add List Varlink methods for all logind object types (sessions, users,
seats, inhibitors).
This commit is contained in:
Yu Watanabe
2026-05-26 03:15:55 +09:00
committed by GitHub
24 changed files with 1236 additions and 82 deletions
+4
View File
@@ -495,6 +495,10 @@ executables += [
'objects' : ['systemd-machined'],
'conditions' : ['ENABLE_MACHINED'],
},
test_template + {
'sources' : files('test-varlink-idl-login.c'),
'objects' : ['systemd-logind'],
},
test_template + {
'sources' : files('test-watchdog.c'),
'type' : 'unsafe',
+21
View File
@@ -0,0 +1,21 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "logind-inhibit.h"
#include "logind-session.h"
#include "tests.h"
#include "test-varlink-idl-util.h"
#include "varlink-io.systemd.Login.h"
TEST(login_enums_idl) {
TEST_IDL_ENUM(SessionType, session_type, vl_type_SessionType);
/* SessionClass has SESSION_NONE ("none") as an internal sentinel that is intentionally not exposed
* via Varlink. Only validate the IDL→C direction. */
TEST_IDL_ENUM_FROM_STRING(SessionClass, session_class, vl_type_SessionClass);
TEST_IDL_ENUM(InhibitMode, inhibit_mode, vl_type_InhibitMode);
/* InhibitWhat is a bit-flag enum: inhibit_what_to_string() accepts a bitmask and
* the index does not correspond to a sequential integer, so the TEST_IDL_ENUM
* round-trip macro doesn't apply. The flag→string mapping is exercised through
* ListInhibitors integration tests in TEST-35-LOGIN.sh. */
}
DEFINE_TEST_MAIN(LOG_DEBUG);