| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
It is not used currently, but will be used later.
|
| |
|
|
|
|
|
| |
It is similar to config_parse_uint32_flag(), but drops the specified flag
when true.
|
|
|
|
| |
It will be used later.
|
|
|
|
|
|
| |
This also makes all conf parsers defined in conf-parser.c return 1
on success, 0 on non-critical error.
Also, use free_and_strdup_warn() where applicable.
|
|
|
|
|
|
|
|
|
| |
- use GREEDY_REALLOC() and FOREACH_ARRAY(),
- do not set an array with only terminating 'invalid' value.
Note, this macro is only used by parsing NamePolicy= and AlternativeNamesPolicy=
in .link files. and udevd correctly handles both an empty array and an
array with only 'invalid'. Hence, this does not change any behavior.
|
|
|
|
|
| |
This makes the macros use log_syntax_parse_error(), hopefully which provides
more informative log message in general, and reduces binary size.
|
|
|
|
|
| |
The function is generic enough. Currently it is used at only one place.
But it will be used at another place.
|
|
|
|
| |
This is not used currently, but will be used later.
|
|
|
|
|
|
| |
Typically, conf parsers will ignore most errors during parsing strings
and return 0. Let's return 1 on success. Otherwise it is hard to reused
these function in another conf parser.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Update frameworks that work automatically in the background
occasionally need to schedule reboots. Systemd-logind already
provides a nice mechanism to schedule shutdowns, send notfications
and block logins short before the time. Systemd has a framework for
calendar events, so we may conveniently use logind to define a
maintenance time for reboots.
The existing ScheduleShutdown DBus method in logind expects a usec_t
with an absolute time. Passing USEC_INFINITY as magic value now tells
logind to take the time from the configured maintenance time if set.
"shutdown -r" leverages that and uses the maintenance time
automatically if configured. The one minute default is still used if
nothing was specified.
Similarly the new 'auto' setting for the --when parameter of systemctl
uses the maintenance time if configured or a one minute timer like the
shutdown command.
|
|
|
|
|
| |
Even though it is currently only used by networkd, the parser itself
is quite generic. Let's move it to the shared library.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This means the main config file is loaded also from /run and /usr.
We should load the main config file from all the places where we load drop-ins.
I realize I had a giant blind spot: I always assumed that we load config files
from /etc, /run, /usr/local/lib, /usr/lib. But it turns out that we only used
those paths for drop-ins. For the main config file, we only looked in /etc. The
docs actually partially described this behaviour, i.e. most SYNOPSIS sections
and some parts of the text, but not others.
This is strange, because 6495361c7d5e8bf640841d1292ef6cfe1ea244cf was completely
bogus with the behaviour before this patch. We had a huge discussion before it
was merged, and clearly nobody noticed this. Similarly, in the previous version
of the current pull request, we had a long discussion about the appropriate
order of directories, and apparently nobody noticed that there was no order,
because only looked in one directory. So the blind spot seems to have been
shared.
Also, systemd-analyze cat-config behaved incorrectly, i.e. its behaviour matches
the new behaviour.
Possibly, in the future it'll make it easier to add support for --root.
|
|
|
|
|
| |
Also allow config_parse_many() to be called for config files without
sections. The test uses such a file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function was partially implementing chroot lookups. It would be given
file names that were prefixed with the chroot, so it would mostly work.
But if any of those files were symlinks, fopen() would do the wrong thing.
Also we don't need locking.
So give 'root' as the argument and use chase_and_fopen_unlocked() to get
proper chroot-aware lookups.
The only place where config_parse_many() is called with root is is repart.c.
So this is a follow-up for e594a3b154bd06c535a934a1cc7231b1ef76df73 and
34f2fd5096cdb26ef57998740b1b876332d968fc.
|
|
|
|
|
|
|
|
|
|
| |
This essentially reverts 5656cdfeeabc16b5489f5ec7a0a36025a2ec1f23. I find it
much easier to understand what is going on when the
path-relative-to-the-search-path is passed in full, instead of being constructed
from two parts, with one of the parts being implicit in some places.
Also, we call 'systemd-analyze cat-config <path>' with <path> with the same
meaning, so this makes the internal and external APIs more consistent.
|
|\
| |
| | |
Allow dropins for udev.conf
|
| | |
|
|/
|
|
| |
They will be used in later commits.
|
|
|
|
| |
Prompted by #29972.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This compresses repetetive code and makes it easier to add new options
in networkd. The formatting of error messages becomes uniform. The
error message always specifies the rvalue literally, instead of using
a "descriptive name". This makes the message much easier to handle for
the user.
I opted to add just one parser, and wrap it with inline functions to proxy
the type. This is less verbose than copying functions for each type
separately, and the compiler should be able to get rid of the inline wrapper
almost entirely.
asserts are reordered to use the same order as the parameter list.
This makes the code easier to read.
No functional change intended, apart from the difference in error message
formatting.
|
| |
|
|
|
|
|
| |
Also, this also renames the function, and makes it optionally takes
a filename.
|
|
|
|
|
| |
- add assertions,
- rename argument to store result.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All daemons use a similar scheme to read their main config files and theirs
drop-ins. The main config files are always stored in /etc/systemd directory and
it's easy enough to construct the name of the drop-in directories based on the
name of the main config file.
Hence the new helper does that internally, which allows to reduce and simplify
the args passed previously to config_parse_many_nulstr().
Besides the overall code simplification it results:
16 files changed, 87 insertions(+), 159 deletions(-)
it allows to identify clearly the locations in the code where configuration
files are parsed.
|
| |
|
| |
|
|
|
|
| |
This will be used to save the list of drop-in files for each partition
|
|
|
|
|
| |
The mtime of directory is not updated when an existing rule file is
changed. Hence, paths_check_timestamp() is not reliable.
|
|
|
|
|
|
| |
drop-in configs are checked
Preparation for later commits.
|
|
|
|
| |
Fixes #23128.
|
|
|
|
| |
This makes nspawn refuse hostnames which are invalid DNS domain names.
|
|
|
|
|
| |
When the flag is set, the string which contains non-ascii characters
will be refused.
|
|
|
|
|
| |
This also makes unsafe strings escaped when logged. Otherwise,
journalctl may not show the log message unless '--all' is specified.
|
| |
|
|
|
|
|
| |
Let's rename the return parameters ret_xyz, and always initialize them
if we return >= 0, as per our current coding style.
|
|
|
|
|
|
|
|
| |
This helper is just like config_parse_string() but does some superficial
checks for control characters and quotes.
In most cases we currently use config_parse_string() we probably want to
use config_parse_safe_string() for safety reasons.
|
|
|
|
| |
And move it and relevant functions to conf-parser.[ch].
|
|
|
|
| |
Make it compatible to the ulimit setting: unlimited
|
| |
|
| |
|
|
|
|
| |
Fixes #21113.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Nominally, the bug was in unit_load_dropin(), which just took the last mtime
instead of calculating the maximum. But instead of adding code to wrap the
loop, this patch goes in the other direction.
All (correct) callers of config_parse() followed a very similar pattern to
calculate the maximum mtime. So let's simplify things by making config_parse()
assume that mtime is initialized and update it to the maximum. This makes all
the callers that care about mtime simpler and also fixes the issue in
unit_load_dropin().
config_parse_many_nulstr() and config_parse_many() are different, because it
makes sense to call them just once, and current ret_mtime behaviour make sense.
Fixes #17730, https://bugzilla.redhat.com/show_bug.cgi?id=1933137.
|
|
|
|
| |
No functional change as long as only one path is passed.
|
|
|
|
| |
Follow-up for #11484.
|
|
|
|
|
|
|
| |
Requested in
https://github.com/systemd/systemd/pull/15206#discussion_r505506657,
preserve the full granularity for memory pressure limits (permyriad)
instead of capping out at percent.
|
|\
| |
| | |
libsystemd-network: split network-internal.c
|