KDK_RTI_GET_MEM_SWAP_FREE_KIB(3)
💖 NAME 💖
kdk_rti_get_mem_swap_free_KiB — 获取Swap分区空闲大小 ✨
okay so bestie, this is a little function from the Library Functions Manual, and its whole entire job is: tell you how much free space your Swap partition has. that's it. that's the gig. 🫶
🌸 SYNOPSIS 🌸
#include <libkyrtinfo.h>
extern unsigned long kdk_rti_get_mem_swap_free_KiB();
Link with -lkyrtinfo.
so you include <libkyrtinfo.h>, you get an extern unsigned long function called kdk_rti_get_mem_swap_free_KiB() that takes literally no arguments (not me showing up empty-handed 💅), and then you link against -lkyrtinfo like a good little programmer. no cap.
🦋 Detailed Description 🦋
The main function of the interface is to obtain the free size of the Swap partition. 💾✨
like... that's literally what it does. it looks at your Swap partition and reports back how much room is left in there. iconic behaviour honestly. 👑
⭐ RETURN VALUE ⭐
- on success — it hands you back the free size of the Swap partition as an
unsigned long. the unit is KiB bestie, don't forget, iykyk. 📏 - on error — it returns
0. that's your "something went sideways" signal, fr fr. 😭
🎀 EXAMPLES 🎀
here's the whole vibe, a full little main() showing off the whole fam of functions:
#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;
}
the line you actually care about for this page is the 交换分区剩余大小 one, where kdk_rti_get_mem_swap_free_KiB() slides in. the rest is just the whole squad showing up to the party. 🎉
💜 CONFORMING TO 💜
These functions are as per the withdrawn POSIX.1e draft specification. (withdrawn, bestie, so don't go expecting it at the standards party 💀)
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_total_KiB()kdk_rti_get_mem_swap_usage_percent()kdk_rti_get_mem_swap_usage_KiB()kdk_rti_get_cpu_current_usage()kdk_rti_get_uptime()
🌈 SEE ALSO 🌈
the whole friend group, go say hi 👋:
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_total_KiB(3)kdk_rti_get_mem_swap_usage_percent(3)kdk_rti_get_mem_swap_usage_KiB(3)kdk_rti_get_cpu_current_usage(3)kdk_rti_get_uptime(3)
and that's the whole page bestie!! 💖 this one comes to you from the Linux Programmer's Manual, dated Mon Sep 18 2023, and it lives under the name KDK_RTI_GET_MEM_SWAP_FREE_KIB(3). go check your swap, stay hydrated, 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