[systemd-devel] [PATCH v2] Add support for transient presets, applied on every boot.

Lennart Poettering lennart at poettering.net
Thu Jun 18 11:59:22 PDT 2015


On Mon, 15.06.15 16:37, Dimitri John Ledkov (dimitri.j.ledkov at intel.com) wrote:

> >> +
> >>  int main(int argc, char *argv[]) {
> >>          Manager *m = NULL;
> >>          int r, retval = EXIT_FAILURE;
> >> @@ -1619,6 +1636,16 @@ int main(int argc, char *argv[]) {
> >>          if (arg_running_as == SYSTEMD_SYSTEM) {
> >>                  bump_rlimit_nofile(&saved_rlimit_nofile);
> >>
> >> +                // NB! transient presets must be applied before
> >> normal
> >
> > We try to stick to /* comments */ instead of // comments....
> 
> Ok. I grew up with // comments =)

You C++ programmer, you... ;-)

> Now, remember we discussed ways to optimise the preset application
> logic. (parse and cache the policy first, and then for each unit do
> lookups in the parsed policy). Reopening that discussion, would the
> behaviour be acceptable to change slitghly:
> 
> 1) if there are no .preset policy files defined at all. Bail out,
> nothing is enabled.

We ship a preset file from upstream these days, so this case will
never really happen. It's nothing we have to optimize for, but then
again, i don't mind either way...

> 2) if there are /usr/lib/systemd/preset/*.preset. Parse and create
> policy cache, with the fall-through to "enable *" as before.

Sure, loading this into memory makes a lot of sense. You could even
turn this into the patricia tree thing, the way udev does it...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list