Updated Filelist
This commit is contained in:
parent
ed4015a8fe
commit
f05826942a
15 changed files with 182 additions and 163 deletions
|
|
@ -6,19 +6,33 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/04 17:59:48 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/07/29 19:05:12 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/07/30 14:48:48 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "exec/spawn_cmd/pipe.h"
|
||||
#include "me/fs/fs.h"
|
||||
#include "me/str/str.h"
|
||||
|
||||
t_error exec_create_pipe(t_pipe *out)
|
||||
t_error exec_create_pipe(t_exec_pipe *out)
|
||||
{
|
||||
int fds[2];
|
||||
int fd[2];
|
||||
struct s_file_slot *read;
|
||||
struct s_file_slot *write;
|
||||
|
||||
if (pipe(fds))
|
||||
if (pipe(fd))
|
||||
return (ERROR);
|
||||
out->read = fds[0];
|
||||
out->write = fds[1];
|
||||
read = get_unused_fd_slot();
|
||||
if (read == NULL)
|
||||
return (close(fd[0]), close(fd[1]), ERROR);
|
||||
read->ty = SLOT_FD;
|
||||
write = get_unused_fd_slot();
|
||||
if (write == NULL)
|
||||
return (read->ty = SLOT_UNUSED, close(fd[0]), close(fd[1]), ERROR);
|
||||
write->ty = SLOT_FD;
|
||||
read->slot.fd = (t_fd){.fd = fd[0], .type = FD_PIPE, .name = str_clone("<pipe[R]>"), .perms = FD_READ};
|
||||
read->slot.fd = (t_fd){.fd = fd[1], .type = FD_PIPE, .name = str_clone("<pipe[W]>"), .perms = FD_WRITE};
|
||||
out->read = &read->slot.fd;
|
||||
out->write = &write->slot.fd;
|
||||
return (NO_ERROR);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue