Lines Matching refs:pid
270 int pid = strtol(ptr, &ptr, 10);
272 if (pid == 0)
278 if (kill(pid, SIGKILL))
305 int cg_enter(const char *cgroup, int pid)
309 snprintf(pidbuf, sizeof(pidbuf), "%d", pid);
327 int pid, retcode;
329 pid = fork();
330 if (pid < 0) {
331 return pid;
332 } else if (pid == 0) {
340 waitpid(pid, &retcode, 0);
351 pid_t pid;
359 pid = sys_clone3(&args, sizeof(struct __clone_args));
365 if (pid < 0 && (errno == ENOSYS || errno == E2BIG))
368 return pid;
376 int clone_reap(pid_t pid, int options)
384 ret = waitid(P_PID, pid, &info, options | __WALL | __WNOTHREAD);
426 pid_t pid;
432 pid = clone_into_cgroup(cgroup_fd);
434 if (pid == 0)
437 return pid;
444 int pid;
446 pid = clone_into_cgroup_run_nowait(cgroup, fn, arg);
447 if (pid > 0)
448 return pid;
451 if (pid < 0 && errno != ENOSYS)
454 pid = fork();
455 if (pid == 0) {
464 return pid;
524 int set_oom_adj_score(int pid, int score)
529 sprintf(path, "/proc/%d/oom_score_adj", pid);
557 ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size)
562 if (!pid)
566 snprintf(path, sizeof(path), "/proc/%d/%s", pid, item);
572 int proc_read_strstr(int pid, bool thread, const char *item, const char *needle)
576 if (proc_read_text(pid, thread, item, buf, sizeof(buf)) < 0)
585 pid_t pid;
591 pid = clone_into_cgroup(cgroup_fd);
593 if (pid < 0)
596 if (pid == 0)
603 (void)clone_reap(pid, WEXITED);