Commit Graph

6670 Commits

Author SHA1 Message Date
Yu Watanabe
28b9c823c7 fs-util: make readlink_malloc() inline 2024-10-15 19:09:38 +09:00
Lennart Poettering
6f9826b6d8 Merge pull request #34723 from poettering/machined-pidref-more
machined: switch remaining Varlink overs over to use json_dispatch_pidref() and friends
2024-10-15 11:37:39 +02:00
Yu Watanabe
11a8cb490f Merge pull request #34736 from yuwata/network-mtu
network: wait for IPv6 MTU being synced to link MTU
2024-10-15 10:54:58 +09:00
Mike Yuan
e472238525 basic/stat-util: use xopenat() where appropriate 2024-10-15 01:16:57 +02:00
Yu Watanabe
d56d07fc1e sysctl-util: introduce sysctl_read_ip_property_int() and _uint32()
Currently not used, but will be used later.
2024-10-15 06:42:12 +09:00
Michiel
2053182bd1 Fix some typos in socket-util.h 2024-10-14 16:09:41 +02:00
Lennart Poettering
625f109604 sd-json: drop sd_json_dispatch_pid() again, as we prefer json_dispatch_pidref() now
The calls are now unused, and we generally prefer if people send a PID
triplet rather than a single PID, hence stop supporting a high-level
dispacher for pid_t.
2024-10-14 12:47:17 +02:00
Lennart Poettering
de34ec188c pidref: hookup PID_AUTOMATIC special pid_t value with PidRef
The PID_AUTOMATIC value is now properly recognized by the PidRef logic
too. This needed some massaging of header includes, to ensure pidref.h
can access process-util.h's definitions and vice versa.
2024-10-14 12:44:36 +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