aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2017-12-04rc-service: add --ifcrashed optionWilliam Hubbs
This works like the other --if options. If the service is crashed, run the command. This fixes #154.
2017-11-30Fix repeated dependency cache rebuild if clock skewedWill Miles
rc_deptree_update_needed would return early as soon as it found any file newer than the existing dependency cache. Unfortunately, the first file found may not be the newest one there; so the clock skew workaround in rc-misc:_rc_deptree_load would be given a timestamp that was still too old. This fix forces a full scan of all relevant files, so as to ensure that we return a timestamp that will allow the clock skew fix to operate. The runtime cost is no worse than the case where the cache is up to date (ie. we must check every possible file). This fixes #161.
2017-11-29start-stop-daemon: properly handle missing pidfileDoug Freed
X-Gentoo-Bug: 639218 X-Gentoo-Bug-URL: https://bugs.gentoo.org/639218
2017-11-27fix FreeBSD buildWilliam Hubbs
This is for #186.
2017-11-19rc-schedules: if given nothing to look for, stopDoug Freed
This avoids trying to kill everything. X-Gentoo-Bug: 631958 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=631958
2017-11-13rc_find_pids: namespace fixWilliam Hubbs
Ignore namespaces if there are errors reading either the pid namespace for the current process or the process we aare testing. This fixes https://github.com/openrc/openrc/issues/180.
2017-11-07start-stop-daemon: do not use do_stop to verify whether a daemon is runningWilliam Hubbs
X-Gentoo-Bug: 636574 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=636574
2017-10-30fix issue with --reexec callWilliam Hubbs
2017-10-27supervise-daemon: use RC_SVCNAME as the first argument to the daemonWilliam Hubbs
This makes ps show which service the supervisor is monitoring.
2017-10-27supervise-daemon: fix logging for reexec and the child command lineWilliam Hubbs
2017-10-27log as supervise-daemon not the serviceWilliam Hubbs
2017-10-26supervise-daemon: clarify a log messageWilliam Hubbs
2017-10-26supervise-daemon: log the command line we run to spawn the child processWilliam Hubbs
2017-10-26supervise-daemon: log with the service name instead of "supervise-daemon"William Hubbs
2017-10-26implement "unsupervised" statusWilliam Hubbs
The unsupervised status is to be used when a supervisor of a supervised service dies but leaves the service daemon itself running.
2017-10-26supervise-daemon: remove child_pid from saved options during shutdownWilliam Hubbs
This allows us to detect when the supervisor dies unexpectedly because in that case child_pid will still exist.
2017-10-26rc_service_value_set: remove the option if NULL is the valueWilliam Hubbs
This allows the equivalent of "unsetting" a value for a service.
2017-10-24supervise-daemon: fix build issue for >=glibc-2.26William Hubbs
X-Gentoo-Bug: 635334 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=635334
2017-10-24rc_find_pids: ignore pids that are not in our pid namespaceWilliam Hubbs
X-Gentoo-Bug: 634634 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=634634
2017-10-24supervise-daemon: multiple fixesWilliam Hubbs
- Harden against dying by handling all signals that would terminate the program and adding --reexec support - factor the supervisor into its own function - fix test for whether we are already running
2017-10-18supervise-daemon: elevate some log messages to warningsWilliam Hubbs
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.
2017-10-05fix compiler warningWilliam Hubbs
2017-10-02remove service binaryWilliam Hubbs
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.
2017-09-18ignore sigchld when shutting down the supervised processWilliam Hubbs
We need to do this to skip the zombie state for the child process since we are not easily able to wait() for it.
2017-09-18typo fixWilliam Hubbs
2017-09-18typo fixWilliam Hubbs
2017-09-18supervise-daemon: code cleanupWilliam Hubbs
Clean up the process for killing an active supervisor when stopping.
2017-09-18initialize the stop scheduleWilliam Hubbs
2017-09-17rc-schedules.c: pass the correct pid to rc_find_pidsWilliam Hubbs
This is for #163.
2017-09-17selinux: fix const qualifier warningJason Zaman
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); ^
2017-09-17selinux: use openrc contexts path to get contextsJason Zaman
The minimum requirement for libselinux is now >=2.6 The refpolicy and the gentoo policy contain the contexts since version 2.20170204-r4
2017-09-14add quiet switch to do_stop in src-schedules.cWilliam Hubbs
This allows supervise-daemon to run this code without attempting to print some status messages used by start-stop-daemon.
2017-09-06add quiet parameter to run_stop_scheduleWilliam Hubbs
2017-09-06add retry option to supervise-daemonWilliam Hubbs
The --retry option for supervise-daemon defines how the supervisor will attempt to stop the child process it is monitoring. It is defined when the supervisor is started since stopping the supervisor just sends a signal to the active supervisor. This fixes #160.
2017-08-25make run_stop_schedule accept a pid instead of a pid fileWilliam Hubbs
2017-08-24start-stop-daemon: move --retry processing code to a shared moduleWilliam Hubbs
This was part of start-stop-daemon; however, it needs to be shared in order to be used by supervise-daemon.
2017-08-23move get_pid function to a shared fileWilliam Hubbs
2017-07-24fix ENT macro usageJason Graham
X-Gentoo-Bug: 624796 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=624796
2017-06-08kill_all: include limits.h for PATH_MAXJory A. Pratt
2017-06-08fix compile issue for muslWilliam Hubbs
2017-06-05openrc-shutdown: add --single option and clean up option processingWilliam Hubbs
2017-06-04add support for writing reboot and shutdown records to wtmpWilliam Hubbs
2017-05-30openrc-init: fix buffer overflow in init.ctlSergei Trofimovich
How to reproduce 1-byte overflow: ``` $ FEATURES=-test CFLAGS="-fsanitize=address -O0 -ggdb3" emerge -1 openrc ================================================================= ==1==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff0efd8710 at pc 0x000000402076 bp 0x7fff0efd7d50 sp 0x7fff0efd7d40 WRITE of size 1 at 0x7fff0efd8710 thread T0 #0 0x402075 (/sbin/openrc-init+0x402075) #1 0x3cf6e2070f in __libc_start_main (/lib64/libc.so.6+0x3cf6e2070f) #2 0x4013b8 (/sbin/openrc-init+0x4013b8) Address 0x7fff0efd8710 is located in stack of thread T0 at offset 2432 in frame #0 0x401cfb (/sbin/openrc-init+0x401cfb) This frame has 3 object(s): [32, 160) 'signals' [192, 344) 'sa' [384, 2432) 'buf' <== Memory access at offset 2432 overflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-overflow ??:0 ?? ``` The problem here is in the code handling reads from 'init.ctl': ``` int main(int argc, char **argv) { ... char buf[2048]; for (;;) { /* This will block until a command is sent down the pipe... */ fifo = fopen(RC_INIT_FIFO, "r"); count = fread(buf, 1, 2048, fifo); buf[count] = 0; ... } ``` `buf[count] = 0;` writes outside the buffer when `fread()` returns non-truncated read. This fixes #138.
2017-05-30rc-logger.c: fix crash on fclose(NULL) (#137)Sergei Trofimovich
Only close the log if we successfully opened it. Reported-by: Brian Evans <grknight@gentoo.org> Tested-by: Brian Evans <grknight@gentoo.org> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2017-05-22openrc-shutdown: add dry-run optionWilliam Hubbs
2017-05-22openrc-shutdown: move to single user mode by defaultWilliam Hubbs
To be more compatible with sysvinit, move to single user mode if no options are specified on the command line.
2017-05-22init: add ability to switch to single user modeWilliam Hubbs
2017-05-19add kill_all helperWilliam Hubbs
This is similar to the sysvinit killall5 utility. It should only be used in service scripts, so it will not be installed in the path. This closes #129.
2017-05-15rc_status: calculate time differences in time_t and display seconds in uptimeWilliam Hubbs
2017-05-12supervise-daemon: save start time and respawn count before dropping privsWilliam Hubbs