1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00
Commit Graph

56911 Commits

Author SHA1 Message Date
Yu Watanabe
80a226b26b list: make LIST_FOREACH() and LIST_FOREACH_BACKWARDS() safer 2022-03-19 08:10:29 +09:00
Yu Watanabe
03677889f0 list: declare iterator of LIST_FOREACH() in the loop 2022-03-19 08:10:29 +09:00
Lennart Poettering
922a650829 timesyncd: improve log message whe getting a reply from server
The message is misleading: it's not about synchronization but about
successful communicaiton. And it's not about "initial", but only about
first contact since we siwtched to this server.

Let's hence reword the message a bit.
2022-03-18 23:54:18 +01:00
Lennart Poettering
b016e77efd timesyncd: generate a structure log message the first time we set the clock correctly
Usecase: later on we can use this to retroactively adjust log output in
journalctl or similar on systems lacking an RTC: we just have to search
for this sructured log message that indicates the first sync point and
can then retroactively adjust the incorrect timestamps collected before
that.
2022-03-18 23:54:05 +01:00
Lennart Poettering
1aa7ca2241 timesyncd: add debug logging in case we can't touch /run/systemd/timesync/synchronized 2022-03-18 23:54:01 +01:00
Lennart Poettering
1f129b7fb7 timesyncd: when updating timestamp file, use best time we know, instead of system clock
We adjust the system clock slowly after all, even if we know a more
accurate time. Use the accurate time for the timestamp.
2022-03-18 23:53:58 +01:00
Lennart Poettering
87057128e6 timesyncd: rename bool 'good' → 'talking'
THe name is just too generic. Let's pick a name that makes clear that
this is about successful communication.
2022-03-18 23:53:54 +01:00
Lennart Poettering
20c1a21066 timesyncd: don't abort packet handling if we can't save the timestamp to disk
This should not be a fatal error, and it isn't in the other place we
call this.
2022-03-18 23:53:50 +01:00
Lennart Poettering
ec75e8e07a sd-event: add a single implementation of an event source that runs on clock changes
We basically had the same code in three places. Let's unify it in a
common helper function.

event_add_time_change() might be something we should add to the official
sd-event API sooner or later, given its general usefulness.
2022-03-18 23:53:34 +01:00
Lennart Poettering
7cb08ea80f timesyncd: move stuff that is not about setting the clock out of manager_adjust_clock()
Let's make sure manager_adjust_clock() is purely about setting the
clock, and nothing else.

Let's clean up logging this way. manager_adjust_clock() now won#t log
about errors, but the caller can safely do that, and do with the right
log message string.
2022-03-18 23:53:31 +01:00
Lennart Poettering
adc07c2bf5 timesyncd: use CMSG_FIND_DATA() macro where appropriate 2022-03-18 23:53:27 +01:00
Lennart Poettering
5ba674cca5 timesyncd: merge some variable declarations 2022-03-18 23:53:24 +01:00
Lennart Poettering
9a8b43021b timesyncd: rebreak some comments 2022-03-18 23:53:20 +01:00
Lennart Poettering
0fd08026f8 timesyncd: add comment what bool arg is 2022-03-18 23:53:17 +01:00
Lennart Poettering
853efc39ea timesyncd: make a constant structure actually static/const 2022-03-18 23:53:13 +01:00
Lennart Poettering
c696878ac0 timesyncd: cast some function invocations to void 2022-03-18 23:53:09 +01:00
Lennart Poettering
aabda4f3e0 timesyncd: get rid of unnecessary 'r' assignments 2022-03-18 23:53:06 +01:00
Lennart Poettering
40c6b5143b timesyncd: use structured initialization more 2022-03-18 23:52:36 +01:00
Zbigniew Jędrzejewski-Szmek
40f35786b0 various: make parse_env_file error handling the same in various places
No big reason to do this, except that I was looking at all call sites
and it's nicer if the same style is used accross the codebase.
2022-03-18 23:26:59 +01:00
Jan Janssen
592d576552 boot: Draw unicode separator line for status messages 2022-03-18 19:33:13 +01:00
Zbigniew Jędrzejewski-Szmek
62a4b584bb sd-boot+bootctl: invert order of entries w/o sort-key
With the changes in 20ec8f534f, we would sort
entries with sort-key as expected (higher versions earlier, i.e. at the top of
the menu), but entries without the sort-key as before, with higher versions
later.

When we have a bunch of boot entries grouped by machine-id (or even in the
typical case of all boot entries having the same machine id), sorting by id
should generally give good results. Entries will be grouped by installation,
and then newer entries should generally be at the top of the menu.
2022-03-18 19:11:59 +01:00
Zbigniew Jędrzejewski-Szmek
5f1077af1e
Merge pull request #22519 from poettering/boot-order-title-revert
sd-boot: rework boot entry sorting
2022-03-18 19:04:48 +01:00
Zbigniew Jędrzejewski-Szmek
523487f713 efi: use CMP() more 2022-03-18 19:00:10 +01:00
Zbigniew Jędrzejewski-Szmek
9817b7dbc9 shared/bootspec: reduce scope of variables 2022-03-18 18:49:07 +01:00
Yu Watanabe
d0b4f13ef8 strv: use STRV_FOREACH() at two more places 2022-03-18 18:38:08 +01:00
Yu Watanabe
9eb814818d strv: rewrite strv_copy() with cleanup attribute and STRV_FOREACH() 2022-03-18 18:36:48 +01:00
Lennart Poettering
52bb308c13 time-util: add macros around timespec_store() that operates on compund literal allocated timespec struct
This way we can convert usec_t to timespec on-the-fly, without a buffer.

