chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
turn negative options into positive options
[elogind.git]
/
src
/
execute.c
diff --git
a/src/execute.c
b/src/execute.c
index 0bdd60000bba15f60b6fbd3555d9041fc540ef03..2acb11192d45f44d40b0c9aaf9028a2d73c3c38b 100644
(file)
--- a/
src/execute.c
+++ b/
src/execute.c
@@
-197,7
+197,7
@@
static int connect_logger_as(const ExecContext *context, ExecOutput output, cons
output == EXEC_OUTPUT_KMSG ? "kmsg" : "syslog",
context->syslog_priority,
context->syslog_identifier ? context->syslog_identifier : ident,
output == EXEC_OUTPUT_KMSG ? "kmsg" : "syslog",
context->syslog_priority,
context->syslog_identifier ? context->syslog_identifier : ident,
-
!context->syslog_no
_prefix);
+
context->syslog_level
_prefix);
if (fd != nfd) {
r = dup2(fd, nfd) < 0 ? -errno : nfd;
if (fd != nfd) {
r = dup2(fd, nfd) < 0 ? -errno : nfd;
@@
-964,7
+964,7
@@
int exec_spawn(ExecCommand *command,
goto fail;
}
goto fail;
}
- if (!context->
no_setsid
)
+ if (!context->
same_pgrp
)
if (setsid() < 0) {
r = EXIT_SETSID;
goto fail;
if (setsid() < 0) {
r = EXIT_SETSID;
goto fail;
@@
-1083,8
+1083,8
@@
int exec_spawn(ExecCommand *command,
goto fail;
}
goto fail;
}
- if (context->timer_slack_ns_set)
- if (prctl(PR_SET_TIMERSLACK, context->timer_slack_ns
_set
) < 0) {
+ if (context->timer_slack_ns
ec
_set)
+ if (prctl(PR_SET_TIMERSLACK, context->timer_slack_ns
ec
) < 0) {
r = EXIT_TIMERSLACK;
goto fail;
}
r = EXIT_TIMERSLACK;
goto fail;
}
@@
-1281,8
+1281,7
@@
int exec_spawn(ExecCommand *command,
log_debug("Forked %s as %lu", command->path, (unsigned long) pid);
log_debug("Forked %s as %lu", command->path, (unsigned long) pid);
- command->exec_status.pid = pid;
- dual_timestamp_get(&command->exec_status.start_timestamp);
+ exec_status_start(&command->exec_status, pid);
*ret = pid;
return 0;
*ret = pid;
return 0;
@@
-1295,6
+1294,7
@@
void exec_context_init(ExecContext *c) {
c->ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, 0);
c->cpu_sched_policy = SCHED_OTHER;
c->syslog_priority = LOG_DAEMON|LOG_INFO;
c->ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, 0);
c->cpu_sched_policy = SCHED_OTHER;
c->syslog_priority = LOG_DAEMON|LOG_INFO;
+ c->syslog_level_prefix = true;
c->mount_flags = MS_SHARED;
}
c->mount_flags = MS_SHARED;
}
@@
-1469,8
+1469,8
@@
void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
fputs("\n", f);
}
fputs("\n", f);
}
- if (c->timer_slack_ns_set)
- fprintf(f, "%sTimerSlackNS
: %lu\n", prefix, c->timer_slack_ns
);
+ if (c->timer_slack_ns
ec
_set)
+ fprintf(f, "%sTimerSlackNS
ec: %lu\n", prefix, c->timer_slack_nsec
);
fprintf(f,
"%sStandardInput: %s\n"
fprintf(f,
"%sStandardInput: %s\n"
@@
-1561,9
+1561,21
@@
void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
}
}
}
}
-void exec_status_
fill(ExecStatus *s, pid_t pid, int code, int status
) {
+void exec_status_
start(ExecStatus *s, pid_t pid
) {
assert(s);
assert(s);
+ zero(*s);
+ s->pid = pid;
+ dual_timestamp_get(&s->start_timestamp);
+}
+
+void exec_status_exit(ExecStatus *s, pid_t pid, int code, int status) {
+ assert(s);
+
+ if ((s->pid && s->pid != pid) ||
+ !s->start_timestamp.realtime <= 0)
+ zero(*s);
+
s->pid = pid;
dual_timestamp_get(&s->exit_timestamp);
s->pid = pid;
dual_timestamp_get(&s->exit_timestamp);