public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/openrc:0.31.x commit in: src/rc/
@ 2017-09-18 18:07 William Hubbs
  0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2017-09-18 18:07 UTC (permalink / raw
  To: gentoo-commits

commit:     dec0722c30e41480d300549a69d3672c38e0c15d
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sun Sep 17 19:20:05 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 15:28:42 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=dec0722c

rc-schedules.c: pass the correct pid to rc_find_pids

This is for #163.

 src/rc/rc-schedules.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/rc/rc-schedules.c b/src/rc/rc-schedules.c
index 13f615ee..164581d6 100644
--- a/src/rc/rc-schedules.c
+++ b/src/rc/rc-schedules.c
@@ -261,10 +261,10 @@ int do_stop(const char *applet, const char *exec, const char *const *argv,
 	bool killed;
 	int nkilled = 0;
 
-	if (pid)
+	if (pid > 0)
 		pids = rc_find_pids(NULL, NULL, 0, pid);
 	else
-		pids = rc_find_pids(exec, argv, uid, pid);
+		pids = rc_find_pids(exec, argv, uid, 0);
 
 	if (!pids)
 		return 0;


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:0.31.x commit in: src/rc/
@ 2017-09-18 22:06 William Hubbs
  0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2017-09-18 22:06 UTC (permalink / raw
  To: gentoo-commits

commit:     038cea416c0a4cda83872733ab660cf0bb2b5eaf
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Sep 18 21:59:18 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 22:06:17 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=038cea41

ignore sigchld when shutting down the supervised process

We need to do this to skip the zombie state for the child process since
we are not easily able to wait() for it.

 src/rc/supervise-daemon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index 09db1912..a781ad9d 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -753,6 +753,7 @@ int main(int argc, char **argv)
 		while (!exiting) {
 			wait(&i);
 			if (exiting) {
+				signal_setup(SIGCHLD, SIG_IGN);
 				syslog(LOG_INFO, "stopping %s, pid %d", exec, child_pid);
 				nkilled = run_stop_schedule(applet, exec, NULL, child_pid,
 						0, false, false, true);


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:0.31.x commit in: src/rc/
@ 2017-09-18 22:06 William Hubbs
  0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2017-09-18 22:06 UTC (permalink / raw
  To: gentoo-commits

commit:     e2bd550d13d23ce132650d7e3dc36dc512bf048e
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Sep 18 18:30:56 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 18:33:19 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=e2bd550d

typo fix

 src/rc/supervise-daemon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index 3d39906e..09db1912 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -670,6 +670,7 @@ int main(int argc, char **argv)
 				ts.tv_sec = 0;
 				ts.tv_nsec = 1;
 				nanosleep(&ts, NULL);
+			}
 		}
 
 		/* Even if we have not actually killed anything, we should


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:0.31.x commit in: src/rc/
@ 2017-09-18 18:07 William Hubbs
  0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2017-09-18 18:07 UTC (permalink / raw
  To: gentoo-commits

commit:     3a2774732aa629083bc6395c5c7a8a3040e64b60
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Sep 18 15:36:17 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 16:57:53 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=3a277473

initialize the stop schedule

 src/rc/rc-schedules.c | 6 +-----
 src/rc/rc-schedules.h | 1 -
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/rc/rc-schedules.c b/src/rc/rc-schedules.c
index 164581d6..9568e51d 100644
--- a/src/rc/rc-schedules.c
+++ b/src/rc/rc-schedules.c
@@ -56,11 +56,6 @@ typedef struct scheduleitem {
 
 static TAILQ_HEAD(, scheduleitem) schedule;
 
-void initialize_schedulelist(void)
-{
-	TAILQ_INIT(&schedule);
-}
-
 void free_schedulelist(void)
 {
 	SCHEDULEITEM *s1 = TAILQ_FIRST(&schedule);
@@ -186,6 +181,7 @@ void parse_schedule(const char *applet, const char *string, int timeout)
 	size_t len;
 	SCHEDULEITEM *item;
 
+	TAILQ_INIT(&schedule);
 	if (string)
 		for (slash = string; *slash; slash++)
 			if (*slash == '/')

diff --git a/src/rc/rc-schedules.h b/src/rc/rc-schedules.h
index 234e62df..e5dd64c2 100644
--- a/src/rc/rc-schedules.h
+++ b/src/rc/rc-schedules.h
@@ -13,7 +13,6 @@
 #ifndef __RC_SCHEDULES_H
 #define __RC_SCHEDULES_H
 
-void initialize_schedulelist(void);
 void free_schedulelist(void);
 int parse_signal(const char *applet, const char *sig);
 void parse_schedule(const char *applet, const char *string, int timeout);


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:0.31.x commit in: src/rc/
@ 2017-09-18 18:07 William Hubbs
  0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2017-09-18 18:07 UTC (permalink / raw
  To: gentoo-commits

commit:     09fc8fe09c01a347666de66fb11e759de371a873
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Sep 18 17:25:37 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 17:28:58 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=09fc8fe0

supervise-daemon: code cleanup

Clean up the process for killing an active supervisor when stopping.

 src/rc/supervise-daemon.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index 7b894e7b..2800d1a2 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -432,6 +432,7 @@ int main(int argc, char **argv)
 	int respawn_period = 5;
 	time_t respawn_now= 0;
 	time_t first_spawn= 0;
+	struct timespec ts;
 	struct passwd *pw;
 	struct group *gr;
 	FILE *fp;
@@ -658,17 +659,18 @@ int main(int argc, char **argv)
 
 	if (stop) {
 		pid = get_pid(applet, pidfile);
-		if (pid == -1)
-			i = pid;
-		else
+		if (pid != -1) {
 			i = kill(pid, SIGTERM);
-		if (i != 0)
-			/* We failed to send the signal */
-			exit(EXIT_FAILURE);
-
-		/* wait for the supervisor to go down */
-		while (kill(pid, 0) == 0)
-			sleep(1);
+			if (i != 0)
+				/* We failed to send the signal */
+				exit(EXIT_FAILURE);
+
+			/* wait for the supervisor to go down */
+			while (kill(pid, 0) == 0)
+				ts.tv_sec = 0;
+				ts.tv_nsec = 1;
+				nanosleep(&ts, NULL);
+		}
 
 		/* Even if we have not actually killed anything, we should
 		 * remove information about it as it may have unexpectedly


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:0.31.x commit in: src/rc/
@ 2017-09-18 18:07 William Hubbs
  0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2017-09-18 18:07 UTC (permalink / raw
  To: gentoo-commits

commit:     ac498146071636a3fbda4fb48ff64102c244415d
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Sep 18 18:03:34 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 18:06:52 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=ac498146

typo fix

 src/rc/supervise-daemon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index 2800d1a2..3d39906e 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -666,7 +666,7 @@ int main(int argc, char **argv)
 				exit(EXIT_FAILURE);
 
 			/* wait for the supervisor to go down */
-			while (kill(pid, 0) == 0)
+			while (kill(pid, 0) == 0) {
 				ts.tv_sec = 0;
 				ts.tv_nsec = 1;
 				nanosleep(&ts, NULL);


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:0.31.x commit in: src/rc/
@ 2017-09-18 18:07 William Hubbs
  0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2017-09-18 18:07 UTC (permalink / raw
  To: gentoo-commits

commit:     949daeb68b2a39fa1e64f2eb3fa72579f98df09e
Author:     Jason Zaman <jason <AT> perfinion <DOT> com>
AuthorDate: Sun Sep 17 15:52:52 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 15:28:42 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=949daeb6

selinux: fix const qualifier warning

rc-selinux.c: In function ‘selinux_setup’:
rc-selinux.c:361:9: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  curr_t = context_type_get(curr_con);
         ^

 src/rc/rc-selinux.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/rc/rc-selinux.c b/src/rc/rc-selinux.c
index 514ca5e5..bfaf1556 100644
--- a/src/rc/rc-selinux.c
+++ b/src/rc/rc-selinux.c
@@ -358,14 +358,13 @@ void selinux_setup(char **argv)
 		goto out;
 	}
 
-	curr_t = context_type_get(curr_con);
+	curr_t = xstrdup(context_type_get(curr_con));
 	if (!curr_t) {
 		context_free(curr_con);
 		free(curr_context);
 		goto out;
 	}
 
-	curr_t = xstrdup(curr_t);
 	/* dont need them anymore so free() now */
 	context_free(curr_con);
 	free(curr_context);


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/openrc:0.31.x commit in: src/rc/
@ 2017-09-18 18:07 William Hubbs
  0 siblings, 0 replies; 8+ messages in thread
From: William Hubbs @ 2017-09-18 18:07 UTC (permalink / raw
  To: gentoo-commits

commit:     fbab2affd2d5309ed4b5416e0e239902d77b4232
Author:     Jason Zaman <jason <AT> perfinion <DOT> com>
AuthorDate: Sun Sep 17 13:15:13 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 15:28:42 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=fbab2aff

selinux: use openrc contexts path to get contexts

The minimum requirement for libselinux is now >=2.6
The refpolicy and the gentoo policy contain the
contexts since version 2.20170204-r4

 src/rc/rc-selinux.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/rc/rc-selinux.c b/src/rc/rc-selinux.c
index 2eb631a6..514ca5e5 100644
--- a/src/rc/rc-selinux.c
+++ b/src/rc/rc-selinux.c
@@ -39,7 +39,6 @@
 #include "rc-selinux.h"
 
 /* the context files for selinux */
-#define RUN_INIT_FILE "run_init_type"
 #define INITRC_FILE "initrc_context"
 
 #ifdef HAVE_AUDIT
@@ -299,6 +298,26 @@ static int read_context_file(const char *filename, char **context)
 	return ret;
 }
 
+static int read_run_init_context(char **context)
+{
+	int ret = -1;
+	RC_STRINGLIST *list;
+	char *value = NULL;
+
+	list = rc_config_list(selinux_openrc_contexts_path());
+	if (list == NULL)
+		return ret;
+
+	value = rc_config_value(list, "run_init");
+	if (value != NULL && strlen(value) > 0) {
+		*context = xstrdup(value);
+		ret = 0;
+	}
+
+	rc_stringlist_free(list);
+	return ret;
+}
+
 void selinux_setup(char **argv)
 {
 	char *new_context = NULL;
@@ -312,7 +331,7 @@ void selinux_setup(char **argv)
 		return;
 	}
 
-	if (read_context_file(RUN_INIT_FILE, &run_init_t) != 0) {
+	if (read_run_init_context(&run_init_t) != 0) {
 		/* assume a reasonable default, rather than bailing out */
 		run_init_t = xstrdup("run_init_t");
 		ewarn("Assuming SELinux run_init type is %s", run_init_t);


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-09-18 22:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-18 18:07 [gentoo-commits] proj/openrc:0.31.x commit in: src/rc/ William Hubbs
  -- strict thread matches above, loose matches on Subject: below --
2017-09-18 22:06 William Hubbs
2017-09-18 22:06 William Hubbs
2017-09-18 18:07 William Hubbs
2017-09-18 18:07 William Hubbs
2017-09-18 18:07 William Hubbs
2017-09-18 18:07 William Hubbs
2017-09-18 18:07 William Hubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox