MCPcopy Create free account
hub / github.com/F-Stack/f-stack / reap_status

Function reap_status

freebsd/kern/kern_procctl.c:165–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165static int
166reap_status(struct thread *td, struct proc *p,
167 struct procctl_reaper_status *rs)
168{
169 struct proc *reap, *p2, *first_p;
170
171 sx_assert(&proctree_lock, SX_LOCKED);
172 bzero(rs, sizeof(*rs));
173 if ((p->p_treeflag & P_TREE_REAPER) == 0) {
174 reap = p->p_reaper;
175 } else {
176 reap = p;
177 rs->rs_flags |= REAPER_STATUS_OWNED;
178 }
179 if (reap == initproc)
180 rs->rs_flags |= REAPER_STATUS_REALINIT;
181 rs->rs_reaper = reap->p_pid;
182 rs->rs_descendants = 0;
183 rs->rs_children = 0;
184 if (!LIST_EMPTY(&reap->p_reaplist)) {
185 first_p = LIST_FIRST(&reap->p_children);
186 if (first_p == NULL)
187 first_p = LIST_FIRST(&reap->p_reaplist);
188 rs->rs_pid = first_p->p_pid;
189 LIST_FOREACH(p2, &reap->p_reaplist, p_reapsibling) {
190 if (proc_realparent(p2) == reap)
191 rs->rs_children++;
192 rs->rs_descendants++;
193 }
194 } else {
195 rs->rs_pid = -1;
196 }
197 return (0);
198}
199
200static int
201reap_getpids(struct thread *td, struct proc *p, struct procctl_reaper_pids *rp)

Callers 1

kern_procctl_singleFunction · 0.85

Calls 2

bzeroFunction · 0.85
proc_realparentFunction · 0.85

Tested by

no test coverage detected