}
}
-static bool debug_trace;
static struct udev_rules *rules;
static struct udev_queue_export *udev_queue_export;
static struct udev_ctrl *udev_ctrl;
int fd;
FILE *f;
sigset_t mask;
- const char *value;
int daemonize = false;
int resolve_names = 1;
static const struct option options[] = {
{ "daemon", no_argument, NULL, 'd' },
- { "debug-trace", no_argument, NULL, 't' },
{ "debug", no_argument, NULL, 'D' },
+ { "children-max", required_argument, NULL, 'c' },
+ { "resolve-names", required_argument, NULL, 'N' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
- { "resolve-names", required_argument, NULL, 'N' },
{}
};
int rc = 1;
case 'd':
daemonize = true;
break;
- case 't':
- debug_trace = true;
+ case 'c':
+ children_max = strtoul(optarg, NULL, 10);
break;
case 'D':
debug = true;
}
break;
case 'h':
- printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] "
+ printf("Usage: udevd [--help] [--daemon] [--children-max] [--debug] "
"[--resolve-names=early|late|never] [--version]\n");
goto exit;
case 'V':
}
/* redirect std{out,err} */
- if (!debug && !debug_trace) {
+ if (!debug) {
dup2(fd, STDIN_FILENO);
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
close(fd);
}
- /* in trace mode run one event after the other */
- if (debug_trace) {
- children_max = 1;
- } else {
- int memsize = mem_size_mb();
+ if (children_max <= 0) {
+ const char *value = getenv("UDEVD_CHILDREN_MAX");
- if (memsize > 0)
- children_max = 128 + (memsize / 8);
- else
- children_max = 128;
- }
+ if (value) {
+ children_max = strtoul(value, NULL, 10);
+ } else {
+ int memsize = mem_size_mb();
- /* possibly overwrite maximum limit of executed events */
- value = getenv("UDEVD_MAX_CHILDREN");
- if (value)
- children_max = strtoul(value, NULL, 10);
- info(udev, "initialize children_max to %u\n", children_max);
+ /* set value depending on the amount of RAM */
+ if (memsize > 0)
+ children_max = 128 + (memsize / 8);
+ else
+ children_max = 128;
+ }
+ }
+ info(udev, "set children_max to %u\n", children_max);
static_dev_create(udev);
static_dev_create_from_modules(udev);
<cmdsynopsis>
<command>udevd</command>
<arg><option>--daemon</option></arg>
- <arg><option>--debug-trace</option></arg>
+ <arg><option>--children-max</option></arg>
<arg><option>--debug</option></arg>
<arg><option>--version</option></arg>
<arg><option>--resolve-names=early|late|never</option></arg>
</listitem>
</varlistentry>
<varlistentry>
- <term><option>--debug-trace</option></term>
+ <term><option>--children-max</option></term>
<listitem>
- <para>Run all events completely serialized. This may be useful if udev triggers
- actions or loads kernel modules which cause problems and a slow but continuous
- operation is needed, where no events are processed in parallel.
+ <para>Limit the number of parallel executed events.
</para>
</listitem>
</varlistentry>