[systemd-devel] [PATCH 3/3] WIP: service: add StartLimitInterval/StartLimitBurst/StartLimitAction

Lennart Poettering lennart at poettering.net
Tue Feb 7 06:39:34 PST 2012


On Fri, 03.02.12 21:14, Michael Olbrich (m.olbrich at pengutronix.de) wrote:

> +        s->start_limit_interval = 10*USEC_PER_SEC;
> +        s->start_limit_burst = 5;
> +

Just use RATELIMIT_INIT() here, as previously.

>          s->timer_watch.type = WATCH_INVALID;
>  #ifdef HAVE_SYSV_COMPAT
>          s->sysv_start_priority = -1;
> @@ -125,7 +128,8 @@ static void service_init(Unit *u) {
>  
>          exec_context_init(&s->exec_context);
>  
> -        RATELIMIT_INIT(s->ratelimit, 10*USEC_PER_SEC, 5);
> +        /* FIXME: when are the .service file values available? */
> +        RATELIMIT_INIT(s->ratelimit, s->start_limit_interval,
> s->start_limit_burst);

The logic here is that _init() is called immediately after malloc()ing
the Service object. It should just do constant initialization of
everything where just initialization to 0 is not good enough.

Then, later on the actual configuration is applied to the Service
object, overriding these static defaults, directly via the calls in
load-fragment.c. In fact, you should just modify load-fragment.c to
directly modify the ratelimit struct here, there's no need to
duplicate the variables in it. RateLimit is not an opaque struct.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list