在这个程序中,我使用 execv 启动另一个进程。
if (fork() == 0) {
struct rlimit limits;
limits.rlim_cur = 10000000; // set data segment limit to 10MB
limits.rlim_max = 10000000; // make sure the child can't increase it again
setrlimit(RLIMIT_DATA, &limits);
execv(...);
}
如何获取已启动程序的 pid?