removed debug messages in job control before merge

This commit is contained in:
Jack Halford 2017-01-10 12:34:27 +01:00
parent 0ec9313b4c
commit da285e7c1f
16 changed files with 28 additions and 33 deletions

@ -1 +1 @@
Subproject commit d799465c2e0d51f24fe4d5cf1e51c5109a1617a0
Subproject commit af71e8b8de26051cd63fde8ab82c90801bd835d8

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */
/* Updated: 2017/01/10 11:03:44 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:28:41 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
/* Updated: 2017/01/10 10:30:35 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:28:36 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -28,7 +28,7 @@ int launch_process(t_process *p)
set_exitstatus((*p->execf)(p->path, p->av, data_singleton()->env));
else
{
DG("process is to be forked, %i->[]->%i, attr=%b", p->fdin, p->fdout, p->attributes);
/* DG("process is to be forked, %i->[]->%i, attr=%b", p->fdin, p->fdout, p->attributes); */
p->attributes &= ~PROCESS_STATE_MASK;
p->attributes |= PROCESS_RUNNING;
if (p->attributes & (PROCESS_BINARY | PROCESS_SCRIPT)

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 13:54:51 by jhalford #+# #+# */
/* Updated: 2017/01/08 15:41:56 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:30:12 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -25,13 +25,13 @@ int job_addprocess(t_process *p)
job->id = jobc->current_id;
job->pgid = p->pid;
ft_lstadd(&jobc->first_job, ft_lstnew(job, sizeof(*job)));
DG("added new job [%i]", job->id);
/* DG("added new job [%i]", job->id); */
}
job = jobc->first_job->content;
if (p->pid > 0)
{
ft_lsteadd(&job->first_process, ft_lstnew(p, sizeof(*p)));
DG("added pid=%i to [%i]", p->pid, job->id);
/* DG("added pid=%i to [%i]", p->pid, job->id); */
}
if (JOB_IS_BG(job->attributes) && IS_PIPEEND(p->attributes))
job_notify_new(job);

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 15:10:20 by jhalford #+# #+# */
/* Updated: 2017/01/09 14:03:40 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:30:33 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -25,10 +25,10 @@ int job_is_completed(int id)
while (lst)
{
p = lst->content;
DG("checking pid=%i", p->pid);
/* DG("checking pid=%i", p->pid); */
if (!(p->attributes & PROCESS_COMPLETED))
{
DG("process %i is not completed", p->pid);
/* DG("process %i is not completed", p->pid); */
return (0);
}
lst = lst->next;

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 15:06:45 by jhalford #+# #+# */
/* Updated: 2017/01/10 10:31:56 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:30:05 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/15 12:51:08 by jhalford #+# #+# */
/* Updated: 2017/01/09 16:46:42 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:31:00 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,11 +19,11 @@ void job_remove(int id)
jobc = &data_singleton()->jobc;
if (job_is_completed(id))
{
DG("job_remove");
/* DG("job_remove"); */
if (id < data_singleton()->jobc.current_id)
data_singleton()->jobc.current_id = id;
ft_lst_delif(&jobc->first_job, &id, job_cmp_id, job_free);
}
else
DG("job_remove failed (not completed)");
/* else */
/* DG("job_remove failed (not completed)"); */
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/15 12:56:11 by jhalford #+# #+# */
/* Updated: 2016/12/15 15:09:05 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:33:09 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,7 +17,6 @@ void job_update_status(void)
int status;
pid_t pid;
DG("updating job status'");
pid = waitpid (WAIT_ANY, &status, WUNTRACED | WNOHANG);
while (!process_mark_status(pid, status))
pid = waitpid (WAIT_ANY, &status, WUNTRACED | WNOHANG);

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/09 13:05:55 by jhalford #+# #+# */
/* Updated: 2017/01/10 11:30:52 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:27:47 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/12 12:41:11 by jhalford #+# #+# */
/* Updated: 2017/01/10 10:55:31 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:28:22 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -23,13 +23,13 @@ int process_mark_status(pid_t pid, int status)
p->status = status;
if (WIFSTOPPED(status))
{
DG("marking: pid=%i, status=%i (stopped sig %i)", pid, status, WTERMSIG(status));
/* DG("marking: pid=%i, status=%i (stopped sig %i)", pid, status, WTERMSIG(status)); */
p->attributes &= ~PROCESS_STATE_MASK;
p->attributes |= PROCESS_SUSPENDED;
}
else
{
DG("marking: pid=%i, status=%i (completed sig %i)", pid, status, WTERMSIG(status));
/* DG("marking: pid=%i, status=%i (completed sig %i)", pid, status, WTERMSIG(status)); */
p->attributes &= ~PROCESS_STATE_MASK;
p->attributes |= PROCESS_COMPLETED;
if (WIFSIGNALED(status))

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 14:58:36 by jhalford #+# #+# */
/* Updated: 2017/01/10 11:06:02 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:32:49 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -24,15 +24,13 @@ int put_job_in_foreground(t_job *job, int cont)
signal(SIGTTOU, SIG_IGN);
if (tcsetpgrp(STDIN, job->pgid) == -1)
DG("couldn't put process in control. errno=%i, pgid=%i", errno, job->pgid);
else
DG("pgid %i is now in control.", job->pgid);
signal(SIGTTOU, sigttou_handler);
tcsetattr (STDIN, TCSANOW, &job->tmodes);
if (kill(-job->pgid, SIGCONT) < 0)
perror("kill (SIGCONT)");
}
/* Wait for it to report. */
DG("gonna wait for job id=%i", job->id);
/* DG("gonna wait for job id=%i", job->id); */
job_wait(job->id);
job_remove(job->id);

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/10 17:37:56 by jhalford #+# #+# */
/* Updated: 2017/01/08 11:28:29 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:33:18 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,7 +18,7 @@ void sigchld_handler(int signo)
(void)signo;
data = data_singleton();
DG("got SIGCHLD");
/* DG("got SIGCHLD"); */
/* if (do_job_notification()) */
/* ft_putstr(SHELL_PROMPT); */
if (data_singleton()->mode != MODE_EXEC)

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/01 12:14:12 by jhalford #+# #+# */
/* Updated: 2017/01/09 14:28:54 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:31:35 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/10 14:22:34 by jhalford #+# #+# */
/* Updated: 2017/01/09 14:28:20 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:31:27 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,9 +14,7 @@
int ft_prompt(void)
{
DG("do_job_notification() before prompt");
do_job_notification();
DG("new prompt now");
ft_putstr(SHELL_PROMPT);
return (0);
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/03 13:35:03 by jhalford #+# #+# */
/* Updated: 2017/01/09 15:35:56 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:31:46 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */
/* Updated: 2017/01/09 15:36:12 by jhalford ### ########.fr */
/* Updated: 2017/01/10 12:31:34 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */