Commit graph

62581 commits

Author SHA1 Message Date
Lennart Poettering 8142d73574 cap-list: rename capability_set_to_string_alloc() → capability_set_to_string()
We typically don't use the _alloc() suffix anymore for anything, hence
drop it here too.
2023-02-20 16:13:49 +01:00
Daan De Meyer 0cd90cf4f3
Merge pull request #26437 from DaanDeMeyer/repart-exclude
repart: Add ExcludeFiles= option
2023-02-20 15:49:29 +01:00
Luca Boccassi 96f321b6b4 man: document DefaultStartupMemoryLow=
Fixes https://github.com/systemd/systemd/issues/26493
2023-02-20 13:35:15 +00:00
Daan De Meyer eb483e7ae1
Merge pull request #26465 from DaanDeMeyer/openat-helpers
Add more openat() helpers of utility functions
2023-02-20 13:58:59 +01:00
Daan De Meyer a9af827613 repart: Add ExcludeFiles= option 2023-02-20 13:51:46 +01:00
Daan De Meyer 9dcb8923cc smack-util: Add renameat_and_apply_smack_floor_label()
Also add mac_smack_apply_at() as its a requirement for
renameat_and_apply_smack_floor_label().
2023-02-20 12:45:43 +01:00
Daan De Meyer e8729892e8 tmpfile-util-label: Add fopen_temporary_at_label() 2023-02-20 12:44:44 +01:00
Daan De Meyer d9daf0d144 copy: Add copy_file_at() 2023-02-20 12:44:18 +01:00
Daan De Meyer 361bcb2097 env-file: Add write_env_file_at() 2023-02-20 12:43:31 +01:00
Yu Watanabe 135e5a201a udev-node: make stack_directory_read_one() accept NULL for devnode
No functional change, as currently the function is always called with
non-NULL argument. Just a preparation for #26048 or #25839.
2023-02-20 19:40:31 +09:00
Lennart Poettering 0ba75bde5f
Merge pull request #26479 from yuwata/exec-util-misc
exec-util: several cleanups
2023-02-20 11:17:58 +01:00
Yu Watanabe c207a57227 udev-node: drop unnecessary initialization
The priority of device node symlink can be negative. So the
initialization is confusing.

Fortunately, this changes no functionality, as we only compare the
priorities of symlinks only when we parsed at least one device node and
its priority.
2023-02-20 10:54:48 +01:00
Ronan Pigott d668ba131c core: permit sending augmented enable/disable methods
systemctl disable some.service fails to acquire interactive permission
because the DisableUnitFilesWithFlagsAndInstallInto method isn't permitted
2023-02-20 12:33:57 +09:00
Yu Watanabe ced30d69fa exec-util: use TAKE_FD() 2023-02-19 12:17:52 +09:00
Yu Watanabe 65cd9c7251 exec-util: propagate error in wait_for_terminate_and_check()
Then, the two error handlings becomes consistent with the one in
execute_directories().
2023-02-19 12:17:52 +09:00
Yu Watanabe b9fadf2e2c process-util: show requested process name in the log
This is useful for debugging issues like #26474.
2023-02-19 12:17:52 +09:00
Ronan Pigott fe5cb7a7ae systemctl: edit: fix double free of instanced name
There is a double free of unit_name when an instance is used, causing
systemctl --user edit service@instance to abort.
2023-02-19 07:07:15 +09:00
Mike Yuan db4691961c journalctl: fix output when --lines is used with --grep
Previously, we skip the entries before arg_lines
unconditionally, which doesn't behave correctly
when used with --grep. After this commit, when
a pattern is specified, we don't skip the entries
early, but rely on the count of the lines shown
to tell us when to stop. To achieve that we would
have to search backwards instead.

Fixes #25147
2023-02-19 07:06:49 +09:00
Yu Watanabe 2421dd7267 loop-util: fix error condition and return value
Fixes a bug introduced by da4fd28871.
2023-02-19 05:20:53 +09:00
Lennart Poettering d499fdbcf0 shared: move psi-util.[ch] to basic/ so that we can use it in sd-event 2023-02-17 23:46:19 +00:00
Lennart Poettering c56e8d8f41 util: move mallinfo compat glue from selinux code into generic code 2023-02-17 23:45:23 +00:00
Yu Watanabe ebc19b154c hashmap: fix build with valgrind
Follow-up for a2b052b29f.
2023-02-17 22:56:37 +00:00
Winterhuman 1ec9b72258 Correct journal misspell 2023-02-17 22:12:44 +00:00
Lennart Poettering 6cbb864d37
Merge pull request #26443 from poettering/mempool-fixes
mempool tweaks
2023-02-17 17:15:35 +01:00
Lennart Poettering c144696e12 tests: add test for mempool logic 2023-02-17 15:05:13 +01:00
Lennart Poettering a2b052b29f mempool: rework mempool_cleanup() to only release freed tiles
This substantially reworks mempool_cleanup() so that it releases pools
with all freed tiles only, but keeps all pools with still-allocated
tiles around.

This is more correct, as the previous implementation just released all
pools regardless if anything was still used or not. This would make
valgrind shut up but would just hide memory leaks altogether. Moreover
if called during regular runtime of a program would result in bad memory
accesses all over.

