Lines Matching refs:child
36 s->child.pidfd >= 0 && in EVENT_SOURCE_WATCH_PIDFD()
37 s->child.options == WEXITED; in EVENT_SOURCE_WATCH_PIDFD()
485 if (!s->child.registered) in source_child_pidfd_unregister()
489 if (epoll_ctl(s->event->epoll_fd, EPOLL_CTL_DEL, s->child.pidfd, NULL) < 0) in source_child_pidfd_unregister()
493 s->child.registered = false; in source_child_pidfd_unregister()
508 s->child.registered ? EPOLL_CTL_MOD : EPOLL_CTL_ADD, in source_child_pidfd_register()
509 s->child.pidfd, &ev) < 0) in source_child_pidfd_register()
513 s->child.registered = true; in source_child_pidfd_register()
858 s->child.process_owned = false; in source_disconnect()
860 if (s->child.pid > 0) { in source_disconnect()
866 (void) hashmap_remove(s->event->child_sources, PID_TO_PTR(s->child.pid)); in source_disconnect()
958 if (s->child.process_owned) { in source_free()
960 if (!s->child.exited) { in source_free()
963 if (s->child.pidfd >= 0) { in source_free()
964 … if (pidfd_send_signal(s->child.pidfd, SIGKILL, NULL, 0) < 0) { in source_free()
969 s->child.pid); in source_free()
975 if (kill(s->child.pid, SIGKILL) < 0) in source_free()
978 s->child.pid); in source_free()
981 if (!s->child.waited) { in source_free()
985 (void) waitid(P_PID, s->child.pid, &si, WEXITED); in source_free()
989 if (s->child.pidfd_owned) in source_free()
990 s->child.pidfd = safe_close(s->child.pidfd); in source_free()
1435 s->child.options = options; in sd_event_add_child()
1436 s->child.callback = callback; in sd_event_add_child()
1444 s->child.pidfd = pidfd_open(pid, 0); in sd_event_add_child()
1445 if (s->child.pidfd < 0) { in sd_event_add_child()
1450 … s->child.pidfd_owned = true; /* If we allocate the pidfd we own it by default */ in sd_event_add_child()
1452 s->child.pidfd = -1; in sd_event_add_child()
1474 s->child.pid = pid; in sd_event_add_child()
1531 s->child.pidfd = pidfd; in sd_event_add_child_pidfd()
1532 s->child.pid = pid; in sd_event_add_child_pidfd()
1533 s->child.options = options; in sd_event_add_child_pidfd()
1534 s->child.callback = callback; in sd_event_add_child_pidfd()
1535 …s->child.pidfd_owned = false; /* If we got the pidfd passed in we don't own it by default (similar… in sd_event_add_child_pidfd()
2715 *pid = s->child.pid; in sd_event_source_get_child_pid()
2724 if (s->child.pidfd < 0) in sd_event_source_get_child_pidfd()
2727 return s->child.pidfd; in sd_event_source_get_child_pidfd()
2739 if (s->child.exited) in sd_event_source_send_child_signal()
2742 if (s->child.pidfd >= 0) { in sd_event_source_send_child_signal()
2750 if (pidfd_send_signal(s->child.pidfd, sig, si ? © : NULL, 0) < 0) { in sd_event_source_send_child_signal()
2767 if (rt_sigqueueinfo(s->child.pid, sig, ©) < 0) in sd_event_source_send_child_signal()
2769 } else if (kill(s->child.pid, sig) < 0) in sd_event_source_send_child_signal()
2779 if (s->child.pidfd < 0) in sd_event_source_get_child_pidfd_own()
2782 return s->child.pidfd_owned; in sd_event_source_get_child_pidfd_own()
2789 if (s->child.pidfd < 0) in sd_event_source_set_child_pidfd_own()
2792 s->child.pidfd_owned = own; in sd_event_source_set_child_pidfd_own()
2800 return s->child.process_owned; in sd_event_source_get_child_process_own()
2807 s->child.process_owned = own; in sd_event_source_set_child_process_own()
3252 if (s->child.exited) in process_child()
3260 zero(s->child.siginfo); in process_child()
3261 if (waitid(P_PID, s->child.pid, &s->child.siginfo, in process_child()
3262 … WNOHANG | (s->child.options & WEXITED ? WNOWAIT : 0) | s->child.options) < 0) in process_child()
3265 if (s->child.siginfo.si_pid != 0) { in process_child()
3266 … bool zombie = IN_SET(s->child.siginfo.si_code, CLD_EXITED, CLD_KILLED, CLD_DUMPED); in process_child()
3269 s->child.exited = true; in process_child()
3271 if (!zombie && (s->child.options & WEXITED)) { in process_child()
3276 assert(s->child.options & (WSTOPPED|WCONTINUED)); in process_child()
3277 …(void) waitid(P_PID, s->child.pid, &s->child.siginfo, WNOHANG|(s->child.options & (WSTOPPED|WCONTI… in process_child()
3308 zero(s->child.siginfo); in process_pidfd()
3309 … if (waitid(P_PID, s->child.pid, &s->child.siginfo, WNOHANG | WNOWAIT | s->child.options) < 0) in process_pidfd()
3312 if (s->child.siginfo.si_pid == 0) in process_pidfd()
3315 if (IN_SET(s->child.siginfo.si_code, CLD_EXITED, CLD_KILLED, CLD_DUMPED)) in process_pidfd()
3316 s->child.exited = true; in process_pidfd()
3609 zombie = IN_SET(s->child.siginfo.si_code, CLD_EXITED, CLD_KILLED, CLD_DUMPED); in source_dispatch()
3611 r = s->child.callback(s, &s->child.siginfo, s->userdata); in source_dispatch()
3615 (void) waitid(P_PID, s->child.pid, &s->child.siginfo, WNOHANG|WEXITED); in source_dispatch()
3616 s->child.waited = true; in source_dispatch()