Commit graph

62878 commits

Author SHA1 Message Date
Yu Watanabe 9cddd36707
Merge pull request #26574 from YHNdnzj/sd-login-new-interface
sd-login: add two interfaces for retriving session info
2023-02-24 09:20:52 +09:00
Yu Watanabe 8b51c41fd0 test: add tests for format_timestamp() and parse_timestamp() with various timezone 2023-02-24 08:55:28 +09:00
Yu Watanabe 7a9afae604 time-util: make parse_timestamp() use the RFC-822/ISO 8601 standard timezone spec
If the timezone is specified with a number e.g. +0900 or so, then
let's parse the time as a UTC, and adjust it with the specified time
shift.

Otherwise, if an area has timezone change, e.g.
---
Africa/Casablanca  Sun Jun 17 01:59:59 2018 UT = Sun Jun 17 01:59:59 2018 +00 isdst=0 gmtoff=0
Africa/Casablanca  Sun Jun 17 02:00:00 2018 UT = Sun Jun 17 03:00:00 2018 +01 isdst=1 gmtoff=3600
Africa/Casablanca  Sun Oct 28 01:59:59 2018 UT = Sun Oct 28 02:59:59 2018 +01 isdst=1 gmtoff=3600
Africa/Casablanca  Sun Oct 28 02:00:00 2018 UT = Sun Oct 28 03:00:00 2018 +01 isdst=0 gmtoff=3600
---
then we could not determine isdst from the timezone (+01 in the above)
and mktime() will provide wrong results.

Fixes #26370.
2023-02-24 08:55:27 +09:00
Yu Watanabe 97c5f7ba1f time-util: drop unnecessary assignment of timezone name
As mktime() does not use timezone neme.
2023-02-24 08:55:27 +09:00
Yu Watanabe a83c1baaeb time-util: rename variables
No functional changes, just refactoring.
2023-02-24 08:55:27 +09:00
Yu Watanabe 1d2c42c5dc time-util: shorten code a bit
No functional change, just refactoring.
2023-02-24 08:55:27 +09:00
Yu Watanabe db43717e98 time-util: use usec_add() and usec_sub_unsigned()
And move the check with USEC_TIMESTAMP_FORMATTABLE_MAX at the end,
as usec_add() can handle overflow correctly.
2023-02-24 08:55:27 +09:00
Yu Watanabe f2ecfd8bc1 time-util: use result from startswith_no_case()
No functional change, just refactoring.
2023-02-24 08:55:27 +09:00
Yu Watanabe 804537bdc4 time-util: do not use strdupa()
The input string may come from command line, config files.
2023-02-24 08:55:27 +09:00
Yu Watanabe 17d1ebfc43 time-util: drop redundant else 2023-02-24 08:55:27 +09:00
Yu Watanabe dff3bddc54 time-util: add assertions 2023-02-24 08:55:27 +09:00
Yu Watanabe cf98b66d1a time-util: rename variables 2023-02-24 08:55:27 +09:00
Yu Watanabe e01a8fdd26 time-util: align string table 2023-02-24 08:55:27 +09:00
Yu Watanabe d227a42aad time-util: use DEFINE_STRING_TABLE_LOOKUP_TO_STRING() macro 2023-02-24 08:55:27 +09:00
Yu Watanabe 7464953f33 time-util: drop redundant space 2023-02-24 08:55:27 +09:00
Yu Watanabe 6b04af6072 time-util: drop unused definition of FORMAT_TIMESTAMP_WIDTH 2023-02-24 08:55:27 +09:00
Yu Watanabe c73676dcbb man,catalog: fix typo
Follow-up for #26448.
2023-02-24 08:52:42 +09:00
Lennart Poettering dafb406383 shared: move cg_set_access() declaration to right header file
This function was moved from cgroup-util.c to cgroup-setup.c a while
back, but the prototype in the matching header files wasn't migrated.
Let's fix that.
2023-02-23 20:44:35 +00:00
Daan De Meyer 06762aa53e journal-file: Improve debug messages 2023-02-23 19:16:59 +00:00
Daan De Meyer 0399902440 journal-file: Fix return value in bump_entry_array() 2023-02-23 19:11:25 +00:00
Yu Watanabe 43823dfefd systemctl: use bus_message_hash_ops 2023-02-23 19:10:00 +00:00
Lennart Poettering efb18b6ae7 man: link up sd_event_add_memory_pressure() more 2023-02-23 19:04:56 +00:00
Luca Boccassi f50535afad analyze: add 'malloc' verb to dump malloc_info()
Gets the memory state of the manager:

root@image:~# systemd-analyze malloc
<malloc version=1>
<heap nr=0>
<sizes>
  <size from=33 to=33 total=396 count=12/>
  <unsorted from=20385 to=20385 total=20385 count=1/>
