KDK_GET_PROCESS_ID(3) Library Functions Manual KDK_GET_PROCESS_ID(3) NAME kdk_get_process_id - id SYNOPSIS #include extern int kdk_get_process_id(char *proc_name); Link with -lkyrtinfo. Detailed Description The main function of the interface is to obtain the PID of the specified process. The argument proc_num is the name of the process. RETURN VALUE On success, returns the PID of the process of type int. On error, return 0. EXAMPLES #include "libkyprocess.h" #include #include 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; } CONFORMING TO These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: kdk_get_process_name(), 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() and kdk_proc_freeall(). SEE ALSO kdk_get_process_name(3), kdk_get_process_cpu_usage_percent(3), kdk_get_process_mem_usage_percent(3), kdk_get_process_status(3), kdk_get_process_port(3), kdk_get_process_start_time(), 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 kdk_proc_freeall(3). Linux Programmer's Manual Mon Sep 18 2023 KDK_GET_PROCESS_ID(3)