linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* udev syntax and features
@ 2018-10-17 20:06 Greg
  2018-10-19  4:27 ` Andrei Borzenkov
  0 siblings, 1 reply; 2+ messages in thread
From: Greg @ 2018-10-17 20:06 UTC (permalink / raw)
  To: linux-hotplug

Hello all.

I have a few questions about udev.

I have tried the net for several hours/days, but much of the udev 
documentation out there is over 5 years old and I have had no lucuck 
with the following questions:

Udev. Q1. is it case sensitive? i.e. is kernel="sd?*" allowed as a 
synonym for KERNEL="sd?*"

Udev Q2. What does UDEV define as a "long running process"? Are there 
some docs or a udevadm cmd that will report udev compile time options? A 
config file that specs that? a systemd unit file that specs that?

Udev. Q3.  Would a  command like: systemctl set-environment GKH="Gregory 
the Great" qualify as long running? (it takes about 0.132 secs)

Udev Q4. Could ANY list variable that can be modded with += have TWO (or 
more) new terms added to it?

such as say SYMLINK+="/media/%k","/mnt/%k"  ?

Udev Q5. Similar to the above I would like to have 
RUN+="/path/to/Somecmd %k %n","/path/to/Someothercmd $foo" in some rule.
  is that OK?

Udev. Q6. Is RUN guaranteed to be last? so that PROGRAM will set the var 
RESULT before RUN starts its stuff?

Udev. Q7. At what point does SYSTEMD_WANTS take effect? How would I 
ensure that say my PROGRAM had set RESULT before
  the SYSTEMD_WANTS magic happened?

  Udev. Q8. IMPORT and RUN and PROGRAM all have a "type" option one of 
which is "builtin" which refers to bultin cmds.
     where do I get a list of such builtins? there is nothing in man udev.


Thank you.

Greg Morse



-- 
Sent from My Linux Mint Desktop

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: udev syntax and features
  2018-10-17 20:06 udev syntax and features Greg
@ 2018-10-19  4:27 ` Andrei Borzenkov
  0 siblings, 0 replies; 2+ messages in thread
From: Andrei Borzenkov @ 2018-10-19  4:27 UTC (permalink / raw)
  To: linux-hotplug

17.10.2018 23:06, Greg пишет:
> Hello all.
> 
> I have a few questions about udev.
> 
> I have tried the net for several hours/days, but much of the udev 
> documentation out there is over 5 years old and I have had no lucuck 
> with the following questions:
> 
> Udev. Q1. is it case sensitive? i.e. is kernel="sd?*" allowed as a 
> synonym for KERNEL="sd?*"
> 

It is case sensitive.

> Udev Q2. What does UDEV define as a "long running process"? Are
> there some docs or a udevadm cmd that will report udev compile time
> options? A config file that specs that? a systemd unit file that
> specs that?
> 

Default is 3 minutes. It can be changed with udevd argument or kernel
command line. Note that it applies only to external (non-builtin) commands.

> Udev. Q3.  Would a  command like: systemctl set-environment
> GKH="Gregory the Great" qualify as long running? (it takes about
> 0.132 secs)
> 

Should not unless connection hangs.

> Udev Q4. Could ANY list variable that can be modded with += have TWO
> (or more) new terms added to it?
> 
> such as say SYMLINK+="/media/%k","/mnt/%k"  ?
> 

As far as I know everything after "+=" is treated as single value which
gets added to list of values of this "variable". Where have you seen
example of such usage? You would need two "+=" statements with different
values. Your example would fail with invalid syntax (unknown keyword
after comma).

> Udev Q5. Similar to the above I would like to have 
> RUN+="/path/to/Somecmd %k %n","/path/to/Someothercmd $foo" in some
> rule. is that OK?
> 

See above. You need two "RUN+=" statements. Note that timeout is applied
to each individual command, not to overall execution time. At least if I
interpret code correctly.

> Udev. Q6. Is RUN guaranteed to be last? so that PROGRAM will set the
> var RESULT before RUN starts its stuff?
> 

Yes, RUN are started after all other rules have been processed. I am not
aware of formal design specification, but changing this would have quite
some compatibility impact.

> Udev. Q7. At what point does SYSTEMD_WANTS take effect? How would I 
> ensure that say my PROGRAM had set RESULT before the SYSTEMD_WANTS
> magic happened?
> 

SYSTEMD_WANTS is evaluated by systemd when it gets notified by udev
about device event. This notification is sent by udev after kernel event
processing has been completed (including after all RUN have been
executed). What follows, it should see any RESULT assignment done as
part of rules processing.

Note that you need to save RESULT in some environment variable to be
accessible.

> Udev. Q8. IMPORT and RUN and PROGRAM all have a "type" option one of 
> which is "builtin" which refers to bultin cmds. where do I get a list
> of such builtins? there is nothing in man udev.
> 

I do not think such list exists. You may want to direct your question to
systemd list where udev development happens now.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-19  4:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-17 20:06 udev syntax and features Greg
2018-10-19  4:27 ` Andrei Borzenkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).