return pi->cmdtext;
}
-static void insert_bg_job(struct pipe *pi)
+static void insert_job_into_table(struct pipe *pi)
{
struct pipe *job, **jobp;
int i;
G.last_jobid = job->jobid;
}
-static void remove_bg_job(struct pipe *pi)
+static void remove_job_from_table(struct pipe *pi)
{
struct pipe *prev_pipe;
}
/* Remove a backgrounded job */
-static void delete_finished_bg_job(struct pipe *pi)
+static void delete_finished_job(struct pipe *pi)
{
- remove_bg_job(pi);
+ remove_job_from_table(pi);
free_pipe(pi);
}
#endif /* JOB */
if (G_interactive_fd) {
#if ENABLE_HUSH_JOB
if (fg_pipe->alive_cmds != 0)
- insert_bg_job(fg_pipe);
+ insert_job_into_table(fg_pipe);
#endif
return rcode;
}
if (G_interactive_fd)
printf(JOB_STATUS_FORMAT, pi->jobid,
"Done", pi->cmdtext);
- delete_finished_bg_job(pi);
+ delete_finished_job(pi);
//bash deletes finished jobs from job table only in interactive mode, after "jobs" cmd,
//or if pid of a new process matches one of the old ones
//(see cleanup_dead_jobs(), delete_old_job(), J_NOTIFIED in bash source).
* I'm NOT treating inner &'s as jobs */
#if ENABLE_HUSH_JOB
if (G.run_list_level == 1)
- insert_bg_job(pi);
+ insert_job_into_table(pi);
#endif
/* Last command's pid goes to $! */
G.last_bg_pid = pi->cmds[pi->num_cmds - 1].pid;
i = kill(- pi->pgrp, SIGCONT);
if (i < 0) {
if (errno == ESRCH) {
- delete_finished_bg_job(pi);
+ delete_finished_job(pi);
return EXIT_SUCCESS;
}
bb_perror_msg("kill (SIGCONT)");
}
if (argv[0][0] == 'f') {
- remove_bg_job(pi);
+ remove_job_from_table(pi); /* FG job shouldn't be in job table */
return checkjobs_and_fg_shell(pi);
}
return EXIT_SUCCESS;
# if 0
else {
if (!wait_pipe->alive_cmds)
- delete_finished_bg_job(wait_pipe);
+ delete_finished_job(wait_pipe);
}
# endif
}