]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/udev.xml
test-hostname-util: add assert_se's to make coverity happy
[thirdparty/systemd.git] / man / udev.xml
1 <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 SPDX-License-Identifier: LGPL-2.1+
7
8 This file is part of systemd.
9
10 Copyright 2012 Kay Sievers
11 Copyright 2014 Jason St. John
12
13 systemd is free software; you can redistribute it and/or modify it
14 under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation; either version 2.1 of the License, or
16 (at your option) any later version.
17
18 systemd is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public License
24 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 -->
26
27 <refentry id="udev">
28 <refentryinfo>
29 <title>udev</title>
30 <productname>systemd</productname>
31 <authorgroup>
32 <author>
33 <contrib>Developer</contrib>
34 <firstname>Greg</firstname>
35 <surname>Kroah-Hartmann</surname>
36 <email>greg@kroah.com</email>
37 </author>
38 <author>
39 <contrib>Developer</contrib>
40 <firstname>Kay</firstname>
41 <surname>Sievers</surname>
42 <email>kay@vrfy.org</email>
43 </author>
44 </authorgroup>
45 </refentryinfo>
46
47 <refmeta>
48 <refentrytitle>udev</refentrytitle>
49 <manvolnum>7</manvolnum>
50 </refmeta>
51
52 <refnamediv>
53 <refname>udev</refname>
54 <refpurpose>Dynamic device management</refpurpose>
55 </refnamediv>
56
57 <refsect1><title>Description</title>
58 <para>udev supplies the system software with device events, manages permissions
59 of device nodes and may create additional symlinks in the <filename>/dev</filename>
60 directory, or renames network interfaces. The kernel usually just assigns unpredictable
61 device names based on the order of discovery. Meaningful symlinks or network device
62 names provide a way to reliably identify devices based on their properties or
63 current configuration.</para>
64
65 <para>The udev daemon, <citerefentry><refentrytitle>systemd-udevd.service</refentrytitle>
66 <manvolnum>8</manvolnum></citerefentry>, receives device uevents directly from
67 the kernel whenever a device is added or removed from the system, or it changes its
68 state. When udev receives a device event, it matches its configured set of rules
69 against various device attributes to identify the device. Rules that match may
70 provide additional device information to be stored in the udev database or
71 to be used to create meaningful symlink names.</para>
72
73 <para>All device information udev processes is stored in the udev database and
74 sent out to possible event subscribers. Access to all stored data and the event
75 sources is provided by the library libudev.</para>
76 </refsect1>
77
78 <refsect1><title>Rules Files</title>
79 <para>The udev rules are read from the files located in the
80 system rules directory <filename>/usr/lib/udev/rules.d</filename>,
81 the volatile runtime directory <filename>/run/udev/rules.d</filename>
82 and the local administration directory <filename>/etc/udev/rules.d</filename>.
83 All rules files are collectively sorted and processed in lexical order,
84 regardless of the directories in which they live. However, files with
85 identical filenames replace each other. Files in <filename>/etc</filename>
86 have the highest priority, files in <filename>/run</filename> take precedence
87 over files with the same name in <filename>/usr/lib</filename>. This can be
88 used to override a system-supplied rules file with a local file if needed;
89 a symlink in <filename>/etc</filename> with the same name as a rules file in
90 <filename>/usr/lib</filename>, pointing to <filename>/dev/null</filename>,
91 disables the rules file entirely. Rule files must have the extension
92 <filename>.rules</filename>; other extensions are ignored.</para>
93
94 <para>Every line in the rules file contains at least one key-value pair.
95 Except for empty lines or lines beginning with <literal>#</literal>, which are ignored.
96 There are two kinds of keys: match and assignment.
97 If all match keys match against their values, the rule gets applied and the
98 assignment keys get the specified values assigned.</para>
99
100 <para>A matching rule may rename a network interface, add symlinks
101 pointing to the device node, or run a specified program as part of
102 the event handling.</para>
103
104 <para>A rule consists of a comma-separated list of one or more key-value pairs.
105 Each key has a distinct operation, depending on the used operator. Valid
106 operators are:</para>
107 <variablelist>
108 <varlistentry>
109 <term><literal>==</literal></term>
110 <listitem>
111 <para>Compare for equality.</para>
112 </listitem>
113 </varlistentry>
114
115 <varlistentry>
116 <term><literal>!=</literal></term>
117 <listitem>
118 <para>Compare for inequality.</para>
119 </listitem>
120 </varlistentry>
121
122 <varlistentry>
123 <term><literal>=</literal></term>
124 <listitem>
125 <para>Assign a value to a key. Keys that represent a list are reset
126 and only this single value is assigned.</para>
127 </listitem>
128 </varlistentry>
129
130 <varlistentry>
131 <term><literal>+=</literal></term>
132 <listitem>
133 <para>Add the value to a key that holds a list of entries.</para>
134 </listitem>
135 </varlistentry>
136
137 <varlistentry>
138 <term><literal>-=</literal></term>
139 <listitem>
140 <para>Remove the value from a key that holds a list of entries.</para>
141 </listitem>
142 </varlistentry>
143
144 <varlistentry>
145 <term><literal>:=</literal></term>
146 <listitem>
147 <para>Assign a value to a key finally; disallow any later changes.</para>
148 </listitem>
149 </varlistentry>
150 </variablelist>
151
152 <para>The following key names can be used to match against device properties.
153 Some of the keys also match against properties of the parent devices in sysfs,
154 not only the device that has generated the event. If multiple keys that match
155 a parent device are specified in a single rule, all these keys must match at
156 one and the same parent device.</para>
157 <variablelist class='udev-directives'>
158 <varlistentry>
159 <term><varname>ACTION</varname></term>
160 <listitem>
161 <para>Match the name of the event action.</para>
162 </listitem>
163 </varlistentry>
164
165 <varlistentry>
166 <term><varname>DEVPATH</varname></term>
167 <listitem>
168 <para>Match the devpath of the event device.</para>
169 </listitem>
170 </varlistentry>
171
172 <varlistentry>
173 <term><varname>KERNEL</varname></term>
174 <listitem>
175 <para>Match the name of the event device.</para>
176 </listitem>
177 </varlistentry>
178
179 <varlistentry>
180 <term><varname>NAME</varname></term>
181 <listitem>
182 <para>Match the name of a network interface. It can be used once the
183 NAME key has been set in one of the preceding rules.</para>
184 </listitem>
185 </varlistentry>
186
187 <varlistentry>
188 <term><varname>SYMLINK</varname></term>
189 <listitem>
190 <para>Match the name of a symlink targeting the node. It can
191 be used once a SYMLINK key has been set in one of the preceding
192 rules. There may be multiple symlinks; only one needs to match.
193 </para>
194 </listitem>
195 </varlistentry>
196
197 <varlistentry>
198 <term><varname>SUBSYSTEM</varname></term>
199 <listitem>
200 <para>Match the subsystem of the event device.</para>
201 </listitem>
202 </varlistentry>
203 <varlistentry>
204 <term><varname>DRIVER</varname></term>
205 <listitem>
206 <para>Match the driver name of the event device. Only set this key for devices
207 which are bound to a driver at the time the event is generated.</para>
208 </listitem>
209 </varlistentry>
210 <varlistentry>
211 <term><varname>ATTR{<replaceable>filename</replaceable>}</varname></term>
212 <listitem>
213 <para>Match sysfs attribute values of the event device. Trailing
214 whitespace in the attribute values is ignored unless the specified match
215 value itself contains trailing whitespace.
216 </para>
217 </listitem>
218 <term><varname>SYSCTL{<replaceable>kernel parameter</replaceable>}</varname></term>
219 <listitem>
220 <para>Match a kernel parameter value.
221 </para>
222 </listitem>
223 </varlistentry>
224
225 <varlistentry>
226 <term><varname>KERNELS</varname></term>
227 <listitem>
228 <para>Search the devpath upwards for a matching device name.</para>
229 </listitem>
230 </varlistentry>
231
232 <varlistentry>
233 <term><varname>SUBSYSTEMS</varname></term>
234 <listitem>
235 <para>Search the devpath upwards for a matching device subsystem name.</para>
236 </listitem>
237 </varlistentry>
238
239 <varlistentry>
240 <term><varname>DRIVERS</varname></term>
241 <listitem>
242 <para>Search the devpath upwards for a matching device driver name.</para>
243 </listitem>
244 </varlistentry>
245
246 <varlistentry>
247 <term><varname>ATTRS{<replaceable>filename</replaceable>}</varname></term>
248 <listitem>
249 <para>Search the devpath upwards for a device with matching sysfs attribute values.
250 If multiple <varname>ATTRS</varname> matches are specified, all of them
251 must match on the same device. Trailing whitespace in the attribute values is ignored
252 unless the specified match value itself contains trailing whitespace.</para>
253 </listitem>
254 </varlistentry>
255
256 <varlistentry>
257 <term><varname>TAGS</varname></term>
258 <listitem>
259 <para>Search the devpath upwards for a device with matching tag.</para>
260 </listitem>
261 </varlistentry>
262
263 <varlistentry>
264 <term><varname>ENV{<replaceable>key</replaceable>}</varname></term>
265 <listitem>
266 <para>Match against a device property value.</para>
267 </listitem>
268 </varlistentry>
269
270 <varlistentry>
271 <term><varname>TAG</varname></term>
272 <listitem>
273 <para>Match against a device tag.</para>
274 </listitem>
275 </varlistentry>
276
277 <varlistentry>
278 <term><varname>TEST{<replaceable>octal mode mask</replaceable>}</varname></term>
279 <listitem>
280 <para>Test the existence of a file. An octal mode mask can be specified
281 if needed.</para>
282 </listitem>
283 </varlistentry>
284
285 <varlistentry>
286 <term><varname>PROGRAM</varname></term>
287 <listitem>
288 <para>Execute a program to determine whether there
289 is a match; the key is true if the program returns
290 successfully. The device properties are made available to the
291 executed program in the environment. The program's standard output
292 is available in the <varname>RESULT</varname> key.</para>
293 <para>This can only be used for very short-running foreground tasks. For details,
294 see <varname>RUN</varname>.</para>
295 </listitem>
296 </varlistentry>
297
298 <varlistentry>
299 <term><varname>RESULT</varname></term>
300 <listitem>
301 <para>Match the returned string of the last <varname>PROGRAM</varname> call.
302 This key can be used in the same or in any later rule after a
303 <varname>PROGRAM</varname> call.</para>
304 </listitem>
305 </varlistentry>
306 </variablelist>
307
308 <para>Most of the fields support shell glob pattern matching and
309 alternate patterns. The following special characters are supported:</para>
310 <variablelist>
311 <varlistentry>
312 <term><literal>*</literal></term>
313 <listitem>
314 <para>Matches zero or more characters.</para>
315 </listitem>
316 </varlistentry>
317 <varlistentry>
318 <term><literal>?</literal></term>
319 <listitem>
320 <para>Matches any single character.</para>
321 </listitem>
322 </varlistentry>
323 <varlistentry>
324 <term><literal>[]</literal></term>
325 <listitem>
326 <para>Matches any single character specified within the brackets. For
327 example, the pattern string <literal>tty[SR]</literal>
328 would match either <literal>ttyS</literal> or <literal>ttyR</literal>.
329 Ranges are also supported via the <literal>-</literal> character.
330 For example, to match on the range of all digits, the pattern
331 <literal>[0-9]</literal> could be used. If the first character
332 following the <literal>[</literal> is a <literal>!</literal>,
333 any characters not enclosed are matched.</para>
334 </listitem>
335 </varlistentry>
336 <varlistentry>
337 <term><literal>|</literal></term>
338 <listitem>
339 <para>Separates alternative patterns. For example, the pattern string
340 <literal>abc|x*</literal> would match either <literal>abc</literal>
341 or <literal>x*</literal>.</para>
342 </listitem>
343 </varlistentry>
344 </variablelist>
345
346 <para>The following keys can get values assigned:</para>
347 <variablelist class='udev-directives'>
348 <varlistentry>
349 <term><varname>NAME</varname></term>
350 <listitem>
351 <para>The name to use for a network interface. See
352 <citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>
353 for a higher-level mechanism for setting the interface name.
354 The name of a device node cannot be changed by udev, only additional
355 symlinks can be created.</para>
356 </listitem>
357 </varlistentry>
358
359 <varlistentry>
360 <term><varname>SYMLINK</varname></term>
361 <listitem>
362 <para>The name of a symlink targeting the node. Every matching rule adds
363 this value to the list of symlinks to be created.</para>
364 <para>The set of characters to name a symlink is limited. Allowed
365 characters are <literal>0-9A-Za-z#+-.:=@_/</literal>, valid UTF-8 character
366 sequences, and <literal>\x00</literal> hex encoding. All other
367 characters are replaced by a <literal>_</literal> character.</para>
368 <para>Multiple symlinks may be specified by separating the names by the
369 space character. In case multiple devices claim the same name, the link
370 always points to the device with the highest link_priority. If the current
371 device goes away, the links are re-evaluated and the device with the
372 next highest link_priority becomes the owner of the link. If no
373 link_priority is specified, the order of the devices (and which one of
374 them owns the link) is undefined.</para>
375 <para>Symlink names must never conflict with the kernel's default device
376 node names, as that would result in unpredictable behavior.
377 </para>
378 </listitem>
379 </varlistentry>
380
381 <varlistentry>
382 <term><varname>OWNER</varname>, <varname>GROUP</varname>, <varname>MODE</varname></term>
383 <listitem>
384 <para>The permissions for the device node. Every specified value overrides
385 the compiled-in default value.</para>
386 </listitem>
387 </varlistentry>
388
389 <varlistentry>
390 <term><varname>SECLABEL{<replaceable>module</replaceable>}</varname></term>
391 <listitem>
392 <para>Applies the specified Linux Security Module label to the device node.</para>
393 </listitem>
394 </varlistentry>
395
396 <varlistentry>
397 <term><varname>ATTR{<replaceable>key</replaceable>}</varname></term>
398 <listitem>
399 <para>The value that should be written to a sysfs attribute of the
400 event device.</para>
401 </listitem>
402 </varlistentry>
403
404 <varlistentry>
405 <term><varname>SYSCTL{<replaceable>kernel parameter</replaceable>}</varname></term>
406 <listitem>
407 <para>The value that should be written to kernel parameter.</para>
408 </listitem>
409 </varlistentry>
410
411 <varlistentry>
412 <term><varname>ENV{<replaceable>key</replaceable>}</varname></term>
413 <listitem>
414 <para>Set a device property value. Property names with a leading <literal>.</literal>
415 are neither stored in the database nor exported to events or
416 external tools (run by, for example, the <varname>PROGRAM</varname>
417 match key).</para>
418 </listitem>
419 </varlistentry>
420
421 <varlistentry>
422 <term><varname>TAG</varname></term>
423 <listitem>
424 <para>Attach a tag to a device. This is used to filter events for users
425 of libudev's monitor functionality, or to enumerate a group of tagged
426 devices. The implementation can only work efficiently if only a few
427 tags are attached to a device. It is only meant to be used in
428 contexts with specific device filter requirements, and not as a
429 general-purpose flag. Excessive use might result in inefficient event
430 handling.</para>
431 </listitem>
432 </varlistentry>
433
434 <varlistentry>
435 <term><varname>RUN{<replaceable>type</replaceable>}</varname></term>
436 <listitem>
437 <para>Add a program to the list of programs to be executed after
438 processing all the rules for a specific event, depending on
439 <literal>type</literal>:</para>
440 <variablelist>
441 <varlistentry>
442 <term><literal>program</literal></term>
443 <listitem>
444 <para>Execute an external program specified as the assigned
445 value. If no absolute path is given, the program is expected
446 to live in <filename>/usr/lib/udev</filename>; otherwise, the
447 absolute path must be specified.</para>
448 <para>This is the default if no <replaceable>type</replaceable>
449 is specified.</para>
450 </listitem>
451 </varlistentry>
452 <varlistentry>
453 <term><literal>builtin</literal></term>
454 <listitem>
455 <para>As <varname>program</varname>, but use one of the
456 built-in programs rather than an external one.</para>
457 </listitem>
458 </varlistentry>
459 </variablelist>
460 <para>The program name and following arguments are separated by spaces.
461 Single quotes can be used to specify arguments with spaces.</para>
462 <para>This can only be used for very short-running foreground tasks. Running an
463 event process for a long period of time may block all further events for
464 this or a dependent device.</para>
465 <para>Starting daemons or other long-running processes is not appropriate
466 for udev; the forked processes, detached or not, will be unconditionally
467 killed after the event handling has finished.</para>
468 </listitem>
469 </varlistentry>
470
471 <varlistentry>
472 <term><varname>LABEL</varname></term>
473 <listitem>
474 <para>A named label to which a <varname>GOTO</varname> may jump.</para>
475 </listitem>
476 </varlistentry>
477
478 <varlistentry>
479 <term><varname>GOTO</varname></term>
480 <listitem>
481 <para>Jumps to the next <varname>LABEL</varname> with a matching name.</para>
482 </listitem>
483 </varlistentry>
484
485 <varlistentry>
486 <term><varname>IMPORT{<replaceable>type</replaceable>}</varname></term>
487 <listitem>
488 <para>Import a set of variables as device properties,
489 depending on <literal>type</literal>:</para>
490 <variablelist>
491 <varlistentry>
492 <term><literal>program</literal></term>
493 <listitem>
494 <para>Execute an external program specified as the assigned
495 value and, if it returns successfully,
496 import its output, which must be in environment key
497 format. Path specification, command/argument separation,
498 and quoting work like in <varname>RUN</varname>.</para>
499 </listitem>
500 </varlistentry>
501 <varlistentry>
502 <term><literal>builtin</literal></term>
503 <listitem>
504 <para>Similar to <literal>program</literal>, but use one of the
505 built-in programs rather than an external one.</para>
506 </listitem>
507 </varlistentry>
508 <varlistentry>
509 <term><literal>file</literal></term>
510 <listitem>
511 <para>Import a text file specified as the assigned value, the content
512 of which must be in environment key format.</para>
513 </listitem>
514 </varlistentry>
515 <varlistentry>
516 <term><literal>db</literal></term>
517 <listitem>
518 <para>Import a single property specified as the assigned value from the
519 current device database. This works only if the database is already populated
520 by an earlier event.</para>
521 </listitem>
522 </varlistentry>
523 <varlistentry>
524 <term><literal>cmdline</literal></term>
525 <listitem>
526 <para>Import a single property from the kernel command line. For simple flags
527 the value of the property is set to <literal>1</literal>.</para>
528 </listitem>
529 </varlistentry>
530 <varlistentry>
531 <term><literal>parent</literal></term>
532 <listitem>
533 <para>Import the stored keys from the parent device by reading
534 the database entry of the parent device. The value assigned to
535 <option>IMPORT{parent}</option> is used as a filter of key names
536 to import (with the same shell glob pattern matching used for
537 comparisons).</para>
538 </listitem>
539 </varlistentry>
540 </variablelist>
541 <para>This can only be used for very short-running foreground tasks. For details
542 see <option>RUN</option>.</para>
543 </listitem>
544 </varlistentry>
545
546 <varlistentry>
547 <term><varname>OPTIONS</varname></term>
548 <listitem>
549 <para>Rule and device options:</para>
550 <variablelist class='udev-directives'>
551 <varlistentry>
552 <term><option>link_priority=<replaceable>value</replaceable></option></term>
553 <listitem>
554 <para>Specify the priority of the created symlinks. Devices with higher
555 priorities overwrite existing symlinks of other devices. The default is 0.</para>
556 </listitem>
557 </varlistentry>
558 <varlistentry>
559 <term><option>string_escape=<replaceable>none|replace</replaceable></option></term>
560 <listitem>
561 <para>Usually, control and other possibly unsafe characters are replaced
562 in strings used for device naming. The mode of replacement can be specified
563 with this option.</para>
564 </listitem>
565 </varlistentry>
566 <varlistentry>
567 <term><option>static_node=</option></term>
568 <listitem>
569 <para>Apply the permissions specified in this rule to the
570 static device node with the specified name. Also, for every
571 tag specified in this rule, create a symlink
572 in the directory
573 <filename>/run/udev/static_node-tags/<replaceable>tag</replaceable></filename>
574 pointing at the static device node with the specified name.
575 Static device node creation is performed by systemd-tmpfiles
576 before systemd-udevd is started. The static nodes might not
577 have a corresponding kernel device; they are used to trigger
578 automatic kernel module loading when they are accessed.</para>
579 </listitem>
580 </varlistentry>
581 <varlistentry>
582 <term><option>watch</option></term>
583 <listitem>
584 <para>Watch the device node with inotify; when the node is
585 closed after being opened for writing, a change uevent is
586 synthesized.</para>
587 </listitem>
588 </varlistentry>
589 <varlistentry>
590 <term><option>nowatch</option></term>
591 <listitem>
592 <para>Disable the watching of a device node with inotify.</para>
593 </listitem>
594 </varlistentry>
595 </variablelist>
596 </listitem>
597 </varlistentry>
598 </variablelist>
599
600 <para>The <varname>NAME</varname>, <varname>SYMLINK</varname>,
601 <varname>PROGRAM</varname>, <varname>OWNER</varname>,
602 <varname>GROUP</varname>, <varname>MODE</varname>, <varname>SECLABEL</varname>,
603 and <varname>RUN</varname> fields support simple string substitutions.
604 The <varname>RUN</varname> substitutions are performed after all rules
605 have been processed, right before the program is executed, allowing for
606 the use of device properties set by earlier matching rules. For all other
607 fields, substitutions are performed while the individual rule is being
608 processed. The available substitutions are:</para>
609 <variablelist class='udev-directives'>
610 <varlistentry>
611 <term><option>$kernel</option>, <option>%k</option></term>
612 <listitem>
613 <para>The kernel name for this device.</para>
614 </listitem>
615 </varlistentry>
616
617 <varlistentry>
618 <term><option>$number</option>, <option>%n</option></term>
619 <listitem>
620 <para>The kernel number for this device. For example,
621 <literal>sda3</literal> has kernel number <literal>3</literal>.
622 </para>
623 </listitem>
624 </varlistentry>
625
626 <varlistentry>
627 <term><option>$devpath</option>, <option>%p</option></term>
628 <listitem>
629 <para>The devpath of the device.</para>
630 </listitem>
631 </varlistentry>
632
633 <varlistentry>
634 <term><option>$id</option>, <option>%b</option></term>
635 <listitem>
636 <para>The name of the device matched while searching the devpath
637 upwards for <option>SUBSYSTEMS</option>, <option>KERNELS</option>,
638 <option>DRIVERS</option>, and <option>ATTRS</option>.
639 </para>
640 </listitem>
641 </varlistentry>
642
643 <varlistentry>
644 <term><option>$driver</option></term>
645 <listitem>
646 <para>The driver name of the device matched while searching the
647 devpath upwards for <option>SUBSYSTEMS</option>,
648 <option>KERNELS</option>, <option>DRIVERS</option>, and
649 <option>ATTRS</option>.
650 </para>
651 </listitem>
652 </varlistentry>
653
654 <varlistentry>
655 <term><option>$attr{<replaceable>file</replaceable>}</option>, <option>%s{<replaceable>file</replaceable>}</option></term>
656 <listitem>
657 <para>The value of a sysfs attribute found at the device where
658 all keys of the rule have matched. If the matching device does not
659 have such an attribute, and a previous <option>KERNELS</option>,
660 <option>SUBSYSTEMS</option>, <option>DRIVERS</option>, or
661 <option>ATTRS</option> test selected a parent device, then the
662 attribute from that parent device is used.
663 </para>
664 <para>If the attribute is a symlink, the last element of the
665 symlink target is returned as the value.
666 </para>
667 </listitem>
668 </varlistentry>
669
670 <varlistentry>
671 <term><option>$env{<replaceable>key</replaceable>}</option>, <option>%E{<replaceable>key</replaceable>}</option></term>
672 <listitem>
673 <para>A device property value.</para>
674 </listitem>
675 </varlistentry>
676
677 <varlistentry>
678 <term><option>$major</option>, <option>%M</option></term>
679 <listitem>
680 <para>The kernel major number for the device.</para>
681 </listitem>
682 </varlistentry>
683
684 <varlistentry>
685 <term><option>$minor</option>, <option>%m</option></term>
686 <listitem>
687 <para>The kernel minor number for the device.</para>
688 </listitem>
689 </varlistentry>
690
691 <varlistentry>
692 <term><option>$result</option>, <option>%c</option></term>
693 <listitem>
694 <para>The string returned by the external program requested with
695 <varname>PROGRAM</varname>.
696 A single part of the string, separated by a space character, may be selected
697 by specifying the part number as an attribute: <literal>%c{N}</literal>.
698 If the number is followed by the <literal>+</literal> character, this part plus all remaining parts
699 of the result string are substituted: <literal>%c{N+}</literal>.</para>
700 </listitem>
701 </varlistentry>
702
703 <varlistentry>
704 <term><option>$parent</option>, <option>%P</option></term>
705 <listitem>
706 <para>The node name of the parent device.</para>
707 </listitem>
708 </varlistentry>
709
710 <varlistentry>
711 <term><option>$name</option></term>
712 <listitem>
713 <para>The current name of the device. If not changed by a rule, it is the
714 name of the kernel device.</para>
715 </listitem>
716 </varlistentry>
717
718 <varlistentry>
719 <term><option>$links</option></term>
720 <listitem>
721 <para>A space-separated list of the current symlinks. The value is
722 only set during a remove event or if an earlier rule assigned a value.</para>
723 </listitem>
724 </varlistentry>
725
726 <varlistentry>
727 <term><option>$root</option>, <option>%r</option></term>
728 <listitem>
729 <para>The udev_root value.</para>
730 </listitem>
731 </varlistentry>
732
733 <varlistentry>
734 <term><option>$sys</option>, <option>%S</option></term>
735 <listitem>
736 <para>The sysfs mount point.</para>
737 </listitem>
738 </varlistentry>
739
740 <varlistentry>
741 <term><option>$devnode</option>, <option>%N</option></term>
742 <listitem>
743 <para>The name of the device node.</para>
744 </listitem>
745 </varlistentry>
746
747 <varlistentry>
748 <term><option>%%</option></term>
749 <listitem>
750 <para>The <literal>%</literal> character itself.</para>
751 </listitem>
752 </varlistentry>
753
754 <varlistentry>
755 <term><option>$$</option></term>
756 <listitem>
757 <para>The <literal>$</literal> character itself.</para>
758 </listitem>
759 </varlistentry>
760 </variablelist>
761 </refsect1>
762
763 <refsect1>
764 <title>See Also</title>
765 <para>
766 <citerefentry>
767 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
768 </citerefentry>,
769 <citerefentry>
770 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
771 </citerefentry>,
772 <citerefentry>
773 <refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum>
774 </citerefentry>
775 </para>
776 </refsect1>
777 </refentry>