]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #34703 from poettering/pidref-varlink
authorLennart Poettering <lennart@poettering.net>
Fri, 11 Oct 2024 11:33:44 +0000 (13:33 +0200)
committerGitHub <noreply@github.com>
Fri, 11 Oct 2024 11:33:44 +0000 (13:33 +0200)
Serialize "PidRef" in a reasonable way in Varlink interfaces

1  2 
src/libsystemd/sd-json/sd-json.c
src/machine/machine-varlink.c
src/machine/machined-varlink.c
src/shared/varlink-io.systemd.Machine.c

Simple merge
Simple merge
Simple merge
index 3beab59e2085d1e9ad8f4b6bf63ec46c2c811163,ce802491236c6c098263dac3bcc00f71b2aa1aba..7b2bb4969fac39853e65e3f594ff3acd0fafd2a2
@@@ -3,15 -3,9 +3,16 @@@
  #include "sd-varlink-idl.h"
  
  #include "bus-polkit.h"
+ #include "varlink-idl-common.h"
  #include "varlink-io.systemd.Machine.h"
  
 +#define VARLINK_DEFINE_MACHINE_LOOKUP_AND_POLKIT_INPUT_FIELDS                                                                                  \
 +        SD_VARLINK_FIELD_COMMENT("If non-null the name of a machine."),                                                                        \
 +        SD_VARLINK_DEFINE_INPUT(name, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),                                                                 \
 +        SD_VARLINK_FIELD_COMMENT("If non-null the PID of a machine. Special value 0 means to take pid of the machine the caller is part of."), \
 +        SD_VARLINK_DEFINE_INPUT(pid, SD_VARLINK_INT, SD_VARLINK_NULLABLE),                                                                     \
 +        VARLINK_DEFINE_POLKIT_INPUT
 +
  static SD_VARLINK_DEFINE_METHOD(
                  Register,
                  SD_VARLINK_DEFINE_INPUT(name,              SD_VARLINK_STRING, 0),
                  SD_VARLINK_DEFINE_INPUT(allocateUnit,      SD_VARLINK_BOOL,   SD_VARLINK_NULLABLE),
                  VARLINK_DEFINE_POLKIT_INPUT);
  
- static SD_VARLINK_DEFINE_STRUCT_TYPE(
-                 Timestamp,
-                 SD_VARLINK_FIELD_COMMENT("Timestamp in µs in the CLOCK_REALTIME clock (wallclock)"),
-                 SD_VARLINK_DEFINE_FIELD(realtime, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
-                 SD_VARLINK_FIELD_COMMENT("Timestamp in µs in the CLOCK_MONOTONIC clock"),
-                 SD_VARLINK_DEFINE_FIELD(monotonic, SD_VARLINK_INT, SD_VARLINK_NULLABLE));
  static SD_VARLINK_DEFINE_METHOD(
                  Unregister,
 -                SD_VARLINK_FIELD_COMMENT("The name of a machine to unregister."),
 -                SD_VARLINK_DEFINE_INPUT(name, SD_VARLINK_STRING, 0));
 +                VARLINK_DEFINE_MACHINE_LOOKUP_AND_POLKIT_INPUT_FIELDS);
  
  static SD_VARLINK_DEFINE_METHOD(
                  Terminate,