summaryrefslogtreecommitdiff
path: root/src/timedate
Commit message (Collapse)AuthorAgeFilesLines
* Highlight the synopsis and summary in --helpZbigniew Jędrzejewski-Szmek2019-10-081-2/+4
| | | | | This doesn't cover all the binaries, but I don't know how to script this, and I run out of steam ;)
* Move the Commands section above Options sectionZbigniew Jędrzejewski-Szmek2019-10-081-14/+14
| | | | | | | For executables which take a verb, we should list the verbs first, and then options which modify those verbs second. The general layout of the man page is from general description to specific details, usually Overview, Commands, Options, Return Value, Examples, References.
* timedated: always enable&start the service with highest priorityZbigniew Jędrzejewski-Szmek2019-08-061-39/+20
| | | | | | | | | | | | | | | | | This removes a special case that was implemented before: if some service was already enabled, we'd treat it as having higher priority. From https://bugzilla.redhat.com/show_bug.cgi?id=1735584#c4: > Setting ntp off and on should give the same result as just setting it > on. There should be no stickiness (hidden state). It should behave like > running an ansible role. > > The other service might have been enabled because no other was installed at > the time. If I install a new NTP service with a higher priority, setting ntp > on should enable and start the new service, and disable all other. Also, if > for some reason multiple services are enabled, after setting ntp on there > should be only one enabled to avoid systemd selecting between them randomly > on the next boot.
* timedated: log about unit enablement actions and enhance logs in generalZbigniew Jędrzejewski-Szmek2019-08-051-12/+52
| | | | | | | | | The general idea is that for things which can occur repeatedly, like SetNTP being called with the same argument, we only log at debug level. For things which change state, like when we realize that a unit that wasn't enabled before needs to be enabled, we log at info level. Also, don't return success if there are no units loaded.
* timedated: minor code simplificationsZbigniew Jędrzejewski-Szmek2019-08-041-18/+9
|
* timedated: add back support for ntp-units.d/Zbigniew Jędrzejewski-Szmek2019-07-221-8/+64
| | | | | | | | | | | | | | | | | | | | We removed support for foreign services (and ntp-units.d/) in b72ddf0f4. Support for foreign services was added back in 5d280742, but through an environment variable. The problem with the env var approach is that it only works as a mechanism to select one item, and doesn't work nicely as a mechinism to create a list of items through drop-ins (because the env var can be easily overridden, but not extended). Having a list of "ntp providers" is important to be able to reliably disable all of them when that is requested. Another problem is that nobody ever bothered to care about our new "standard". ntp-units.d/ is a nice simple format that works and is already supported by chrony and ntpd and timedatex. If we were to introduce and ask people to follow a new standard, there should be some good reason for this. The idea with env vars has lower functionality, requires systemd-specific syntax. We should just re-adopt the format that we originally introduced and that seems to work for everyone, and more on to more interesting problems.
* timedatectl: add 'ntp-servers' and 'revert' commands to modify link NTP serversYu Watanabe2019-07-171-0/+103
|
* tree-wide: get rid of strappend()Lennart Poettering2019-07-121-1/+1
| | | | | It's a special case of strjoin(), so no need to keep both. In particular as typing strjoin() is even shoert than strappend().
* Enable log colors for most of tools in /usr/binZbigniew Jędrzejewski-Szmek2019-05-081-0/+1
| | | | | | | | | | When emitting the calendarspec warning we want to see some color. Follow-up for 04220fda5c. Exceptions: - systemctl, because it has a lot hand-crafted coloring - tmpfiles, sysusers, stdio-bridge, etc, because they are also used in services and I'm not sure if this wouldn't mess up something.
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-0/+2
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* util: split out memcmp()/memset() related calls into memory-util.[ch]Lennart Poettering2019-03-131-1/+1
| | | | Just some source rearranging.
* timedate: fix emitted value when ntp client is enabled/disabled (#11951)Yu Watanabe2019-03-101-2/+2
| | | | | | This fixes a regression originall caused by cf3872bd2 and triggered by b4356b5720a. Fixes #11944
* bus-util: drop unnecessary re-formattingYu Watanabe2019-03-041-1/+1
|
* timedate: refuse to set time when previous request is not finishedYu Watanabe2019-01-151-0/+11
| | | | | | | If `timedatectl set-time` is invoked right after `timedatectl set-ntp true`, then, the NTP service may not be started yet. Fixes #11420.
* timedate: treat 'activating' or 'inactivating' NTP client status as 'active'Yu Watanabe2019-01-151-2/+2
| | | | | | | | | When `timedatectl set-time` is called, NTP client may be in 'activating' or something. For safety, let's treat such states as 'active'. This also changes all unit file status except for 'masked' or 'disabled' are treated as 'enabled'.
* timedated: Add dbus method to retrieve list of time zones (#11114)tibbling2018-12-122-3/+41
| | | | Move function call get_timezones from timedatectl to timedated and create a dbus method to list timezones.
* util: drop missing.h from util.hYu Watanabe2018-12-041-0/+1
|
* util-lib: split out all temporary file related calls into tmpfiles-util.cLennart Poettering2018-12-021-0/+1
| | | | | | | | This splits out a bunch of functions from fileio.c that have to do with temporary files. Simply to make the header files a bit shorter, and to group things more nicely. No code changes, just some rearranging of source files.
* timedate: define main through macroYu Watanabe2018-11-231-34/+21
|
* coccinelle: make use of SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek2018-11-221-8/+6
| | | | | | | | | | | Ideally, coccinelle would strip unnecessary braces too. But I do not see any option in coccinelle for this, so instead, I edited the patch text using search&replace to remove the braces. Unfortunately this is not fully automatic, in particular it didn't deal well with if-else-if-else blocks and ifdefs, so there is an increased likelikehood be some bugs in such spots. I also removed part of the patch that coccinelle generated for udev, where we returns -1 for failure. This should be fixed independently.
* Split out pretty-print.c and move pager.c and main-func.h to shared/Zbigniew Jędrzejewski-Szmek2018-11-201-0/+1
| | | | | This is high-level functionality, and fits better in shared/ (which is for our executables), than in basic/ (which is also for libraries).
* timedatectl: define main through macroZbigniew Jędrzejewski-Szmek2018-11-201-17/+9
| | | | pager_close() is called from DEFINE_MAIN_FUNCTION().
* log: introduce new helper call log_setup_service()Lennart Poettering2018-11-201-3/+1
| | | | | Let's reduce the common boilerplate and have a single setup function used by all service code to setup logging.
* Merge pull request #10753 from keszybz/pager-no-interruptLennart Poettering2018-11-141-3/+3
|\ | | | | Add mode in journalctl where ^C is handled by the pager
| * basic/pager: convert the pager options to a flags argumentZbigniew Jędrzejewski-Szmek2018-11-141-3/+3
| | | | | | | | | | Pretty much everything uses just the first argument, and this doesn't make this common pattern more complicated, but makes it simpler to pass multiple options.
* | hostnamed,localed,timedate: properly propagate errors from sd_event_add_signal()Lennart Poettering2018-11-121-4/+8
|/ | | | main() can't doesn't expect negative error codes as return.
* bus-util: make --property= optionally take valueYu Watanabe2018-09-121-10/+2
|
* tree-wide: add clickable man page link to all --help textsLennart Poettering2018-08-201-1/+11
| | | | | | | | | | This is a bit like the info link in most of GNU's --help texts, but we don't do info but man pages, and we make them properly clickable on terminal supporting that, because awesome. I think it's generally advisable to link up our (brief) --help texts and our (more comprehensive) man pages a bit, so this should be an easy and straight-forward way to do it.
* timedate: emit property changed signal after all jobs are completedYu Watanabe2018-08-081-30/+40
| | | | Follow-up for 3af0a96c0fcc623bd16649fc3640396a657cf9ef (#9684).
* tree-wide: shorten error logging a bitYu Watanabe2018-08-071-8/+8
| | | | Continuation of 4027f96aa08c73f109aa46b89842ca0e25c9c0e9.
* timedate: defer the property changed signal until job of starting/stopping ↵Yu Watanabe2018-07-261-13/+65
| | | | | | | | | | | | NTP service is finished Before this, the property changed signal is emitted immediately after StartUnit/StopUnit method is called. So, the running state of the NTP client service may not updated. This makes the timing of emitting property changed signal is deferred until job of starting/stopping NTP client service is completed. Fixes #9672.
* timedate: increment reference count of sd_bus_messageYu Watanabe2018-07-261-5/+9
| | | | | | | | | | | The commit 5d280742b645a69a19e7f9131adc0c95f5c7fa07 introduces a barrier to suppress calling context_update_ntp_status() multiple times. However, it just stores the address of sd_bus_message object. So, when an address is reused on the subsequent message, then the status of NTP clients are not updated. This makes the stored message object is referenced by the context object. So, the subsequent message is on cirtainly different address.
* timedate: set sd_event_add_signal()Yu Watanabe2018-07-201-1/+12
|
* tree-wide: use localtime_r() instead of localtime()Yu Watanabe2018-06-261-3/+3
| | | | Follow-up for e46acb7950a9f07ac60d772309de842c444ad2bd.
* timedate: use gmtime_r() and localtime_r()Lennart Poettering2018-06-251-10/+10
| | | | | | | | | | gmtime() and localtime() operate on a static buffer. let's avoid this, as we never know whether some library might use these calls in some backrgound thread. Discovered by lgtm: https://lgtm.com/projects/g/systemd/systemd/
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-3/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-06-141-2/+0
| | | | | | | perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-142-2/+2
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-142-4/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-142-4/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* timedatectl: add 'show' command to display machine-readable outputYu Watanabe2018-06-141-0/+22
| | | | Closes #9249.
* tree-wide: drop !! casts to booleansZbigniew Jędrzejewski-Szmek2018-06-131-1/+1
| | | | | | | | | | | They are not needed, because anything that is non-zero is converted to true. C11: > 6.3.1.2: When any scalar value is converted to _Bool, the result is 0 if the > value compares equal to 0; otherwise, the result is 1. https://stackoverflow.com/questions/31551888/casting-int-to-bool-in-c-c
* basic/log: add the log_struct terminator to macroZbigniew Jędrzejewski-Szmek2018-06-041-4/+2
| | | | | This way all callers do not need to specify it. Exhaustively tested by running test-log under valgrind ;)
* timedated: add some debug logging when a number of kernel calls failLennart Poettering2018-05-291-16/+26
|
* timedated: show the short timezone name when changing timezones in logsLennart Poettering2018-05-291-3/+8
|
* Merge pull request #8985 from yuwata/bus-macro-3Lennart Poettering2018-05-181-24/+3
|\ | | | | tree-wide: use BUS_DEFINE_PROPERTY_GET* macros
| * timedate: use BUS_DEFINE_PROPERTY_GET* macrosYu Watanabe2018-05-151-24/+3
| |
* | Merge pull request #9002 from yuwata/fix-timedateLennart Poettering2018-05-171-4/+5
|\ \ | | | | | | Fixes timedated and cleanups hostnamed
| * | timedate: do not copy input string before bus_verify_polkit_async()Yu Watanabe2018-05-151-4/+5
| |/ | | | | | | | | This fixes the commit 2c3def62144c9d689ddda88a866b1e623074eaae which breaks `timedatectl set-timezone` called by non-privileged user.
* | timedatectl: do not wrap polkit policy messageYu Watanabe2018-05-181-4/+2
|/ | | | | | | If messages are wrapped, then only the last line is shown in the dialog, at least polkit gui for Xfce. It may be a bug of polkit or Xfce. But it is not necessary to wrap the message in the policy file. So, let's fix them.