Commit Graph
6364 Commits
Author SHA1 Message Date
Mike Yuan e472238525 basic/stat-util: use xopenat() where appropriate 2024-10-15 01:16:57 +02:00
Michiel 2053182bd1 Fix some typos in socket-util.h 2024-10-14 16:09:41 +02:00
Yu Watanabe 632407c3e4 Merge pull request #34700 from yuwata/network-conf-parser
network: several cleanups for conf parsers
2024-10-12 05:22:11 +09:00
Yu Watanabe c1316cd00d in-addr-util: rename in_addr_prefix_from_string_auto_internal() -> _full()
The function is also used in other source files. Hence, not internal.
No functional change, just refactoring.
2024-10-12 03:23:23 +09:00
Mike Yuan 407bfa0db6 time-util: use saturate_add for usec_add() 2024-10-11 18:21:09 +02:00
Ivan Kruglov dafd44de4f sd-json: add sd_json_dispatch_pid() 2024-10-10 13:40:45 +02:00
Ivan Kruglov 729fbe78df sd-json: add sd_json_dispatch_signal() 2024-10-10 13:40:45 +02:00
Luca Boccassi 2b577d598b Merge pull request #34675 from poettering/dupfd-query
fd-util: use F_DUPFD_QUERY for same_fd()
2024-10-08 19:30:57 +01:00
Luca Boccassi 8a1c78f33e Merge pull request #34674 from yuwata/reallocarray
tree-wide: replace reallocarray() with GREEDY_REALLOC()
2024-10-08 19:27:43 +01:00
Lennart Poettering e7f9053475 fd-util: use F_DUPFD_QUERY for same_fd()
Catch up with the nice little toys the kernel fs developers have added
for us. Preferably, let's make use of the new F_DUPFD_QUERY fcntl() call
that checks whether two fds are just duplicates of each other
(duplicates as in dup(), not as in open() of the same inode, i.e.
whether they share a single file offset and so on).

This API is much nicer, since it is a core kernel feature, unlike the
kcmp() call we so far used, which is part of the (optional)
checkpoint/restore stuff.

F_DUPFD_QUERY is available since kernel 6.10.
2024-10-08 13:13:49 +02:00
Lennart Poettering 6056663a14 fd-util: introduce fd_validate() helper
It just uses F_GETFD to validate an fd. it's a bit easier to read
though, and handles the < 0 case internally.
2024-10-08 13:13:44 +02:00
Yu Watanabe 6d3012bab4 time-util: copy input string before fork()
Fixes #34670.
2024-10-08 19:15:54 +09:00
Yu Watanabe eb87d3e1e9 time-util: fix parsing timestamp with NZ timezone
Fixes a bug caused by ef658a63f8.
2024-10-08 19:15:00 +09:00
Yu Watanabe 858eac353b prioq: use GREEDY_REALLOC() and structured initializer
No functional change, just refactoring.
2024-10-08 14:43:23 +09:00
Yu Watanabe f769518c9a tree-wide: drop doubled empty lines 2024-10-07 09:51:37 +02:00
Mike Yuan f005e267bc path-lookup: move from basic/ to libsystemd/
So that sd_path_lookup() can be utilized to replace
duplicate functions.
2024-10-06 19:27:12 +02:00
Mike Yuan feae34d64e path-lookup: move find_portable_profile() to portable-util 2024-10-06 19:27:11 +02:00
Mike Yuan cd7d732dc5 path-lookup: move NETWORK_DIRS to network-util.h 2024-10-06 19:27:11 +02:00
Mike Yuan 2bf5b262b5 basic/unit-file: move to shared/
Preparation for later commits, where path-lookup would be
moved into libsystemd.

Note that it currently includes sd-id128.h, hence shared/
seems more appropriate anyway.
2024-10-06 19:27:00 +02:00
Yu Watanabe 61c7f38f10 Merge pull request #34638 from YHNdnzj/laccess-error-check
various: correct laccess() error check
2024-10-06 13:50:11 +09:00
Mike Yuan 3f8999a76e fs-util: rename laccess to access_nofollow
In order to distinguish it from libc function naming.
2024-10-05 01:30:43 +02:00
Daan De Meyer 87333bd1dc chase: Fix shortcut
We can't shortcut chaseat() if CHASE_PARENT is set.
2024-10-04 21:34:33 +02:00
Mike Yuan 7c1dd9e288 various: correct laccess() error check
laccess is our own macro that uses RET_NERRNO.
2024-10-04 21:26:04 +02:00
Luca Boccassi 3509fe124d man: consolidate list of active unit states into a shared table
Avoids the need to maintain the same list over and over again, and
link it to the defition table in the implementation as a reminder
too
2024-10-04 12:22:55 +02:00
Peter Hutterer 305272ab2b logind: add support for hidraw devices
Add support for opening /dev/hidraw devices via logind's TakeDevice().
Same semantics as our support for evdev devices, but it requires the
HIDIOCREVOKE ioctl in the kernel.
2024-10-03 09:36:57 +01:00
Antonio Alvarez Feijoo 16b50d4018 core: fix copy/paste error 2024-10-02 22:15:41 +01:00
Luca Boccassi 394c61416c core: load IPE policy on boot
IPE is a new LSM being introduced in 6.12. Like IMA, it works based on a
policy file that has to be loaded at boot, the earlier the better. So
like IMA, if such a policy is present, load it and activate it.

If there are any .p7b files in /etc/ipe/, load them as policies.
The files have to be inline signed in DER format as per IPE documentation.

For more information on the details of IPE:

