Merge pull request #29 from AntonioMeireles/add_version_flag

add -v flag in order to easily spot running version.
This commit is contained in:
Michael Steil 2015-07-02 07:07:41 +02:00
commit eccf36b721
2 changed files with 21 additions and 3 deletions

View file

@ -1,3 +1,5 @@
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags)
ifeq ($V, 1)
VERBOSE =
else
@ -73,6 +75,8 @@ OBJ := $(SRC:src/%.c=build/%.o)
DEP := $(OBJ:%.o=%.d)
INC := -Iinclude
CFLAGS += -DVERSION=\"$(GIT_VERSION)\"
TARGET = build/xhyve
all: $(TARGET) | build

View file

@ -113,7 +113,7 @@ static struct bhyvestats {
#pragma clang diagnostic ignored "-Wpadded"
static struct mt_vmm_info {
pthread_t mt_thr;
int mt_vcpu;
int mt_vcpu;
} mt_vmm_info[VM_MAXCPU];
#pragma clang diagnostic pop
@ -141,6 +141,7 @@ usage(int code)
" -s: <slot,driver,configinfo> PCI slot config\n"
" -u: RTC keeps UTC time\n"
" -U: uuid\n"
" -v: show build version\n"
" -w: ignore unimplemented MSRs\n"
" -W: force virtio to use single-vector MSI\n"
" -x: local apic is in x2APIC mode\n"
@ -150,6 +151,17 @@ usage(int code)
exit(code);
}
__attribute__ ((noreturn)) static void
show_version()
{
fprintf(stderr, "%s: %s\n\n%s\n",progname, VERSION,
"xhyve is a port of FreeBSD's bhyve hypervisor to OS X that\n"
"works entirely in userspace and has no other dependencies.\n\n"
"Homepage: https://github.com/mist64/xhyve\n"
"License: BSD\n");
exit(0);
}
void
xh_vm_inject_fault(int vcpu, int vector, int errcode_valid,
uint32_t errcode)
@ -780,7 +792,7 @@ main(int argc, char *argv[])
rtc_localtime = 1;
fw = 0;
while ((c = getopt(argc, argv, "behuwxACHPWY:f:g:c:s:m:l:U:")) != -1) {
while ((c = getopt(argc, argv, "behvuwxACHPWY:f:g:c:s:m:l:U:")) != -1) {
switch (c) {
case 'A':
acpi = 1;
@ -847,8 +859,10 @@ main(int argc, char *argv[])
case 'Y':
mptgen = 0;
break;
case 'v':
show_version();
case 'h':
usage(0);
usage(0);
default:
usage(1);
}