aboutsummaryrefslogtreecommitdiff
path: root/src/rc/start-stop-daemon.c
AgeCommit message (Collapse)Author
2022-04-06migrate fully to meson build systemWilliam Hubbs
- drop old build system - move shared include and source files to common directory - drop "rc-" prefix from shared include and source files - move executable-specific code to individual directories under src - adjust top-level .gitignore file for new build system This closes #489.
2022-03-05Add Posix Scheduling Support to start-stop-daemon (#497)sad-goldfish
2022-03-05switch 0x100 constants to enumsMike Frysinger
This should make the code easier to maintain without having to remember what the exact 0x100 constant means.
2022-03-05switch 0x80 to 0x103 for long optionsMike Frysinger
We use 0x100+ to avoid collisions in the 8 bit getopt interface, so switch 0x80 to align with the other existing 0x100 options we have.
2022-02-06linux: Add support for No New Privs flagLinkTed
This add No New Privs flag for start-stop-daemon and supervise-daemon by adding --no-new-privs flag. As a result, the user set the No New Privs flag for the program should run with. see PR_SET_NO_NEW_PRIVS prctl(2)
2022-02-06capabilities: Add support for securebits flagsLinkTed
This adds securebits flags for start-stop-daemon and supervise-daemon by adding --secbits option. As a result, the user can specify securebits the program should run with. see capabilities(7)
2021-12-23capabilities: Add support for Linux capabilities(7)LinkTed
This adds capabilities for start-stop-daemon by adding --capabilities option. As a result, the user can specify the inheritable, ambient and bounding set by define capabilities in the service script. This fixes #314.
2021-12-22add option for OOM score adjustmentMatt Whitlock
This commit adds a new --oom-score-adj option to start-stop-daemon and supervise-daemon, as well as an equivalent SSD_OOM_SCORE_ADJ environment variable. If either of these are specified (with the command-line option taking precedence), then the specified adjustment value is written to /proc/self/oom_score_adj after forking but prior to exec'ing the daemon (at the time when nice and ionice are applied). Additionally, per a suggestion by Mike Frysinger, the suggested values for the SSD_NICELEVEL, SSD_IONICELEVEL, and SSD_OOM_SCORE_ADJ variables in the example config file are now given as zeros, which are the kernel's default values of these process knobs for the init process at boot. Note that uncommenting any of these zero-valued suggestions will cause SSD/SD to set the corresponding process knob affirmatively to zero, whereas leaving the variable unset (and the equivalent command- line option unspecified) means SSD/SD will not change the corresponding process knob from its inherited value. See: https://github.com/OpenRC/openrc/pull/435#discussion_r688310672 This fixes #435.
2021-12-21start-stop-daemon: fix typo in error messageMatt Whitlock
2021-12-21code style: remove space after unary "not" operatorMatt Whitlock
There are no semantic changes in this commit. Suggested-by: Mike Frysinger <vapier@gentoo.org> See: https://github.com/OpenRC/openrc/pull/435#pullrequestreview-727035394
2021-12-20use HEAD in git URIs to point to the default branchMike Frysinger
This makes the URIs shorter and dynamic: whatever the default branch the repo uses will be used.
2021-12-20change getopt definition to elide pointer storageMike Frysinger
Make this a const pointer to the storage directly instead of a pointer variable that points to the storage. Makes the code slightly smaller.
2021-02-22start-stop-daemon: Fix off by ones when checking for RC_* envvarsDisconnect3d
The same as https://github.com/OpenRC/openrc/pull/361 This fixes #362.
2020-11-27start-stop-daemon, supervise-daemon: fix parsing of usernames passed via ↵Johannes Heimansberg
--user that start with a number start-stop-daemon and supervise-daemon parse usernames and group names passed via the --user argument as numeric UID/GID if they start with a number (e.g. user "4foo" will be treated as UID 4). This results in the process that is being started to run under a totally unexpected user if that UID exists. Even though the result of the sscanf calls are tested for a result of exactly 1, which means exactly one value was extracted, because sscanf's format string only contains only one placeholder, it will never return a value greater than 1, even if there are still characters left to be parsed. This causes start-stop-daemon and supervise-daemon to assume that usernames starting with a number are just that number. Adding a second placeholder "%1s" to the format string, which matches a string of length 1, makes sure that sscanf can distinguish between pure numbers (in which case it will return 1) and strings either starting with a number (in which case it will return 2) and any other string (in which case it will return 0). This fixes #379. This fixes #380.
2020-11-20start-stop-daemon: Don't segfault if --exec was given a non-existing file nameLars Wendler
Starting program: /sbin/start-stop-daemon --start --exec i-dont-exist Program received signal SIGSEGV, Segmentation fault. 0x0000555555559053 in main (argc=1, argv=0x7fffffffdc20) at start-stop-daemon.c:631 631 *exec_file ? exec_file : exec); This fixes #385.
2019-07-24Fix build with ClangMartin Wilke
This fixes #313.
2018-12-28start-stop-daemon: fix compiler warningWilliam Hubbs
2018-12-27fix leading whitespacephilhofer
Clean up code indented with mixed tabs and spaces. No actual code changes. This fixes #280.
2018-11-15Do not complain if interrupted by a signalWilliam Hubbs
In start-stop-daemon and rc-schedules, we were printing out a warning if the nanosleep call was interrupted by a signal, but we did not treat this as an error situation other than displaying the message, so there is no need for the message.
2018-06-19start-stop-daemon: convert snprintf calls to xasprintfWilliam Hubbs
2018-06-19start-stop-daemon: fix gcc 7 warningsWilliam Hubbs
2018-06-15start-stop-daemon: add ability to log stdout or stderr to processesWilliam Hubbs
2018-05-02start-stop-daemon: don't fail stopping if pidfile is goneAndrey Utkin
If pidfile does not exist when we are stopping the daemon, assume it is already stopped, and report success. hostapd is an example of a daemon which removes its pidfile when it is exiting. If this daemon terminates prematurely, that is, without s-s-d involvement, then openrc fails to restart it, because s-s-d "stop" command fails when pidfile is missing. X-Gentoo-Bug: 646274 X-Gentoo-Bug-URL: https://bugs.gentoo.org/646274
2018-02-21start-stop-daemon: compiler warning cleanupWilliam Hubbs
2018-02-16start-stop-daemon: clean up string handlingWilliam Hubbs
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-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-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-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-04-03start-stop-daemon: warn if calling --start with --retry or --stop with --waitAustin English
This fixes #122
2017-01-25start-stop-daemon: allow all standard signalsDoug Freed
Also we define the signalpair_item macro. This fixes #113. X-Gentoo-Bug: 604986 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604986
2017-01-04Clean up warnings that can use the _unused macroBenda Xu
X-Gentoo-Bug: 604666 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604666
2017-01-04Indentation fixesBenda Xu
X-Gentoo-Bug: 604666 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=604666
2016-07-26start-stop-daemon: Add SSD_IONICELEVELKenneth Lakin
This is the disk IO counterpart to SSD_NICELEVEL. Modified by William Hubbs to add the variable to the start-stop-daemon man page. This fixes #69.
2016-07-14Remove the DEBUG_MEMORY macroWilliam Hubbs
This fixes #43.
2016-04-11start-stop-daemon: Allow group read/write when creating output filesMike Gilbert
This allows for better interaction with inherited ACL entries. This fixes #84. X-Gentoo-Bug: 577362 X-Gentoo-Bug-URL: https://bugs.gentoo.org/577362
2016-01-12Remove multicall binary structure from OpenRCWilliam Hubbs
This eliminates the need for the selinux-specific wrapper scrript we were installing in /lib*/rc/{bin,sbin}.
2015-12-21Convert OpenRC to a centralized copyright/license structureWilliam Hubbs
In the past, OpenRC was a hybrid of a centralized and file-scope license/copyright structure. I followed the instructions from the Software Freedom Law Center [1] to convert to a Centralized structure where possible, for easier future maintenance. [1] https://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html
2015-04-24start-stop-daemon: redirect stdin if --background option is usedWilliam Hubbs
X-Gentoo-Bug: 498684 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=498684
2015-03-24start-stop-daemon: Fix regression for --testWill Miles
The previous fix to --test (PR #34) prevented reading one too many arguments when --exec -or --name was not specified, but created a regression where the last argument would not print if either of those arguments was specified. This corrects the issue. Fixes #41.
2015-01-22Fix off-by-one error in --test argument printout in start-stop-daemon.Will Miles
Fixes #34.
2014-10-23helpers.h, start-stop-daemon.c: remove uneeded macrosAnthony G. Basile
TAILQ_CONCAT, TAILQ_FOREACH_SAFE and LIST_FOREACH_SAFE are defined in our bundled queue.h and are no longer required.
2014-10-23Bundle <sys/queue.h> from NetBSDAnthony G. Basile
We are bundling this to allow building on musl-based systems since musl does not include <sys/queue.h>.
2013-10-06start-stop-daemon: fix do_stop callsWilliam Hubbs
Several calls to do_stop were forcing the test parameter to be true, which was causing extra output to the terminal, such as: * Would send signal 0 to pid xxxxx This should only happen if the --test command line option was used.
2013-09-30start-stop-daemon: fix eerorr calls in get_pidWilliam Hubbs
The eerror calls in this function make it too verbose, so change them to ewarnv() calls instead. This means that they will only print if the --verbose option is used or EINFO_VERBOSE=yes is set in the environment.
2013-09-24start-stop-daemon: remove the verbose variableWilliam Hubbs
Along the same lines as the quiet variable, this is controlled by an environment variable for the einfo code, so we do not need a separate boolean flag.
2013-09-23start-stop-daemon: remove the quiet variableWilliam Hubbs
The suppression of output is controlled in the e* functions themselves, so there is no need for a variable to test in start-stop-daemon. X-Gentoo-Bug: 482396 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=482396