Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Paste
P690
Command-Line Input
Active
Public
Actions
Authored by
antranigv_freebsd.am
on Thu, Jan 29, 1:43 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Flag For Later
Award Token
Tags
None
Referenced Files
F143334954: Command-Line Input
Thu, Jan 29, 1:43 AM
2026-01-29 01:43:50 (UTC+0)
Subscribers
None
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
index 9db62972467c..cbd5d0b4de08 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -356,18 +356,12 @@ calc_topology(void)
guest_ncpus = ncpus;
}
-int
-bhyve_pincpu_parse(const char *opt)
+static int
+bhyve_pincpu(int vcpu, int pcpu)
{
const char *value;
char *newval;
char key[16];
- int vcpu, pcpu;
-
- if (sscanf(opt, "%d:%d", &vcpu, &pcpu) != 2) {
- fprintf(stderr, "invalid format: %s\n", opt);
- return (-1);
- }
if (vcpu < 0) {
fprintf(stderr, "invalid vcpu '%d'\n", vcpu);
@@ -394,6 +388,42 @@ bhyve_pincpu_parse(const char *opt)
return (0);
}
+int
+bhyve_pincpu_parse(const char *opt)
+{
+ int vcpu_first, vcpu_last, pcpu_first, pcpu_last;
+ int vcpu, pcpu;
+ int count;
+ int i;
+
+ if (sscanf(opt, "%d-%d:%d-%d", &vcpu_first, &vcpu_last, &pcpu_first, &pcpu_last) == 4) {
+ if (vcpu_first > vcpu_last || pcpu_first > pcpu_last) {
+ fprintf(stderr, "invalid range (must be ascending): %s\n", opt);
+ return (-1);
+ }
+ count = vcpu_last - vcpu_first + 1;
+ if (count != (pcpu_last - pcpu_first + 1)) {
+ fprintf(stderr, "range sizes do not match: %s\n", opt);
+ return (-1);
+ }
+ for (i = 0; i < count; i++) {
+ vcpu = vcpu_first + i;
+ pcpu = pcpu_first + i;
+ if (bhyve_pincpu(vcpu, pcpu) != 0) {
+ return (-1);
+ }
+ }
+ return (0);
+ }
+
+ if (sscanf(opt, "%d:%d", &vcpu, &pcpu) == 2) {
+ return bhyve_pincpu(vcpu, pcpu);
+ }
+
+ fprintf(stderr, "invalid format: %s\n", opt);
+ return (-1);
+}
+
static void
parse_cpuset(int vcpu, const char *list, cpuset_t *set)
{
Event Timeline
antranigv_freebsd.am
created this paste.
Thu, Jan 29, 1:43 AM
2026-01-29 01:43:50 (UTC+0)
Log In to Comment