While stracing PID1's forking off of children I noticed that every single forked off child reads cap_last_cap from procfs. That value is a kernel constant, hence we can save a lot of work if we'd cache it. Thing is, we actually do cache it, in a thread_local cache field. This means that the forked off processes (which are considered new threads) will have to re-query it, even though we already know the result. Hence, let's get rid of the thread_local stuff (given that the value is going to be the same for all threads anyway, and we pretty much have a single thread only anyway). Use an C11 atomic_int instead, which ensures the value is either initialized or not initialized, but we don't need to be concerned of partial initialization. This makes the cap_last_cap reading go away in the children, as strace shows (since cap_last_cap() is already called by PID 1 before fork()ing, anyway).
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, join our IRC channel #systemd on libera.chat or Matrix channel
Stable branches with backported patches are available in the stable repo.
We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack
