Commit Graph

110 Commits

Author SHA1 Message Date
Matt Whitlock
fd1e4a384a add option for OOM score adjustment
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-22 10:01:14 -06:00
Mike Frysinger
301161a7a4 use HEAD in git URIs to point to the default branch
This makes the URIs shorter and dynamic: whatever the default branch
the repo uses will be used.
2021-12-20 20:07:00 -05:00
Aidan Harris
eaa42da9a6 Use cgroup.kill in cgroup_cleanup when possible
The old code is moved to a cgroup_fallback_cleanup function and only
 called if cgroup2_kill fails.

 This fixes #454.
2021-10-15 22:10:37 -05:00
William Hubbs
d6622a1156 add meson build files
Closes #116.
Closes #171.
Closes #172.
Closes #175.
2021-09-04 16:01:29 -05:00
William Hubbs
4fb4674374 fix unified cgroups v2 setup
The cgroups v2 setup required the rc_cgroups_controllers variable
to be set to the list of controllers to enable regardless of whether the
mode was hybrid or unified.

This makes sense for hybrid mode since the controllers can't be in both
the cgroups v1 and v2 hierarchies, but for unified mode we should enable
all controllers that are configured in the kernel.
2021-02-23 23:08:56 -06:00
William Hubbs
5427783fdf standardize the default shell
I do not know of a need to have the default shell be a build-time
configurable setting. All *nix systems I am aware of have /bin/sh as a
default posix compatible shell.
If some systems running OpenRC do not make that assumption about
/bin/sh, I will consider bringing this back, so feel free to open an
issue.
2018-12-08 12:06:26 -06:00
William Hubbs
ee41e444ad rc.conf: typo fix
X-Gentoo-Bug: 670874
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=670874
2018-11-29 08:19:56 -06:00
William Hubbs
c6047f887a cgroups: add rc_cgroup_memory_use_hierarchy setting for cgroups v1 2018-02-26 14:33:15 -06:00
William Hubbs
6a5ca2ab36 make the procedure for killing child processes of services configurable 2017-09-14 16:17:20 -05:00
William Hubbs
457f928e79 add support for control groups version 2
This is for #94.
2017-09-14 10:38:10 -05:00
William Hubbs
13ca79856e add init process
openrc-init.c and openrc-shutdown.c are based on code which was written by
James Hammons <jlhamm@acm.org>, so I would like to publically
thank him for his work.
2017-04-06 17:13:59 -05:00
Doug Freed
8ad460c54c Fix typos
Fixes #99
2016-12-17 18:41:02 +00:00
William Hubbs
dd61e6bfc3 rc.conf: fix the commented default setting for rc_logger
X-Gentoo-Bug: 601480
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=601480
2016-12-15 17:52:34 -06:00
William Hubbs
969546bcf0 typo fix
X-Gentoo-Bug: 595306
X-Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=595306
2016-09-27 19:39:02 -05:00
Kenneth Lakin
94b98430cb start-stop-daemon: Add SSD_IONICELEVEL
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-26 12:30:39 -05:00
William Hubbs
8927a37fb7 etc: remove rc.conf.* file fragments 2016-07-20 15:38:36 -05:00
William Hubbs
b085b2cda5 etc: create default rc.conf
Before now, /etc/rc.conf was created by the build system from multiple
rc.conf.* file fragments and there was no reason for this.
2016-07-20 15:37:50 -05:00
William Hubbs
000503fad7 Convert OpenRC to a centralized copyright/license structure
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-12-21 12:16:06 -06:00
William Hubbs
a4038e1171 rc.conf.Linux: document the rkt keyword 2015-12-02 11:11:45 -06:00
William Hubbs
9fedb3b40b Add detection for docker containers 2015-12-02 10:20:15 -06:00
William Hubbs
6cae41a4e6 etc/rc.conf: Clean up documentation for rc_hotplug
X-Gentoo-Bug: 554540
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=554540
2015-10-21 12:49:00 -05:00
Austin S. Hemmelgarn
80d3928b0d cgroups: Add the hugetlb, net_cls and pids controllers
Note from WilliamH: I slightly rearranged the code and added the
settings in rc.conf.

X-Gentoo-Bug: 555488
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=555488
2015-10-06 15:05:35 -05:00
William Hubbs
bbabf546f9 Document bash's handling of ulimit options
When bash is used in posix mode for the shell, the ulimit command uses
a block size of 512 bytes for the -c and -f options.

