fd fix, process state now enum not flag

This commit is contained in:
Jack Halford 2017-03-20 11:22:43 +01:00
parent 685c749d3d
commit 38d8847f82
34 changed files with 87 additions and 114 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
/* Updated: 2017/03/20 09:46:31 by jhalford ### ########.fr */
/* Updated: 2017/03/20 10:35:30 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,13 +17,6 @@
# include "job_control.h"
# include <sys/stat.h>
# define PROCESS_COMPLETED (1 << 0)
# define PROCESS_SUSPENDED (1 << 1)
# define PROCESS_RUNNING (1 << 2)
# define PROCESS_CONTINUED (1 << 3)
# define PROCESS_STATE_MASK ((1 << 4) - (1 << 0))
# define IS_PIPESTART(p) ((p).fdin == STDIN)
# define IS_PIPEEND(p) ((p).fdout == STDOUT)
# define IS_PIPESINGLE(p) (IS_PIPESTART(p) && IS_PIPEEND(p))
@ -80,6 +73,14 @@ union u_process_data
struct s_data_list d_case;
};
enum e_process_state
{
PROCESS_COMPLETED,
PROCESS_SUSPENDED,
PROCESS_RUNNING,
PROCESS_CONTINUED,
};
enum e_process_type
{
PROCESS_FUNCTION,
@ -109,13 +110,13 @@ struct s_process
t_process_type type;
t_process_data data;
t_process_map map;
t_process_state state;
pid_t pid;
int fdin;
int fdout;
int to_close;
t_list *redirs;
int status;
t_flag attrs;
};
struct s_job

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/10 13:07:44 by jhalford #+# #+# */
/* Updated: 2017/03/20 09:37:28 by jhalford ### ########.fr */
/* Updated: 2017/03/20 10:35:37 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */
/* Updated: 2017/03/17 00:06:21 by ariard ### ########.fr */
/* Updated: 2017/03/20 10:38:12 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -62,6 +62,7 @@ typedef int (t_execf)(const char *path,
char *const argv[],
char *const envp[]);
typedef enum e_process_type t_process_type;
typedef enum e_process_state t_process_state;
typedef union u_process_data t_process_data;
typedef struct s_process_map t_process_map;
typedef struct s_data_cond t_data_while;

View file

@ -6,25 +6,12 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 13:33:32 by jhalford #+# #+# */
/* Updated: 2017/03/20 09:23:01 by jhalford ### ########.fr */
/* Updated: 2017/03/20 10:26:37 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
enum e_conversion =
{
CONV_D,
CONV_I,
CONV_U,
CONV_O,
CONV_x,
CONV_X,
CONV_B,
CONV_S,
CONV_C,
};
char *ft_transform(t_fmt *fmt, va_list ap)
{
char *ret;

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/05 11:50:51 by jhalford #+# #+# */
/* Updated: 2017/03/18 18:17:20 by ariard ### ########.fr */
/* Updated: 2017/03/20 10:24:29 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/06 22:32:43 by jhalford #+# #+# */
/* Updated: 2017/02/07 16:02:12 by jhalford ### ########.fr */
/* Updated: 2017/03/20 10:24:40 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 15:47:30 by wescande #+# #+# */
/* Updated: 2017/03/17 23:10:43 by wescande ### ########.fr */
/* Updated: 2017/03/20 10:54:59 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -49,7 +49,6 @@ int exec_leaf(t_btree **ast)
job_notify_new(job->id);
job->pgid = 0;
}
DG("check");
}
return (0);
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/12 12:41:11 by jhalford #+# #+# */
/* Updated: 2017/03/18 00:04:46 by wescande ### ########.fr */
/* Updated: 2017/03/20 10:40:20 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -22,18 +22,12 @@ int mark_process_status(pid_t pid, int status)
p = plist->content;
p->status = status;
if (WIFSTOPPED(status))
{
p->attrs &= ~PROCESS_STATE_MASK;
p->attrs |= PROCESS_SUSPENDED;
}
p->state = PROCESS_SUSPENDED;
else
{
p->attrs &= ~PROCESS_STATE_MASK;
p->attrs |= PROCESS_COMPLETED;
p->state = PROCESS_COMPLETED;
if (WIFSIGNALED(status))
psignal(WTERMSIG(status), NULL);
/* ft_printf("{mag}%d: Terminated by signal %d.\n{eoc}", */
/* (int)pid, WTERMSIG(status)); */
ft_dprintf(2, "%s\n", strsignal((WTERMSIG(status))));
}
return (0);
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/13 22:21:19 by jhalford #+# #+# */
/* Updated: 2017/03/17 23:49:43 by wescande ### ########.fr */
/* Updated: 2017/03/20 10:35:14 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -50,8 +50,7 @@ int process_launch(t_process *p)
pid_t pid;
DG("p->type=%i", p->type);
p->attrs &= ~PROCESS_STATE_MASK;
p->attrs |= PROCESS_RUNNING;
p->state = PROCESS_RUNNING;
if (!(pid = do_the_muther_forker(p)))
{
DG("launcher did not fork!");

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/05 14:54:45 by jhalford #+# #+# */
/* Updated: 2017/03/19 16:00:16 by wescande ### ########.fr */
/* Updated: 2017/03/20 10:57:06 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/13 19:07:34 by jhalford #+# #+# */
/* Updated: 2017/03/13 20:31:21 by jhalford ### ########.fr */
/* Updated: 2017/03/20 10:29:06 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 20:36:04 by wescande #+# #+# */
/* Updated: 2017/03/15 01:46:29 by ariard ### ########.fr */
/* Updated: 2017/03/20 10:27:59 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 15:06:05 by wescande #+# #+# */
/* Updated: 2017/03/19 16:42:10 by wescande ### ########.fr */
/* Updated: 2017/03/20 10:28:38 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 19:38:05 by wescande #+# #+# */
/* Updated: 2017/03/15 01:57:17 by ariard ### ########.fr */
/* Updated: 2017/03/20 10:28:13 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 19:19:50 by wescande #+# #+# */
/* Updated: 2017/03/15 02:03:19 by ariard ### ########.fr */
/* Updated: 2017/03/20 10:27:36 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/08 00:02:01 by wescande #+# #+# */
/* Updated: 2017/03/13 20:31:21 by jhalford ### ########.fr */
/* Updated: 2017/03/20 10:28:24 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 22:22:24 by wescande #+# #+# */
/* Updated: 2017/03/13 20:31:21 by jhalford ### ########.fr */
/* Updated: 2017/03/20 10:27:47 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 19:38:10 by wescande #+# #+# */
/* Updated: 2017/03/13 20:31:19 by jhalford ### ########.fr */
/* Updated: 2017/03/20 10:27:31 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 15:55:53 by wescande #+# #+# */
/* Updated: 2017/03/14 22:39:25 by ariard ### ########.fr */
/* Updated: 2017/03/20 10:24:57 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/08 14:30:07 by jhalford #+# #+# */
/* Updated: 2017/03/10 16:27:01 by jhalford ### ########.fr */
/* Updated: 2017/03/20 11:00:49 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -27,16 +27,23 @@ int builtin_fg(const char *path, char *const av[], char *const envp[])
return (-1);
}
jobc = &data_singleton()->jobc;
job_getrank(&rank);
id = av[1] ? ft_atoi(av[1]) : rank[0];
if ((jlist = ft_lst_find(jobc->first_job, &id, job_cmp_id)))
job_getrank(&rank);
if (av[1] ? (id = *av[1]) : 0)
{
job_run(jlist->content, 1);
return (0);
if ((jlist = ft_lst_find(jobc->first_job, &id, job_cmp_id)))
job_run(jlist->content, 1);
else
ft_dprintf(2, "{red}fg: job not found: [%i]{eoc}\n", id);
}
else if (av[1])
ft_dprintf(2, "{red}fg: job not found: [%i]{eoc}\n", id);
else
ft_dprintf(2, "{red}fg: no current job{eoc}\n");
return (1);
{
DG("rank:%i:%i", rank[0], rank[1]);
if ((jlist = ft_lst_find(jobc->first_job, &rank[0], job_cmp_id)))
job_run(jlist->content, 1);
else if ((jlist = ft_lst_find(jobc->first_job, &rank[1], job_cmp_id)))
job_run(jlist->content, 1);
else
ft_dprintf(2, "{red}fg: no current job{eoc}\n");
}
return (0);
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 13:54:51 by jhalford #+# #+# */
/* Updated: 2017/03/17 23:06:08 by wescande ### ########.fr */
/* Updated: 2017/03/20 10:57:09 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -29,7 +29,5 @@ int job_addprocess(t_process *p)
}
job = jobc->first_job->content;
ft_lsteadd(&job->first_process, ft_lstnew(p, sizeof(*p)));
/* if (JOB_IS_BG(job->attrs) && IS_PIPEEND(*p)) */
/* job_notify_new(job); */
return (0);
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/09 12:38:31 by jhalford #+# #+# */
/* Updated: 2017/01/31 15:04:33 by jhalford ### ########.fr */
/* Updated: 2017/03/20 11:10:27 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 15:10:20 by jhalford #+# #+# */
/* Updated: 2017/03/16 18:26:29 by jhalford ### ########.fr */
/* Updated: 2017/03/20 11:10:14 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -25,7 +25,7 @@ int job_is_completed(int id)
while (lst)
{
p = lst->content;
if (!(p->attrs & PROCESS_COMPLETED))
if (!(p->state == PROCESS_COMPLETED))
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/03/16 18:26:27 by jhalford ### ########.fr */
/* Updated: 2017/03/20 11:10:12 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -25,7 +25,8 @@ int job_is_stopped(int id)
while (lst)
{
p = lst->content;
if (!(p->attrs & (PROCESS_COMPLETED | PROCESS_SUSPENDED)))
if (!(p->state == PROCESS_COMPLETED)
|| !(p->state == PROCESS_SUSPENDED))
return (0);
lst = lst->next;
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/12 15:04:03 by jhalford #+# #+# */
/* Updated: 2017/03/18 00:51:40 by wescande ### ########.fr */
/* Updated: 2017/03/20 10:21:10 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,6 +19,5 @@ void job_notify_change(int id)
jobc = &data_singleton()->jobc;
job = ft_lst_find(jobc->first_job, &id, job_cmp_id)->content;
// if (job->attrs & JOB_BG) utilise pour notif dynamic
job_format(job, JOBS_OPTS_L);
job_format(job, JOBS_OPTS_L);
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/15 12:51:08 by jhalford #+# #+# */
/* Updated: 2017/03/16 18:29:43 by jhalford ### ########.fr */
/* Updated: 2017/03/20 10:20:57 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -15,8 +15,8 @@
void job_remove(int id)
{
t_jobc *jobc;
t_job *j;
t_list *jlist;
t_job *j;
t_list *jlist;
t_process *p;
jobc = &data_singleton()->jobc;

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/09 16:54:18 by jhalford #+# #+# */
/* Updated: 2017/01/31 14:47:26 by jhalford ### ########.fr */
/* Updated: 2017/03/20 10:40:16 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/08 14:40:40 by jhalford #+# #+# */
/* Updated: 2017/03/06 12:30:50 by wescande ### ########.fr */
/* Updated: 2017/03/20 10:56:42 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -21,11 +21,8 @@ void mark_job_as_running(t_job *j)
while (plist)
{
p = plist->content;
if (p->attrs & PROCESS_SUSPENDED)
{
p->attrs &= ~PROCESS_STATE_MASK;
p->attrs |= PROCESS_CONTINUED;
}
if (p->state == PROCESS_SUSPENDED)
p->state = PROCESS_CONTINUED;
plist = plist->next;
}
j->attrs &= ~JOB_NOTIFIED;

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/09 13:05:55 by jhalford #+# #+# */
/* Updated: 2017/03/17 21:35:27 by jhalford ### ########.fr */
/* Updated: 2017/03/20 10:54:51 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -34,22 +34,19 @@ static int redirection_print(t_redir *redir)
static void process_format_state(t_process *p)
{
int state;
char *statestr;
state = p->attrs & PROCESS_STATE_MASK;
statestr = NULL;
if (state == PROCESS_RUNNING)
if (p->state == PROCESS_RUNNING)
ft_asprintf(&statestr, "running");
else if (state == PROCESS_SUSPENDED)
else if (p->state == PROCESS_SUSPENDED)
ft_asprintf(&statestr, "suspended");
else if (state == PROCESS_CONTINUED)
else if (p->state == PROCESS_CONTINUED)
{
ft_asprintf(&statestr, "continued");
p->attrs &= ~PROCESS_STATE_MASK;
p->attrs |= PROCESS_RUNNING;
p->state = PROCESS_RUNNING;
}
else if (state == PROCESS_COMPLETED)
else if (p->state == PROCESS_COMPLETED)
{
if (WIFSIGNALED(p->status))
ft_asprintf(&statestr, strsignal(WTERMSIG(p->status)));
@ -82,14 +79,10 @@ static void process_format_com_short(t_list **plist, t_flag state)
while (*plist)
{
p = (*plist)->content;
if (!(p->attrs & state) ||
(state == PROCESS_COMPLETED && p->status != 0))
if (p->state != state)
break ;
if (p->attrs & PROCESS_CONTINUED)
{
p->attrs &= ~PROCESS_STATE_MASK;
p->attrs &= ~PROCESS_RUNNING;
}
if (p->state == PROCESS_CONTINUED)
p->state = PROCESS_RUNNING;
if (p->map.print)
(p->map.print)(p);
ft_lstiter(p->redirs, redirection_print);
@ -102,10 +95,8 @@ static void process_format_com_short(t_list **plist, t_flag state)
void process_format(t_list **plist, int firstp, int opts)
{
t_process *p;
t_flag state;
p = (*plist)->content;
state = p->attrs & PROCESS_STATE_MASK;
if (!firstp)
ft_printf(" ");
if (opts & JOBS_OPTS_L)
@ -114,6 +105,6 @@ void process_format(t_list **plist, int firstp, int opts)
if (opts & JOBS_OPTS_L)
process_format_com_long(plist);
else
process_format_com_short(plist, state);
process_format_com_short(plist, p->state);
ft_putchar('\n');
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/10 17:37:56 by jhalford #+# #+# */
/* Updated: 2017/03/18 00:05:39 by wescande ### ########.fr */
/* Updated: 2017/03/20 10:20:44 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,6 +14,5 @@
void sigchld_handler(int signo)
{
//do_job_notification();dynamic notif ???
(void)signo;
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/10 15:14:53 by jhalford #+# #+# */
/* Updated: 2017/03/14 10:55:49 by gwojda ### ########.fr */
/* Updated: 2017/03/20 10:30:55 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/09 20:39:06 by jhalford #+# #+# */
/* Updated: 2017/03/20 10:02:26 by jhalford ### ########.fr */
/* Updated: 2017/03/20 10:02:52 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */
/* Updated: 2017/03/20 09:54:18 by jhalford ### ########.fr */
/* Updated: 2017/03/20 11:21:53 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -34,11 +34,8 @@ static int get_input_fd(t_data *data)
char *file;
struct stat buf;
/* fds = (int[2]){-1, STDIN}; */
if (data->opts & SH_OPTS_LC)
if (data->opts & SH_OPTS_LC && (file = data->c_arg))
{
DG("-c");
file = data->c_arg;
pipe(fds);
write(fds[PIPE_WRITE], file, ft_strlen(file));
close(fds[PIPE_WRITE]);
@ -51,8 +48,11 @@ static int get_input_fd(t_data *data)
ft_printf("{red}%s: %s: No such file or directory\n{eoc}",
data->argv[0], file);
}
fds[PIPE_WRITE] = fds[PIPE_READ] != -1 ?
fcntl(fds[PIPE_READ], F_DUPFD_CLOEXEC, 10) : STDIN;
else
return (STDIN);
if (fds[PIPE_READ] < 0)
return (-1);
fds[PIPE_WRITE] = fcntl(fds[PIPE_READ], F_DUPFD_CLOEXEC, 10);
close(fds[PIPE_READ]);
return (fds[PIPE_WRITE]);
}

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/15 18:57:44 by ariard #+# #+# */
/* Updated: 2017/03/14 00:36:34 by ariard ### ########.fr */
/* Updated: 2017/03/20 10:35:11 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */