Lines Matching defs:child

23 // Reap |child| process. This call blocks until completion.
24 void BlockingReap(pid_t child) {
25 const pid_t result = HANDLE_EINTR(waitpid(child, NULL, 0));
27 DPLOG(ERROR) << "waitpid(" << child << ", NULL, 0)";
31 // Waits for |timeout| seconds for the given |child| to exit and reap it. If
32 // the child doesn't exit within the time specified, kills it.
38 // the exited child. If the kqueue doesn't provide an exit event notification,
42 // A child process passed to this function may be in one of several states:
52 // collects the known-dying child, preventing zombies from congregating.
56 // function will forcibly kill and reap the child without delay. This
61 // The fact that this function seemingly can be called to wait on a child
63 // problem: a reaped child's pid can be reclaimed and may refer to a distinct
65 // to wait on a process that's not even a child is also a problem: kqueue will
66 // work in that case, but waitpid won't, and killing a non-child might not be
68 void WaitForChildToDie(pid_t child, int timeout) {
69 DCHECK(child > 0);
73 // |child| has been reaped. Specifically, even if a kqueue, kevent, or other
85 EV_SET(&change, child, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
90 DPLOG(ERROR) << "kevent (setup " << child << ")";
99 result = HANDLE_EINTR(waitpid(child, NULL, WNOHANG));
103 // the child. A result of -1 indicates case 2. The child has already
132 DPLOG(ERROR) << "kevent (wait " << child << ")";
134 DLOG(ERROR) << "kevent (wait " << child << "): unexpected result "
138 (event.ident == static_cast<uintptr_t>(child))) {
141 BlockingReap(child);
144 DLOG(ERROR) << "kevent (wait " << child
152 // The child is still alive, or is very freshly dead. Be sure by sending it
156 result = kill(child, SIGKILL);
158 DPLOG(ERROR) << "kill(" << child << ", SIGKILL)";
160 // The child is definitely on the way out now. BlockingReap won't need to
162 BlockingReap(child);