KDK_CPU_GET_MODEL(3)

📦 version 3.0.1.4, in arch rolling, ubuntu resolute, ubuntu stonking

💖 KDK_CPU_GET_MODEL — the manual page for kdk_cpu_get_model(3) 💖

okay bestie, sit down, hydrate, and let's talk about libkycpu because this little function is literally the moment. this page lives in section 3 of the Linux Programmer's Manual, it's a library functions situation, and it's about to tell you which CPU you're running on. no cap. ✨


🌸 NAME 🌸

kdk_cpu_get_model — 获取CPU型号 (a.k.a. "get the CPU model", and yes we're keeping the original wording because it ATE 💅)


🦋 SYNOPSIS 🦋

#include <libkycpu.h>

extern const char* kdk_cpu_get_model();

and listen — when you build this, you gotta link with -lkyhw. that's not optional, that's the vibe. 🔥


🎀 Detailed Description 🎀

so the main function of this interface — the whole point of its existence, its main character era — is to obtain the CPU model. that's it. that's the job. she shows up, she reads the model, she serves. 🫶


👑 RETURN VALUE 👑

  • On success, it returns the CPU model as a char*. like, for example, something iconic such as "Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz" 🌈
  • > ⚠️ important!! the return is const char*, so do not free it. do NOT. put your little hands down. it's not yours to free, bestie 😭
  • On error, it returns NULL. so like, check for that. please. 🙈

💜 EXAMPLES 💜

here's a whole lil program living her best life, calling all the CPU girlies at once:

#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;
}

look at her go. compile that, run that, screenshot that. 📸✨


⭐ CONFORMING TO ⭐

these functions are as per the withdrawn POSIX.1e draft specification. yes, withdrawn. she's giving vintage, she's giving archival, she's giving "we still love her". 💀

and these following ones are Linux extensions, not part of that draft:

  • kdk_cpu_get_vendor()
  • kdk_cpu_get_arch()
  • kdk_cpu_get_freq_MHz()
  • kdk_cpu_get_corenums()
  • kdk_cpu_get_virt()
  • kdk_cpu_get_process()

periodt. 👑


🧚 SEE ALSO 🧚

the whole friend group, fr fr:


and that's the page, bestie 💖 this one came from the Linux Programmer's Manual and it's dated Thu Aug 24 2023 — so yeah, a lil throwback, a lil vintage, still absolutely slaying. go read your CPU's model and tell her she's pretty. 🌸🦋💅

📦 where this page comes from