chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
unit: rename 'banned' load state to 'masked'
[elogind.git]
/
src
/
execute.c
diff --git
a/src/execute.c
b/src/execute.c
index 755b4700fc0c02fbbe1bcb1b03459ff45998e6db..9c7e0d6b708e7d618957fb5b5fbc190a48f8ff61 100644
(file)
--- a/
src/execute.c
+++ b/
src/execute.c
@@
-54,6
+54,7
@@
#include "tcpwrap.h"
#include "exit-status.h"
#include "missing.h"
#include "tcpwrap.h"
#include "exit-status.h"
#include "missing.h"
+#include "utmp-wtmp.h"
/* This assumes there is a 'tty' group */
#define TTY_MODE 0620
/* This assumes there is a 'tty' group */
#define TTY_MODE 0620
@@
-174,7
+175,7
@@
static int connect_logger_as(const ExecContext *context, ExecOutput output, cons
sa.sa.sa_family = AF_UNIX;
strncpy(sa.un.sun_path+1, LOGGER_SOCKET, sizeof(sa.un.sun_path)-1);
sa.sa.sa_family = AF_UNIX;
strncpy(sa.un.sun_path+1, LOGGER_SOCKET, sizeof(sa.un.sun_path)-1);
- if (connect(fd, &sa.sa,
sizeof(sa_family_t
) + 1 + sizeof(LOGGER_SOCKET) - 1) < 0) {
+ if (connect(fd, &sa.sa,
offsetof(struct sockaddr_un, sun_path
) + 1 + sizeof(LOGGER_SOCKET) - 1) < 0) {
close_nointr_nofail(fd);
return -errno;
}
close_nointr_nofail(fd);
return -errno;
}
@@
-1129,6
+1130,9
@@
int exec_spawn(ExecCommand *command,
goto fail;
}
goto fail;
}
+ if (context->utmp_id)
+ utmp_put_init_process(0, context->utmp_id, getpid(), getsid(0), context->tty_path);
+
if (context->user) {
username = context->user;
if (get_user_creds(&username, &uid, &gid, &home) < 0) {
if (context->user) {
username = context->user;
if (get_user_creds(&username, &uid, &gid, &home) < 0) {
@@
-1604,6
+1608,12
@@
void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
"%sKillSignal: SIG%s\n",
prefix, kill_mode_to_string(c->kill_mode),
prefix, signal_to_string(c->kill_signal));
"%sKillSignal: SIG%s\n",
prefix, kill_mode_to_string(c->kill_mode),
prefix, signal_to_string(c->kill_signal));
+
+ if (c->utmp_id)
+ fprintf(f,
+ "%sUtmpIdentifier: %s\n",
+ prefix, c->utmp_id);
+
}
void exec_status_start(ExecStatus *s, pid_t pid) {
}
void exec_status_start(ExecStatus *s, pid_t pid) {
@@
-1614,7
+1624,7
@@
void exec_status_start(ExecStatus *s, pid_t pid) {
dual_timestamp_get(&s->start_timestamp);
}
dual_timestamp_get(&s->start_timestamp);
}
-void exec_status_exit(ExecStatus *s, pid_t pid, int code, int status) {
+void exec_status_exit(ExecStatus *s, pid_t pid, int code, int status
, const char *utmp_id
) {
assert(s);
if ((s->pid && s->pid != pid) ||
assert(s);
if ((s->pid && s->pid != pid) ||
@@
-1626,6
+1636,9
@@
void exec_status_exit(ExecStatus *s, pid_t pid, int code, int status) {
s->code = code;
s->status = status;
s->code = code;
s->status = status;
+
+ if (utmp_id)
+ utmp_put_dead_process(utmp_id, pid, code, status);
}
void exec_status_dump(ExecStatus *s, FILE *f, const char *prefix) {
}
void exec_status_dump(ExecStatus *s, FILE *f, const char *prefix) {