[PATCH v2 3/9] qemu_tpm: Expose qemuTPMEmulatorGetPid()

Michal Privoznik mprivozn at redhat.com
Mon Jun 27 10:44:35 UTC 2022


In near future it will be necessary to know the PID of swtpm
process for QEMU. Export the function that does just that
(qemuTPMEmulatorGetPid()).

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>
---
 src/qemu/qemu_tpm.c | 2 +-
 src/qemu/qemu_tpm.h | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 03829775b8..49237c6be5 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -138,7 +138,7 @@ qemuTPMEmulatorPidFileBuildPath(const char *swtpmStateDir,
  * If the PID was not still alive, zero will be returned, and @pid will be
  * set to -1;
  */
-static int
+int
 qemuTPMEmulatorGetPid(const char *swtpmStateDir,
                       const char *shortName,
                       pid_t *pid)
diff --git a/src/qemu/qemu_tpm.h b/src/qemu/qemu_tpm.h
index 9951f025a6..9f4d01f60b 100644
--- a/src/qemu/qemu_tpm.h
+++ b/src/qemu/qemu_tpm.h
@@ -50,6 +50,13 @@ void qemuExtTPMStop(virQEMUDriver *driver,
                     virDomainObj *vm)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
+int qemuTPMEmulatorGetPid(const char *swtpmStateDir,
+                          const char *shortName,
+                          pid_t *pid)
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
+    ATTRIBUTE_NONNULL(3)
+    G_GNUC_WARN_UNUSED_RESULT;
+
 int qemuExtTPMSetupCgroup(virQEMUDriver *driver,
                           virDomainDef *def,
                           virCgroup *cgroup)
-- 
2.35.1



More information about the libvir-list mailing list