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: introduce Type=idle and use it for gettys
[elogind.git]
/
src
/
core
/
execute.c
diff --git
a/src/core/execute.c
b/src/core/execute.c
index 271c57f562186974fcde25e0c76b5afb99a8c5b8..99a7881f1cbbc81c03d2af9fe36ca5dfe87e7ec1 100644
(file)
--- a/
src/core/execute.c
+++ b/
src/core/execute.c
@@
-37,6
+37,7
@@
#include <sys/mount.h>
#include <linux/fs.h>
#include <linux/oom.h>
#include <sys/mount.h>
#include <linux/fs.h>
#include <linux/oom.h>
+#include <sys/poll.h>
#ifdef HAVE_PAM
#include <security/pam_appl.h>
#ifdef HAVE_PAM
#include <security/pam_appl.h>
@@
-962,6
+963,8
@@
int exec_spawn(ExecCommand *command,
bool confirm_spawn,
CGroupBonding *cgroup_bondings,
CGroupAttribute *cgroup_attributes,
bool confirm_spawn,
CGroupBonding *cgroup_bondings,
CGroupAttribute *cgroup_attributes,
+ const char *cgroup_suffix,
+ int idle_pipe[2],
pid_t *ret) {
pid_t pid;
pid_t *ret) {
pid_t pid;
@@
-1049,6
+1052,15
@@
int exec_spawn(ExecCommand *command,
goto fail_child;
}
goto fail_child;
}
+ if (idle_pipe) {
+ if (idle_pipe[1] >= 0)
+ close_nointr_nofail(idle_pipe[1]);
+ if (idle_pipe[0] >= 0) {
+ fd_wait_for_event(idle_pipe[0], POLLHUP, DEFAULT_TIMEOUT_USEC);
+ close_nointr_nofail(idle_pipe[0]);
+ }
+ }
+
/* Close sockets very early to make sure we don't
* block init reexecution because it cannot bind its
* sockets */
/* Close sockets very early to make sure we don't
* block init reexecution because it cannot bind its
* sockets */
@@
-1154,7
+1166,7
@@
int exec_spawn(ExecCommand *command,
}
if (cgroup_bondings) {
}
if (cgroup_bondings) {
- err = cgroup_bonding_install_list(cgroup_bondings, 0);
+ err = cgroup_bonding_install_list(cgroup_bondings, 0
, cgroup_suffix
);
if (err < 0) {
r = EXIT_CGROUP;
goto fail_child;
if (err < 0) {
r = EXIT_CGROUP;
goto fail_child;
@@
-1505,7
+1517,7
@@
int exec_spawn(ExecCommand *command,
* sure that when we kill the cgroup the process will be
* killed too). */
if (cgroup_bondings)
* sure that when we kill the cgroup the process will be
* killed too). */
if (cgroup_bondings)
- cgroup_bonding_install_list(cgroup_bondings, pid);
+ cgroup_bonding_install_list(cgroup_bondings, pid
, cgroup_suffix
);
log_debug("Forked %s as %lu", command->path, (unsigned long) pid);
log_debug("Forked %s as %lu", command->path, (unsigned long) pid);