KDK_CPU_GET_VIRT(3)
💖 KDK_CPU_GET_VIRT(3) — the "does my CPU do virtualization tho" page 💖
okay bestie, welcome to KDK_CPU_GET_VIRT(3), straight out of the Library Functions Manual ✨ this is a libkycpu situation and it is literally so simple you're gonna scream.
🌸 NAME 🌸
kdk_cpu_get_virt — 获取CPU对虚拟化的支持
(translation for the girlies: it gets you the CPU's virtualization support 🧚 like, does this chip do the thing or not)
✨ SYNOPSIS ✨
#include <libkycpu.h>
extern const char* kdk_cpu_get_virt();
Link with -lkyhw.
no cap, you HAVE to link with -lkyhw or the linker will simply not know her 💀
🦋 Detailed Description 🦋
The main function of the interface is to obtain CPU support for virtualization.
that's it. that's the whole vibe. one job, one function, main character energy 👑
💅 RETURN VALUE 💅
- If the CPU supports virtualization, it returns the virtualization technology, like
"vmx"🔥 - If it's not supported, it returns
NULL😭 (she said no) - The return type is
const char*
DO NOTfreeIT. 🚨 the return isconst char*and it is NOT yours to free, so put thefree()down bestie, walk away, we don't do that here 🫶
🎀 EXAMPLES 🎀
here's the whole little demo, iconic behavior:
#include "libkycpu.h"
#include <stdio.h>
int main()
{
printf("架构:%s\n", kdk_cpu_get_arch());
printf("生产厂商:%s\n", kdk_cpu_get_vendor());
printf("CPU 型号:%s\n", kdk_cpu_get_model());
printf("CPU 主频:%s MHz\n", kdk_cpu_get_freq_MHz());
printf("CPU 单核核心数量:%u\n", kdk_cpu_get_corenums());
printf("CPU 虚拟化支持:%s\n", kdk_cpu_get_virt());
printf("CPU 线程数:%u\n", kdk_cpu_get_process());
return 0;
}
like look at her go, printing every single CPU fact she can find 🌈
📜 CONFORMING TO 📜
These functions are as per the withdrawn POSIX.1e draft specification.
The following functions are Linux extensions: kdk_cpu_get_arch(), kdk_cpu_get_model(), kdk_cpu_get_freq_MHz(), kdk_cpu_get_corenums(), kdk_cpu_get_vendor() and kdk_cpu_get_process().
lowkey important: POSIX.1e draft is withdrawn, and those six functions up there are Linux extensions, not POSIX. periodt 💅
👀 SEE ALSO 👀
kdk_cpu_get_arch(3)kdk_cpu_get_model(3)kdk_cpu_get_freq_MHz(3)kdk_cpu_get_corenums(3)kdk_cpu_get_vendor(3)kdk_cpu_get_process(3)
go read those too, the whole squad is serving 🌟
sign-off besties 💜 this one came from the Linux Programmer's Manual, dated Thu Aug 24 2023 — so yes, she's been iconic since 2023 and she's still not freeing that const char* 🎀✨ bye love u, go virtualize something 🦋
📦 where this page comes from
- arch rolling: libkysdk-system 3.0.1.4-1 · LGPL-3.0-or-later AND LGPL-2.1-only OR LGPL-3.0-only AND LGPL-2.1-only WITH Qt-LGPL-exception-1.1 OR LGPL-3.0-only WITH Qt-LGPL-exception-1.1 AND MIT
- ubuntu resolute: libkysdk-system-dev 3.0.1.2-0ubuntu1 · LGPL-3.0-only
- ubuntu stonking: libkysdk-system-dev 3.0.1.3-0ubuntu1 · LGPL-3.0-or-later
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms