summaryrefslogtreecommitdiffstats
path: root/src/machine (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-07-08tmpfiles: take error code from "errno" earlierLennart Poettering1-18/+19
This uses RET_NERRNO to more quickly pull the error code we see into "r" out of "errno". This does not change anything really. The only reason to do this is because it is harder to break this accidentally. The thing is that "errno" is easily set as side-effect of arbitrary functions. Thus, if we rely on it being set for long code paths, we need to make carefully sure that no code in between calls any function that might corrupt it as side-effect. As far as I can see we did get this right. Nonetheless, I think we should just store the value in "r" instead, to make it easier to maintain this in the long run, if more code is inserted one day, who knows.
2022-07-08mkdir-label: don't use mkdirat_errno_wrapper() without reasonLennart Poettering1-1/+2
mkdirat_errno_wrapper(x,y,z) is identical to RET_NERRNO(mkdirat(x, y, z)). Let's always use the latter when we can, because easier to read, shorter. The only reason to have mkdirat_errno_wrapper() at all is so that we can pass a function pointer to it around. Otherwise, let's not use it.
2022-07-08time-util: fix buffer-over-runYu Watanabe2-1/+6
Fixes #23928.
2022-07-08smack: catch more types of 'not supported' errorsLennart Poettering1-1/+2
2022-07-08tmpfiles: shorten code a bitLennart Poettering1-4/+2
2022-07-08test-network: merge DHCP client tests to improve performanceYu Watanabe11-361/+141
2022-07-08tmpfiles: port from dirname/basename to path_extract_directory/filename()Lennart Poettering1-52/+76
let's use our better, newer internal APIs for these purposes. This gets us two things: safer handling when the root dir is specified, and better handling of paths with trailing slashes, as we can refuse them whenever a directory is not acceptable.
2022-07-08path-util: NULL strings are definitely not valid pathsLennart Poettering1-2/+6
Let's make this functions that check validity of paths a bit more friendly towards one specific kind of invalid path: a NULL pointer. This follows similar logic in path_is_valid(), path_is_normalized() and so on.
2022-07-08update TODOLennart Poettering1-0/+11
2022-07-08tmpfiles: correct error variable to useLennart Poettering1-1/+1
2022-07-08namespace: fix propagated error numberLennart Poettering1-1/+1
2022-07-08test: use timeout command to improve performanceYu Watanabe1-40/+9
c.f. #23723.
2022-07-08test: remove /failed and /testok before running test scriptYu Watanabe2-3/+5
2022-07-07test: use PBKDF2 with capped iterations instead of Argon2Frantisek Sumsal1-1/+1
to reduce the amount of resources the test needs (similarly to TEST-24 where we do the same thing).
2022-07-07test: make TEST-64 a bit more ASan friendlyFrantisek Sumsal1-15/+25
Reduce the number of iterations in some of the test cases, since they generate a huge amount of uevents and basically DoS udev (which can't keep up while being slowed down by ASan). To avoid this, let's reduce the number of iterations and bump the timeout when running under ASan, since we're not interested in performance in such cases.
2022-07-07test: avoid overriding an already existing EXIT handlerFrantisek Sumsal1-10/+13
TEST-70 specified its own EXIT handler, which replaced the `cleanup_loopdev` handler, so the loop device was always hanging around once this test was run. Let's use the new `add_at_exit_handler()` stuff to mitigate this.
2022-07-07test: allow multiple handlers for the EXIT signalFrantisek Sumsal1-1/+28
Bash allows only one handler per signal, so let's overcome this limitation by having one dedicated EXIT signal which runs all registered handlers from all over the place.
2022-07-07test: bump the data partition size if we don't strip binariesFrantisek Sumsal1-9/+14
so we can run TEST-24 under sanitizers as well. Also, when at it, use the 'named-fields' sfdisk format to make the code a bit more descriptive without needing a manual.
2022-07-07test: create an ASan wrapper for `getent` and `su`Frantisek Sumsal1-2/+2
since they "suffer" from the same issue as `login` and other binaries that load PAM stuff
2022-07-07test: several cleanups for TEST-35-LOGINYu Watanabe3-231/+193
- use test_append_files() to install additional commands - drop use of expect - include assert.sh and use assertions at several places - use timeout command at several places - always use logind-test-user - etc
2022-07-07resolvectl man page: Word correctionFrank Dana1-1/+1
2022-07-07boot: Use UEFI protocol struct namesJan Janssen8-18/+18
These are somewhat pointless gnu-efi typedefs. Using the names from the UEFI spec makes things clearer. The one exception left is EFI_FILE as we use it a lot and EFI_FILE_PROTOCOL is quite a handful.
2022-07-07boot: Use typedef for PE structsJan Janssen1-33/+33
2022-07-07boot: Constify PE sections typeJan Janssen4-8/+8
2022-07-07boot: Use void for base pointerJan Janssen2-10/+10
2022-07-07boot: Use open_volume when creating cpioJan Janssen1-11/+3
2022-07-07systemctl: drop color settings in log messageYu Watanabe1-3/+1
`log_warning()` colorize the message gracefully.
2022-07-07systemctl: enable colorized logging by defaultYu Watanabe1-2/+1
2022-07-07NEWS: mention change in default behavior of background sessionsMichal Sekletar1-0/+8
2022-07-07tests: add test for handling of background sessionsMichal Sekletar2-0/+65
2022-07-07logind: don't start user@UID.service instance for background sessionsMichal Sekletar7-17/+20
We have had background session class for a long time (since commit e2acb67baa), but so far the only difference in handling of background sessions was logging, i.e. we log some messages with LOG_DEBUG for such sessions. Previously there were complains [1] about excessive logging for each time cron session is started. We used to advise user to enable lingering for users if they want to avoid these log messages. However, on servers with a lot of users the extra processes that result from lingering just adds too much overhead. Hence I think that our current handling of background sessions is not ideal and we should make better use of this attribute. This commit introduces a change in default behavior of logind. Logind is now not going to start user instance of systemd when background session is created and that should address excessive logging problem for cron where background class is used by default. When the same user actually logs in normally then user instance will be started as previously. Also note that PAM_TTY variable is now always set to some value for PAM sessions started via PAMName= option. Otherwise we would categorize such sessions as "background" and user manager won't be started. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1825942
2022-07-07test: fix typoYu Watanabe1-2/+2
2022-07-07TODO: fix typoYu Watanabe1-1/+1
2022-07-07os-release: define SUPPORT_END=Zbigniew Jędrzejewski-Szmek1-0/+10
Fixes #21764. I think is very simple, but flexible. The date may be set early, for distros that have a fixed schedule, but it doesn't have to. So for example Debian could push out an update that sets a few months before the release goes EOL. And various tools, in particular graphical desktops, can start nagging people to upgrade a few weeks before the date. As discussed in the bug, we don't need granularity higher than a day. And this means that we can use a simple human- and machine-readable format. I was considering other names, e.g. something with "EOL", but I think that "SUPPORT_END" is better because it doesn't imply that the machine will somehow stop working. This is supposed to be an advisory, nothing more.
2022-07-06fundamental: adjust #if conditional for _fallthrough_ for clangThomas Haller1-1/+1
NetworkManager takes systemd sources. It gets compiler warnings related to _fallthrough_. They probably can also affect systemd itself. A) on RHEL-7, gcc 4.8.5-44.el7 we get: ../src/libnm-systemd-shared/src/fundamental/macro-fundamental.h:45:22: error: "__clang__" is not defined [-Werror=undef] #if __GNUC__ >= 7 || __clang__ ^ Presumably gcc older than 7 is supported, so fix this. B) on Ubuntu 18.04, clang 1:6.0-41~exp5~ubuntu1 we get: ../src/libnm-systemd-core/src/libsystemd-network/sd-dhcp6-client.c:746:17: error: declaration does not declare anything [-Werror,-Wmissing-declarations] _fallthrough_; ^ ../src/libnm-systemd-shared/src/fundamental/macro-fundamental.h:46:25: note: expanded from macro '_fallthrough_' # define _fallthrough_ __attribute__((__fallthrough__)) ^ Granted, README comments that clang >= 10 is required. However, parts of systemd build just fine with older clang. It seems unnecessary to break this and the fix helps NetworkManager. Fixes: c0f5d58c9ab7 ('meson: Document why -Wimplicit-fallthrough is not used with clang')
2022-07-06mkosi: Update to latest releaseDaan De Meyer1-1/+1
This fixes the mkosi github action to unbreak the mkosi CI
2022-07-06man: "enabled commands are started at boot" is rubbishLennart Poettering1-20/+22
it's enabled units, and they might be started by various forms of activation, not just "at boot". Fix that.
2022-07-06update TODOLennart Poettering1-0/+3
2022-07-06dissect: refuse empty release IDYu Watanabe1-0/+2
2022-07-06Revert "dissect: ID from os-release should be non-empty, not just non-NULL"Yu Watanabe1-1/+1
This reverts commit a2cf73f0b602a93a32107cfc066a5e307263c577. This is not necessary after 78ab2b5064a0f87579ce5430f9cb83bba0db069a. Addresses https://github.com/systemd/systemd/pull/23454#discussion_r913611798.
2022-07-05json: actually use numeric C locale we just allocatedLennart Poettering1-1/+3
This fixes formatting of JSON real values, and uses C locale for them. It's kinda interesting that this wasn't noticed before: the C locale object we allocated was not used, hence doing the dance had zero effect. This makes "test-varlink" pass again on systems with non-C locale. (My guess: noone noticed this because "long double" was used before by the JSON code and that had no locale supporting printer or so?)
2022-07-05journal: Make sd_journal_previous/next() return 0 at HEAD/TAILDaan De Meyer2-4/+8
Currently, both these functions don't return 0 if we're at HEAD/TAIL and move in the corresponding direction. Let's fix that. Replaces #23480
2022-07-05docs: normalize uppercasing of titles of network docLennart Poettering2-23/+17
2022-07-05tree-wide: drop duplicated semicolonsZbigniew Jędrzejewski-Szmek6-6/+6
2022-07-05man: fix link to glob(3)Zbigniew Jędrzejewski-Szmek1-3/+3
2022-07-05fuzz: rename samples to avoid long test namesZbigniew Jędrzejewski-Szmek14-0/+0
2022-07-05firstboot: Don't skip passwd/shadow logic if only one of the files existsDaan De Meyer1-4/+2
If one of the files exists but not the other one, we want to make sure we create the other file to make sure the passwd database is in a valid state.
2022-07-05machine: switch to BusLocator-oriented helpersQuentin Deslandes2-24/+7
Replace existing sd_bus_x calls with counterparts from bus-locator.h.
2022-07-05user: delegate cpu controller, assign weights to user slicesZbigniew Jędrzejewski-Szmek5-1/+12
So far we didn't enable the cpu controller because of overhead of the accounting. If I'm reading things correctly, delegation was enabled for a while for the units with user and pam context set, i.e. for user@.service too. a931ad47a8623163a29d898224d8a8c1177ffdaf added the explicit Delegate=yes|no switch, but it was initially set to 'yes'. acc8059129b38d60c1b923670863137f8ec8f91a disabled delegation for user@.service with the justication that CPU accounting is expensive, but half a year later a88c5b8ac4df713d9831d0073a07fac82e884fb3 changed DefaultCPUAccounting=yes for kernels >=4.15 with the justification that CPU accounting is inexpensive there. In my (very noncomprehensive) testing, I don't see a measurable overhead if the cpu controller is enabled for user slices. I tried some repeated compilations, and there is was no statistical difference, but the noise level was fairly high. Maybe better benchmarking would reveal a difference. The goal of this change is very simple: currently all of the user session, including services like the display server and pipewire are under user@.service. This means that when e.g. a compilation job is started in the session's app.slice, the processes in session.slice compete for CPU and can be starved. In particular, audio starts to stutter, etc. With CPU controller enabled, I can start start 'ninja -C build -j40' in a tab and this doesn't have any noticable effect on audio. I don't think the particular values matter too much: the CPU controller is work-convserving, and presumably the session slice would never need more than e.g. one 1 full CPU, i.e. half or a quarter of available CPU resources on even the smallest of today's machines. app.slice and session.slice are assigned equal weights, background.slice is assigned a smaller fraction. CPUWeight=100 is the default, but I wrote it explicitly to make it easier for users to see how the split is done. So effectively this should result in session.slice getting as much power as it needs. If if turns out that this does have a noticable overhead, we could make it opt-in. But I think that the benefit to usability is important enough to enable it by default. W/o something like this the session is not really usable with background tasks.
2022-07-05tree-wide: add global ascii_isdigit() + ascii_isalpha()Lennart Poettering25-89/+68
We now have a local implementation in string-util-fundamental.c, but it's useful at a lot of other places, hence let's give it a more expressive name and share it across the tree. Follow-up for: 8d9156660d6958c8d63b1d44692968f1b5d33920