Hence, let's add a proper implementation and only trim pools we really
know are empty.

This way we can safely call these functions later, when under memory
pressure, at any time.
2023-02-17 15:03:53 +01:00
Lennart Poettering 4392b983b8 mempool: make mempool_free_tile() return NULL
To match how we usually do this current allocation code.

(Also, make it accept a NULL pointer, also in order to match behaviour
in the rest of our codebase)
2023-02-17 15:03:10 +01:00
Lennart Poettering 72381db942 mempool: introduce new helper pool_ptr()
This new helper returns the beginning of the usable area of the pool
object.

For now this is only used once, a later commit will use it more.
2023-02-17 15:02:18 +01:00
Dan Streetman e8858f1104 tpm2: simplify tpm2_seal() blob creation
TPM2 marshalling will never increase the total size, only possibly decrease.
There is no need for checking for insufficient size if the buffer size
is set to the sizeof both objects to be marshalled.
2023-02-17 14:02:15 +00:00
Lennart Poettering 993a9314c4 mempool: rename local variable to match current coding style 2023-02-17 15:01:36 +01:00
Lennart Poettering b6ff400ffb mempool: use size_t for all memory object sizes and counts 2023-02-17 15:00:55 +01:00
Lennart Poettering 9a0f0ef557 hashmap: expose helper for releasing memory pools independently of valgrind
Let's clean this up and export this always, so that we can later call
when we are under memory pressure.
2023-02-17 14:59:54 +01:00
Daan De Meyer a133d2c366 dissect-image: Return mount point fd if requested 2023-02-17 14:58:55 +01:00
Lennart Poettering 6aa90884a0 process-util: add helper get_process_threads()
Let's add a proper helper for querying the number of threads in a
process.
2023-02-17 14:27:58 +01:00
Luca Boccassi ceecf3d45d
Merge pull request #26463 from DaanDeMeyer/hacking
Hacking
2023-02-17 11:58:13 +00:00
Lennart Poettering 6ac55dfb46 sync-util: port fsync_directory_of_file() to fd_is_opath()
As suggested here:

https://github.com/systemd/systemd/pull/26450#pullrequestreview-1302922404
2023-02-17 20:50:01 +09:00
Lennart Poettering 9857dc1117
Merge pull request #26438 from poettering/event-source-shorten
sd-event: reduce memory use of sd_event_source objects
2023-02-17 12:46:55 +01:00
Luca Boccassi b8933fa843
Merge pull request #26341 from DaanDeMeyer/chase-fixes
chase-symlinks fixes
2023-02-17 11:44:47 +00:00
Lennart Poettering fdc2ad76b4
Merge pull request #26447 from poettering/sigqueue
pid1/systemctl: add ability to enqueue POSIX RT sigs with associated value to service processes
2023-02-17 10:51:58 +01:00
Lennart Poettering 9a603dc251 socket-util: make connect_unix_path() work with a NULL path 2023-02-17 10:51:35 +01:00
Lennart Poettering e940b2f371
Merge pull request #26343 from DaanDeMeyer/bus-debug
Bus debug
2023-02-17 10:50:19 +01:00
Lennart Poettering 48445827e3
Merge pull request #26450 from yuwata/fd-is-opath
util: introduce fd_is_opath() and use it in xsetxattr()
2023-02-17 10:28:32 +01:00
Lennart Poettering a38cf9fb96 sd-event: allocate event source objects with the actually needed size
Currently we allocate fixed-size memory for event sources: the largest
any of the event source type needs. Discrepancy in the sizes needed for
the various event sources is quite major however: it's 144 bytes on
x86_64, i.e. more than two cache lines.

hence, let's be a tiny bit more careful, and allocate exactly as much as
we need, but not more.
2023-02-17 10:09:30 +01:00
Lennart Poettering d6e9e8c7b9 macro: add macro for determining size of struct with trailing union 2023-02-17 10:09:30 +01:00
Lennart Poettering dd131fcf8c test: add test for new "systemctl --kill-value=" functionality
(as side-effect this also tests the new systemd-notify --exec switch)
2023-02-17 09:55:35 +01:00
Lennart Poettering c4ef4df417 man: document new --exec switch for systemd-notify 2023-02-17 09:55:35 +01:00
Lennart Poettering 9175338e09 notify: add new --exec switch for chaining other commands to systemd-notify
This is useful in tests, so that we can first send a READY message and
then continue doing something else without changing PID.
2023-02-17 09:55:35 +01:00
Lennart Poettering 4ea517a6e0 strv: add strv_copy_n() helper for copying part of a n strv 2023-02-17 09:55:35 +01:00
Lennart Poettering f4ff3e7149 man: document new --kill-value= switch to systemctl 2023-02-17 09:55:35 +01:00
Lennart Poettering d06e61996d systemctl: add --kill-value= argument to systemctl
This allows accompanying a signal with a value (as supported for Linux
Realtime signals). This is particularly useful as it allows us to do
stuff like this:

   systemctl kill --kill-whom=main --kill-value=0x300 systemd-journald

In order to ask journald to flush its allocation caches and compact
memory.
2023-02-17 09:55:35 +01:00