Lines Matching refs:child
199 static void free_child PARAMS ((struct child *));
200 static void start_job_command PARAMS ((struct child *child));
202 static int job_next_command PARAMS ((struct child *));
203 static int start_waiting_job PARAMS ((struct child *));
208 struct child *children = 0;
220 static struct child *waiting_jobs = 0;
408 /* Handle a dead child. This handler may or may not ever be installed.
444 state (`cs_finished') in the `file' member of the `struct child' for the
445 dead child, and removing the child from the chain. In addition, if BLOCK
447 complete child, waiting for it to die if necessary. If ERR is nonzero,
467 We have at least one child outstanding OR a shell function in progress,
469 We're blocking for a complete child OR there are more children to reap
479 register struct child *lastc, *c;
496 /* We have one less dead child to reap. As noted in
509 longer than necessary to reap a child, and lose some parallelism;
522 DB (DB_JOBS, (_("Live child %p (%s) PID %ld %s\n"),
537 /* We got a remote child. */
573 /* We got a child exit; chop the status word up. */
590 /* Now try a blocking wait for a remote child. */
598 /* We got a remote child. */
677 /* Check if this is the child of the `shell' function. */
690 /* Search for a child matching the deceased one. */
697 /* An unknown child died.
702 ? _("Reaping losing child %p PID %ld %s\n")
703 : _("Reaping winning child 0x%08lx PID %ld %s\n"),
719 /* If this child had the good stdin, say it is now free. */
773 about to put that child on the chain. But it is
775 arrive now; it will clean up this child's targets. */
806 DB (DB_JOBS, (_("Removing child %p PID %ld%s from chain.\n"),
812 a fatal signal arriving after the child is off the chain and
813 before job_slots_used is decremented would believe a child was
821 /* Remove the child from the chain and free it. */
838 /* Only block for one child. */
846 /* Free the storage allocated for CHILD. */
849 free_child (struct child *child)
852 fatal (NILF, "INTERNAL: Freeing child %p (%s) but no tokens left!\n",
853 child, child->file->name);
855 /* If we're using the jobserver and this child is not the only outstanding
869 DB (DB_JOBS, (_("Released token for child %p (%s).\n"),
870 child, child->file->name));
878 if (child->command_lines != 0)
881 for (i = 0; i < child->file->cmds->ncommand_lines; ++i)
882 free (child->command_lines[i]);
883 free ((char *) child->command_lines);
886 if (child->environment != 0)
888 register char **ep = child->environment;
891 free ((char *) child->environment);
894 free ((char *) child);
929 /* Set the child handler action flags to FLAGS. */
936 /* The child handler must be turned off here. */
965 /* Start a job to run the commands specified in CHILD.
966 CHILD is updated to reflect the commands and ID of the child process.
969 for calling `unblock_sigs', once the new child is safely on the chain so
973 start_job_command (struct child *child)
987 if (!child->command_ptr)
992 flags = (child->file->command_flags
993 | child->file->cmds->lines_flags[child->command_line - 1]);
995 p = child->command_ptr;
996 child->noerror = ((flags & COMMANDS_NOERROR) != 0);
1005 child->noerror = 1;
1017 child->file->cmds->lines_flags[child->command_line - 1]
1027 argv = construct_command_argv (p, &end, child->file, &child->sh_batch_file);
1030 child->command_ptr = NULL;
1034 child->command_ptr = end;
1048 child->file->update_status = 1;
1049 notice_finished_file (child->file);
1074 if (job_next_command (child))
1075 start_job_command (child);
1080 set_command_state (child->file, cs_running);
1081 child->file->update_status = 0;
1082 notice_finished_file (child->file);
1161 child's descriptor table. When it is dup2'd onto descriptor 0,
1169 /* Decide whether to give this child the `good' standard input
1173 child->good_stdin = !good_stdin_used;
1174 if (child->good_stdin)
1179 child->deleted = 0;
1182 /* Set up the environment for the child. */
1183 if (child->environment == 0)
1184 child->environment = target_environment (child->file);
1190 /* start_waiting_job has set CHILD->remote if we can start a remote job. */
1191 if (child->remote)
1194 if (start_remote_job (argv, child->environment,
1195 child->good_stdin ? 0 : bad_stdin,
1202 if (child->good_stdin && !used_stdin)
1204 child->good_stdin = 0;
1207 child->remote = is_remote;
1208 child->pid = id;
1214 /* Fork the child process. */
1221 child->remote = 0;
1224 if (!child_execute_job (argv, child)) {
1246 child->pid = child_execute_job (child->good_stdin ? 0 : bad_stdin, 1,
1247 argv, child->environment);
1248 if (child->pid < 0)
1256 /* undo CLOSE_ON_EXEC() after the child process has been started */
1267 child->pid = vfork ();
1268 environ = parent_environ; /* Restore value child may have clobbered. */
1269 if (child->pid == 0)
1271 /* We are the child side. */
1284 child_execute_job (child->good_stdin ? 0 : bad_stdin, 1,
1285 argv, child->environment);
1287 else if (child->pid < 0)
1317 environ = child->environment;
1336 proc_return = spawnvpe (P_WAIT, argv[0], argv, child->environment);
1340 dos_command_running, so that child's signals
1345 /* If the child got a signal, dos_status has its
1352 child->pid = dos_pid++;
1359 child->pid = amiga_pid++;
1381 hPID = process_easy(argv, child->environment);
1384 child->pid = (intptr_t) hPID;
1406 set_command_state (child->file, cs_running);
1408 /* Free the storage used by the child's argument list. */
1417 child->file->update_status = 2;
1418 notice_finished_file (child->file);
1422 /* Try to start a child running.
1423 Returns nonzero if the child was started (and maybe finished), or zero if
1424 the load was too high and the child was put on the `waiting_jobs' chain. */
1427 start_waiting_job (struct child *c)
1446 /* Put this child on the chain of children waiting for the load average
1461 DB (DB_JOBS, (_("Putting child %p (%s) PID %ld%s on the chain.\n"),
1488 /* Create a `struct child' for FILE and start its commands running. */
1494 register struct child *c;
1611 `struct child', and add that to the chain. */
1613 c = (struct child *) xmalloc (sizeof (struct child));
1614 bzero ((char *)c, sizeof (struct child));
1635 starting the child. */
1671 the read(2) call is entered, below, where if a child dies we won't
1678 way, if a child dies during the section mentioned above, the
1701 /* There must be at least one child already, or we have no business
1715 DB (DB_JOBS, (_("Obtained token for child 0x%08lx (%s).\n"),
1738 Wait for the child to die, setting the state to `cs_finished'. */
1746 /* Move CHILD's pointers to the next command for it to execute.
1750 job_next_command (struct child *child)
1752 while (child->command_ptr == 0 || *child->command_ptr == '\0')
1755 if (child->command_line == child->file->cmds->ncommand_lines)
1758 child->command_ptr = 0;
1763 child->command_ptr = child->command_lines[child->command_line++];
1877 struct child *job;
1902 /* EMX: Start a child process. This function returns the new pid. */
1919 /* Close unnecessary file handles for the child. */
1925 /* Connect the pipes to the child process. */
1990 /* EMX: This function returns the pid of the child process. */
2033 /* wait and reap last child */
2055 _("make reaped child pid %lld, still waiting for pid %lld\n"),
2059 /* return child's exit code as our exit code */
2227 not be expanded if we call the child via `spawnXX'.