Skip to content

en_get_pid

伏秋洛 edited this page Jun 17, 2023 · 1 revision

preface

What is pid?

A: In Linux, PID is an abbreviation for Process ID, used to uniquely identify the running process. Each running process has a unique PID that can be used to identify and control the process. In Linux, PID is an integer value that is usually assigned starting from 1. When a process starts, the kernel assigns a new PID to it and stores it in the Process Control Block (PCB). You can use commands such as ps and top to view the running process and its PID. PID is also widely used in inter process communication (IPC) and process management in Linux.

Example

#include <iostream>
#include "proc.h"

std::string packageName = "bin.mt.plus";
auto pid = hak::find_process(packageName);
std::cout << "pid = " << pid << "\n";