1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00
Commit Graph

338 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
d6e2c1ab71 policy files: adjust landing page link 2022-01-12 16:05:59 +01:00
Scott Worley
77ec2816c6 timedatectl: Uniform commas in NTPMessage output 2021-12-21 09:46:19 +09:00
Luca Boccassi
8389fd19d2
Merge pull request #20138 from keszybz/coding-style-variable-decls
A coding style tweak and checking of sd_notify() calls and voidification of pager_open()
2021-11-05 13:57:30 +00:00
Zbigniew Jędrzejewski-Szmek
10a7340a97 tree-wide: do not print hint about -M if -M is already used
(Or when -H is used, since -H and -M are incompatible.)

Note that the slightly unusual form with separate boolean variables (hint_vars,
hint_addr) instead of e.g. a const char* variable to hold the message, because this
way we don't trigger the warning about non-literal format.
2021-11-04 11:00:54 +01:00
Zbigniew Jędrzejewski-Szmek
384c2c3239 Make pager_open() return void 2021-11-03 15:24:56 +01:00
Lennart Poettering
2f82562bad alloc-util: add strdupa_safe() + strndupa_safe() and use it everywhere
Let's define two helpers strdupa_safe() + strndupa_safe() which do the
same as their non-safe counterparts, except that they abort if called
with allocations larger than ALLOCA_MAX.

This should ensure that all our alloca() based allocations are subject
to this limit.

afaics glibc offers three alloca() based APIs: alloca() itself,
strndupa() + strdupa(). With this we have now replacements for all of
them, that take the limit into account.
2021-10-14 15:57:52 +02:00
Zbigniew Jędrzejewski-Szmek
04499a70fb Drop the text argument from assert_not_reached()
In general we almost never hit those asserts in production code, so users see
them very rarely, if ever. But either way, we just need something that users
can pass to the developers.

We have quite a few of those asserts, and some have fairly nice messages, but
many are like "WTF?" or "???" or "unexpected something". The error that is
printed includes the file location, and function name. In almost all functions
there's at most one assert, so the function name alone is enough to identify
the failure for a developer. So we don't get much extra from the message, and
we might just as well drop them.

Dropping them makes our code a tiny bit smaller, and most importantly, improves
development experience by making it easy to insert such an assert in the code
without thinking how to phrase the argument.
2021-08-03 10:05:10 +02:00
Zbigniew Jędrzejewski-Szmek
5291f26d4a tree-wide: add FORMAT_TIMESPAN() 2021-07-09 11:03:36 +02:00
Zbigniew Jędrzejewski-Szmek
04f5c018ce tree-wide: use FORMAT_TIMESTAMP() 2021-07-09 11:03:35 +02:00
Zbigniew Jędrzejewski-Szmek
8f0ea0efd9 timedated: make ntp_synced() static
No need to have this in basic.
2021-05-12 12:05:21 +02:00
Yu Watanabe
255b1fc8a3 bus-print-property: introduce BusPrintPropertyFlags
Follow-ups for 1ceaad6937.
2021-04-28 17:36:09 +02:00
Yu Watanabe
5b098203fd timedate: make log_unit_xxx_errno() refuse zero errno 2021-04-16 08:46:51 +09:00
Zbigniew Jędrzejewski-Szmek
22344fcfb9
Merge pull request #19243 from bluca/lgtm
Fix various issues reported by LGTM
2021-04-09 13:12:41 +02:00
Luca Boccassi
dfc5c4f26d timedated: use format_timestamp instead of ctime
Some static analyzers (lgtm) warn against using non-re-entrant functions,
even though at the moment this code is not multi-threaded, just switch to
format_timestamp.
2021-04-08 13:07:31 +01:00
Zbigniew Jędrzejewski-Szmek
a03e335b86 timedatectl: rework handling of conditions in print_status_info()
gcc-11.0.1-0.3.fc34.x86_64 was complaining that n might be unset with
--optimization=1. It was wrong, but let's rework the code to make it
obvious that it is always set.
2021-04-08 13:00:50 +02:00
Zbigniew Jędrzejewski-Szmek
03a81441b1 timedated: fix skipping of comments in config file
Reading file '/usr/lib/systemd/ntp-units.d/80-systemd-timesync.list'
Failed to add NTP service "# This file is part of systemd.", ignoring: Invalid argument
Failed to add NTP service "# See systemd-timedated.service(8) for more information.", ignoring: Invalid argument

