2ac67221bb
This code is trying to do two things: when reading a file with working st.st_size, detect when the file size changes between the fstat() and our allocation of the buffer based on the returned size, and the subsequent read(). When reading a file without st.st_size, read up to READ_FULL_BYTES_MAX. But this second scenario was partially broken: we'd start with size = 4095, and double the size up to three times, i.e. up to 32767. But we want to read up to READ_FULL_BYTES_MAX. So let's listentangle the two cases a bit: if a file returns non-zero st._size, proceed as before. But if we don't know the size, let's immediately allocate the buffer of maximum size of READ_FULL_BYTES_MAX. I think that allocating 4MB and 1MB is going to take pretty much the same time as long as the memory is not written to, so by allocating 1MB, 2MB, and 4MB, we wouldn't really be saving anything internally, but wasting time on repeated reads, if the file is long enough. Also, don't do the seek if we know we're going to return an error immediately after. This should fix reading of any files in /proc, which all have size == 0. In particular, various files read by coredump might be larger than 32767. What about /sys? The file there return a fake value, usually 4096. So we'll allocate a small buffer and read that. |
||
---|---|---|
.github | ||
.lgtm/cpp-queries | ||
.mkosi | ||
.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 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.