aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichal Privoznik <mprivozn@redhat.com>2016-09-27 17:24:56 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-04 10:00:27 +0200
commit7dc9ae4339faa97e89daadb2e1098147ab4aadc8 (patch)
tree14fe0cb005009fd3de9ac1cb78dfb9f6765f6d95 /include
parent6a7b2b21008f271e7a91e937e521e22f94579bb9 (diff)
util: Introduce qemu_get_pid_name
This is a small helper that tries to fetch binary name for given PID. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Message-Id: <4d75d475c1884f8e94ee8b1e57273ddf3ed68bf7.1474987617.git.mprivozn@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/qemu/osdep.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 9e9fa61546..384bfe245f 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -388,6 +388,16 @@ void os_mem_prealloc(int fd, char *area, size_t sz, Error **errp);
int qemu_read_password(char *buf, int buf_size);
/**
+ * qemu_get_pid_name:
+ * @pid: pid of a process
+ *
+ * For given @pid fetch its name. Caller is responsible for
+ * freeing the string when no longer needed.
+ * Returns allocated string on success, NULL on failure.
+ */
+char *qemu_get_pid_name(pid_t pid);
+
+/**
* qemu_fork:
*
* A version of fork that avoids signal handler race