From 48e43cabdac9c0c9b090125127313c9d1121086e Mon Sep 17 00:00:00 2001 From: Dave Voutila Date: Sun, 8 Jan 2023 19:57:18 +0000 Subject: vmd(8): add thread names to vm process. ok guenther@. --- usr.sbin/vmd/vm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/vmd/vm.c b/usr.sbin/vmd/vm.c index f2852411550..25204bcccb8 100644 --- a/usr.sbin/vmd/vm.c +++ b/usr.sbin/vmd/vm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm.c,v 1.80 2023/01/04 02:19:19 dv Exp $ */ +/* $OpenBSD: vm.c,v 1.81 2023/01/08 19:57:17 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include /* PAGE_SIZE */ +#include /* PAGE_SIZE, MAXCOMLEN */ #include #include #include @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -1211,6 +1212,7 @@ run_vm(int child_cdrom, int child_disks[][VM_MAX_BASE_PER_DISK], size_t i; int ret; pthread_t *tid, evtid; + char tname[MAXCOMLEN + 1]; struct vm_run_params **vrp; void *exit_status; @@ -1353,6 +1355,9 @@ run_vm(int child_cdrom, int child_disks[][VM_MAX_BASE_PER_DISK], __func__, i); return (ret); } + + snprintf(tname, sizeof(tname), "vcpu-%zu", i); + pthread_set_name_np(tid[i], tname); } log_debug("%s: waiting on events for VM %s", __func__, vcp->vcp_name); @@ -1362,6 +1367,7 @@ run_vm(int child_cdrom, int child_disks[][VM_MAX_BASE_PER_DISK], log_warn("%s: could not create event thread", __func__); return (ret); } + pthread_set_name_np(evtid, "event"); for (;;) { ret = pthread_cond_wait(&threadcond, &threadmutex); -- cgit v1.2.3