From: ZhaoQiang Date: Thu, 11 Jul 2019 21:53:31 +0000 (+0000) Subject: ply terminal session: Drop ply_terminal_session_run, this is a feature from a bygone... X-Git-Tag: 0.9.5~58^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c6a2e1a2a6e59a11aeed7111cb0ccbb063ae60dd;p=thirdparty%2Fplymouth.git ply terminal session: Drop ply_terminal_session_run, this is a feature from a bygone time which is no longer in use --- diff --git a/src/libply/ply-terminal-session.c b/src/libply/ply-terminal-session.c index 5cecbbdb..50193328 100644 --- a/src/libply/ply-terminal-session.c +++ b/src/libply/ply-terminal-session.c @@ -263,80 +263,6 @@ open_pseudoterminal (ply_terminal_session_t *session) return true; } - -bool -ply_terminal_session_run (ply_terminal_session_t *session, - ply_terminal_session_flags_t flags, - ply_terminal_session_begin_handler_t begin_handler, - ply_terminal_session_output_handler_t output_handler, - ply_terminal_session_hangup_handler_t hangup_handler, - void *user_data) -{ - pid_t pid; - bool run_in_parent, look_in_path, should_redirect_console; - - assert (session != NULL); - assert (session->loop != NULL); - assert (!session->is_running); - assert (session->hangup_handler == NULL); - - run_in_parent = (flags & PLY_TERMINAL_SESSION_FLAGS_RUN_IN_PARENT) != 0; - look_in_path = (flags & PLY_TERMINAL_SESSION_FLAGS_LOOK_IN_PATH) != 0; - should_redirect_console = - (flags & PLY_TERMINAL_SESSION_FLAGS_REDIRECT_CONSOLE) != 0; - - ply_trace ("creating terminal device"); - if (!open_pseudoterminal (session)) - return false; - ply_trace ("done creating terminal device"); - - if (should_redirect_console) - ply_trace ("redirecting system console to terminal device"); - if (should_redirect_console && - !ply_terminal_session_redirect_console (session)) { - ply_save_errno (); - close_pseudoterminal (session); - ply_restore_errno (); - return false; - } - if (should_redirect_console) - ply_trace ("done redirecting system console to terminal device"); - - ply_trace ("creating subprocess"); - pid = fork (); - - if (pid < 0) { - ply_save_errno (); - ply_terminal_session_unredirect_console (session); - close_pseudoterminal (session); - ply_restore_errno (); - return false; - } - - if (((pid == 0) && run_in_parent) || - ((pid != 0) && !run_in_parent)) { - session->is_running = true; - session->output_handler = output_handler; - session->hangup_handler = hangup_handler; - session->user_data = user_data; - ply_terminal_session_start_logging (session); - - return true; - } - - if (begin_handler != NULL) { - ply_trace ("running 'begin handler'"); - begin_handler (user_data, session); - ply_trace ("ran 'begin handler'"); - } - - ply_trace ("beginning session"); - ply_terminal_session_execute (session, look_in_path); - - _exit (errno); - return false; -} - bool ply_terminal_session_attach (ply_terminal_session_t *session, ply_terminal_session_flags_t flags, diff --git a/src/libply/ply-terminal-session.h b/src/libply/ply-terminal-session.h index 26a47c99..5bd5cfd1 100644 --- a/src/libply/ply-terminal-session.h +++ b/src/libply/ply-terminal-session.h @@ -54,12 +54,6 @@ ply_terminal_session_t *ply_terminal_session_new (const char *const *argv); void ply_terminal_session_free (ply_terminal_session_t *session); void ply_terminal_session_attach_to_event_loop (ply_terminal_session_t *session, ply_event_loop_t *loop); -bool ply_terminal_session_run (ply_terminal_session_t *session, - ply_terminal_session_flags_t flags, - ply_terminal_session_begin_handler_t begin_handler, - ply_terminal_session_output_handler_t output_handler, - ply_terminal_session_hangup_handler_t done_handler, - void *user_data); bool ply_terminal_session_attach (ply_terminal_session_t *session, ply_terminal_session_flags_t flags,