[cgmanager-devel] [PATCH 3/3] Add --sigstop support
Stéphane Graber
stgraber at ubuntu.com
Fri Apr 4 17:11:37 UTC 2014
This is used to indicate that the service is ready so that upstart and
possibly some other systems can then have depending services start.
--daemon does something similar, however calling it prevents log message
from being logged.
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
cgmanager-proxy.c | 5 +++++
cgmanager.c | 5 +++++
frontend.c | 1 +
frontend.h | 1 +
4 files changed, 12 insertions(+)
diff --git a/cgmanager-proxy.c b/cgmanager-proxy.c
index 075c13f..35d797d 100644
--- a/cgmanager-proxy.c
+++ b/cgmanager-proxy.c
@@ -948,6 +948,8 @@ out:
static NihOption options[] = {
{ 0, "daemon", N_("Detach and run in the background"),
NULL, NULL, &daemonise, NULL },
+ { 0, "sigstop", N_("Raise SIGSTOP when ready"),
+ NULL, NULL, &sigstop, NULL },
{ 0, "check-master", N_("Check whether cgmanager is running"),
NULL, NULL, &checkmaster, NULL },
@@ -1030,6 +1032,9 @@ main (int argc, char *argv[])
exit(1);
}
+ if (sigstop)
+ raise(SIGSTOP);
+
ret = nih_main_loop ();
/* Destroy any PID file we may have created */
diff --git a/cgmanager.c b/cgmanager.c
index b3567ff..bb1ba5c 100644
--- a/cgmanager.c
+++ b/cgmanager.c
@@ -739,6 +739,8 @@ static NihOption options[] = {
NULL, "subsystems to mount", NULL, my_setter },
{ 0, "daemon", N_("Detach and run in the background"),
NULL, NULL, &daemonise, NULL },
+ { 0, "sigstop", N_("Raise SIGSTOP when ready"),
+ NULL, NULL, &sigstop, NULL },
NIH_OPTION_LAST
};
@@ -884,6 +886,9 @@ main (int argc, char *argv[])
}
}
+ if (sigstop)
+ raise(SIGSTOP);
+
ret = nih_main_loop ();
/* Destroy any PID file we may have created */
diff --git a/frontend.c b/frontend.c
index c575d5f..036594c 100644
--- a/frontend.c
+++ b/frontend.c
@@ -24,6 +24,7 @@
#include <frontend.h>
int daemonise = FALSE;
+int sigstop = FALSE;
bool setns_pid_supported = false;
unsigned long mypidns;
bool setns_user_supported = false;
diff --git a/frontend.h b/frontend.h
index c8ce4ae..144fd07 100644
--- a/frontend.h
+++ b/frontend.h
@@ -69,6 +69,7 @@
**/
#ifndef __frontend_c
extern int daemonise;
+extern int sigstop;
extern bool setns_pid_supported;
extern unsigned long mypidns;
extern bool setns_user_supported;
--
1.9.1
More information about the cgmanager-devel
mailing list