Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想创建一个这样的功能,但有优先权。为此,我需要 pid,但我不知道如何获取它。任何想法?
我的是使用setpriority (0, pid, value),但我需要 pid。
setpriority (0, pid, value)
void cmd_exec(char * tr[]) { if (execvp(tr[0], tr)== -1) perror("Error"); }
要获取调用进程的进程 ID,请使用getpid().
getpid()
请找到
Linux 手册页在这里。
当前(问题 7)POSIX 文档在这里。