Compare commits

...

27 Commits

Author SHA1 Message Date
William Hubbs
eedafe0f1a version 0.43.5 2021-08-20 11:33:49 -05:00
William Hubbs
7f634589f1 update ChangeLog 2021-08-20 11:33:16 -05:00
Matt Whitlock
291cddb72b supervise-daemon: implement SSD_IONICELEVEL
supervise-daemon was apparently overlooked when support for the
SSD_IONICELEVEL environment variable was added. This commit brings
supervise-daemon up to parity with start-stop-daemon with respect to
this environment variable.
2021-08-20 11:28:08 -05:00
William Hubbs
002e25a74a update ChangeLog 2021-08-15 14:20:08 -05:00
William Hubbs
2ac620cf53 update travis ci irc notifications
- move to libera network
- always notify on successful build
2021-08-14 15:11:42 -05:00
William Hubbs
e9fb5f81cc man/supervise-daemon.8: document --pidfile option 2021-08-13 23:09:23 -05:00
Sven Wegener
67dfdec43f on_ac_power: support multiple power_supply devices in sysfs
Newer devices have multiple power_supply devices in sysfs:

$ grep ^ /sys/class/power_supply/*/type
/sys/class/power_supply/AC/type:Mains
/sys/class/power_supply/BAT0/type:Battery
/sys/class/power_supply/ucsi-source-psy-USBC000:001/type:USB
/sys/class/power_supply/ucsi-source-psy-USBC000:002/type:USB

There are two "USB" Type-C ports than can supply power and both are
aggregated into the "Mains" power supply by the firmware. The "Battery"
also counts as a power supply, but is missing the online attribute.

The -f check with a wildcard pattern results in an error, when multiple
devices are present:

/lib/rc/bin/on_ac_power: line 21: [: too many arguments

When the power_supply class is registered, check for a "Mains" device.

Fixes #427.
2021-08-13 15:06:51 -05:00
Alex Xu
fa88750060 conf.d/hostname: clarify hostname variable usage
https://gitlab.alpinelinux.org/alpine/aports/-/issues/9744

This fixes #433.
2021-08-13 15:06:51 -05:00
William Hubbs
223550f676 Revert "openrc-init: ignore an empty string in argv[1]"
This reverts commit 7a15323822.
    This check is no longer needed since rc_runlevel_exists() is fixed.

        X-Gentoo-Bug: 803536
        X-Gentoo-Bug-URL: https://bugs.gentoo.org/803536
        Closes: https://github.com/OpenRC/openrc/pull/431
2021-08-13 11:37:12 -05:00
William Hubbs
d6295768ea librc: fix rc_runlevel_exists return for empty string
This function should return false if the runlevel is an empty string.

    X-Gentoo-Bug: 803536
    X-Gentoo-Bug-URL: https://bugs.gentoo.org/803536
    Closes: https://github.com/OpenRC/openrc/pull/431
2021-08-13 11:35:21 -05:00
Mike Gilbert
7a15323822 openrc-init: ignore an empty string in argv[1]
X-Gentoo-Bug: 803536
X-Gentoo-Bug-URL: https://bugs.gentoo.org/803536
Closes: https://github.com/OpenRC/openrc/pull/431
2021-08-12 15:22:24 -05:00
William Hubbs
edb07278af sh/rc-cgroup.sh: fix case in starting message
X-Gentoo-Bug: 804193
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=804193
2021-08-12 15:22:24 -05:00
William Hubbs
d07d896aa8 sh/rc-cgroup.sh: fix cgroup_cleanup
X-Gentoo-Bug: 804193
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=804193
2021-08-12 15:22:24 -05:00
William Hubbs
80955a691b version 0.43.4 2021-06-02 10:29:49 -05:00
William Hubbs
2413f487e2 update ChangeLog 2021-06-02 10:26:12 -05:00
William Hubbs
32a8a202d0 move the irc channel to the libera network 2021-06-01 17:17:18 -05:00
Lars Wendler
803ed1badd init.d/modules.in: Avoid loading modules twice in Linux with dash shell
Since commit 6b475ab269, openrc tries to load
modules twice which have been defined in /etc/conf.d/modules via modules=
variable when /bin/sh points to dash shell.
The reason is that when the "modules-load" service was merged into "modules"
service, the "modules" variable name got used in both, load_modules()
function and in Linux_modules() function which both get called when modules
service is started. Although "modules" variable is marked as local in
load_modules(), dash simply ignores this.

Avoid the issue by renaming "modules" variable to "_modules" in
load_modules() function.

This fixes #419.
2021-06-01 17:17:18 -05:00
William Hubbs
8a6f9d943b README: convert references to markdown links 2021-06-01 17:17:18 -05:00
William Hubbs
ee8c0c1cc1 version 0.43.3 2021-04-15 21:12:06 -05:00
William Hubbs
f61e44d110 update ChangeLog 2021-04-15 21:11:12 -05:00
William Hubbs
55ceac775c checkpath: fix code to walk the directory path
X-Gentoo-Bug: 782808
X-Gentoo-Bug-URL: https://bugs.gentoo.org/782808
2021-04-15 21:09:46 -05:00
William Hubbs
7b07c55c86 version 0.43.2 2021-04-13 17:34:50 -05:00
William Hubbs
793673df3c update ChangeLog 2021-04-13 17:32:26 -05:00
William Hubbs
6219d87071 checkpath: remove extra slashes from paths
This fixes #418.
2021-04-13 17:25:23 -05:00
William Hubbs
72b5c74290 version 0.43.1 2021-04-04 22:09:32 -05:00
William Hubbs
aad77d0267 update ChangeLog 2021-04-04 22:07:49 -05:00
William Hubbs
99565e359f cgroup2_set_limits: fix harmless error message
In legacy cgroups mode, we were running `mountinfo -q ""` which was
generating an error message. If we return immediately when
cgroup2_find_path returns an empty value, we avoid this message.
2021-04-04 22:05:09 -05:00
12 changed files with 323 additions and 166 deletions

View File

@@ -19,8 +19,8 @@ addons:
notifications: notifications:
irc: irc:
channels: channels:
- "irc.freenode.org#openrc" - "irc.libera.chat#openrc"
on_success: change # options: [always|never|change] default: always on_success: always # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always on_failure: always # options: [always|never|change] default: always
on_start: false # default: false on_start: false # default: false

377
ChangeLog
View File

@@ -1,3 +1,244 @@
commit 291cddb72b1e00c0708e2b4c2278f9fbd0db007e
Author: Matt Whitlock <gentoo@mattwhitlock.name>
Commit: William Hubbs <w.d.hubbs@gmail.com>
supervise-daemon: implement SSD_IONICELEVEL
supervise-daemon was apparently overlooked when support for the
SSD_IONICELEVEL environment variable was added. This commit brings
supervise-daemon up to parity with start-stop-daemon with respect to
this environment variable.
commit 002e25a74ac8eff31f9aa804fbda77b97f2ef944
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
update ChangeLog
commit 2ac620cf53fbbd201927055b771d59f16086ddc4
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
update travis ci irc notifications
- move to libera network
- always notify on successful build
commit e9fb5f81cc862001bcc10a4ce0f18a7cd6cd6df3
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
man/supervise-daemon.8: document --pidfile option
commit 67dfdec43ffe9160f4d63394c6334fc10c6992c8
Author: Sven Wegener <sven.wegener@stealer.net>
Commit: William Hubbs <w.d.hubbs@gmail.com>
on_ac_power: support multiple power_supply devices in sysfs
Newer devices have multiple power_supply devices in sysfs:
$ grep ^ /sys/class/power_supply/*/type
/sys/class/power_supply/AC/type:Mains
/sys/class/power_supply/BAT0/type:Battery
/sys/class/power_supply/ucsi-source-psy-USBC000:001/type:USB
/sys/class/power_supply/ucsi-source-psy-USBC000:002/type:USB
There are two "USB" Type-C ports than can supply power and both are
aggregated into the "Mains" power supply by the firmware. The "Battery"
also counts as a power supply, but is missing the online attribute.
The -f check with a wildcard pattern results in an error, when multiple
devices are present:
/lib/rc/bin/on_ac_power: line 21: [: too many arguments
When the power_supply class is registered, check for a "Mains" device.
Fixes #427.
commit fa88750060effe4a23a14d7e70517e475fd11b39
Author: Alex Xu <351006+Hello71@users.noreply.github.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
conf.d/hostname: clarify hostname variable usage
https://gitlab.alpinelinux.org/alpine/aports/-/issues/9744
This fixes #433.
commit 223550f6765a89254f978c2007612e5be7d308a6
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Revert "openrc-init: ignore an empty string in argv[1]"
This reverts commit 7a1532382284d9d3d0f1e31d89ff1ca0d3199cb5.
This check is no longer needed since rc_runlevel_exists() is fixed.
X-Gentoo-Bug: 803536
X-Gentoo-Bug-URL: https://bugs.gentoo.org/803536
Closes: https://github.com/OpenRC/openrc/pull/431
commit d6295768eaa886d7cf296e5d7f94711ec1f08038
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
librc: fix rc_runlevel_exists return for empty string
This function should return false if the runlevel is an empty string.
X-Gentoo-Bug: 803536
X-Gentoo-Bug-URL: https://bugs.gentoo.org/803536
Closes: https://github.com/OpenRC/openrc/pull/431
commit 7a1532382284d9d3d0f1e31d89ff1ca0d3199cb5
Author: Mike Gilbert <floppym@gentoo.org>
Commit: William Hubbs <w.d.hubbs@gmail.com>
openrc-init: ignore an empty string in argv[1]
X-Gentoo-Bug: 803536
X-Gentoo-Bug-URL: https://bugs.gentoo.org/803536
Closes: https://github.com/OpenRC/openrc/pull/431
commit edb07278af2f5e05873da99d4a80bfbb6f08812b
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
sh/rc-cgroup.sh: fix case in starting message
X-Gentoo-Bug: 804193
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=804193
commit d07d896aa82a789c558876ee3257b785df1e7946
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
sh/rc-cgroup.sh: fix cgroup_cleanup
X-Gentoo-Bug: 804193
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=804193
commit 80955a691bfb151b92d04c12b5d138bafdedf532
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
version 0.43.4
commit 2413f487e2d556a657bca8c873828873c650f995
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
update ChangeLog
commit 32a8a202d0728e3e550050069da3e27de2d98d7f
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
move the irc channel to the libera network
commit 803ed1badddb3edfc78f4346d8d059253a334cd9
Author: Lars Wendler <polynomial-c@gentoo.org>
Commit: William Hubbs <w.d.hubbs@gmail.com>
init.d/modules.in: Avoid loading modules twice in Linux with dash shell
Since commit 6b475ab26992f1dd8815700828df46abc4b71d27, openrc tries to load
modules twice which have been defined in /etc/conf.d/modules via modules=
variable when /bin/sh points to dash shell.
The reason is that when the "modules-load" service was merged into "modules"
service, the "modules" variable name got used in both, load_modules()
function and in Linux_modules() function which both get called when modules
service is started. Although "modules" variable is marked as local in
load_modules(), dash simply ignores this.
Avoid the issue by renaming "modules" variable to "_modules" in
load_modules() function.
This fixes #419.
commit 8a6f9d943bf7256630a37ea9e3a8421e079f05b9
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
README: convert references to markdown links
commit ee8c0c1cc1edb4959845e5bc487ce6e83ad9f2b3
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
version 0.43.3
commit f61e44d110d3ceb96c06bf7dbdd07b8ab85166e3
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
update ChangeLog
commit 55ceac775c388191090fe37aef489d721ee9299d
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
checkpath: fix code to walk the directory path
X-Gentoo-Bug: 782808
X-Gentoo-Bug-URL: https://bugs.gentoo.org/782808
commit 7b07c55c86cf356a832fe2975c9f8e164bcb2b7b
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
version 0.43.2
commit 793673df3ca3ad8692e135bd5c77b21bae3ebbe2
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
update ChangeLog
commit 6219d87071d07acf4d6b3e99ec58134acf129d8e
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
checkpath: remove extra slashes from paths
This fixes #418.
commit 72b5c7429011e0d20c450fe06dc4b645e36eecb0
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
version 0.43.1
commit aad77d0267426edef6a568e26c9bae11c2367db4
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
update ChangeLog
commit 99565e359f3081e053573d10756e1a756c56342b
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
cgroup2_set_limits: fix harmless error message
In legacy cgroups mode, we were running `mountinfo -q ""` which was
generating an error message. If we return immediately when
cgroup2_find_path returns an empty value, we avoid this message.
commit ee05403c501b5f0c0a955b1f8d67b2d88f0ede7a
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
version 0.43
commit c1558abb0f1e0fe2d1a2c42a536de335a1cd8de9
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
update ChangeLog
commit 901b752463eb37784fcebe5a3b5648b4bfbd9371 commit 901b752463eb37784fcebe5a3b5648b4bfbd9371
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>
@@ -401,139 +642,3 @@ Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com> Commit: William Hubbs <w.d.hubbs@gmail.com>
supervise-daemon: only log debug logs when verbose mode is active supervise-daemon: only log debug logs when verbose mode is active
commit fbec1eed51c85c53b39f97a213479caa0a2b75ab
Author: Manuel Rüger <manuel@rueg.eu>
Commit: Manuel Rüger <manuel@rueg.eu>
.cirrus.yml: Update FreeBSD releases
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
commit 229692cc3424e95d8185e6c681b76c0dc88899f9
Author: Austin English <austinenglish@gmail.com>
Commit: Mike Frysinger <vapier@gmail.com>
man/openrc-run.8: fix a typo
commit 375ef42393f3dc6edbaa2cb70c79b2366072db38
Author: Sergei Trofimovich <slyfox@gentoo.org>
Commit: William Hubbs <w.d.hubbs@gmail.com>
src/rc/rc-logger.h: fix build failure against gcc-10
On gcc-10 (and gcc-9 -fno-common) build fails as:
```
cc -L../librc -L../libeinfo -O2 -g -std=c99 -Wall -Wextra -Wimplicit -Wshadow \
-Wformat=2 -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn \
-Wmissing-format-attribute -Wnested-externs -Winline -Wwrite-strings \
-Wcast-align -Wcast-qual -Wpointer-arith -Wdeclaration-after-statement \
-Wsequence-point -Werror=implicit-function-declaration \
-Wl,-rpath=/lib -o openrc rc.o rc-logger.o rc-misc.o rc-plugin.o _usage.o -lutil -lrc -leinfo -Wl,-Bdynamic -ldl
ld: rc-logger.o:/home/slyfox/dev/git/openrc/src/rc/rc-logger.h:16:
multiple definition of `rc_logger_pid'; rc.o:openrc/src/rc/rc-logger.h:16: first defined here
ld: rc-logger.o:/home/slyfox/dev/git/openrc/src/rc/rc-logger.h:17:
multiple definition of `rc_logger_tty'; rc.o:openrc/src/rc/rc-logger.h:17: first defined here
```
gcc-10 will change the default from -fcommon to fno-common:
https://gcc.gnu.org/PR85678.
The error also happens if CFLAGS=-fno-common passed explicitly.
This fixes #348.
commit 6deda13754f1b60245945e953cce8d97e40e86fc
Author: Wolf <wolf@wolfsden.cz>
Commit: William Hubbs <w.d.hubbs@gmail.com>
supervise-daemon: Fix segfault when executable does not exist
When executable is provided just by name (and therefore searched in a
path), exec_file is reset to NULL every time. exists() handles it being
NULL just fine, but dereferencing it in eerror does not work.
Fixes #326
Fixes #327
commit eb610859519292c6164c4ba601d22e642c306beb
Author: artoo <artoo@artixlinux.org>
Commit: William Hubbs <w.d.hubbs@gmail.com>
binfmt: ensure a file is ungegistered before registering
This fixes #328
commit 039845b742e40752b05ef9393d5a6959d55fe0b6
Author: Andrew Scheller <github@loowis.durge.org>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Fix typo in README
This fixes #338
commit a7e7fd2b37a7666f26c2d4de9386b2d04f583b41
Author: Ethan Sommer <e5ten.arch@gmail.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
make grep usage POSIX compliant
use grep -E instead of egrep
check for space or end of line instead of GNU-specific word boundary
This fixes #345
commit 12e147a107c6e27172734c660624343a3c092437
Author: Jason Bowen <jbowen@infinitecactus.com>
Commit: William Hubbs <w.d.hubbs@gmail.com>
Delete stray text.
It looks like some stray text was left at the bottom of the file:
```
package.
migrating your system to openrc-init.
```
There's a subsection on migrating a system to `openrc-ini`; perhaps this was
an embryonic section title?
This fixes #347.
commit fd852865e06a74ecf8b77ff534fa8053e020160f
Author: William Hubbs <william.hubbs@sony.com>
Commit: William Hubbs <william.hubbs@sony.com>
openrc-shutdown.c: typo fix
commit 35ec935741ffb571cacf763dcca98661c0cfb296
Author: William Hubbs <w.d.hubbs@gmail.com>
Commit: William Hubbs <william.hubbs@sony.com>
ci/travis.sh: run shellcheck on shell scripts
commit 19cfd82dadf2e52299cf3752deb04562be52145c
Author: Austin English <austinenglish@gmail.com>
Commit: William Hubbs <william.hubbs@sony.com>
.travis.yml: install shellcheck
commit 87cfad3d6cd619c6090e8209092448ae68279b0c
Author: E5ten <ethancsommer@gmail.com>
Commit: William Hubbs <william.hubbs@sony.com>
cgroup2_set_limits: verify that the cgroup2 path is a mount point
prior to cgroups getting mounted, /sys/fs/cgroup will still exist,
but attempts to make directories in it will fail, change cgroup2_set_limits() to
verify that cgroups are mounted instead of just checking that /sys/fs/cgroup
exists.
This fixes #307.
This fixes #321.
commit 8e31614c4b6679fc1bc1f1d1e0779dcedd066a5a
Author: William Hubbs <william.hubbs@sony.com>
Commit: William Hubbs <william.hubbs@sony.com>
fix clang build

View File

@@ -1,3 +1,3 @@
NAME= openrc NAME= openrc
VERSION= 0.43 VERSION= 0.43.5
PKG= ${NAME}-${VERSION} PKG= ${NAME}-${VERSION}

View File

@@ -78,16 +78,14 @@ remove them and then install so that the OS hooks into OpenRC.
## Reporting Bugs ## Reporting Bugs
Please report issues on our github bug tracker [1]. Please report bugs on our [bug tracker](http://github.com/OpenRC/openrc/issues).
Better yet, if you can contribute code, please feel free to submit pull If you can contribute code , please feel free to do so by opening
requests [2]. [pull requests](https://github.com/OpenRC/openrc/pulls).
## IRC Channel ## IRC Channel
We have an official irc channel, #openrc on freenode, feel free to join We have an official irc channel, #openrc on the libera network.
us there. Please connect your irc client to irc.libera.chat and join #openrc on
that network.
[1] https://github.com/openrc/openrc/issues
[2] https://github.com/openrc/openrc/pulls

View File

@@ -1,2 +1,2 @@
# Set to the hostname of this machine # Hostname fallback if /etc/hostname does not exist
hostname="localhost" hostname="localhost"

View File

@@ -41,18 +41,18 @@ find_modfiles()
load_modules() load_modules()
{ {
local file m modules rc x local file m _modules rc x
file=$1 file=$1
[ -z "$file" ] && return 0 [ -z "$file" ] && return 0
while read m x; do while read m x; do
case $m in case $m in
\;*) continue ;; \;*) continue ;;
\#*) continue ;; \#*) continue ;;
*) modules="$modules $m" *) _modules="$_modules $m"
;; ;;
esac esac
done < $file done < $file
for x in $modules; do for x in $_modules; do
ebegin "Loading module $x" ebegin "Loading module $x"
case "$RC_UNAME" in case "$RC_UNAME" in
FreeBSD) kldload "$x"; rc=$? ;; FreeBSD) kldload "$x"; rc=$? ;;

