7ab7547a40
When reading virtual files (i.e. procfs, sysfs, …) we currently put a limit of 4M-1 on that. We have to pick something, and we have to read these files in a single read() (since the kernel generally doesn't support continuation read()s for them). 4M-1 is actually the maximum size the kernel allows for reads from files in /proc/sys/, all larger reads will result in an ENOMEM error (which is really weird, but the kernel does what the kernel does). Hence 4M-1 sounds like a smart choice. However, we made one mistake here: in order to be able to detect EOFs properly we actually read one byte more than we actually intend to return: if that extra byte can be read, then we know the file is actually larger than our limit and we can generate an EFBIG error from that. However, if it cannot be read then we know EOF was hit, and we are good. So ultimately after all we issued a single 4M read, which the kernel then responds with ENOMEM to. And that means read_virtual_file() actually doesn't work properly right now on /proc/sys/. Let's fix that. The fix is simple, lower the limit of the the buffer we intend to return by one, i.e. 4M-2. That way, the read() we'll issue is exactly as large as the limit the kernel allows, and we still get safely detect EOF from it. |
||
---|---|---|
.github | ||
.lgtm/cpp-queries | ||
.semaphore | ||
catalog | ||
coccinelle | ||
docs | ||
factory/etc | ||
hwdb.d | ||
man | ||
mkosi.default.d | ||
modprobe.d | ||
network | ||
po | ||
presets | ||
rules.d | ||
shell-completion | ||
src | ||
sysctl.d | ||
sysusers.d | ||
test | ||
tmpfiles.d | ||
tools | ||
units | ||
xorg | ||
.clang-format | ||
.ctags | ||
.dir-locals.el | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
.lgtm.yml | ||
.mailmap | ||
.packit.yml | ||
.vimrc | ||
.ycm_extra_conf.py | ||
configure | ||
LICENSE.GPL2 | ||
LICENSE.LGPL2.1 | ||
Makefile | ||
meson_options.txt | ||
meson.build | ||
mkosi.build | ||
NEWS | ||
README | ||
README.md | ||
TODO |
System and Service Manager
Details
Most documentation is available on systemd's web site.
Assorted, older, general information about systemd can be found in the systemd Wiki.
Information about build requirements is provided in the README file.
Consult our NEWS file for information about what's new in the most recent systemd versions.
Please see the Code Map for information about this repository's layout and content.
Please see the Hacking guide for information on how to hack on systemd and test your modifications.
Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.
When preparing patches for systemd, please follow our Coding Style Guidelines.
If you are looking for support, please contact our mailing list or join our IRC channel.
Stable branches with backported patches are available in the stable repo.