Home | History | Annotate | Download | only in src

Lines Matching refs:opts

115 set_conf_defaults (struct opts *opts)
121 opts->user = UNPRIV_USER;
122 opts->group = UNPRIV_GROUP;
123 opts->supp_groups = NULL;
124 opts->max_tries = MAX_TRIES;
125 opts->min_steady_state_interval = STEADY_STATE_INTERVAL;
126 opts->wait_between_tries = WAIT_BETWEEN_TRIES;
127 opts->subprocess_tries = SUBPROCESS_TRIES;
128 opts->subprocess_wait_between_tries = SUBPROCESS_WAIT_BETWEEN_TRIES;
129 opts->steady_state_interval = STEADY_STATE_INTERVAL;
130 opts->continuity_interval = CONTINUITY_INTERVAL;
131 opts->base_path = kCacheDir;
132 opts->base_argv = kDefaultArgv;
133 opts->argv = NULL;
134 opts->should_dbus = 1;
135 opts->should_sync_hwclock = DEFAULT_SYNC_HWCLOCK;
136 opts->should_load_disk = DEFAULT_LOAD_FROM_DISK;
137 opts->should_save_disk = DEFAULT_SAVE_TO_DISK;
138 opts->should_netlink = DEFAULT_USE_NETLINK;
139 opts->dry_run = DEFAULT_DRY_RUN;
140 opts->jitter = 0;
141 opts->conf_file = NULL;
142 opts->sources = NULL;
143 opts->cur_source = NULL;
144 opts->proxy = NULL;
145 opts->leap = 0;
149 parse_argv (struct opts *opts, int argc, char *argv[])
157 opts->should_sync_hwclock = 0;
160 opts->should_netlink = 0;
163 opts->should_dbus = 0;
166 opts->dry_run = 1;
169 opts->max_tries = atoi (optarg);
172 opts->wait_between_tries = atoi (optarg);
175 opts->subprocess_tries = atoi (optarg);
178 opts->subprocess_wait_between_tries = atoi (optarg);
181 opts->base_path = optarg;
184 opts->steady_state_interval = atoi (optarg);
187 opts->should_load_disk = 0;
190 opts->should_save_disk = 0;
199 opts->min_steady_state_interval = atoi (optarg);
202 opts->jitter = atoi (optarg);
205 opts->conf_file = optarg;
208 opts->proxy = optarg;
211 opts->user = optarg;
214 opts->group = optarg;
217 opts->supp_groups = optarg;
226 opts->base_argv = argv + optind;
231 void add_source_to_conf (struct opts *opts, char *host, char *port, char *proxy)
249 if (!opts->sources)
251 opts->sources = source;
256 for (s = opts->sources; s->next; s = s->next)
264 parse_source (struct opts *opts, struct conf_entry *conf)
294 add_source_to_conf (opts, host, port, proxy);
299 load_conf (struct opts *opts)
303 char *conf_file = opts->conf_file;
304 if (!opts->conf_file)
309 if (opts->conf_file)
311 pfatal ("can't open conf file '%s'", opts->conf_file);
327 opts->max_tries = atoi (e->value);
331 opts->min_steady_state_interval = atoi (e->value);
335 opts->wait_between_tries = atoi (e->value);
339 opts->subprocess_tries = atoi (e->value);
343 opts->subprocess_wait_between_tries = atoi (e->value);
347 opts->steady_state_interval = atoi (e->value);
351 opts->base_path = strdup (e->value);
352 if (!opts->base_path)
357 opts->should_sync_hwclock = e->value ? !strcmp (e->value, "yes") : 1;
361 opts->should_load_disk = e->value ? !strcmp (e->value, "yes") : 1;
365 opts->should_save_disk = e->value ? !strcmp (e->value, "yes") : 1;
369 opts->should_netlink = e->value ? !strcmp (e->value, "yes") : 1;
373 opts->dry_run = e->value ? !strcmp (e->value, "yes") : 1;
377 opts->jitter = atoi (e->value);
385 e = parse_source (opts, e);
389 opts->leap = e->value ? !strcmp (e->value, "yes") : 1;
397 struct opts *opts = &state->opts;
398 if (!opts->max_tries)
400 if (!opts->wait_between_tries)
402 if (!opts->steady_state_interval)
405 "%s/timestamp", opts->base_path);
407 fatal ("supplied base path is too long: '%s'", opts->base_path);
408 if (opts->jitter >= opts->steady_state_interval)
410 opts->jitter, opts->steady_state_interval);
488 set_conf_defaults (&state.opts);
489 parse_argv (&state.opts, argc, argv);
491 load_conf (&state.opts);
493 if (!state.opts.sources)
494 add_source_to_conf (&state.opts, DEFAULT_HOST, DEFAULT_PORT, DEFAULT_PROXY);
497 state.backoff = state.opts.wait_between_tries;
500 if (state.opts.should_sync_hwclock &&
504 state.opts.should_sync_hwclock = 0;
520 if (state.opts.should_sync_hwclock)
525 if (state.opts.supp_groups)
526 supp_groups = parse_supp_groups (state.opts.supp_groups);
527 drop_privs_to (state.opts.user, state.opts.group, supp_groups);
530 if (state.opts.should_save_disk)
539 if (state.opts.should_dbus && init_dbus (&state))
574 if (state.opts.should_load_disk)