From da285e7c1fbfa9ca125a59c78844c9a818a3aedc Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Tue, 10 Jan 2017 12:34:27 +0100 Subject: [PATCH] removed debug messages in job control before merge --- 42sh/libft | 2 +- 42sh/src/exec/exec_command.c | 2 +- 42sh/src/exec/launch_process.c | 4 ++-- 42sh/src/job-control/job_addprocess.c | 6 +++--- 42sh/src/job-control/job_is_completed.c | 6 +++--- 42sh/src/job-control/job_is_stopped.c | 2 +- 42sh/src/job-control/job_remove.c | 8 ++++---- 42sh/src/job-control/job_update_status.c | 3 +-- 42sh/src/job-control/process_format.c | 2 +- 42sh/src/job-control/process_mark_status.c | 6 +++--- 42sh/src/job-control/put_job_in_foreground.c | 6 ++---- 42sh/src/job-control/sigchld_handler.c | 4 ++-- 42sh/src/line-editing/ft_interactive_sh.c | 2 +- 42sh/src/line-editing/ft_prompt.c | 4 +--- 42sh/src/line-editing/input_init.c | 2 +- 42sh/src/main/shell_init.c | 2 +- 16 files changed, 28 insertions(+), 33 deletions(-) diff --git a/42sh/libft b/42sh/libft index d799465c..af71e8b8 160000 --- a/42sh/libft +++ b/42sh/libft @@ -1 +1 @@ -Subproject commit d799465c2e0d51f24fe4d5cf1e51c5109a1617a0 +Subproject commit af71e8b8de26051cd63fde8ab82c90801bd835d8 diff --git a/42sh/src/exec/exec_command.c b/42sh/src/exec/exec_command.c index 23c8d28a..788dbb1c 100644 --- a/42sh/src/exec/exec_command.c +++ b/42sh/src/exec/exec_command.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/launch_process.c b/42sh/src/exec/launch_process.c index 70b1175f..64310ff9 100644 --- a/42sh/src/exec/launch_process.c +++ b/42sh/src/exec/launch_process.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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) diff --git a/42sh/src/job-control/job_addprocess.c b/42sh/src/job-control/job_addprocess.c index 2dd27595..0215844a 100644 --- a/42sh/src/job-control/job_addprocess.c +++ b/42sh/src/job-control/job_addprocess.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); diff --git a/42sh/src/job-control/job_is_completed.c b/42sh/src/job-control/job_is_completed.c index a2a84610..11ce8b55 100644 --- a/42sh/src/job-control/job_is_completed.c +++ b/42sh/src/job-control/job_is_completed.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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; diff --git a/42sh/src/job-control/job_is_stopped.c b/42sh/src/job-control/job_is_stopped.c index b83c9024..7b4b5b85 100644 --- a/42sh/src/job-control/job_is_stopped.c +++ b/42sh/src/job-control/job_is_stopped.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/job-control/job_remove.c b/42sh/src/job-control/job_remove.c index 297969b9..ffeb3933 100644 --- a/42sh/src/job-control/job_remove.c +++ b/42sh/src/job-control/job_remove.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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)"); */ } diff --git a/42sh/src/job-control/job_update_status.c b/42sh/src/job-control/job_update_status.c index a8702233..5426c5fc 100644 --- a/42sh/src/job-control/job_update_status.c +++ b/42sh/src/job-control/job_update_status.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); diff --git a/42sh/src/job-control/process_format.c b/42sh/src/job-control/process_format.c index 4a7e734a..92ad7d88 100644 --- a/42sh/src/job-control/process_format.c +++ b/42sh/src/job-control/process_format.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/job-control/process_mark_status.c b/42sh/src/job-control/process_mark_status.c index 83e7b921..49784124 100644 --- a/42sh/src/job-control/process_mark_status.c +++ b/42sh/src/job-control/process_mark_status.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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)) diff --git a/42sh/src/job-control/put_job_in_foreground.c b/42sh/src/job-control/put_job_in_foreground.c index fd3ed42a..59e265fc 100644 --- a/42sh/src/job-control/put_job_in_foreground.c +++ b/42sh/src/job-control/put_job_in_foreground.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); diff --git a/42sh/src/job-control/sigchld_handler.c b/42sh/src/job-control/sigchld_handler.c index c750bba6..210f52a2 100644 --- a/42sh/src/job-control/sigchld_handler.c +++ b/42sh/src/job-control/sigchld_handler.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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) diff --git a/42sh/src/line-editing/ft_interactive_sh.c b/42sh/src/line-editing/ft_interactive_sh.c index 62654c96..113e0f93 100644 --- a/42sh/src/line-editing/ft_interactive_sh.c +++ b/42sh/src/line-editing/ft_interactive_sh.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/line-editing/ft_prompt.c b/42sh/src/line-editing/ft_prompt.c index a9e1162f..b86610cb 100644 --- a/42sh/src/line-editing/ft_prompt.c +++ b/42sh/src/line-editing/ft_prompt.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); } diff --git a/42sh/src/line-editing/input_init.c b/42sh/src/line-editing/input_init.c index b76ce92e..21d5b7c3 100644 --- a/42sh/src/line-editing/input_init.c +++ b/42sh/src/line-editing/input_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/shell_init.c b/42sh/src/main/shell_init.c index f33b8a0d..2c8578c5 100644 --- a/42sh/src/main/shell_init.c +++ b/42sh/src/main/shell_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 */ /* */ /* ************************************************************************** */