View File

@@ -37,6 +37,8 @@ servicename
.Ar count .Ar count
.Fl N , -nicelevel .Fl N , -nicelevel
.Ar level .Ar level
.Fl p , -pidfile
.Ar supervisorpidfile
.Fl P , -respawn-period .Fl P , -respawn-period
.Ar seconds .Ar seconds
.Fl R , -retry .Fl R , -retry
@@ -122,6 +124,9 @@ If respawn-period is also set, more than respawn-max crashes must occur
during respawn-period seconds to cause during respawn-period seconds to cause
.Nm .Nm
to give up and exit. to give up and exit.
.It Fl p , -pidfile Ar supervisorpidfile
Sets a path for the supervisor's pid file. Note that this is not the pid
file of the process that is being supervised.
.It Fl N , -nicelevel Ar level .It Fl N , -nicelevel Ar level
Modifies the scheduling priority of the daemon. Modifies the scheduling priority of the daemon.
.It Fl P , -respawn-period Ar seconds .It Fl P , -respawn-period Ar seconds
@@ -151,6 +156,10 @@ The same thing as
but with the standard error output. but with the standard error output.
.El .El
.Sh ENVIRONMENT .Sh ENVIRONMENT
.Va SSD_IONICELEVEL
can also set the IO scheduling priority of the daemon, but the command line
option takes precedence.
.Pp
.Va SSD_NICELEVEL .Va SSD_NICELEVEL
can also set the scheduling priority of the daemon, but the command line can also set the scheduling priority of the daemon, but the command line
option takes precedence. option takes precedence.

