KDK_RTI_GE..._TOTAL_KIB(3)
💖 kdk_rti_get_mem_swap_total_KiB — bestie, it's giving swap size ✨
okay so real talk, this is a page from the Library Functions Manual, and it's about exactly one little function in libkyrtinfo. Her whole job? Tell you how big your Swap partition is, total. That's it. She's not nosy, she's not doing extra credit, she's just handing you a number. 🎀
🦋 NAME 🦋
kdk_rti_get_mem_swap_total_KiB — 获取系统中Swap分区总大小 (aka: get the total size of the Swap partition on your system, no cap)
✨ SYNOPSIS ✨
#include <libkyrtinfo.h>
extern unsigned long kdk_rti_get_mem_swap_total_KiB();
Link with -lkyrtinfo. yes bestie you literally have to link it, she will not appear out of thin air 💅
🌸 DETAILED DESCRIPTION 🌸
The main character energy of this interface is super simple: it gets you the total size of the Swap partition in the system. That's the whole plot. No subplot, no twist, just swap total. 🫶
🔥 RETURN VALUE 🔥
- On success, it returns the Swap partition size as an
unsigned long. The unit is KiB, okay? not bytes, not MiB, KiB. Write it down. 📝 - On error, it returns
0. Which is lowkey tragic but that's the contract.
heads up: 0 means error here, so don't go reading it as "wow zero swap" without checking yourself first. 🙈
🍓 EXAMPLES 🍓
here's the whole vibe in one file, go off:
#include "libkyrtinfo.h"
#include <stdio.h>
int main()
{
printf("内存总大小:%lu KiB0, kdk_rti_get_mem_res_total_KiB());
printf("当前已用内存:%lu KiB,%f0, kdk_rti_get_mem_res_usage_KiB(), kdk_rti_get_mem_res_usage_percent());
printf("当前空闲内存:%lu KiB0, kdk_rti_get_mem_res_free_KiB());
printf("可用内存大小:%lu KiB0, kdk_rti_get_mem_res_available_KiB());
printf("应用总申请虚拟内存大小:%lu KiB0, kdk_rti_get_mem_virt_alloc_KiB());
printf("交换分区总量:%lu KiB0, kdk_rti_get_mem_swap_total_KiB());
printf("交换分区已用量:%lu KiB, %f0, kdk_rti_get_mem_swap_usage_KiB(), kdk_rti_get_mem_swap_usage_percent());
printf("交换分区剩余大小:%lu KiB0, kdk_rti_get_mem_swap_free_KiB());
printf("当前CPU使用率:%f0, kdk_rti_get_cpu_current_usage());
unsigned int day, hour, min, sec;
kdk_rti_get_uptime(&day, &hour, &min, &sec);
printf("开机时长:%u天%u小时%u分钟%u秒0, day, hour, min, sec);
return 0;
}
like, it's a whole tour of the memory-and-CPU situation and your girl kdk_rti_get_mem_swap_total_KiB() is right there in the middle of it, holding it down. 👑
💜 CONFORMING TO 💜
These functions are as per the withdrawn POSIX.1e draft specification. (yes, withdrawn. it's giving vintage. 🕰️)
The following functions are Linux extensions:
kdk_rti_get_mem_res_total_KiB()kdk_rti_get_mem_res_usage_percent()kdk_rti_get_mem_res_usage_KiB()kdk_rti_get_mem_res_available_KiB()kdk_rti_get_mem_res_free_KiB()kdk_rti_get_mem_virt_alloc_KiB()kdk_rti_get_mem_swap_usage_percent()kdk_rti_get_mem_swap_usage_KiB()kdk_rti_get_mem_swap_free_KiB()kdk_rti_get_cpu_current_usage()kdk_rti_get_uptime()
🌈 SEE ALSO 🌈
the whole friend group, fr fr:
kdk_rti_get_mem_res_total_KiB(3)kdk_rti_get_mem_res_usage_percent(3)kdk_rti_get_mem_res_usage_KiB(3)kdk_rti_get_mem_res_available_KiB(3)kdk_rti_get_mem_res_free_KiB(3)kdk_rti_get_mem_virt_alloc_KiB()kdk_rti_get_mem_swap_usage_percent(3)kdk_rti_get_mem_swap_usage_KiB(3)kdk_rti_get_mem_swap_free_KiB(3)kdk_rti_get_cpu_current_usage(3)kdk_rti_get_uptime(3)
and that's the page bestie!! 🎀 this one came straight out of the Linux Programmer's Manual, dated Mon Sep 18 2023. go get that swap number, ily, mwah 💋✨
📦 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