logind,machined: expose bus properties for leader PID fd ids, too
This commit is contained in:
@@ -1251,6 +1251,8 @@ node /org/freedesktop/login1/session/1 {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly u Leader = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly t LeaderPIDFDId = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly u Audit = ...;
|
||||
readonly s Type = '...';
|
||||
readonly s Class = '...';
|
||||
@@ -1351,6 +1353,8 @@ node /org/freedesktop/login1/session/1 {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="Leader"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="LeaderPIDFDId"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="Audit"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="Type"/>
|
||||
@@ -1539,6 +1543,9 @@ node /org/freedesktop/login1/session/1 {
|
||||
|
||||
<para><varname>Leader</varname> encodes the PID of the process that registered the session.</para>
|
||||
|
||||
<para><varname>LeaderPIDFDId</varname> encodes the Linux pidfd inode ID of the process that registered
|
||||
the session.</para>
|
||||
|
||||
<para><varname>Audit</varname> encodes the Kernel Audit session ID of the session if auditing is
|
||||
available.</para>
|
||||
|
||||
@@ -1660,6 +1667,7 @@ node /org/freedesktop/login1/session/1 {
|
||||
<para><function>SetDisplay()</function> was added in version 252.</para>
|
||||
<para><function>SetTTY()</function> was added in version 254.</para>
|
||||
<para><function>SetClass()</function> was added in version 256.</para>
|
||||
<para><varname>LeaderPIDFDId</varname> was added in version 258.</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
|
||||
|
||||
@@ -513,6 +513,8 @@ node /org/freedesktop/machine1/machine/rawhide {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly u Leader = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly t LeaderPIDFDId = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly s Class = '...';
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly s RootDirectory = '...';
|
||||
@@ -603,6 +605,8 @@ node /org/freedesktop/machine1/machine/rawhide {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="Leader"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="LeaderPIDFDId"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="Class"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="RootDirectory"/>
|
||||
@@ -650,6 +654,9 @@ node /org/freedesktop/machine1/machine/rawhide {
|
||||
|
||||
<para><varname>Leader</varname> is the PID of the leader process of the machine.</para>
|
||||
|
||||
<para><varname>LeaderPIDFDId</varname> encodes the Linux pidfd inode ID of the leader process of the
|
||||
machine.</para>
|
||||
|
||||
<para><varname>Class</varname> is the class of the machine and is either the string "vm" (for real VMs
|
||||
based on virtualized hardware) or "container" (for lightweight userspace virtualization sharing the
|
||||
same kernel as the host).</para>
|
||||
@@ -717,6 +724,7 @@ $ gdbus introspect --system \
|
||||
<function>CopyToWithFlags()</function> were added in version 252.</para>
|
||||
<para><function>GetSSHInfo()</function>, <varname>VSockCID</varname>, <varname>SSHAddress</varname>
|
||||
and <varname>SSHPrivateKeyPath</varname> were added in version 256.</para>
|
||||
<para><varname>LeaderPIDFDId</varname> was added in version 258.</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
|
||||
|
||||
@@ -993,6 +993,7 @@ static const sd_bus_vtable session_vtable[] = {
|
||||
SD_BUS_PROPERTY("Desktop", "s", NULL, offsetof(Session, desktop), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Scope", "s", NULL, offsetof(Session, scope), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Leader", "u", bus_property_get_pid, offsetof(Session, leader.pid), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("LeaderPIDFDId", "t", bus_property_get_pidfdid, offsetof(Session, leader), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Audit", "u", NULL, offsetof(Session, audit_id), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Type", "s", property_get_type, offsetof(Session, type), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
|
||||
SD_BUS_PROPERTY("Class", "s", property_get_class, offsetof(Session, class), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
|
||||
|
||||
@@ -717,7 +717,8 @@ static const sd_bus_vtable machine_vtable[] = {
|
||||
SD_BUS_PROPERTY("Service", "s", NULL, offsetof(Machine, service), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Unit", "s", NULL, offsetof(Machine, unit), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Scope", "s", NULL, offsetof(Machine, unit), SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_HIDDEN),
|
||||
SD_BUS_PROPERTY("Leader", "u", NULL, offsetof(Machine, leader.pid), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Leader", "u", bus_property_get_pid, offsetof(Machine, leader.pid), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("LeaderPIDFDId", "t", bus_property_get_pidfdid, offsetof(Machine, leader), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Class", "s", property_get_class, offsetof(Machine, class), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("RootDirectory", "s", NULL, offsetof(Machine, root_directory), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("NetworkInterfaces", "ai", property_get_netif, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "bus-get-properties.h"
|
||||
#include "bus-message-util.h"
|
||||
#include "pidref.h"
|
||||
#include "rlimit-util.h"
|
||||
#include "string-util.h"
|
||||
|
||||
@@ -188,3 +189,23 @@ int bus_property_get_string_set(
|
||||
|
||||
return bus_message_append_string_set(reply, *s);
|
||||
}
|
||||
|
||||
int bus_property_get_pidfdid(
|
||||
sd_bus *bus,
|
||||
const char *path,
|
||||
const char *interface,
|
||||
const char *property,
|
||||
sd_bus_message *reply,
|
||||
void *userdata,
|
||||
sd_bus_error *error) {
|
||||
|
||||
PidRef *pidref = ASSERT_PTR(userdata);
|
||||
|
||||
assert(bus);
|
||||
assert(property);
|
||||
assert(reply);
|
||||
|
||||
(void) pidref_acquire_pidfd_id(pidref);
|
||||
|
||||
return sd_bus_message_append(reply, "t", pidref->fd_id);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ int bus_property_get_rlimit(sd_bus *bus, const char *path, const char *interface
|
||||
|
||||
int bus_property_get_string_set(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
|
||||
|
||||
int bus_property_get_pidfdid(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
|
||||
|
||||
#define BUS_DEFINE_PROPERTY_GET_GLOBAL(function, bus_type, val) \
|
||||
int function(sd_bus *bus, \
|
||||
const char *path, \
|
||||
|
||||
Reference in New Issue
Block a user