No actual behaviour change just some shortening of code.
2022-03-18 17:13:36 +01:00
Nishal Kulkarni
de0988f9d2 shell-completion: Add completion for oomctl
Added bash and zsh completions for oomctl arguments and commands.

Related To: #22118
2022-03-18 13:41:19 +00:00
Lennart Poettering
7d469b63a1
Merge pull request #22787 from poettering/bootspec-split
shared: split bootspec.c in two
2022-03-18 14:22:07 +01:00
AlexCatze
1a34f913a6
Add HP Elitebook 2760p support (#22766) 2022-03-18 13:45:43 +01:00
Lennart Poettering
b7df2c78ea meson: sort shared source file list again 2022-03-18 12:01:45 +01:00
Lennart Poettering
e94830c0a1 shared: split out ESP/XBOOTLDR search stuff from bootspec.c
The code is quite different from the rest of bootspec.c, with different
deps and stuff. There's even a /***/ line to separate the two parts.
Given how large the file already is, let#s just split it into two.

No code changes, just some splitting out.
2022-03-18 12:01:45 +01:00
Lennart Poettering
f620a36865 update TODO 2022-03-18 11:59:30 +01:00
Lennart Poettering
1fe368e526 test: add test that verifies correct order of boot entries 2022-03-18 11:59:30 +01:00
Lennart Poettering
d23b3bfdd6 kernel-install: automatically generate "sort-key" field
Let's order by IMAGE_ID=/ID= by default.
2022-03-18 11:59:30 +01:00
Lennart Poettering
cf5d9598b6 sd-boot: add comments highlighting type 1 vs. type 2 2022-03-18 11:59:30 +01:00
Lennart Poettering
20ec8f534f sd-boot: make use of new "sort-key" boot loader spec field 2022-03-18 11:59:30 +01:00
Lennart Poettering
1011935785 docs: add new "sort-key" field to boot loader spec
This allows snippet generators to explicitly order entries: any string
can be set as an entry's "sort key". If set, sd-boot will use it to sort
entries on display.

New logic is hence (ignore the boot counting logic)

  sort-key is set → primary sort key: sort-key (lexicographically increasing order)
                  → secondary sort key: machine-id (also increasing order)
                  → tertiary sort key: version (lexicographically decreasing order!)

  sort-key is not set → primary sort key: entry filename (aka id), lexicographically increasing order)

With this scheme we can order OSes by their names from A-Z but then put
within the same OS still the newest version first. This should clean up
the order to match expectations more.

Based on discussions here:

https://github.com/systemd/systemd/pull/22391#issuecomment-1040092633
2022-03-18 11:59:30 +01:00
Lennart Poettering
f65a33269e Revert "boot: Change boot entry sorting"
This reverts commit 9818ec8ea5.
2022-03-18 11:59:30 +01:00
Lennart Poettering
09d4d60360 doc: mention that setfsuid() is a reason why UIDs >= 2147483648 are icky 2022-03-18 11:54:45 +01:00
Lennart Poettering
af5ee76c56
Merge pull request #22784 from poettering/bootctl-fixlets
Trivial bootctl/kernel-install fixlets
2022-03-18 11:53:08 +01:00
Zbigniew Jędrzejewski-Szmek
23484e1205 systemctl: fix operations on relative paths
We should treat ./some.service and $PWD/some.service as equivalent. But we'd
try to send the relative paths over dbus, which can't work well:

$ sudo systemctl enable ./test2.service
Failed to look up unit file state: Invalid argument
$ sudo systemctl enable $PWD/test2.service
Created symlink /etc/systemd/system/multi-user.target.wants/test2.service → /home/zbyszek/src/systemd/test2.service.
Created symlink /etc/systemd/system/test2.service → /home/zbyszek/src/systemd/test2.service.

Now both are equivalent.
2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
2cdd6bef9c shared/install-printf: drop now-unused install_path_printf() 2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
46801e7647 shared/install: do not print aliases longer than UNIT_NAME_MAX
0653649202 did the conversion to install_path_printf().
But IIUC, here we are just looking at a unit file name, not the full
path.
2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
09f5fc66f2 basic/env-file: inline one variable declaration 2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
20afd9a184 systemctl: remove unused parameter 2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
4f5160698e systemctl: drop left-over parens 2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
f60b0813ea man/systemd.exec: tweak markup a bit 2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
4f5c24857b shared/install: adjust comment formatting 2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
d29cc4d6e1 tree-wide: use strv_contains() in more places 2022-03-18 10:22:20 +01:00