KDK_PROC_FREEALL(3)
💖 KDK_PROC_FREEALL — bestie's guide to freeing all the strings 💖
okay so this is kdk_proc_freeall from the Library Functions Manual — and fr fr, its whole personality is: 用于回收字符串列表 ✨ (that's "used to recycle/reclaim a list of strings", for the monolingual girlies 🫶). Basically it's the cleanup crew for your char ** situations, and she ate 💅
🎀 NAME 🎀
kdk_proc_freeall — 用于回收字符串列表. she frees a list of strings, no cap 💖
✨ SYNOPSIS ✨
#include <libkyprocess.h>
extern inline void kdk_proc_freeall(char **ptr);
and don't forget to Link with -lkyrtinfo or nothing's gonna link, bestie 😭
🦋 Detailed Description 🦋
okay so the main character job of this interface is to recycle a list of strings of type char **. that's it. that's the whole vibe.
the argument ptr is a list of strings of type char ** 👑
not me saying char ** three times — that's just literally what the page says, and we respect the source 💅
🌸 RETURN VALUE 🌸
No return value. she gives you nothing back and honestly? iconic. she did her job and left 🧚
⭐ EXAMPLES ⭐
here's the full example, copied exactly, no edits, no notes, we don't touch the code:
#include "libkyprocess.h"
#include <stdio.h>
#include <stdlib.h>
int main()
{
char *run_time = kdk_get_process_running_time(841);
char *cpu_time = kdk_get_process_cpu_time(841);
char *cmd = kdk_get_process_command(841);
char *start_time = kdk_get_process_start_time(841);
printf("获取某一进程的CPU利用率:%0.1f0, kdk_get_process_cpu_usage_percent(841));
printf("获取某一进程的内存占用率:%0.1f0, kdk_get_process_mem_usage_percent(841));
printf("获取某一进程的进程状态:%s0, kdk_get_process_status(841));
printf("获取某一进程的进程端口号:%d0, kdk_get_process_port(841));
printf("获取某一进程的启动时间:%s0, start_time);
printf("获取某一进程的运行时间:%s0, run_time);
printf("获取某一进程的CPU时间:%s0, cpu_time);
printf("获取某一进程的Command:%s0, cmd);
printf("获取某一进程的属主:%s0, kdk_get_process_user(841));
free(run_time);
free(cpu_time);
free(cmd);
free(start_time);
char** pid = kdk_procname_get_process_infomation("systemd");
size_t index = 0;
while (pid[index])
{
printf("pid %s0, pid[index]);
index ++;
}
kdk_proc_freeall(pid);
char** info = kdk_get_process_all_information();
size_t count = 0;
while (info[count])
{
printf("No. %d %s0, count + 1, info[count]);
count ++;
}
kdk_proc_freeall(info);
char *name = kdk_get_process_name(1151571);
printf("name = %s0, name);
free(name);
int id = kdk_get_process_id("systemd");
printf("pid %d0, id);
return 0;
}
see how kdk_proc_freeall(pid); and kdk_proc_freeall(info); just show up after the loops? that's her moment. she clears the whole list so you don't have to free every single string yourself. main character energy fr 😌💅
🌈 CONFORMING TO 🌈
These functions are as per the withdrawn POSIX.1e draft specification. (withdrawn! gone! ghosted! 💀)
and the following functions are Linux extensions:
kdk_get_process_name()kdk_get_process_id()kdk_get_process_cpu_usage_percent()kdk_get_process_mem_usage_percent()kdk_get_process_status()kdk_get_process_port()kdk_get_process_start_time()kdk_get_process_running_time()kdk_get_process_cpu_time()kdk_get_process_command()kdk_get_process_user()kdk_procname_get_process_infomation()kdk_get_process_all_information()
👑 SEE ALSO 👑
go read these next, bestie, they're all in the same friend group:
kdk_get_process_name(3)kdk_get_process_id(3)kdk_get_process_cpu_usage_percent(3)kdk_get_process_mem_usage_percent(3)kdk_get_process_status(3)kdk_get_process_port()kdk_get_process_start_time(3)kdk_get_process_running_time(3)kdk_get_process_cpu_time(3)kdk_get_process_command(3)kdk_get_process_user(3)kdk_procname_get_process_infomation(3)kdk_get_process_all_information(3)
💜 and that's the whole page, babe. this one came from the Linux Programmer's Manual, dated Mon Sep 18 2023 — so when you're done freeing all your strings, say thank you to the 2023 girlies who wrote it down. periodt. 💜
📦 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