Lines Matching defs:procp

649 static bool claim_record(struct proc* procp, pid_t pid) {
650 if (procp->reg_pid == pid) {
654 if (procp->reg_pid == 0) {
656 procp->reg_pid = pid;
667 struct proc* procp = pidhash[i];
668 while (procp) {
669 if (procp->reg_pid == pid) {
670 procp->reg_pid = 0;
672 procp = procp->pidhash_next;
820 struct proc *procp;
822 for (procp = pidhash[pid_hashfn(pid)]; procp && procp->pid != pid;
823 procp = procp->pidhash_next)
826 return procp;
852 static void proc_slot(struct proc *procp) {
853 int adjslot = ADJTOSLOT(procp->oomadj);
855 adjslot_insert(&procadjslot_list[adjslot], &procp->asl);
858 static void proc_unslot(struct proc *procp) {
859 adjslot_remove(&procp->asl);
862 static void proc_insert(struct proc *procp) {
863 int hval = pid_hashfn(procp->pid);
865 procp->pidhash_next = pidhash[hval];
866 pidhash[hval] = procp;
867 proc_slot(procp);
872 struct proc *procp;
875 for (procp = pidhash[hval], prevp = NULL; procp && procp->pid != pid;
876 procp = procp->pidhash_next)
877 prevp = procp;
879 if (!procp)
883 pidhash[hval] = procp->pidhash_next;
885 prevp->pidhash_next = procp->pidhash_next;
887 proc_unslot(procp);
892 if (procp->pidfd >= 0 && procp->pidfd != last_kill_pid_or_fd) {
893 close(procp->pidfd);
895 free(procp);
1030 struct proc *procp;
1122 procp = pid_lookup(params.pid);
1123 if (!procp) {
1134 procp = static_cast<struct proc*>(calloc(1, sizeof(struct proc)));
1135 if (!procp) {
1140 procp->pid = params.pid;
1141 procp->pidfd = pidfd;
1142 procp->uid = params.uid;
1143 procp->reg_pid = cred->pid;
1144 procp->oomadj = params.oomadj;
1145 proc_insert(procp);
1147 if (!claim_record(procp, cred->pid)) {
1154 proc_unslot(procp);
1155 procp->oomadj = params.oomadj;
1156 proc_slot(procp);
1162 struct proc *procp;
1179 procp = pid_lookup(params.pid);
1180 if (!procp) {
1184 if (!claim_record(procp, cred->pid)) {
1193 * WARNING: After pid_remove() procp is freed and can't be used!
1201 struct proc *procp;
1210 procp = pidhash[i];
1211 while (procp) {
1212 next = procp->pidhash_next;
1214 if (claim_record(procp, cred->pid)) {
1215 pid_remove(procp->pid);
1217 procp = next;
1857 static void killinfo_log(struct proc* procp, int min_oom_score, int tasksize,
1861 android_log_write_int32(ctx, procp->pid);
1862 android_log_write_int32(ctx, procp->uid);
1863 android_log_write_int32(ctx, procp->oomadj);
2043 /* Kill one process specified by procp. Returns the size of the process killed */
2044 static int kill_one_process(struct proc* procp, int min_oom_score, int kill_reason,
2047 int pid = procp->pid;
2048 int pidfd = procp->pidfd;
2049 uid_t uid = procp->uid;
2100 inc_killcnt(procp->oomadj);
2102 killinfo_log(procp, min_oom_score, tasksize, kill_reason, mi, wi, tm);
2106 uid, procp->oomadj, tasksize * page_k, kill_desc);
2109 uid, procp->oomadj, tasksize * page_k);
2112 stats_write_lmk_kill_occurred(uid, taskname, procp->oomadj, min_oom_score, tasksize, mem_st);
2120 * WARNING: After pid_remove() procp is freed and can't be used!
2138 struct proc *procp;
2141 procp = kill_heaviest_task ?
2144 if (!procp)
2147 killed_size = kill_one_process(procp, min_score_adj, kill_reason, kill_desc,