X-Gentoo-Bug: 549238
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=549238
2015-05-22 09:43:51 -05:00
William Hubbs
a15fa1a3b1 Rework supervisor integration framework
The original way of doing this allowed users to change the supervisor in
conf.d/*. This changes this so that the supervisor setup can be done in
the service script itself.
2015-05-11 09:44:06 -05:00
William Hubbs
0198affc74 The rc_supervisor variable is a service configuration variable
This variable should not be changed globally unless you really know what
you are doing.
2015-05-08 12:29:26 -05:00
William Hubbs
abef2fcb2d Make the default start, stop and status functions overridable
This will make it possible to add support for supervision suites such as
runit and s6.
2015-05-08 11:39:39 -05:00
William Hubbs
c709e6077c Add support for systemd-nspawn containers
This adds support for running OpenRC in a container created by
the systemd-nspawn utility.

This fixes #52.

X-Gentoo-Bug: 548058
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=548058
2015-05-01 09:04:07 -05:00
William Hubbs
72186ea3bb etc/rc and etc/rc.shutdown: change references from rc to openrc 2014-12-07 19:07:11 -06:00
Svante Signell
203b754f84 add missing files for GNU/Hurd 2014-10-23 13:00:24 -05:00
William Hubbs
24d82d9ff1 rc.conf: document rc_verbose 2014-08-11 12:57:23 -05:00
William Hubbs
e0e1f2a4da rc.conf: typo fix 2014-03-14 22:18:25 -05:00
William Hubbs
d0186d422c rc.conf: document rc_nocolor setting 2014-03-09 15:37:38 -05:00
William Hubbs
7230b29bf3 rc.conf: Sync list of network file systems with actual defaults
I would like to thank Aaron Ten Clay <aarontc@aarontc.com> for pointing
this out; this is based on a patch he submitted.

X-Gentoo-Bug: 491384
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=491384
2013-12-08 13:40:23 -06:00
Steven Chamberlain
766d71c2d3 Begin port to GNU/kFreeBSD
This is just a minimal port to get Debian up and running; the rest will
be done later.
2013-10-30 01:40:03 -05:00
Gary
9ebd5a6aff Add support for DragonFly BSD 2013-07-25 22:33:24 -05:00
Alexander Vershilov
c984506537 add cgroup cleanup support
This adds the ability to kill all processes within a service's cgroup
when that service is stopped or restarted.
2013-04-25 16:59:19 -05:00
William Hubbs
66dd88d6f6 config: move rc_fuser_timeout to rc.conf
I was told that fuser does exist on *bsd, so this will need to bee
supported there. This moves the timeout setting to rc.conf.
2013-03-12 14:16:41 -05:00
William Hubbs
6794441224 Make fuser command time out
This avoids situations in which fuser hangs because of open files on
remote file systems when the remote system goes down.
I have also passed this bug on to the maintainers of psmisc since it
should really be fixed in fuser.
This is based on a patch submitted by evermind@tuxfamily.org

Reported-by: evermind@tuxfamily.org
X-Gentoo-Bug: 455458
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=455458
2013-03-12 12:57:44 -05:00
William Hubbs
fac96b4df4 cgroups: major update to cgroups support
This reworks cgroups support so we have one variable in rc.conf for each
controller instead of each setting.

Also we add support for all of the possible cgroup controllers.

I would like to thank Alexander Vershilov for his help with testing and
reworking this code.
2013-02-19 17:09:30 -06:00
William Hubbs
a55eb3965e cgroups: remove comment about suspend for cpu_shares setting 2013-02-17 11:09:02 -06:00
William Hubbs
405dfea7ad cgroups: document kernel requirement for cpu controller settings 2013-02-16 16:11:33 -06:00
William Hubbs
31bcc6bee4 Typo Fix 2012-12-03 14:59:22 -06:00
Alexander Vershilov
4f19c2f512 Support cpu usage management for Linux
This commit was modified by William Hubbs as follows:

- The paths in the cgroup fs were put into variables to ease
  maintenance.
- Documentation was added to rc.conf.Linux.
- The services were added originally to openrc/svcname cgroups under the
  controller cgroups, but this left an "openrc" cgroup which was unused.
  Now they are added to individual cgroups with the name openrc_${RC_SVCNAME}.
2012-11-12 10:58:00 -06:00
Robin H. Johnson
1b0130961e checkbashisms: clean up export statements.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2012-11-07 00:22:33 +00:00
William Hubbs
eff07c48b7 Expand the documentation for service configuration variables
The original documentation for these variables did not give an example
of what to do if the service had a name that had illegal characters in
it, so this commit adds an example. There was no bug report; this was
suggested by Tobias Klausmann.
2012-10-30 11:12:20 -05:00
William Hubbs
e641b43849 Bring Back prefix support
We now have a team member who is interested in OpenRC on prefix, so I am
bringing it back to the main tree.
2012-07-26 10:54:48 -05:00
William Hubbs
3df0bd64cb cgroups: allow users to turn off creation of controller cgroups
This adds a switch to not create the one-cgroup-per-controller setup of
cgroups.

reported-by: davidweb@klaftenegger.de
X-Gentoo-Bug: 423317
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=423317
2012-07-03 13:49:58 -05:00
William Hubbs
3247184d86 Remove prefix support
I spoke with the prefix team sometime back and was told that they do not
have an interest in using OpenRC on prefix systems.
2012-02-21 07:27:16 -06:00
William Hubbs
32c506a4c8 Drop rc_sys definition from build system 2012-02-20 20:13:11 -06:00
William Hubbs
8199dee8d6 Revert "Remove rc_parallel from rc.conf"
This reverts commit 695f3886fb.

Reported-by: Pacho Ramos <pacho@gentoo.org>
X-Gentoo-Bug: 400741
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=400741
2012-02-13 11:29:19 -06:00