:(
2021-03-09 14:04:21 +09:00
Yu Watanabe
2be6c4758e timedate: do not ignore fix_system argument in SetLocalRTC method
Fixes #18391.
2021-02-24 23:50:21 +09:00
Yu Watanabe
d2acb93dc5 tree-wide: enable colorized logging for daemons when run in console
It may be useful when debugging daemons.
2021-02-01 01:13:44 +09:00
Daan De Meyer
bc556335b1 tree-wide: Drop custom formatting for print() help messages
I think this formatting was originally used because it simplified
adding new options to the help messages. However, these days, most
tools their help message end with "\nSee the %s for details.\n" so
the final line almost never has to be edited which eliminates the
benefit of the custom formatting used for printf() help messages.
Let's make things more consistent and use the same formatting for
printf() help messages that we use everywhere else.

Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
2021-01-31 13:14:02 +09:00
Yu Watanabe
df49792e01 timedate: actually reset system time with new timezone
Fix a bug introduced by 56b0ef2fc2.

Closes CID#1436943.
2021-01-13 00:59:33 +09:00
Yu Watanabe
56b0ef2fc2 timedate: use localtime_or_gmtime_r() and mktime_or_timegm() 2020-11-21 04:28:45 +09:00
Zbigniew Jędrzejewski-Szmek
063f9f0da9 basic/env-util: add little helper to call setenv or unsetenv 2020-11-10 15:48:14 +01:00
Yu Watanabe
db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
PhoenixDiscord
e8607daf7d
Replace gendered pronouns with gender neutral ones. (#16844) 2020-08-27 11:52:48 +09:00
Zbigniew Jędrzejewski-Szmek
3660da17b0
Merge pull request #16624 from keszybz/timesync-retry-interval
Make timesyncd retry interval grow more slowly
2020-07-30 20:47:41 +02:00
fangxiuning
ddbab78f9a bus: use bus_log_connect_error to print error message 2020-07-21 10:02:01 +09:00
Yu Watanabe
94ec163ad2 timedatectl: do not show (null) if the address of NTP server is not resolved 2020-07-17 03:10:42 +09:00
fangxiuning
d67b1d18fc bus: use bus_log_parse_error to print message 2020-07-12 06:33:48 +09:00
fangxiuning
4b6607d949 table use table_log_print_error() instead of table_log_show_error 2020-07-08 15:16:52 +08:00
fangxiuning
d836018a73 table add table_log_show_error() 2020-07-08 10:50:59 +08:00
Lennart Poettering
40af3d020f shared: split out property get helpers
No code changes, just some refactoring.
2020-06-30 15:10:17 +02:00
Lennart Poettering
9176326ba2 shared: split out code for printing properties
No code changes, just some refactoring.
2020-06-30 15:09:56 +02:00
Lennart Poettering
807542bece shared: split out code that maps properties to local structs
Just some refactoring, no code changes.
2020-06-30 15:09:35 +02:00
Lennart Poettering
9b71e4ab90 shared: actually move all BusLocator related calls to bus-locator.c 2020-06-30 15:09:19 +02:00
Filipe Brandenburger
41d1f469cf log: introduce log_parse_environment_cli() and log_setup_cli()
Presently, CLI utilities such as systemctl will check whether they have a tty
attached or not to decide whether to parse /proc/cmdline or EFI variable
SystemdOptions looking for systemd.log_* entries.

But this check will be misleading if these tools are being launched by a
daemon, such as a monitoring daemon or automation service that runs in
background.

Make log handling of CLI tools uniform by never checking /proc/cmdline or EFI
variables to determine the logging level.

Furthermore, introduce a new log_setup_cli() shortcut to set up common options
used by most command-line utilities.
2020-06-24 16:49:26 +02:00
Christian Göttsche
a9ba0e328f Make failures of mac_selinux_init() fatal 2020-06-23 19:10:07 +02:00
Lennart Poettering
6028d766d1 macro: introduce DISABLE_WARNING_TYPE_LIMITS and make use of it everywhere 2020-05-25 18:25:09 +02:00
Vito Caputo
43fe4f7613 timedate: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
2020-05-07 08:46:44 -07:00
Zbigniew Jędrzejewski-Szmek
c4b7d95c46 timedated: convert to the new scheme and add --bus-introspect 2020-05-05 22:34:37 +02:00
Zbigniew Jędrzejewski-Szmek
d4cc0edfce importd,logind: add --bus-introspect= option 2020-05-05 22:34:17 +02:00
Zbigniew Jędrzejewski-Szmek
fc021a5bbf logind,importd,hostnamed,localed,timedated,machined,resolved: add option parsing stubs
--help and --version are implemented in the usual style.
help() prints full path, since the program is not expected to
be in $PATH.
2020-05-03 10:55:51 +02:00
Lennart Poettering
ac9f55ed40 tree-wide: implement new log control API dbus interface in all our daemons 2020-04-21 17:08:16 +02:00
Zbigniew Jędrzejewski-Szmek
599c99ee3b timedated: add dbus parameter names 2020-04-12 19:48:01 +02:00
Lennart Poettering
269e4d2d6b shared: split out polkit stuff from bus-util.c → bus-polkit.c
It's enough, complex stuff to warrant its own source file.

No other changes, just splitting out.
2020-01-22 12:34:10 +01:00
Lennart Poettering
04d8507f68
Merge pull request #14381 from keszybz/ifindex-cleanup
Resolve alternative names
2020-01-13 17:57:59 +01:00
Zbigniew Jędrzejewski-Szmek
9030b50a7b timedatectl: drop ifindex output parameter too 2020-01-11 12:07:28 +01:00
Zbigniew Jędrzejewski-Szmek
597da51bae tree-wide: make parse_ifindex simply return the index
We don't need a seperate output parameter that is of type int.  glibc() says
that the type is "unsigned", but the kernel thinks it's "int".  And the
"alternative names" interface also uses ints. So let's standarize on ints,
since it's clearly not realisitic to have interface numbers in the upper half
of unsigned int range.
2020-01-11 12:06:08 +01:00
Yu Watanabe
bd17fa8cd8 tree-wide: use table_log_add_error() 2020-01-10 18:28:30 +09:00
Yu Watanabe
cf57766d79 timedatectl: use format-table.[ch] 2020-01-09 15:40:50 +01:00
Lennart Poettering
353b2baa20 tree-wide: clean up --help texts a bit
This cleans up and unifies the outut of --help texts a bit:

1. Highlight the human friendly description string, not the command
   line via ANSI sequences. Previously both this description string and
   the brief command line summary was marked with the same ANSI
   highlight sequence, but given we auto-page to less and less does not
   honour multi-line highlights only the command line summary was
   affectively highlighted. Rationale: for highlighting the description
   instead of the command line: the command line summary is relatively
   boring, and mostly the same for out tools, the description on the
   other hand is pregnant, important and captions the whole thing and
   hence deserves highlighting.

2. Always suffix "Options" with ":" in the help text

3. Rename "Flags" →  "Options" in one case

4. Move commands to the top in a few cases

5. add coloring to many more help pages

6. Unify on COMMAND instead of {COMMAND} in the command line summary.
   Some tools did it one way, others the other way. I am not sure what
   precisely {} is supposed to mean, that uppercasing doesn't, hence
   let's simplify and stick to the {}-less syntax

And minor other tweaks.
2019-11-18 15:14:43 +01:00