View File

@@ -18,9 +18,10 @@ if [ -f /proc/acpi/ac_adapter/*/state ]; then
"state:"*"off-line") exit 128;; "state:"*"off-line") exit 128;;
esac esac
done done
elif [ -f /sys/class/power_supply/*/online ]; then elif [ -d /sys/class/power_supply ]; then
cat /sys/class/power_supply/*/online | while read line; do for dir in /sys/class/power_supply/*/; do
[ "${line}" = 0 ] && exit 128 [ "$(cat "${dir}/type")" != "Mains" ] && continue
[ "$(cat "${dir}/online")" = 0 ] && exit 128
done done
elif [ -f /proc/pmu/info ]; then elif [ -f /proc/pmu/info ]; then
cat /proc/pmu/info | while read line; do cat /proc/pmu/info | while read line; do

View File

@@ -189,6 +189,7 @@ cgroup2_set_limits()
{ {
local cgroup_path local cgroup_path
cgroup_path="$(cgroup2_find_path)" cgroup_path="$(cgroup2_find_path)"
[ -z "${cgroup_path}" ] && return 0
mountinfo -q "${cgroup_path}"|| return 0 mountinfo -q "${cgroup_path}"|| return 0
rc_cgroup_path="${cgroup_path}/${RC_SVCNAME}" rc_cgroup_path="${cgroup_path}/${RC_SVCNAME}"
[ ! -d "${rc_cgroup_path}" ] && mkdir "${rc_cgroup_path}" [ ! -d "${rc_cgroup_path}" ] && mkdir "${rc_cgroup_path}"
@@ -208,7 +209,7 @@ cgroup2_set_limits()
cgroup_cleanup() cgroup_cleanup()
{ {
cgroup_running || return 0 cgroup_running || return 0
ebegin "starting cgroups cleanup" ebegin "Starting cgroups cleanup"
local loops=0 local loops=0
cgroup_get_pids cgroup_get_pids
if [ -n "${cgroup_pids}" ]; then if [ -n "${cgroup_pids}" ]; then
@@ -218,7 +219,7 @@ cgroup_cleanup()
kill -s HUP ${cgroup_pids} 2> /dev/null kill -s HUP ${cgroup_pids} 2> /dev/null
kill -s "${stopsig:-TERM}" ${cgroup_pids} 2> /dev/null kill -s "${stopsig:-TERM}" ${cgroup_pids} 2> /dev/null
cgroup_get_pids cgroup_get_pids
while [ -n "$(cgroup_pids)" ] && while [ -n "${cgroup_pids}" ] &&
[ "${loops}" -lt "${rc_timeout_stopsec:-90}" ]; do [ "${loops}" -lt "${rc_timeout_stopsec:-90}" ]; do
loops=$((loops+1)) loops=$((loops+1))
sleep 1 sleep 1

View File

@@ -481,7 +481,8 @@ rc_runlevel_exists(const char *runlevel)
char path[PATH_MAX]; char path[PATH_MAX];
struct stat buf; struct stat buf;
if (!runlevel || strcmp(runlevel, ".") == 0 || strcmp(runlevel, "..") == 0) if (!runlevel || strcmp(runlevel, "") == 0 || strcmp(runlevel, ".") == 0 ||
strcmp(runlevel, "..") == 0)
return false; return false;
snprintf(path, sizeof(path), "%s/%s", RC_RUNLEVELDIR, runlevel); snprintf(path, sizeof(path), "%s/%s", RC_RUNLEVELDIR, runlevel);
if (stat(path, &buf) == 0 && S_ISDIR(buf.st_mode)) if (stat(path, &buf) == 0 && S_ISDIR(buf.st_mode))

View File

@@ -92,13 +92,13 @@ static int get_dirfd(char *path, bool symlinks) {
if (dirfd == -1) if (dirfd == -1)
eerrorx("%s: unable to open the root directory: %s", eerrorx("%s: unable to open the root directory: %s",
applet, strerror(errno)); applet, strerror(errno));
path_dupe = xstrdup(path); ch = path;
ch = path_dupe;
while (*ch) { while (*ch) {
if (*ch == '/') if (*ch == '/')
components++; components++;
ch++; ch++;
} }
path_dupe = xstrdup(path);
item = strtok(path_dupe, "/"); item = strtok(path_dupe, "/");
#ifdef O_PATH #ifdef O_PATH
flags |= O_PATH; flags |= O_PATH;
@@ -131,6 +131,7 @@ static int get_dirfd(char *path, bool symlinks) {
*/ */
close(new_dirfd); close(new_dirfd);
} else { } else {
/* now walk down the directory path */
close(dirfd); close(dirfd);
dirfd = new_dirfd; dirfd = new_dirfd;
free(linkpath); free(linkpath);
@@ -140,13 +141,39 @@ static int get_dirfd(char *path, bool symlinks) {
} }
} }
free(path_dupe); free(path_dupe);
if (linkpath) { free(linkpath);
free(linkpath);
linkpath = NULL;
}
return dirfd; return dirfd;
} }
static char *clean_path(char *path)
{
char *ch;
char *ch2;
char *str;
str = xmalloc(strlen(path));
ch = path;
ch2 = str;
while (true) {
*ch2 = *ch;
ch++;
ch2++;
if (!*(ch-1))
break;
while (*(ch - 1) == '/' && *ch == '/')
ch++;
}
/* get rid of trailing / characters */
while ((ch = strrchr(str, '/'))) {
if (ch == str)
break;
if (!*(ch+1))
*ch = 0;
else
break;
}
return str;
}
static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode, static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode,
inode_t type, bool trunc, bool chowner, bool symlinks, bool selinux_on) inode_t type, bool trunc, bool chowner, bool symlinks, bool selinux_on)
{ {
@@ -344,6 +371,7 @@ int main(int argc, char **argv)
bool symlinks = false; bool symlinks = false;
bool writable = false; bool writable = false;
bool selinux_on = false; bool selinux_on = false;
char *path = NULL;
applet = basename_c(argv[0]); applet = basename_c(argv[0]);
while ((opt = getopt_long(argc, argv, getoptstring, while ((opt = getopt_long(argc, argv, getoptstring,
@@ -406,12 +434,14 @@ int main(int argc, char **argv)
selinux_on = true; selinux_on = true;
while (optind < argc) { while (optind < argc) {
path = clean_path(argv[optind]);
if (writable) if (writable)
exit(!is_writable(argv[optind])); exit(!is_writable(path));
if (do_check(argv[optind], uid, gid, mode, type, trunc, chowner, if (do_check(path, uid, gid, mode, type, trunc, chowner,
symlinks, selinux_on)) symlinks, selinux_on))
retval = EXIT_FAILURE; retval = EXIT_FAILURE;
optind++; optind++;
free(path);
} }
if (selinux_on) if (selinux_on)

View File

@@ -423,7 +423,8 @@ static void child_process(char *exec, char **argv)
if ((strncmp(env->value, "RC_", 3) == 0 && if ((strncmp(env->value, "RC_", 3) == 0 &&
strncmp(env->value, "RC_SERVICE=", 11) != 0 && strncmp(env->value, "RC_SERVICE=", 11) != 0 &&
strncmp(env->value, "RC_SVCNAME=", 11) != 0) || strncmp(env->value, "RC_SVCNAME=", 11) != 0) ||
strncmp(env->value, "SSD_NICELEVEL=", 14) == 0) strncmp(env->value, "SSD_NICELEVEL=", 14) == 0 ||
strncmp(env->value, "SSD_IONICELEVEL=", 16) == 0)
{ {
p = strchr(env->value, '='); p = strchr(env->value, '=');
*p = '\0'; *p = '\0';
@@ -733,6 +734,17 @@ int main(int argc, char **argv)
if (sscanf(tmp, "%d", &nicelevel) != 1) if (sscanf(tmp, "%d", &nicelevel) != 1)
eerror("%s: invalid nice level `%s' (SSD_NICELEVEL)", eerror("%s: invalid nice level `%s' (SSD_NICELEVEL)",
applet, tmp); applet, tmp);
if ((tmp = getenv("SSD_IONICELEVEL"))) {
int n = sscanf(tmp, "%d:%d", &ionicec, &ioniced);
if (n != 1 && n != 2)
eerror("%s: invalid ionice level `%s' (SSD_IONICELEVEL)",
applet, tmp);
if (ionicec == 0)
ioniced = 0;
else if (ionicec == 3)
ioniced = 7;
ionicec <<= 13; /* class shift */
}
/* Get our user name and initial dir */ /* Get our user name and initial dir */
p = getenv("USER"); p = getenv("USER");