]> err.no Git - systemd/commitdiff
udevd: replace --debug-trace with --children-max
authorKay Sievers <kay.sievers@vrfy.org>
Thu, 27 May 2010 15:41:51 +0000 (17:41 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Thu, 27 May 2010 15:41:51 +0000 (17:41 +0200)
udev/udevd.c
udev/udevd.xml

index 5e74f6e01332cfb8808163dbb9162482d1e484c3..189ab007a491e8da5f23cdcc9a629b509f750271 100644 (file)
@@ -69,7 +69,6 @@ static void log_fn(struct udev *udev, int priority,
        }
 }
 
-static bool debug_trace;
 static struct udev_rules *rules;
 static struct udev_queue_export *udev_queue_export;
 static struct udev_ctrl *udev_ctrl;
@@ -952,16 +951,15 @@ int main(int argc, char *argv[])
        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;
@@ -986,8 +984,8 @@ int main(int argc, char *argv[])
                case 'd':
                        daemonize = true;
                        break;
-               case 't':
-                       debug_trace = true;
+               case 'c':
+                       children_max = strtoul(optarg, NULL, 10);
                        break;
                case 'D':
                        debug = true;
@@ -1008,7 +1006,7 @@ int main(int argc, char *argv[])
                        }
                        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':
@@ -1151,7 +1149,7 @@ int main(int argc, char *argv[])
        }
 
        /* redirect std{out,err} */
-       if (!debug && !debug_trace) {
+       if (!debug) {
                dup2(fd, STDIN_FILENO);
                dup2(fd, STDOUT_FILENO);
                dup2(fd, STDERR_FILENO);
@@ -1175,23 +1173,22 @@ int main(int argc, char *argv[])
                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);
index 1f81f06535548b0b2e90e3780ff294ea1e210324..8e7755a6ff61173bda15755fda5a631522a71066 100644 (file)
@@ -23,7 +23,7 @@
     <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>