https://microsoft.github.io/ipe/
2024-10-02 18:29:43 +02:00
Daan De Meyer ec75a254d2 Move show_menu() to terminal-util.h 2024-10-02 15:05:24 +02:00
Lennart Poettering bd4beaa2eb tree-wide: always do dlopen() with RTLD_NOW + RTLD_NODELETE
Let's systematically use RTL_NOW|RLTD_NODELETE as flags passed to
dlopen(), across our codebase.

Various distros build with "-z now" anyway, hence it's weird to specify
RTLD_LAZY trying to override that (which it doesn't). Hence, let's
follow suit, and just do what everybody else does.

Also set RTLD_NODELETE, which is apparently what distros will probably
end up implying sooner or later anyway. Given that for pretty much all
our dlopen() calls we never call dlclose() anyway, let's just set this
everywhere too, to make things systematic.

This way, the flags we use by default match what distros such as fedora
do, there are no surprises, and read-only relocations can be a thing.

Fixes: #34537
2024-10-02 07:13:21 +02:00
Lennart Poettering 0a73c8e7b8 linux: import input.h and friends
The CIs apparently have rally old headers, where KEY_BRIGHTNESS_AUTO is
missing, let's hence ship our own copies from a current kernel.
2024-10-01 18:35:00 +02:00
Yu Watanabe bfa834f138 Merge pull request #34511 from YHNdnzj/strv-extend-strv-consume
basic/strv: introduce strv_extend_strv_consume()
2024-09-21 13:57:02 +09:00
Mike Yuan a2c8652a2a tree-wide: use strv_extend_strv_consume() where appropriate 2024-09-21 00:53:50 +02:00
Mike Yuan 8a7ade7427 basic/strv: introduce strv_extend_strv_consume() 2024-09-21 00:53:49 +02:00
Mike Yuan 527b9e2437 basic/strv: make string_strv_hash_ops static, add missing assertions 2024-09-20 22:44:35 +02:00
Mike Yuan 47941afd17 basic/memory-util: make mempcpy_typesafe() take number of obj rather than raw size
Follow-up for eda6223942
2024-09-20 22:44:34 +02:00
Mike Yuan 34fb408f8b basic: replace size_multiply_overflow() with MUL_ASSIGN_SAFE where applicable 2024-09-20 22:44:34 +02:00
Mike Yuan 175de2c28e basic/macro: move DECIMAL_STR_FMT to shared/tests
This shall never be used outside of test functions.
2024-09-20 22:44:34 +02:00
Yu Watanabe ffdf497860 strv: introduce strv_find_closest()
Follow-up for 1e1ac5d53b.
2024-09-21 05:06:12 +09:00
Michael Ferrari 1e1ac5d53b firstboot: add similar input suggestion
This uses the same logic as similar verb suggestion for command line
utilities. Try to be helpful when the user entered something invalid
instead of just showing the prompt again.
2024-09-20 08:34:03 +09:00
Mike Yuan eda6223942 basic/memory-util: introduce mempcpy_typesafe 2024-09-20 08:29:35 +09:00
Yu Watanabe 4f2975385f Merge pull request #34040 from AdrianVovk/repart-dollar-boot
repart: Implement $BOOT support
2024-09-18 05:09:20 +09:00
Daan De Meyer 0432e28394 Merge pull request #34440 from yuwata/network-log-no-matching-network
network: log when no matching .network file found
2024-09-17 21:09:19 +02:00
Michael Ferrari 91ea3dcf35 homed: wait for user input during firstboot
This mirrors the behavior of `systemd-firstboot` and allows bootup
messages to settle down before user input is actually processed.

See: https://github.com/systemd/systemd/issues/34448
2024-09-18 03:21:11 +09:00
Adrian Vovk e671bdc5c3 strv: Fixup STRV_FOREACH_PAIR macro
The macro didn't properly parenthesize a caller-controlled argument.
For example: `STRV_FOREACH_PAIR(a, b, something ?: something_else)`
would expand to `typeof(*something ?: something_else)`, which would
cause compile failures
2024-09-17 14:06:26 -04:00
Yu Watanabe 572d031eca log: introduce log_oom_full() 2024-09-18 02:50:19 +09:00
Mike Yuan 93d2d36638 basic/build: also include BTF status 2024-09-16 10:42:16 +09:00
Lennart Poettering c8d60ae79d efivars: add helper that reads an fs path from an efi var 2024-09-15 19:34:19 +02:00
Lennart Poettering d7a6bb9891 tree-wide: make sigprocmask() changes more automatic
This tries to get rid of most manual sigprocmask() changes, in favour
of:

1. The SD_EVENT_SIGNAL_PROCMASK flag to sd_event_add_signal()
2. The sd_event_set_signal_exit() call for handling SIGTERM/SIGINT
3. Move masking of SIGWINCH into ptyfwd, out of nspawn/vmspawn/run

And while we are at it get rid of a bunch of event source fields whose
lifetime is bound to the sd_event object they belong to anyway, and make
use of the "floating" event source feature of sd-event instead.
2024-09-13 17:12:28 +02:00
Lennart Poettering 868258cf38 basic: split ifname related calls from format-util.h into format-ifname.h
This way we don't have to pull in net/if.h into format-util.h.

This is supposed to address https://github.com/systemd/systemd/pull/32212#discussion_r1755639881

No actual code changes, just a .c/.h file split-up.
2024-09-13 07:27:47 +02:00
Matteo Croce 64e03ca8bf minor fixups for #32212
Fix minor post merge comments
2024-09-13 07:23:07 +02:00