summaryrefslogtreecommitdiffstats
path: root/src/basic (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #34040 from AdrianVovk/repart-dollar-bootYu Watanabe2024-09-171-1/+1
|\ | | | | repart: Implement $BOOT support
| * strv: Fixup STRV_FOREACH_PAIR macroAdrian Vovk2024-09-171-1/+1
| | | | | | | | | | | | | | 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
* | Merge pull request #34440 from yuwata/network-log-no-matching-networkDaan De Meyer2024-09-171-3/+4
|\ \ | | | | | | network: log when no matching .network file found
| * | log: introduce log_oom_full()Yu Watanabe2024-09-171-3/+4
| |/
* / homed: wait for user input during firstbootMichael Ferrari2024-09-172-0/+20
|/ | | | | | | 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
* basic/build: also include BTF statusMike Yuan2024-09-161-1/+7
|
* efivars: add helper that reads an fs path from an efi varLennart Poettering2024-09-152-2/+31
|
* tree-wide: make sigprocmask() changes more automaticLennart Poettering2024-09-131-1/+1
| | | | | | | | | | | | | 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.
* basic: split ifname related calls from format-util.h into format-ifname.hLennart Poettering2024-09-136-57/+66
| | | | | | | | 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.
* minor fixups for #32212Matteo Croce2024-09-131-1/+4
| | | | Fix minor post merge comments
* Merge pull request #32212 from teknoraver/networkd-sysctlLennart Poettering2024-09-122-14/+52
|\ | | | | More visibility into systemd-networkd sysctls
| * extend sysctl functions to shadow valuesMatteo Croce2024-09-112-14/+52
| | | | | | | | | | Pass to all the sysctl_* functions a hashmap which can be used to optionally save the value written in the sysctl.
* | syscalls: run "ninja update-syscalls-*"Lennart Poettering2024-09-1220-43/+3
|/
* Merge pull request #33833 from YHNdnzj/manager-reload-assertMike Yuan2024-09-091-5/+5
|\ | | | | core/manager: do not re-init Manager.lookup_paths when manager_reload(), minor assorted cleanups
| * chattr-util: use BIT_FOREACH where appropriateMike Yuan2024-09-071-4/+3
| |
| * chattr-util: set O_NOCTTY when reopening O_PATH fdMike Yuan2024-09-071-1/+2
| | | | | | | | Follow-up for 07862c9fc2becdc4bbe112b023591d2ab2dd032b
* | missing_socket: drop unnecessary definitionsYu Watanabe2024-09-092-43/+3
| | | | | | | | | | Now, we have copy of vm_sockets.h, hence these definitions are not necessary anymore.
* | missing_network: drop unnecessary definitionYu Watanabe2024-09-092-5/+1
| | | | | | | | Now we have ipv6.h, hence the definition is not necessary anymore.
* | arphrd-list: use imported linux/if_arp.hYu Watanabe2024-09-092-2/+2
| |
* | linux: import more network related headers from v6.11-rc6Yu Watanabe2024-09-0924-0/+2689
| | | | | | | | Hopefully, no effective change.
* | terminal-util: correct fd validity checkMike Yuan2024-09-081-1/+1
|/ | | | Follow-up for 14f594b995bbaea85456a4c26e5c07446a4c446e
* iovec-util: add iovec_append() for appending to an existing iovecLennart Poettering2024-09-062-0/+14
|
* user-util: switch from utmp to utmpxLennart Poettering2024-09-061-2/+2
| | | | | | | | | | We generally use utmpx instead of utmp (both are actually identical on Linux, but utmpx is POSIX, while utmp is not). Let's fix one left-over case. UT_NAMESIZE does not exist in utmpx world, it has no direct counterpart, hence let's just sizeof_field() to determine the size of the actual field. (which comes to the same result of course: 32).
* Merge pull request #34155 from poettering/gmtime-safeYu Watanabe2024-09-064-33/+70
|\ | | | | handle gmtime_r() errors more robustly
| * time-util: rework localtime_or_gmtime() into localtime_or_gmtime_usec()Lennart Poettering2024-09-054-33/+70
| | | | | | | | | | | | | | | | | | | | | | | | We typically want to deal in usec_t, hence let's change the prototype accordingly, and do proper range checks. Also, make sure are not confused by negative times. Do something similar for mktime_or_timegm(). This is a more comprehensive alternative to #34065 Replaces: #34065
* | basic: Include <sys/file.h> for LOCK_* constantsA. Wilcox2024-09-061-0/+2
|/ | | | | This is needed to ensure LOCK_{EX,SH} are defined in certain environments, including uclibc-ng and musl libc.
* Merge pull request #34090 from DaanDeMeyer/cow-fixYu Watanabe2024-09-051-4/+13
|\ | | | | Rework COW <=> NOCOW copying behavior
| * chattr-util: Optimize read_attr_at()Daan De Meyer2024-09-041-4/+13
| | | | | | | | Let's make sure we only reopen O_PATH file descriptors.
* | socket-util: make recvmsg_safe() handle MSG_TRUNC tooMike Yuan2024-09-042-5/+9
| | | | | | | | Also, unify MSG_TRUNC handling all across the codebase.
* | audit-util: check correct errnoMike Yuan2024-09-041-1/+1
| |
* | fd-util: also close pidfd from SCM_PIDFD in cmsg_close_all()Mike Yuan2024-09-041-4/+11
|/
* log: protect errno from log_syntax_invalid_utf8_internal()Yu Watanabe2024-09-011-0/+1
| | | | | Potentially, utf8_escape_invalid() called by log_syntax_invalid_utf8_internal() may update errno.
* log: introduce log_syntax_parse_error()Yu Watanabe2024-09-012-0/+56
| | | | | This provides generic error message for failures in conf parsers. Currently this is not used, but will be used later.
* basic/raw-clone: refuse CLONE_PIDFD tooMike Yuan2024-09-011-6/+6
|
* core: do BindMount/MountImage operations in async control processLuca Boccassi2024-08-292-0/+5
| | | | | | | | | | | | | | | | | | These operations might require slow I/O, and thus might block PID1's main loop for an undeterminated amount of time. Instead of performing them inline, fork a worker process and stash away the D-Bus message, and reply once we get a SIGCHILD indicating they have completed. That way we don't break compatibility and callers can continue to rely on the fact that when they get the method reply the operation either succeeded or failed. To keep backward compatibility, unlike reload control processes, these are ran inside init.scope and not the target cgroup. Unlike ExecReload, this is under our control and is not defined by the unit. This is necessary because previously the operation also wasn't ran from the target cgroup, so suddenly forking a copy-on-write copy of pid1 into the target cgroup will make memory usage spike, and if there is a MemoryMax= or MemoryHigh= set and the cgroup is already close to the limit, it will cause an OOM kill, where previously it would have worked fine.
* parse-util: drop unused parse_ip_prefix_length()Yu Watanabe2024-08-242-18/+0
|
* basic/sigbus: use FOREACH_ELEMENT where appropriate, assert >= 0 for successMike Yuan2024-08-221-5/+5
|
* process-util: always retry with pidfd_spawn() w/o cgroup firstMike Yuan2024-08-211-37/+39
| | | | | | | | | | | | | Follow-up for 7ac58157ca67ab001307f1fd72e0cc7c0c4e846a With the mentioned commit, iff E2BIG we'd retry pidfd_spawn() with POSIX_SPAWN_SETCGROUP disabled. However, the same strategy should actually apply to EOPNOTSUPP/ENOSYS/EPERM too - they can mean two things here: no clone3() or no CLONE_PIDFD. Therefore, let's first try clone() + CLONE_PIDFD, and fall further back to plain clone() (posix_spawn()) only as last resort. Plus, record the fact so that we don't unnecessarily retry every single time if CLONE_PIDFD is the one that's unavailable.
* process-util: check the flag instead of 'cgroup' paramMike Yuan2024-08-211-1/+1
| | | | We might skip CLONE_INTO_CGROUP wholly if not supported.
* Revert "cgroup-util: Don't try to open pidfd for kernel threads"Daan De Meyer2024-08-211-3/+1
| | | | | | | The kernel patch was reverted so let's try again to open pidfds for kernel threads. This reverts commit ead48ec35c863650944352a3455f26ce3b393058.
* process-util: handle pidfd_spawn() returning E2BIGKornilios Kourtis2024-08-201-5/+21
| | | | | | | | | | | | | | | | | | | | In some kernels (specifically, 5.4) even though the clone3 syscall is supported, setting CLONE_INTO_CGROUP is not. The error message returned in this case is E2BIG. If posix_spawn_wrapper encounters this error, it does not retry, and cannot spawn any programs in said kernels. This commit adds a check for the E2BIG error and retries pidfd_spawn() without the POSIX_SPAWN_SETCGROUP flag. If we encounter an E2BIG error, and the pidfd_spawn() succeeds after removing the POSIX_SPAWN_SETCGROUP flag, then we cache the result so that we do not retry every time. Originally, this issue was reported in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1077204. Signed-off-by: Kornilios Kourtis <kornilios@gmail.com>
* Merge pull request #34044 from poettering/isatty-fixesYu Watanabe2024-08-202-6/+13
|\ | | | | fixes around isatty() handling
| * tree-wide: use isatty_safe() moreLennart Poettering2024-08-202-3/+4
| |
| * terminal-util: don't assume errno is correctly set when using isatty_safe()Lennart Poettering2024-08-201-3/+3
| | | | | | | | | | | | | | | | | | let's instead generate ENOTTY on our own. This is more correct with out coding style (since we generally do not propagate errors via errno), and also addresses #34039 as side effect. (#34039 really needs to be fixed in musl though, too, this is just a work-around as side-effect). Fixes: #34039
| * terminal-util: fix isatty_safe() on hung-up TTYsLennart Poettering2024-08-201-0/+6
| | | | | | | | | | | | | | | | | | | | glibc returs EIO on ttys that are hung up. That's not really correct, POSIX seems to disagree. Work around this in our code, and turn this into a clean "1", since a hung up tty doesn't stop being a tty just because it is hung up. Background: https://github.com/systemd/systemd/pull/34039
* | network/routing-policy-rule: use int32_t for suppress_prefixlenYu Watanabe2024-08-192-3/+3
|/ | | | | | | | The kernel parses FRA_SUPPRESS_PREFIXLEN as uint32_t, but internally handled as signed integer and negative values as unset. Let's explicitly specify the size of the variable. No functional change, just refactoring.
* Merge pull request #34025 from YHNdnzj/edit-util-wrong-placeYu Watanabe2024-08-181-2/+2
|\ | | | | edit-util: catch and warn about edits outside of markers
| * string-util: update ptr declaration to match our coding styleMike Yuan2024-08-181-2/+2
| |
* | Merge pull request #34022 from YHNdnzj/unit-is-filteredYu Watanabe2024-08-181-1/+0
|\ \ | |/ |/| core/unit: two trivial cleanups
| * core/unit: unit_is_filtered() -> unit_passes_filter() and invert logicMike Yuan2024-08-171-1/+0
| | | | | | | | | | | | | | | | | | Follow-up for 6d2984d21bf2a8f71d379ef6bc13a761bb2e2756 The current semantics of "filtered" in unit_is_filtered() are actually the contrary of ListUnitsFiltered(). Let's make things consistent, i.e. return true when the unit shall be included.