Compare commits

..

4 Commits

Author SHA1 Message Date
William Hubbs
60eadd5fa2 Update ChangeLog 2017-09-16 22:55:42 -05:00
William Hubbs
2a203b9b6e sysfs: fix cgroup hybrid mode
In hybrid mode, we should not try to mount cgroup2 if it is not
available in the kernel.

This fixes #164.
2017-09-16 17:16:13 -05:00
William Hubbs
a769ea1b92 cgroup2_find_path: use legacy mode if cgroup2 is not in the kernel
This is related to #164.
2017-09-16 17:16:13 -05:00
William Hubbs
6f564b59cc version 0.31.1 2017-09-16 17:16:02 -05:00
18 changed files with 216 additions and 252 deletions

352
ChangeLog
View File

@@ -1,176 +1,4 @@
commit 8122e2d8f4fa8538e62f6a5e6b7306afcfc23c1c
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
supervise-daemon: elevate some log messages to warnings
Prior to this change, we were logging unexpected terminations of daemons
we were supervising at the info level. This change moves the logs to
warnings.
commit ff07754be27e20a4d272661b071b63b435018b51
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
version 0.33.1
commit acaed1f910a2a00fdd5b6aeab752c552075a7292
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Update ChangeLog
commit 91109e31d81ecd48f5690ad6f63103fca545dec7
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
update news
commit 2b6eeea01d1c64d58929788f4bfa0758393885bf
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
man: remove service(8) man page
commit a15de23e5713d840d871c526b46050983dc6ea1e
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
typo fix
commit efa9ba485d9328f780f3e60dc18339c75974c6c6
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
init.d/sysfs.in: fix reference to RC_LIBEXECDIR
The sysfs init script referred to @LIBEXECDIR@ before this change, but
it is better to refer to RC_LIBEXECDIR so that we get rid of a sed
substitution.
commit d4ddd72701ff5533a1ba07b1da60806859c63d88
Author: Chris Cromer <chris@cromer.cl>
Commit: William Hubbs <w.d.hubbs@gmail.com>
add option to make agetty startup quiet
This fixes #150
commit 1e9af2cd421423404ffe1491bd35af76c2885f1f
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
fix compiler warning
commit 3c05db74f6e733890e9035c183a774db3d512512
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
remove service binary
The service binary was just a synonym for rc-service, so use rc-service
instead of service. If you want a "service" binary, it should be
something that can determine which service manager you are running and
run the appropriate service manager commands.
commit edc54b03770d5f58d1a4969d06c28660003dfb04
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
version 0.33
commit 8e53a3fa8a33fb714064ddbe38bff2213fcf6837
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Update ChangeLog
commit 7f3b41311119e3a96a15b0fb473b44f422e903e9
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
use printf consistently in cgroups handling
This makes the cgroups handling consistent between cgroups v1 and v2.
Also, it fixes #167.
commit 1ccba056584ee1a8e09fb1d5eebd988b47912c06
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
sh/rc-functions.sh: add need_if_exists convenience function
commit c46adf14343df3a74aef7e4ae5be175ae5fa7a01
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
man/openrc-run.8: Clarify the explanation of the need dependency
commit 1cac8b080c16f9aab19c7a3ae1ca155c20dfa14d
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 b58194ef63ec8c0a7e0ea3c291da9c19aa83cb1a
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
typo fix
commit b28c0d6f66e42b1e6d2a39c286a18c8d92881790
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
typo fix
commit 3cf19b0f30a90157d23d09ded304439f1eb42d4a
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 0eb47b9af340dd07209a3920944ed085fe7bd359
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
initialize the stop schedule
commit 4ab60ff10935122277bbaed437f82a765279cd19
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 db4a578273dbfa15b8b96686391bcc9ecc04b646
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 b1c3422f453921e838d419640fe39144dbf8d13d
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 3fafd7a76e6adf15ec72a7ba5f44583eff8fab7a
commit 2a203b9b6e91e4ed140750eb9223012035870864
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
@@ -181,7 +9,7 @@ Commit: William Hubbs <w.d.hubbs@gmail.com>
This fixes #164.
commit cd5722aca50f0eaddde7ce04ee00da53c313ba7d
commit a769ea1b92f47254edf11458d2c8b79d3819e0e6
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
@@ -189,11 +17,11 @@ Commit: William Hubbs <w.d.hubbs@gmail.com>
This is related to #164.
commit dcb4a4d2613a1fdf85651b32e5b7a87528f487bc
commit 6f564b59cc15e688b2fa0758fa9797632e0751d7
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
version 0.32
version 0.31.1
commit e312e569970c74cf52e255da67034391b68dafac
Author: William Hubbs <w.d.hubbs@gmail.com>
@@ -1452,3 +1280,175 @@ Commit: William Hubbs <w.d.hubbs@gmail.com>
X-Gentoo-Bug: 597390
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=597390
commit c44c904a61418189c989e978b0237e5b161263ef
Author: Joe Maloney <jpm820@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
init.d.misc/wpa_supplicant: find wireless interface for FreeBSD
This fixes #101.
commit 78146b0e14cb57dda8a3aed3d4f8d6b1db7a3c7e
Author: Sven Wegener <swegener@gentoo.org>
Commit: William Hubbs <w.d.hubbs@gmail.com>
do_service: Initialize idx to 0
If index is not explicitly specified for service_started_daemon, it will
look for daemons by random index.
This fixes #100.
commit deaae7ab5c499191426cec81f6e803c972f0cca3
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
init.d/sysfs: load efivarfs module when booting in efi mode:1
The presence of /sys/firmware/efi is used to indicate that the system
was booted in efi mode.
commit 3d2c2f0b871944492036d04b0c220ccba1fa2dd5
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
init.d/sysfs: fix efivarfs module test
commit 6a0c033a64ce18056625cd37a94b9810dc5784e3
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
init.d/sysfs: fix efivarfs handling
Separate loading the module, if it isn't built in or loaded, from
mounting the file system.
This also makes sure the warning about configuring the module in
/etc/conf.d/modules or building it in is displayed only if it is loaded
successfully.
X-Gentoo-Bug: 595836
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=595836
commit 6710316a18c33601e780282e72c60f09b5175280
Author: Doug Freed <dwfreed@mtu.edu>
Commit: Doug Freed <dwfreed@mtu.edu>
openrc-run: fix double free
commit 61882821e0d6110a2ca2f67fad7c362983a85cf0
Author: Doug Freed <dwfreed@mtu.edu>
Commit: Doug Freed <dwfreed@mtu.edu>
init.d: Clean up some bad ewarn output
commit 969546bcf0203379db286be21c7f709d27cc73b0
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
typo fix
X-Gentoo-Bug: 595306
X-Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=595306
commit d0ae7ffc2534fa65c2e8927931f5107ce4505ca6
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
version 0.23
commit b71bcc242202752bc74fce3a5c629f172b04fca5
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
update ChangeLog
commit 24010dcb483cf7284cd8a5db111ae63f0d4e1038
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
dist: convert to tar.gz
This allows the "make dist" target to be used as well as the github
archive generation.
commit 0a76627345a173fc00be9864f3f3f5c3b15319cd
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
init.d/swap: remove the case for linux
I am removing the separate case for Linux, because we are droppping the
"-e" switch.
commit bbf98befb86337a36ef5af7f273e503a6de4b9bd
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
sh/init.sh.Linux.in: update test for live /proc to use md5sum
This allows us to avoid the warnings from bash-4.4 about null bytes in
command substitutions.
If you have separate /usr, are not using an initramfs, and have a file
called /proc/self/environ on your root file system, this will break.
X-Gentoo-Bug: 594534
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=594534
commit 316903fbf0da6edc067a98327c8c6cb2b3cdcf93
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
man/openrc-run.8: typo fix
commit 66a9788435e51e658e4ae9d3ce0d0e54ea53e4f9
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
man/openrc-run.8: Add note about eval usage
This fixes #77.
commit bf73363f220ff086d2559e7c2015801f80862749
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Add --use-blacklist to modprobe calls in modules and modules-load
This means that we will honor the modprobe black lists.
X-Gentoo-Bug: 594012
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=594012
commit d6c30ab12a3b335ac57cd1f0ac00231bb34fc0c4
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Revert "Remove eval calls from supervisor start functions"
This reverts commit 0d1f1010c299a95332f224c3be9e8dfdd85eec54.
We need the eval in case someone uses something like:
command_args="this \"is a\" test"
This is related to #77.
commit 0d1f1010c299a95332f224c3be9e8dfdd85eec54
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Remove eval calls from supervisor start functions
This fixes #77.
commit 83bb827edf5b9be04a326d1970d6f55db239281f
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Revert "Disable parallel startup in interactive mode"
This reverts commit 8b4fc05ff2645b2ecb0f153492f72dd8b39ba431.
The original commit did not explain why this feature was disabled, and I
now have a request to enable it.
This fixes #24.

