KDK_REAL_G...EMPERATURE(3)

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

🎀 KDK_REAL_G...EMPERATURE(3) 🎀

okay bestie, sit down, hydrate, because we're reading a Library Functions Manual page together and honestly? it's giving realtime-info realness. This one's all about kdk_real_get_cpu_temperature, and yes the manual page title is literally KDK_REAL_G...EMPERATURE(3) because sometimes manpage titles just get truncated mid-word and we move on 💅


✨ NAME ✨

kdk_real_get_cpu_temperature — 获取CPU温度

no cap, that's the whole name section. it's short. it's iconic. it knows what it is 🫶

🌸 SYNOPSIS 🌸

#include <libkyrealtimeinfo.h>

extern double kdk_real_get_cpu_temperature();

Link with -lkyrealtime.

so like, you #include <libkyrealtimeinfo.h>, you declare the thing as extern double kdk_real_get_cpu_temperature();, and when you build you gotta link with -lkyrealtime. don't skip that part, the linker WILL make it everyone's problem 😭


💫 Detailed Description 💫

The main function of the interface is to obtain the CPU temperature.

that's it. that's the whole vibe. the interface's main character function is literally just get the CPU temperature. lowkey obsessed with how direct that is. no side quests, no lore, just temperature 🍓


🔥 RETURN VALUE 🔥

  • On success — returns the CPU temperature, and the type is double.
  • On error — returns -1.

so if you get a double back, slay, that's your temp. if you get -1, that's not a temperature, bestie, that's a cry for help 💀


🦋 EXAMPLES 🦋

here's the example, copied exactly, typos and all, because we do not edit the sacred text:

#include "stdio.h"
#include "libkyrealtimeinfo.h"

int main()
{
    // if(argc < 3)
    // {
    //     printf("./kyrealtime-test <网卡名> <磁盘名>0);
    //     return 0;
    // }
    printf("netSpeed : %f0, kdk_real_get_net_speed("enaftgm1i0"));
    printf("cpuTemp: %f0, kdk_real_get_cpu_temperature());
    printf("diskTemp : %d0, kdk_real_get_disk_temperature("/dev/nvme0n1"));
    printf("diskRate : %d0, kdk_real_get_disk_rate("/dev/nvme0n1"));
    printf("ifnetSpeed : %f0, kdk_real_get_if_speed("enaftgm1i0"));
    return 0;
}

okay yes the quoting in there is a little unhinged and the %f0 situation is a whole thing, but that is exactly what the page says, so we're keeping it, periodt. not me rewriting the example and accidentally inventing new behaviour 🙈


🌈 CONFORMING TO 🌈

These functions are as per the withdrawn POSIX.1e draft specification.

and then the plot twist: The following functions are Linux extensions:

  • kdk_real_get_net_speed()
  • kdk_real_get_disk_temperature()
  • kdk_real_get_disk_rate()
  • kdk_real_get_if_speed()

so that's the group chat. the CPU temperature one rides with the POSIX.1e draft crowd, and those four are the Linux-extension girlies 🧚


💜 SEE ALSO 💜

go read them, they're the same friend group, iykyk ✨


okay that's the whole page!! written by the Linux Programmer's Manual, dated Tue Sep 19 2023, and honestly the date is giving vintage but the energy is eternal. mwah, go read your temps responsibly 💖

📦 where this page comes from