KDK_CPU_GET_VENDOR(3)

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

💖 KDK_CPU_GET_VENDOR 💖

okay bestie, gather round, because we're about to meet kdk_cpu_get_vendor(3) — the lil library function that tells you who actually made your CPU. no cap. it's part of the libkycpu family and she's the one who walks up to your processor and goes "so... who ARE you? 👑"


🌸 NAME 🌸

kdk_cpu_get_vendor — 获取CPU制造厂商

like, literally, it gets you the CPU manufacturer. that's the whole job. and she does it flawlessly. 💅


✨ SYNOPSIS ✨

#include <libkycpu.h>

extern const char* kdk_cpu_get_vendor();

and bestie, listen — you gotta Link with -lkyhw. do NOT forget it or the linker will simply ghost you. 😭


🦋 Detailed Description 🦋

the main character function of this interface is to obtain the CPU manufacturer. that's it. that's the vibe. one job, done gorgeously. ✨


🎀 RETURN VALUE 🎀

  • on success — she hands you the CPU manufacturer as a char*, like for example "GenuineIntel". iconic name, honestly. the return is const char*, so do not free it. like. do not. it's not yours to free, she's borrowing it from somewhere else. 🙈
  • on error — you get NULL. and then you have to deal with your feelings about it.

🌈 EXAMPLES 🌈

here's the whole squad showing up in one file, being cute and printing everything:

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

not me getting emotional over a struct-free printf dump 🥹 she ate fr fr.


💜 CONFORMING TO 💜

these functions are as per the withdrawn POSIX.1e draft specification. (withdrawn!! she's vintage, she's archival, she's a limited edition 🎀)

and 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_virt()
  • kdk_cpu_get_process()

so yeah, they're Linux-only, iykyk. 🐧


👑 SEE ALSO 👑

go read the whole friend group, they're all linked together like a group chat:


quick vibe check: the pointer you get back is const char* and you do not free it. on error you get NULL. that's the whole deal, no notes. 💖

and that's the page, bestie!! ✨ this one comes to you from the Linux Programmer's Manual, dated Thu Aug 24 2023, and she's filed under KDK_CPU_GET_VENDOR(3) — go forth and identify every processor you meet 🦋💅🌸

📦 where this page comes from