summaryrefslogtreecommitdiff
path: root/src/timesync
AgeCommit message (Collapse)Author
2016-10-16tree-wide: use mfree moreZbigniew Jędrzejewski-Szmek
2016-09-16tree-wide: rename config_parse_many to …_nulstrZbigniew Jędrzejewski-Szmek
In preparation for adding a version which takes a strv.
2016-02-26clock-util: make clock_is_localtime() testable and add initial testsMartin Pitt
Add path argument to clock_is_localtime() and default to "/etc/adjtime" if it's NULL. This makes the function testable. Add test-clock: initial test cases for some scenarios, using a temporary file. This also checks the behaviour with a NULL (i. e. the system's /etc/adjtime) file.
2016-02-10tree-wide: remove Emacs lines from all filesDaniel Mack
This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
2016-01-20timesyncd: use (void) to mark ignored valueZbigniew Jędrzejewski-Szmek
CID #1325772.
2015-11-18tree-wide: sort includes in *.hThomas Hindoe Paaboel Andersen
This is a continuation of the previous include sort patch, which only sorted for .c files.
2015-11-10defs: rework CONF_DIRS_NULSTR() macroLennart Poettering
The macro is generically useful for putting together search paths, hence let's make it truly generic, by dropping the implicit ".d" appending it does, and leave that to the caller. Also rename it from CONF_DIRS_NULSTR() to CONF_PATHS_NULSTR(), since it's not strictly about dirs that way, but any kind of file system path. Also, mark CONF_DIR_SPLIT_USR() as internal macro by renaming it to _CONF_PATHS_SPLIT_USR() so that the leading underscore indicates that it's internal.
2015-11-05timesync: return negative errno from manager_adjust_clock() on errorMichal Schmidt
2015-11-03util-lib: move CONF_DIRS_NULSTR definition to def.hLennart Poettering
After all, this is not some compiler or C magic, but something very specific to how systemd works, hence let's move it into def.h, and out of macro.h
2015-10-27util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering
2015-10-27src/basic: rename audit.[ch] → audit-util.[ch] and capability.[ch] → ↵Lennart Poettering
capability-util.[ch] The files are named too generically, so that they might conflict with the upstream project headers. Hence, let's add a "-util" suffix, to clarify that this are just our utility headers and not any official upstream headers.
2015-10-27util-lib: move a number of fs operations into fs-util.[ch]Lennart Poettering
2015-10-27timesysnd: port to extract_first_wordSusant Sahani
2015-10-26util-lib: split out user/group/uid/gid calls into user-util.[ch]Lennart Poettering
2015-10-25util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering
There are more than enough to deserve their own .c file, hence move them over.
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering
string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
2015-10-19tree-wide: add more void casts for various syscall invocationsLennart Poettering
2015-09-30tree-wide: clean up log_syntax() usageLennart Poettering
- Rely everywhere that we use abs() on the error code passed in anyway, thus don't need to explicitly negate what we pass in - Never attach synthetic error number information to log messages. Only log about errors we *receive* with the error number we got there, don't log any synthetic error, that don#t even propagate, but just eat up. - Be more careful with attaching exactly the error we get, instead of errno or unrelated errors randomly. - Fix one occasion where the error number and line number got swapped. - Make sure we never tape over OOM issues, or inability to resolve specifiers
2015-09-11timesyncd: fix how we print a PIDLennart Poettering
2015-07-31timesyncd: remove RLIMIT_NPROCKay Sievers
NSS plugins might create additional threads. Remove the limit, we cannot really make any assumptions here.
2015-06-23build-sys: add all source files and no built files to the tar ballKay Sievers
This fully synchronizes the content of a "make dist" and a "git archive" tar ball. http://lists.freedesktop.org/archives/systemd-devel/2015-June/033214.html
2015-06-15everywhere: port everything to sigprocmask_many() and friendsLennart Poettering
This ports a lot of manual code over to sigprocmask_many() and friends. Also, we now consistly check for sigprocmask() failures with assert_se(), since the call cannot realistically fail unless there's a programming error. Also encloses a few sd_event_add_signal() calls with (void) when we ignore the return values for it knowingly.
2015-06-10util: introduce CMSG_FOREACH() macro and make use of it everywhereLennart Poettering
It's only marginally shorter then the usual for() loop, but certainly more readable.
2015-05-29util: split out signal-util.[ch] from util.[ch]Lennart Poettering
No functional changes.
2015-04-08timesyncd: print an INFO log message when we successfully reached a time serverLennart Poettering
2015-03-10add REMOTE_ADDR and REMOTE_PORT for Accept=yesShawn Landden
2015-03-03Do not advertise .d snippets over main config fileZbigniew Jędrzejewski-Szmek
For daemons which have a main configuration file, there's little reason for the administrator to use configuration snippets. They are useful for packagers which need to override settings, but we shouldn't advertise that as the main way of configuring those services. https://bugs.freedesktop.org/show_bug.cgi?id=89397
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
2015-02-16timesync: Use UINT64_C for OFFSET_1900_1970Cristian Rodríguez
So it matches what the comment says in both 32 and 64 bit systems.
2015-02-12Revert "tree-wide: Always use recvmsg with MSG_CMSG_CLOEXEC"Lennart Poettering
This reverts commit d6d810fbf8071f8510450dbacd1d083f37603656. It's apparently not OK to pass MSG_CMSG_CLOEXEC to recvmsg() of raw sockets.
2015-02-10tree-wide: Always use recvmsg with MSG_CMSG_CLOEXECCristian Rodríguez
2015-02-04timesyncd: downgrade more log messages from LOG_INFO to LOG_DEBUGLennart Poettering
https://bugs.freedesktop.org/show_bug.cgi?id=87505 Let's make timesyncd less chatty.
2015-02-04timesyncd: reduce log chattiness a bitLennart Poettering
Let's downgrade the statistics output from LOG_INFO to LOG_DEBUG. https://bugs.freedesktop.org/show_bug.cgi?id=88926
2015-01-27timesyncd: set RLIMIT_NPROC to 2Lennart Poettering
This way timesyncd cannot be used to fork(). Note that it generally is not safe to use RLIMIT_NPROC, since it breaks running the same daemon in multiple containers if they do not use user namespacing. However, timesyncd is excepted from running in a container anyway, hence it is safe in this case.
2015-01-18timesyncd: consider too long packets as invalidTopi Miettinen
If the received NTP message from server didn't fit to our buffer, either it is doing something nasty or we don't know the protocol. Consider the packet as invalid. (David: add parantheses around conditional)
2014-12-25timesync: remove square(), use pow insteadCristian Rodríguez
In any case, the compiler generates the same code inline and never actually calls the library function.
2014-11-30timesyncd: minor simplificationLennart Poettering
2014-11-29timesyncd: Support timesyncd.conf.d directories in the usual search pathsJosh Triplett
2014-11-28treewide: another round of simplificationsMichal Schmidt
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: yet more log_*_errno + return simplificationsMichal Schmidt
Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
2014-11-28treewide: drop unnecessary trailing \n in log_*() callsMichal Schmidt
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-11-27timesyncd: do not keep listening socket open foreverSean Young
This also makes the source port less predicatable.
2014-10-24timesyncd: the IP_TOS sockopt is really just an optimization, we shouldn't ↵Lennart Poettering
fail if we can't set it This partially undos 2f905e821e0342c36f5a5d3a51d53aabccc800bd
2014-10-21util: avoid duplication of TIME_T_MAXRonny Chevalier
2014-09-18timesyncd: check return of setting IP_TOSTom Gundersen
Fonud by Coverity. Fixes CID #1237534.
2014-09-02Revert "timesyncd: remove retry_timer logic which is covered by the server ↵Kay Sievers
timeout" This reverts commit 665c6a9eab46b0b253af6566ca9fc70c866b3fcd. On Tue, Sep 2, 2014 at 3:17 PM, Miroslav Lichvar <mlichvar@redhat.com> wrote: > > With the other patch allowing missed replies included it's now getting > stuck as there is no timer to send the 2nd and 3rd request.
2014-09-02timesyncd: don't reset polling interval when reselecting serverKay Sievers
Original patch from: Miroslav Lichvar <mlichvar@redhat.com>