Works on my setup, returning 0 with no VMs. Aug 29, 2026, 05:30 by [email protected]:
> Simon Wollwage <[email protected]> writes: > >> Dave Voutila <[email protected]> writes: >> >>> >>> Yes, I'm in agreement that 0 semantically makes sense here. >>> >>> If you have a diff, happy to review if you can share in the thread. >>> > > Noticed an erroneous whitespace in my diff and while fixing that I > realized that found_running is not needed anymore. > > Index: vmctl.c > =================================================================== > RCS file: /cvs/src/usr.sbin/vmctl/vmctl.c,v > diff -u -p -r1.98 vmctl.c > --- vmctl.c 16 Apr 2026 21:34:47 -0000 1.98 > +++ vmctl.c 29 Aug 2026 02:18:23 -0000 > @@ -700,10 +700,10 @@ print_vm_info(struct vmop_info_result *l > char maxmem[FMT_SCALED_STRSIZE]; > char user[16], group[16]; > const char *name; > - int running, found_running; > + int running, matched; > extern int stat_rflag; > > - found_running = 0; > + matched = 0; > > printf("%5s %5s %5s %7s %7s %7s %12s %8s %s\n", "ID", "PID", "VCPUS", > "MAXMEM", "CURMEM", "TTY", "OWNER", "STATE", "NAME"); > @@ -714,9 +714,8 @@ print_vm_info(struct vmop_info_result *l > if (!running && stat_rflag) > continue; > > - found_running++; > - > if (check_info_id(vir->vir_name, vir->vir_id)) { > + matched = 1; > /* get user name */ > name = user_from_uid(vir->vir_uid, 1); > if (name == NULL) > @@ -768,10 +767,10 @@ print_vm_info(struct vmop_info_result *l > } > } > > - if (found_running) > + if (matched || (info_id == 0 && *info_name == '\0')) > return (0); > - else > - return (ENOENT); > + > + return (ENOENT); > } > > /* >