View File

@@ -1,3 +1,3 @@
NAME= openrc
VERSION= 0.33.1
VERSION= 0.31.1
PKG= ${NAME}-${VERSION}

View File

@@ -3,15 +3,6 @@
This file will contain a list of notable changes for each release. Note
the information in this file is in reverse order.
## OpenRC 0.33
This version removes the "service" binary which was just a copy of
"rc-service" provided for compatibility.
If you still need the "service" binary, as opposed to "rc-service", it is
recommended that you use something like Debian's init-system-helpers.
Otherwise, just use "rc-service" in place of "service".
## OpenRC 0.31
This version adds support for Control Groups version 2, which is

View File

@@ -1,6 +1,3 @@
# make agetty quiet
#quiet="yes"
# Set the baud rate of the terminal line
#baud=""

View File

@@ -53,6 +53,9 @@ Calling `openrc` without any arguments will try to reset all services so
that the current runlevel is satisfied; if you manually started apache it will be
stopped, and if squid died but is in the current runlevel it'll be restarted.
There is a `service` helper that emulates the syntax seen on e.g. older Redhat
and Ubuntu (`service nginx start` etc.)
# Runlevels
OpenRC has a concept of runlevels, similar to what sysvinit historically

View File

@@ -16,7 +16,6 @@ term_type="${term_type:-linux}"
command=/sbin/agetty
command_args_foreground="${agetty_options} ${port} ${baud} ${term_type}"
pidfile="/run/${RC_SVCNAME}.pid"
export EINFO_QUIET="${quiet:-yes}"
depend() {
after local

View File

@@ -1,4 +1,4 @@
#!@SBINDIR@/openrc-run
S#!@BINDIR@/openrc-run
# Copyright (c) 2009-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS

View File

@@ -118,7 +118,7 @@ cgroup1_base()
fi
if ! mountinfo -q /sys/fs/cgroup/openrc; then
local agent="${RC_LIBEXECDIR}/sh/cgroup-release-agent.sh"
local agent="@LIBEXECDIR@/sh/cgroup-release-agent.sh"
mkdir /sys/fs/cgroup/openrc
mount -n -t cgroup \
-o none,${sysfs_opts},name=openrc,release_agent="$agent" \

View File

@@ -6,7 +6,7 @@ MAN3= einfo.3 \
rc_config.3 rc_deptree.3 rc_find_pids.3 rc_plugin_hook.3 \
rc_runlevel.3 rc_service.3 rc_stringlist.3
MAN8= rc-service.8 rc-status.8 rc-update.8 openrc.8 openrc-run.8 \
start-stop-daemon.8 supervise-daemon.8
service.8 start-stop-daemon.8 supervise-daemon.8
ifeq (${OS},Linux)
MAN8 += rc-sstat.8 openrc-init.8 openrc-shutdown.8

View File

@@ -217,10 +217,8 @@ that dependency type to the function, or prefix the names with ! to
remove them from the dependencies.
.Bl -tag -width "RC_DEFAULTLEVEL"
.It Ic need
The service will attempt to start any services it needs regardless of
whether they have been added to the runlevel. It will refuse to start
until all services it needs have started, and it will refuse to stop until all
services that need it have stopped.
The service will refuse to start until needed services have started and it
will refuse to stop until any services that need it have stopped.
.It Ic use
The service will attempt to start any services it uses that have been added
to the runlevel.

1
man/service.8 Normal file
View File

@@ -0,0 +1 @@
.so rc-service.8

View File

@@ -165,7 +165,7 @@ cgroup2_remove()
[ ! -e "${rc_cgroup_path}"/cgroup.events ] &&
return 0
grep -qx "$$" "${rc_cgroup_path}/cgroup.procs" &&
printf "%d" 0 > "${cgroup_path}/cgroup.procs"
echo 0 > "${cgroup_path}/cgroup.procs"
local key populated vvalue
while read -r key value; do
case "${key}" in
@@ -188,12 +188,12 @@ cgroup2_set_limits()
IFS="
"
[ ! -d "${rc_cgroup_path}" ] && mkdir "${rc_cgroup_path}"
printf "%d" 0 > "${rc_cgroup_path}/cgroup.procs"
echo 0 > "${rc_cgroup_path}/cgroup.procs"
echo "${rc_cgroup_settings}" | while IFS="$OIFS" read -r key value; do
[ -z "${key}" ] || [ -z "${value}" ] && continue
[ ! -e "${rc_cgroup_path}/${key}" ] && continue
veinfo "${RC_SVCNAME}: cgroups: ${key} ${value}"
printf "%s" "${value}" > "${rc_cgroup_path}/${key}"
echo "${value}" > "${rc_cgroup_path}/${key}"
done
IFS="$OIFS"
return 0

View File

@@ -119,13 +119,6 @@ get_bootparam_value()
echo $result
}
need_if_exists()
{
for x; do
rc-service --exists "${x}" && need "${x}"
done
}
# Called from openrc-run.sh or gendepends.sh
_get_containers() {
local c

View File

@@ -24,7 +24,7 @@ SBINDIR= ${PREFIX}/sbin
LINKDIR= ${LIBEXECDIR}
BINPROGS= rc-status
SBINPROGS = openrc openrc-run rc rc-service rc-update runscript \
SBINPROGS = openrc openrc-run rc rc-service rc-update runscript service \
start-stop-daemon supervise-daemon
RC_BINPROGS= einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
eindent eoutdent esyslog eval_ecolors ewaitfile \
@@ -150,7 +150,7 @@ rc-depend: rc-depend.o _usage.o rc-misc.o
rc-status: rc-status.o _usage.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
rc-service: rc-service.o _usage.o rc-misc.o
rc-service service: rc-service.o _usage.o rc-misc.o
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
rc-update: rc-update.o _usage.o rc-misc.o

View File

@@ -56,6 +56,11 @@ typedef struct scheduleitem {
static TAILQ_HEAD(, scheduleitem) schedule;
void initialize_schedulelist(void)
{
TAILQ_INIT(&schedule);
}
void free_schedulelist(void)
{
SCHEDULEITEM *s1 = TAILQ_FIRST(&schedule);
@@ -181,7 +186,6 @@ 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 == '/')
@@ -257,10 +261,10 @@ int do_stop(const char *applet, const char *exec, const char *const *argv,
bool killed;
int nkilled = 0;
if (pid > 0)
if (pid)
pids = rc_find_pids(NULL, NULL, 0, pid);
else
pids = rc_find_pids(exec, argv, uid, 0);
pids = rc_find_pids(exec, argv, uid, pid);
if (!pids)
return 0;
@@ -408,12 +412,11 @@ int run_stop_schedule(const char *applet,
if (progressed)
printf("\n");
if (! quiet) {
if (! quiet)
if (nrunning == 1)
eerror("%s: %d process refused to stop", applet, nrunning);
else
eerror("%s: %d process(es) refused to stop", applet, nrunning);
}
return -nrunning;
}

View File

@@ -13,6 +13,7 @@
#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);

View File

@@ -39,6 +39,7 @@
#include "rc-selinux.h"
/* the context files for selinux */
#define RUN_INIT_FILE "run_init_type"
#define INITRC_FILE "initrc_context"
#ifdef HAVE_AUDIT
@@ -298,26 +299,6 @@ 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;
@@ -331,7 +312,7 @@ void selinux_setup(char **argv)
return;
}
if (read_run_init_context(&run_init_t) != 0) {
if (read_context_file(RUN_INIT_FILE, &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);
@@ -358,13 +339,14 @@ void selinux_setup(char **argv)
goto out;
}
curr_t = xstrdup(context_type_get(curr_con));
curr_t = 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);

View File

@@ -432,7 +432,6 @@ 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;
@@ -659,19 +658,17 @@ int main(int argc, char **argv)
if (stop) {
pid = get_pid(applet, pidfile);
if (pid != -1) {
if (pid == -1)
i = pid;
else
i = kill(pid, SIGTERM);
if (i != 0)
/* We failed to send the signal */
exit(EXIT_FAILURE);
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);
}
}
/* wait for the supervisor to go down */
while (kill(pid, 0) == 0)
sleep(1);
/* Even if we have not actually killed anything, we should
* remove information about it as it may have unexpectedly
@@ -753,7 +750,6 @@ 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);
@@ -771,17 +767,17 @@ int main(int argc, char **argv)
} else
respawn_count++;
if (respawn_count >= respawn_max) {
syslog(LOG_WARNING, "respawned \"%s\" too many times, "
syslog(LOG_INFO, "respawned \"%s\" too many times, "
"exiting", exec);
exiting = true;
continue;
}
}
if (WIFEXITED(i))
syslog(LOG_WARNING, "%s, pid %d, exited with return code %d",
syslog(LOG_INFO, "%s, pid %d, exited with return code %d",
exec, child_pid, WEXITSTATUS(i));
else if (WIFSIGNALED(i))
syslog(LOG_WARNING, "%s, pid %d, terminated by signal %d",
syslog(LOG_INFO, "%s, pid %d, terminated by signal %d",
exec, child_pid, WTERMSIG(i));
child_pid = fork();
if (child_pid == -1)