</sizes>
<total type=fast count=0 size=0/>
<total type=rest count=14 size=36589/>
<system type=current size=1691648/>
<system type=max size=1839104/>
<aspace type=total size=1691648/>
<aspace type=mprotect size=1691648/>
</heap>
<total type=fast count=0 size=0/>
<total type=rest count=14 size=36589/>
<total type=mmap count=0 size=0/>
<system type=current size=1691648/>
<system type=max size=1839104/>
<aspace type=total size=1691648/>
<aspace type=mprotect size=1691648/>
</malloc>
2023-02-23 18:59:06 +00:00
Mike Yuan c4ef14dc2a
sd-login: add sd_session_get_start_time 2023-02-24 02:12:36 +08:00
Mike Yuan d71f5b1217
sd-login: add sd_session_get_username 2023-02-24 02:12:08 +08:00
Daan De Meyer caeb2b616f
Merge pull request #26258 from DaanDeMeyer/boot-smbios
stub: Read extra kernel command line items from SMBIOS
2023-02-23 15:59:18 +01:00
Luca Boccassi fb22861da1 manager: add GetMallocInfo() hidden/debug method
Return the output of malloc_info() via a file descriptor (in case it
gets large on a busy system). Useful to get live data about memory
usage when it is not possible to run under a profiler from the get-go.
Do not formally register the method, but add a 'hidden' interface
so that it cannot be seen by introspection or by looking at the
object.
2023-02-23 13:26:52 +00:00
Yu Watanabe 500ecfd513
Merge pull request #26535 from yuwata/systemctl-list-cleanups
systemctl-list: several cleanups
2023-02-23 21:38:13 +09:00
Yu Watanabe e47c426b5c
Merge pull request #26560 from yuwata/journal-send-fix-memleak-and-cleanups
sd-journal: several fixlets and cleanups for sd_journal_send()
2023-02-23 21:37:20 +09:00
Yu Watanabe 4de2b47bde core/dbus-socket: check the socket path is absolute
In config_parse_socket_listen(), we have checked the path is absolute,
however we have not in the dbus method.
2023-02-23 21:34:16 +09:00
Lennart Poettering 638fd8ccb8 execute: pass ambient caps from PAM through to invoked service
If a PAM service sets some ambient caps, we should honour that, hence
query it, and merge it with our own ambient settings.

This needs to be done manually since otherwise dropping privs via
setresuid() will undo all such caps, and we need to manually tweak
things to keep them.
2023-02-23 12:53:09 +01:00
Zbigniew Jędrzejewski-Szmek 20b569a4c6
Merge pull request #26563 from dtardon/fd-init
Initialize fds with -EBADF + drop one unneeded initialization
2023-02-23 11:43:09 +01:00
Zbigniew Jędrzejewski-Szmek a34180a22f
Merge pull request #26556 from keszybz/list-timers-optimize-left
Do not say " left" on every timer in LEFT column
2023-02-23 11:37:48 +01:00
Yu Watanabe 1b7b956a9b systemctl: cleanups for list-paths
- Rename struct path_info -> PathInfo,
- Drop struct path_infos,
- Use CLEANUP_ARRAY(),

No functional change, just refactoring.
2023-02-23 18:00:38 +09:00
Yu Watanabe 032b3f518c systemctl: cleanups for list-automounts
- Rename struct automount_info -> AutomountInfo,
- use CLEANUP_ARRAY(), and etc.

No functional change, just refactoring.
2023-02-23 18:00:38 +09:00
Yu Watanabe 0e351e9a27 systemctl: cleanups for list-timers
- Rename struct timer_info -> TimerInfo,
- use CLEANUP_ARRAY().

No functional change, just refactoring.
2023-02-23 18:00:38 +09:00
Yu Watanabe 1b87606639 systemctl: cleanups for list-sockets
- Rename struct socket_info -> SocketInfo.
- Drop own_triggered field, and always copy the triggered field.
- Use CLEANUP_ARRAY().

No functional changes, just refactoring.
2023-02-23 18:00:24 +09:00
Daan De Meyer c8e5d82c97 vmm: Modernize get_smbios_table() 2023-02-23 09:51:20 +01:00
Daan De Meyer 717af0de46 stub: Read extra kernel command line items from SMBIOS
Let's read more kernel command line arguments from SMBIOS OEM string
io.systemd.stub.kernel-cmdline-extra. This allows adding debug kernel
command line arguments when booting in qemy without having to modify
the UKI.
2023-02-23 09:51:18 +01:00
David Tardon fabaf9ae25 bootctl: drop unneeded initialization 2023-02-23 09:50:26 +01:00
Daan De Meyer a885188b3a vmm: Add smbios_find_oem_string()
This function can be used to find SMBIOS strings in the SMBIOS Type 11
table.
2023-02-23 09:50:18 +01:00
Daan De Meyer 761f62fe98 vmm: Add more const
SMBIOS tables are immutable, so let's access it via const pointers
where possible.
2023-02-23 09:50:18 +01:00
Daan De Meyer e71f0f63da efi-string: Add efi_memchr() 2023-02-23 09:49:56 +01:00
David Tardon 92651a7a2d tree-wide: initialize fds with -EBADF 2023-02-23 09:48:54 +01:00
Lennart Poettering f1e1614e10
Merge pull request #26458 from yuwata/core-network-namespace-remount-sysfs
core: remount sysfs when network and mount namespace are enabled
2023-02-23 09:44:06 +01:00
Yu Watanabe 1912f790fe sd-event: fix error handling
Follow-up for 6d2326e036.
2023-02-23 09:27:48 +01:00
Lennart Poettering ca06d8984f
Merge pull request #26559 from yuwata/sd-event-memory-pressure-follow-ups
sd-event: follow-ups for memory pressure event source
2023-02-23 09:27:20 +01:00
Yu Watanabe f2ccc0d3e1 systemctl-list-units: drop unused return value 2023-02-23 15:13:05 +09:00
Yu Watanabe eef96911e1 systemctl-list-units: fix memleak on error 2023-02-23 15:13:05 +09:00
Yu Watanabe 5648ebaf40 sd-journal: fix memleak and freeing invalid pointers
This also makes
- use GREEDY_REALLOC() or GREEDY_REALLOC0(),
- use CLEANUP_ARRAY() macro.
2023-02-23 15:09:59 +09:00