summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/execute.c17
-rw-r--r--src/core/execute.h1
-rw-r--r--src/core/mount.c1
-rw-r--r--src/core/service.c1
-rw-r--r--src/core/socket.c1
-rw-r--r--src/core/swap.c1
6 files changed, 15 insertions, 7 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index bbc430e055..01dceb0788 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -176,7 +176,7 @@ static int open_null_as(int flags, int nfd) {
return r;
}
-static int connect_logger_as(const ExecContext *context, ExecOutput output, const char *ident, int nfd) {
+static int connect_logger_as(const ExecContext *context, ExecOutput output, const char *ident, const char *unit_id, int nfd) {
int fd, r;
union sockaddr_union sa;
@@ -206,12 +206,14 @@ static int connect_logger_as(const ExecContext *context, ExecOutput output, cons
dprintf(fd,
"%s\n"
+ "%s\n"
"%i\n"
"%i\n"
"%i\n"
"%i\n"
"%i\n",
context->syslog_identifier ? context->syslog_identifier : ident,
+ unit_id,
context->syslog_priority,
!!context->syslog_level_prefix,
output == EXEC_OUTPUT_SYSLOG || output == EXEC_OUTPUT_SYSLOG_AND_CONSOLE,
@@ -311,7 +313,7 @@ static int setup_input(const ExecContext *context, int socket_fd, bool apply_tty
}
}
-static int setup_output(const ExecContext *context, int socket_fd, const char *ident, bool apply_tty_stdin) {
+static int setup_output(const ExecContext *context, int socket_fd, const char *ident, const char *unit_id, bool apply_tty_stdin) {
ExecOutput o;
ExecInput i;
@@ -358,7 +360,7 @@ static int setup_output(const ExecContext *context, int socket_fd, const char *i
case EXEC_OUTPUT_KMSG_AND_CONSOLE:
case EXEC_OUTPUT_JOURNAL:
case EXEC_OUTPUT_JOURNAL_AND_CONSOLE:
- return connect_logger_as(context, o, ident, STDOUT_FILENO);
+ return connect_logger_as(context, o, ident, unit_id, STDOUT_FILENO);
case EXEC_OUTPUT_SOCKET:
assert(socket_fd >= 0);
@@ -369,7 +371,7 @@ static int setup_output(const ExecContext *context, int socket_fd, const char *i
}
}
-static int setup_error(const ExecContext *context, int socket_fd, const char *ident, bool apply_tty_stdin) {
+static int setup_error(const ExecContext *context, int socket_fd, const char *ident, const char *unit_id, bool apply_tty_stdin) {
ExecOutput o, e;
ExecInput i;
@@ -413,7 +415,7 @@ static int setup_error(const ExecContext *context, int socket_fd, const char *id
case EXEC_OUTPUT_KMSG_AND_CONSOLE:
case EXEC_OUTPUT_JOURNAL:
case EXEC_OUTPUT_JOURNAL_AND_CONSOLE:
- return connect_logger_as(context, e, ident, STDERR_FILENO);
+ return connect_logger_as(context, e, ident, unit_id, STDERR_FILENO);
case EXEC_OUTPUT_SOCKET:
assert(socket_fd >= 0);
@@ -913,6 +915,7 @@ int exec_spawn(ExecCommand *command,
CGroupBonding *cgroup_bondings,
CGroupAttribute *cgroup_attributes,
const char *cgroup_suffix,
+ const char *unit_id,
int idle_pipe[2],
pid_t *ret) {
@@ -1101,14 +1104,14 @@ int exec_spawn(ExecCommand *command,
}
if (!keep_stdout) {
- err = setup_output(context, socket_fd, path_get_file_name(command->path), apply_tty_stdin);
+ err = setup_output(context, socket_fd, path_get_file_name(command->path), unit_id, apply_tty_stdin);
if (err < 0) {
r = EXIT_STDOUT;
goto fail_child;
}
}
- err = setup_error(context, socket_fd, path_get_file_name(command->path), apply_tty_stdin);
+ err = setup_error(context, socket_fd, path_get_file_name(command->path), unit_id, apply_tty_stdin);
if (err < 0) {
r = EXIT_STDERR;
goto fail_child;
diff --git a/src/core/execute.h b/src/core/execute.h
index 6c68169a84..2083c2971b 100644
--- a/src/core/execute.h
+++ b/src/core/execute.h
@@ -192,6 +192,7 @@ int exec_spawn(ExecCommand *command,
struct CGroupBonding *cgroup_bondings,
struct CGroupAttribute *cgroup_attributes,
const char *cgroup_suffix,
+ const char *unit_id,
int pipe_fd[2],
pid_t *ret);
diff --git a/src/core/mount.c b/src/core/mount.c
index b885baab00..3f8cf8a68f 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -770,6 +770,7 @@ static int mount_spawn(Mount *m, ExecCommand *c, pid_t *_pid) {
UNIT(m)->cgroup_bondings,
UNIT(m)->cgroup_attributes,
NULL,
+ UNIT(m)->id,
NULL,
&pid)) < 0)
goto fail;
diff --git a/src/core/service.c b/src/core/service.c
index 8941271679..eeabe8fb01 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1810,6 +1810,7 @@ static int service_spawn(
UNIT(s)->cgroup_bondings,
UNIT(s)->cgroup_attributes,
is_control ? "control" : NULL,
+ UNIT(s)->id,
s->type == SERVICE_IDLE ? UNIT(s)->manager->idle_pipe : NULL,
&pid);
diff --git a/src/core/socket.c b/src/core/socket.c
index 633663e7e0..ea24f4b443 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1153,6 +1153,7 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) {
UNIT(s)->cgroup_bondings,
UNIT(s)->cgroup_attributes,
NULL,
+ UNIT(s)->id,
NULL,
&pid);
diff --git a/src/core/swap.c b/src/core/swap.c
index e7ed1b88d7..f3c7fa3076 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -590,6 +590,7 @@ static int swap_spawn(Swap *s, ExecCommand *c, pid_t *_pid) {
UNIT(s)->cgroup_bondings,
UNIT(s)->cgroup_attributes,
NULL,
+ UNIT(s)->id,
NULL,
&pid)) < 0)
goto fail;