Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe86e7691d | ||
|
|
038cea416c | ||
|
|
e2bd550d13 | ||
|
|
ac49814607 | ||
|
|
09fc8fe09c | ||
|
|
3a2774732a | ||
|
|
dec0722c30 | ||
|
|
949daeb68b | ||
|
|
fbab2affd2 | ||
|
|
2824905935 |
76
ChangeLog
76
ChangeLog
@@ -1,3 +1,79 @@
|
|||||||
|
commit 038cea416c0a4cda83872733ab660cf0bb2b5eaf
|
||||||
|
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
commit e2bd550d13d23ce132650d7e3dc36dc512bf048e
|
||||||
|
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
|
||||||
|
typo fix
|
||||||
|
|
||||||
|
commit ac498146071636a3fbda4fb48ff64102c244415d
|
||||||
|
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
|
||||||
|
typo fix
|
||||||
|
|
||||||
|
commit 09fc8fe09c01a347666de66fb11e759de371a873
|
||||||
|
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
|
||||||
|
supervise-daemon: code cleanup
|
||||||
|
|
||||||
|
Clean up the process for killing an active supervisor when stopping.
|
||||||
|
|
||||||
|
commit 3a2774732aa629083bc6395c5c7a8a3040e64b60
|
||||||
|
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
|
||||||
|
initialize the stop schedule
|
||||||
|
|
||||||
|
commit dec0722c30e41480d300549a69d3672c38e0c15d
|
||||||
|
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
|
||||||
|
rc-schedules.c: pass the correct pid to rc_find_pids
|
||||||
|
|
||||||
|
This is for #163.
|
||||||
|
|
||||||
|
commit 949daeb68b2a39fa1e64f2eb3fa72579f98df09e
|
||||||
|
Author: Jason Zaman <jason@perfinion.com>
|
||||||
|
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
|
||||||
|
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);
|
||||||
|
^
|
||||||
|
|
||||||
|
commit fbab2affd2d5309ed4b5416e0e239902d77b4232
|
||||||
|
Author: Jason Zaman <jason@perfinion.com>
|
||||||
|
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
commit 28249059356d8b611a46c5493574abe9805ab48b
|
||||||
|
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
|
||||||
|
version 0.31.2
|
||||||
|
|
||||||
|
commit 60eadd5fa2ba2675caab4f977b8627bc07e39e8e
|
||||||
|
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
|
||||||
|
Update ChangeLog
|
||||||
|
|
||||||
commit 2a203b9b6e91e4ed140750eb9223012035870864
|
commit 2a203b9b6e91e4ed140750eb9223012035870864
|
||||||
Author: William Hubbs <w.d.hubbs@gmail.com>
|
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
NAME= openrc
|
NAME= openrc
|
||||||
VERSION= 0.31.1
|
VERSION= 0.31.2
|
||||||
PKG= ${NAME}-${VERSION}
|
PKG= ${NAME}-${VERSION}
|
||||||
|
|||||||
@@ -56,11 +56,6 @@ typedef struct scheduleitem {
|
|||||||
|
|
||||||
static TAILQ_HEAD(, scheduleitem) schedule;
|
static TAILQ_HEAD(, scheduleitem) schedule;
|
||||||
|
|
||||||
void initialize_schedulelist(void)
|
|
||||||
{
|
|
||||||
TAILQ_INIT(&schedule);
|
|
||||||
}
|
|
||||||
|
|
||||||
void free_schedulelist(void)
|
void free_schedulelist(void)
|
||||||
{
|
{
|
||||||
SCHEDULEITEM *s1 = TAILQ_FIRST(&schedule);
|
SCHEDULEITEM *s1 = TAILQ_FIRST(&schedule);
|
||||||
@@ -186,6 +181,7 @@ void parse_schedule(const char *applet, const char *string, int timeout)
|
|||||||
size_t len;
|
size_t len;
|
||||||
SCHEDULEITEM *item;
|
SCHEDULEITEM *item;
|
||||||
|
|
||||||
|
TAILQ_INIT(&schedule);
|
||||||
if (string)
|
if (string)
|
||||||
for (slash = string; *slash; slash++)
|
for (slash = string; *slash; slash++)
|
||||||
if (*slash == '/')
|
if (*slash == '/')
|
||||||
@@ -261,10 +257,10 @@ int do_stop(const char *applet, const char *exec, const char *const *argv,
|
|||||||
bool killed;
|
bool killed;
|
||||||
int nkilled = 0;
|
int nkilled = 0;
|
||||||
|
|
||||||
if (pid)
|
if (pid > 0)
|
||||||
pids = rc_find_pids(NULL, NULL, 0, pid);
|
pids = rc_find_pids(NULL, NULL, 0, pid);
|
||||||
else
|
else
|
||||||
pids = rc_find_pids(exec, argv, uid, pid);
|
pids = rc_find_pids(exec, argv, uid, 0);
|
||||||
|
|
||||||
if (!pids)
|
if (!pids)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#ifndef __RC_SCHEDULES_H
|
#ifndef __RC_SCHEDULES_H
|
||||||
#define __RC_SCHEDULES_H
|
#define __RC_SCHEDULES_H
|
||||||
|
|
||||||
void initialize_schedulelist(void);
|
|
||||||
void free_schedulelist(void);
|
void free_schedulelist(void);
|
||||||
int parse_signal(const char *applet, const char *sig);
|
int parse_signal(const char *applet, const char *sig);
|
||||||
void parse_schedule(const char *applet, const char *string, int timeout);
|
void parse_schedule(const char *applet, const char *string, int timeout);
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
#include "rc-selinux.h"
|
#include "rc-selinux.h"
|
||||||
|
|
||||||
/* the context files for selinux */
|
/* the context files for selinux */
|
||||||
#define RUN_INIT_FILE "run_init_type"
|
|
||||||
#define INITRC_FILE "initrc_context"
|
#define INITRC_FILE "initrc_context"
|
||||||
|
|
||||||
#ifdef HAVE_AUDIT
|
#ifdef HAVE_AUDIT
|
||||||
@@ -299,6 +298,26 @@ static int read_context_file(const char *filename, char **context)
|
|||||||
return ret;
|
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)
|
void selinux_setup(char **argv)
|
||||||
{
|
{
|
||||||
char *new_context = NULL;
|
char *new_context = NULL;
|
||||||
@@ -312,7 +331,7 @@ void selinux_setup(char **argv)
|
|||||||
return;
|
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 */
|
/* assume a reasonable default, rather than bailing out */
|
||||||
run_init_t = xstrdup("run_init_t");
|
run_init_t = xstrdup("run_init_t");
|
||||||
ewarn("Assuming SELinux run_init type is %s", run_init_t);
|
ewarn("Assuming SELinux run_init type is %s", run_init_t);
|
||||||
@@ -339,14 +358,13 @@ void selinux_setup(char **argv)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
curr_t = context_type_get(curr_con);
|
curr_t = xstrdup(context_type_get(curr_con));
|
||||||
if (!curr_t) {
|
if (!curr_t) {
|
||||||
context_free(curr_con);
|
context_free(curr_con);
|
||||||
free(curr_context);
|
free(curr_context);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
curr_t = xstrdup(curr_t);
|
|
||||||
/* dont need them anymore so free() now */
|
/* dont need them anymore so free() now */
|
||||||
context_free(curr_con);
|
context_free(curr_con);
|
||||||
free(curr_context);
|
free(curr_context);
|
||||||
|
|||||||
@@ -432,6 +432,7 @@ int main(int argc, char **argv)
|
|||||||
int respawn_period = 5;
|
int respawn_period = 5;
|
||||||
time_t respawn_now= 0;
|
time_t respawn_now= 0;
|
||||||
time_t first_spawn= 0;
|
time_t first_spawn= 0;
|
||||||
|
struct timespec ts;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
struct group *gr;
|
struct group *gr;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@@ -658,17 +659,19 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (stop) {
|
if (stop) {
|
||||||
pid = get_pid(applet, pidfile);
|
pid = get_pid(applet, pidfile);
|
||||||
if (pid == -1)
|
if (pid != -1) {
|
||||||
i = pid;
|
|
||||||
else
|
|
||||||
i = kill(pid, SIGTERM);
|
i = kill(pid, SIGTERM);
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
/* We failed to send the signal */
|
/* We failed to send the signal */
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
/* wait for the supervisor to go down */
|
/* wait for the supervisor to go down */
|
||||||
while (kill(pid, 0) == 0)
|
while (kill(pid, 0) == 0) {
|
||||||
sleep(1);
|
ts.tv_sec = 0;
|
||||||
|
ts.tv_nsec = 1;
|
||||||
|
nanosleep(&ts, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Even if we have not actually killed anything, we should
|
/* Even if we have not actually killed anything, we should
|
||||||
* remove information about it as it may have unexpectedly
|
* remove information about it as it may have unexpectedly
|
||||||
@@ -750,6 +753,7 @@ int main(int argc, char **argv)
|
|||||||
while (!exiting) {
|
while (!exiting) {
|
||||||
wait(&i);
|
wait(&i);
|
||||||
if (exiting) {
|
if (exiting) {
|
||||||
|
signal_setup(SIGCHLD, SIG_IGN);
|
||||||
syslog(LOG_INFO, "stopping %s, pid %d", exec, child_pid);
|
syslog(LOG_INFO, "stopping %s, pid %d", exec, child_pid);
|
||||||
nkilled = run_stop_schedule(applet, exec, NULL, child_pid,
|
nkilled = run_stop_schedule(applet, exec, NULL, child_pid,
|
||||||
0, false, false, true);
|
0, false, false, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user