#define TEST_PORT 4321 @@ -139,7 +140,7 @@ echoer(void *param) mev = mevent_add(fd, EVF_READ, echoer_callback, &sync); if (mev == NULL) { printf("Could not allocate echoer event\n"); - exit(4); + exit(BHYVE_EXIT_ERROR); } while (!pthread_cond_wait(&sync.e_cond, &sync.e_mt)) { @@ -197,7 +198,7 @@ acceptor(void *param) if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { perror("cannot create socket"); - exit(4); + exit(BHYVE_EXIT_ERROR); } sin.sin_len = sizeof(sin); @@ -207,12 +208,12 @@ acceptor(void *param) if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { perror("cannot bind socket"); - exit(4); + exit(BHYVE_EXIT_ERROR); } if (listen(s, 1) < 0) { perror("cannot listen socket"); - exit(4); + exit(BHYVE_EXIT_ERROR); } (void) mevent_add(s, EVF_READ, acceptor_callback, NULL); diff --git a/usr.sbin/bhyve/riscv/bhyverun_machdep.c b/usr.sbin/bhyve/riscv/bhyverun_machdep.c index 8ee505e86679..f4c248ee662a 100644 --- a/usr.sbin/bhyve/riscv/bhyverun_machdep.c +++ b/usr.sbin/bhyve/riscv/bhyverun_machdep.c @@ -159,7 +159,7 @@ bhyve_optparse(int argc, char **argv) pci_print_supported_devices(); exit(0); } else if (pci_parse_slot(optarg) != 0) - exit(4); + exit(BHYVE_EXIT_ERROR); else break; case 'S': diff --git a/usr.sbin/bhyve/riscv/vmexit.c b/usr.sbin/bhyve/riscv/vmexit.c index 985f8e4e9065..29afdcc25352 100644 --- a/usr.sbin/bhyve/riscv/vmexit.c +++ b/usr.sbin/bhyve/riscv/vmexit.c @@ -114,15 +114,15 @@ vmexit_suspend(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun) switch (how) { case VM_SUSPEND_RESET: - exit(0); + exit(BHYVE_EXIT_RESET); case VM_SUSPEND_POWEROFF: if (get_config_bool_default("destroy_on_poweroff", false)) vm_destroy(ctx); - exit(1); + exit(BHYVE_EXIT_POWEROFF); case VM_SUSPEND_HALT: - exit(2); + exit(BHYVE_EXIT_HALT); case VM_SUSPEND_DESTROY: - exit(4); + exit(BHYVE_EXIT_ERROR); default: fprintf(stderr, "vmexit_suspend: invalid reason %d\n", how); exit(100); diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index eabe6ab47f80..5b941984c0c0 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -1308,7 +1308,7 @@ vm_checkpoint(struct vmctx *ctx, int fddir, const char *checkpoint_file, if (stop_vm) { vm_destroy(ctx); - exit(5); + exit(BHYVE_EXIT_SUSPEND); } done: