core/execute: morph exec_output_is_* to _forward_to_*
Follow-up for 379d9ae222
After the commit, the functions are only used to determine
whether journals shall be forwarded to selected targets,
hence rename as such and remove effectively unused condition
on EXEC_OUTPUT_TTY.
This commit is contained in:
+26
-14
@@ -187,6 +187,18 @@ static int connect_journal_socket(
|
||||
return r;
|
||||
}
|
||||
|
||||
static bool exec_output_forward_to_console(ExecOutput o) {
|
||||
return IN_SET(o,
|
||||
EXEC_OUTPUT_JOURNAL_AND_CONSOLE,
|
||||
EXEC_OUTPUT_KMSG_AND_CONSOLE);
|
||||
}
|
||||
|
||||
static bool exec_output_forward_to_kmsg(ExecOutput o) {
|
||||
return IN_SET(o,
|
||||
EXEC_OUTPUT_KMSG,
|
||||
EXEC_OUTPUT_KMSG_AND_CONSOLE);
|
||||
}
|
||||
|
||||
static int connect_logger_as(
|
||||
const ExecContext *context,
|
||||
const ExecParameters *params,
|
||||
@@ -219,20 +231,20 @@ static int connect_logger_as(
|
||||
(void) fd_inc_sndbuf(fd, SNDBUF_SIZE);
|
||||
|
||||
if (dprintf(fd,
|
||||
"%s\n"
|
||||
"%s\n"
|
||||
"%i\n"
|
||||
"%i\n"
|
||||
"%i\n"
|
||||
"%i\n"
|
||||
"%i\n",
|
||||
context->syslog_identifier ?: ident,
|
||||
params->flags & EXEC_PASS_LOG_UNIT ? params->unit_id : "",
|
||||
context->syslog_priority,
|
||||
!!context->syslog_level_prefix,
|
||||
false,
|
||||
exec_output_is_kmsg(output),
|
||||
exec_output_is_terminal(output)) < 0)
|
||||
"%s\n"
|
||||
"%s\n"
|
||||
"%i\n"
|
||||
"%i\n"
|
||||
"%i\n"
|
||||
"%i\n"
|
||||
"%i\n",
|
||||
context->syslog_identifier ?: ident,
|
||||
params->flags & EXEC_PASS_LOG_UNIT ? params->unit_id : "",
|
||||
context->syslog_priority,
|
||||
!!context->syslog_level_prefix,
|
||||
false,
|
||||
exec_output_forward_to_kmsg(output),
|
||||
exec_output_forward_to_console(output)) < 0)
|
||||
return -errno;
|
||||
|
||||
return move_fd(TAKE_FD(fd), nfd, false);
|
||||
|
||||
@@ -470,19 +470,6 @@ static inline bool exec_input_is_terminal(ExecInput i) {
|
||||
EXEC_INPUT_TTY_FAIL);
|
||||
}
|
||||
|
||||
static inline bool exec_output_is_terminal(ExecOutput o) {
|
||||
return IN_SET(o,
|
||||
EXEC_OUTPUT_TTY,
|
||||
EXEC_OUTPUT_KMSG_AND_CONSOLE,
|
||||
EXEC_OUTPUT_JOURNAL_AND_CONSOLE);
|
||||
}
|
||||
|
||||
static inline bool exec_output_is_kmsg(ExecOutput o) {
|
||||
return IN_SET(o,
|
||||
EXEC_OUTPUT_KMSG,
|
||||
EXEC_OUTPUT_KMSG_AND_CONSOLE);
|
||||
}
|
||||
|
||||
static inline bool exec_context_has_tty(const ExecContext *context) {
|
||||
assert(context);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user