KDK_SYSTEM_GET_HOSTVIRTTYPE(3) Library Functions Manual NAME kdk_system_get_hostVirtType - SYNOPSIS #include extern char* kdk_system_get_hostVirtType(); Link with -lkysysinfo. Detailed Description The main function of the interface is to obtain the virtual machine type of the operating system host. RETURN VALUE On success, returns the virtual machine type of type char*; The content is [none, qemu, kvm, zvm, vmware, hyper-v, orcale virtualbox, xen, bochs, uml, parallels, bhyve, qnx, arcn, openvz, lxc, lxc-libvirt, systemd-nspawn, docker, podman, rkt, wsl] where none indicates running in a physical environment; Other strings represent specific virtual environment types; The returned string needs to be released by free On error, return NULL. EXAMPLES #include #include #include int main() { char *res = kdk_system_get_architecture(); printf("%s0, res); free(res); res = kdk_system_get_systemName(); printf("%s0, res); free(res); res = kdk_system_get_version(0); printf("%s0, res); free(res); res = kdk_system_get_version(1); printf("%s0, res); free(res); res = kdk_system_get_kernelVersion(); printf("%s0, res); free(res); res = kdk_system_get_serialNumber(); printf("%s0, res); free(res); int p; int d; int act = kdk_system_get_activationStatus(&p,&d); printf("--------------0); printf("%d0,act); printf("%s0, act == 1 ? "" : act == 0 ? "" : ""); res = kdk_system_get_eUser(); printf("%s0, res); // free(res); res = kdk_system_get_eUser_login_time(); printf("%s0, res); res = kdk_system_get_projectName(); printf("%s0, res); free(res); int zyj = kdk_system_is_zyj(); printf("%s0, zyj == 0 ? "":""); res = kdk_system_get_hostVirtType(); printf("%s0, res); free(res); res = kdk_system_get_hostCloudPlatform(); printf("%s0, res); free(res); version_t test = kdk_system_get_version_detaile( ); printf("test.os_version = %s0,test.os_version); printf("test.update_version = %s0,test.update_version); char** name = kdk_system_get_resolving_power(); // printf("name = %s0, name); size_t count = 0; while (name[count]) { printf("No. %d %s0, count + 1, name[count]); count ++; } kdk_resolving_freeall(name); char *ver = kdk_system_get_systemCategory(); printf(" = %s0, ver); free(ver); // ver = kdk_system_get_cloudPlatformType(); // printf(" = %s0, ver); // free(ver); char **ud_time = kdk_system_get_startup_time(); count = 0; while (ud_time[count]) { printf(" = %s0, ud_time[count]); count++; } kdk_resolving_freeall(ud_time); ud_time = kdk_system_get_shutdown_time(); count = 0; while (ud_time[count]) { printf(" = %s0, ud_time[count]); count++; } kdk_resolving_freeall(ud_time); res = kdk_get_host_vendor(); printf(" = %s0, res); free(res); res = kdk_get_host_product(); printf(" = %s0, res); free(res); res = kdk_get_host_serial(); printf(" = %s0, res); free(res); res = kdk_system_get_buildTime(); printf("%s0, res); free(res); res = kdk_system_get_hostName(); printf("%s0, res); free(res); printf("%d0, kdk_system_get_word()); struct KPci *pci = kdk_hw_get_pci_info(); struct KPci *tmp = pci; while (tmp) { printf("slot path : %s0, tmp->slot_path); printf("class name :%s0, tmp->class_name); printf("product name :%s0, tmp->product_name); printf("rev :%02x0, tmp->rev); printf("subsystem name :%s0, tmp->ss_name); printf("driver user :%s0, tmp->driver_use); printf("modules :"); for(int i = 0; i < tmp->module_count; i++) { printf("%s", tmp->modules[i]); } printf("0); tmp = tmp->next; } kdk_hw_free_pci_info(pci); res = kdk_system_get_appScene(); printf("%s0, res); free(res); return 0; } CONFORMING TO These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: kdk_system_get_systemName(), kdk_system_get_architecture(), kdk_system_get_activationStatus(), kdk_system_get_version(), kdk_system_get_serialNumber(), kdk_system_get_kernelVersion(), kdk_system_get_eUser(), kdk_system_get_eUser_login_time(), kdk_system_get_projectName(), kdk_system_get_projectSubName(), kdk_system_get_productFeatures(), kdk_system_get_hostCloudPlatform(), kdk_system_is_zyj(), kdk_system_get_version_detaile(), kdk_system_get_resolving_power(), kdk_system_get_systemCategory(), kdk_system_get_startup_time(), kdk_system_get_shutdown_time(), kdk_get_host_vendor(), kdk_get_host_product(), kdk_get_host_serial(), kdk_system_get_hostName(), kdk_system_get_word(), kdk_system_get_buildTime(), kdk_resolving_freeall(), kdk_hw_get_pci_info(), kdk_hw_free_pci_info(), and kdk_system_get_appScene(). SEE ALSO kdk_system_get_systemName(3), kdk_system_get_architecture(3), kdk_system_get_version(3), kdk_system_get_activationStatus(3), kdk_system_get_serialNumber(3), kdk_system_get_kernelVersion(3), kdk_system_get_eUser(3), kdk_system_get_eUser_login_time(3), kdk_system_get_projectName(3), kdk_system_get_projectSubName(3), kdk_system_get_productFeatures(3), kdk_system_get_hostCloudPlatform(3), kdk_system_is_zyj(3), kdk_system_get_version_detaile(3), kdk_system_get_resolving_power(3), kdk_system_get_systemCategory(3), kdk_system_get_startup_time(3), kdk_system_get_shutdown_time(3), kdk_get_host_vendor(3), kdk_get_host_product(3), kdk_get_host_serial(3), kdk_system_get_hostName(3), kdk_system_get_word(3), kdk_system_get_buildTime(3), kdk_resolving_freeall(3), kdk_hw_get_pci_info(3), kdk_hw_free_pci_info(3), and kdk_system_get_appScene(3). Linux Programmer's Manual Tue Sep 19 2023 KDK_SYSTEM_GET_HOSTVIRTTYPE(3)