Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove libcrun_setup_terminal_ptmx #1528

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libcrun/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -2590,7 +2590,7 @@ libcrun_container_run_internal (libcrun_container_t *container, libcrun_context_

close_and_reset (&socket_pair_0);

ret = libcrun_setup_terminal_ptmx (terminal_fd, &orig_terminal, err);
ret = libcrun_set_raw (0, &orig_terminal, err);
if (UNLIKELY (ret < 0))
goto fail;
}
Expand Down Expand Up @@ -3685,7 +3685,7 @@ libcrun_container_exec_with_options (libcrun_context_t *context, const char *id,
}
else
{
ret = libcrun_setup_terminal_ptmx (terminal_fd, &orig_terminal, err);
ret = libcrun_set_raw (0, &orig_terminal, err);
if (UNLIKELY (ret < 0))
{
flush_fd_to_err (context, terminal_fd);
Expand Down
21 changes: 2 additions & 19 deletions src/libcrun/terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ libcrun_new_terminal (char **pty, libcrun_error_t *err)
return ret;
}

static int
set_raw (int fd, void **current_status, libcrun_error_t *err)
int
libcrun_set_raw (int fd, void **current_status, libcrun_error_t *err)
{
int ret;
struct termios termios;
Expand Down Expand Up @@ -114,23 +114,6 @@ libcrun_set_stdio (char *pty, libcrun_error_t *err)
return 0;
}

int
libcrun_setup_terminal_ptmx (int fd, void **current_status, libcrun_error_t *err)
{
int ret;
struct termios termios;

ret = tcgetattr (fd, &termios);
if (UNLIKELY (ret < 0))
return crun_make_error (err, errno, "tcgetattr");

ret = tcsetattr (fd, TCSANOW, &termios);
if (UNLIKELY (ret < 0))
return crun_make_error (err, errno, "tcsetattr");

return set_raw (0, current_status, err);
}

void
cleanup_terminalp (void *p)
{
Expand Down
2 changes: 1 addition & 1 deletion src/libcrun/terminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int libcrun_new_terminal (char **pty, libcrun_error_t *err);

int libcrun_set_stdio (char *pty, libcrun_error_t *err);

int libcrun_setup_terminal_ptmx (int fd, void **current_status, libcrun_error_t *err);
int libcrun_set_raw (int fd, void **current_status, libcrun_error_t *err);

int libcrun_terminal_setup_size (int fd, unsigned short rows, unsigned short cols, libcrun_error_t *err);

Expand Down
Loading