Lines Matching refs:children
155 * The early_child/children array below is used for tracking children of the
191 static struct early_child *children;
219 /* Allocate and initialise the children array */
225 children = xcalloc(options.max_startups, sizeof(*children));
227 children[i].pipefd = -1;
228 children[i].pid = -1;
232 /* Register a new connection in the children array; child pid comes later */
244 if (children[i].pipefd != -1 ||
245 children[i].config != NULL ||
246 children[i].keys != NULL ||
247 children[i].pid > 0)
249 child = &(children[i]);
278 fatal_f("internal error: more children than max_startups");
329 if (children == NULL || pid <= 0)
332 if (children[i].pid == pid) {
333 children[i].have_status = 1;
334 children[i].status = status;
435 /* Reap all children that have exited; called after SIGCHLD */
443 if (children == NULL)
460 if (!children[i].have_status)
462 child_reap(&(children[i]));
471 if (children == NULL)
474 if (children[i].pipefd != -1)
475 child_close(&(children[i]), 1, 1);
487 if (children == NULL)
491 if (children[i].pipefd == -1 && children[i].pid <= 0)
493 if (children[i].config)
495 else if (children[i].keys)
497 else if (children[i].early)
501 logit("child %d: fd=%d pid=%ld %s%s", i, children[i].pipefd,
502 (long)children[i].pid, children[i].id, child_status);
990 debug("Received SIGHUP; waiting for children");
1007 if (children[i].pipefd != -1) {
1008 pfd[npfd].fd = children[i].pipefd;
1010 if (children[i].config != NULL ||
1011 children[i].keys != NULL)
1029 if (children[i].pipefd == -1 ||
1033 if (children[i].config)
1034 buf = children[i].config;
1035 else if (children[i].keys)
1036 buf = children[i].keys;
1043 ret = write(children[i].pipefd, ptr, len);
1047 if (children[i].early)
1049 child_close(&(children[i]), 0, 0);
1055 if (children[i].config == buf) {
1057 children[i].config = NULL;
1058 children[i].keys = pack_hostkeys();
1059 } else if (children[i].keys == buf) {
1061 children[i].keys = NULL;
1072 if (children[i].pipefd == -1 ||
1076 switch (read(children[i].pipefd, &c, sizeof(c))) {
1082 "read %s", i, children[i].pipefd,
1088 if (children[i].early)
1091 (long)children[i].pid, children[i].id);
1092 child_close(&(children[i]), 0, 0);
1095 if (children[i].config) {
1098 i, children[i].pipefd);
1101 if (children[i].early && c == '\0') {
1104 children[i].early = 0;
1106 "config", (long)children[i].pid,
1107 children[i].id);
1108 } else if (!children[i].early && c == '\001') {
1111 (long)children[i].pid,
1112 children[i].id);
1113 child_close(&(children[i]), 1, 0);
1117 (int)c, (long)children[i].pid,
1118 children[i].id, children[i].early);
1120 if (children[i].early)
1122 if (children[i].pid > 0)
1123 kill(children[i].pid, SIGTERM);
1124 child_close(&(children[i]), 0, 0);