chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
service: optionally, create INIT_PROCESS/DEAD_PROCESS entries for a service
[elogind.git]
/
src
/
execute.c
diff --git
a/src/execute.c
b/src/execute.c
index 6db048c5fce1d669981de7c5dd9d314c1e0b3e95..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
@@
-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) {