condition: unify condition logic in one file

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
shared: create files even if the SELinux policy has no context for them

The SELinux policy defines no context for some files. E.g.:
  $ matchpathcon /run/lock/subsys /dev/mqueue
  /run/lock/subsys        <<none>>
  /dev/mqueue     <<none>>

We still need to be able to create them.
In this case selabel_lookup_raw() returns ENOENT. We should then skip
setfscreatecon(), but still return success.
It was broken since c34255bdb2 ("label: unify code to make directories,
symlinks").

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
util: simplify proc_cmdline() to reuse get_process_cmdline()

Also, make all parsing of the kernel cmdline non-fatal.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
utf8: when looking at the next unichar, honour the size parameter, in utf8_is_printable_newline()

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: use the systemd logging functions in udev tools

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
src/shared/util.{c,h}: import needed functions from upstream
udev: use properly the systemd logging functions

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: switch to systemd logging functions

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: move global property handling from libudev to udevd

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
src/udev: update the definition of udev_event_execute_rule

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
configure.ac: don't die on missing linux/btrfs.h, fixes issue #100

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: silence TOCTOU warning when creating a directory

CID#979416. There is no real race here to fix, but lets make coverity
happy and rework the code.

Note that we still fail if the directory is removed _after_ we ran
mkdir(), so the same race is still there. Coverity is complaining, though.
Rewrite the code to make it happy.

(David: rewrote the commit-message to note that this is not a race. If I'm
        wrong, blame me, not Ronny!)

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
log: unchecked return value from library

fix 1237557 Unchecked return value from library

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
set: make set_consume() actually free the allocated string if the string already is in the set

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
man: add emacs header to get correct indention in nxml-mode for the manpage XML files that use 2ch indenting

In the long run we really should figure out if we want to stick with 8ch
or 2ch indenting, and not continue with half-and-half. For now, just
make emacs aware of the files that use 2ch indenting.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
smack: introduce new SmackProcessLabel option

In service file, if the file has some of special SMACK label in
ExecStart= and systemd has no permission for the special SMACK label
then permission error will occurred. To resolve this, systemd should
be able to set its SMACK label to something accessible of ExecStart=.
So introduce new SmackProcessLabel. If label is specified with
SmackProcessLabel= then the child systemd will set its label to
that. To successfully execute the ExecStart=, accessible label should
be specified with SmackProcessLabel=.
Additionally, by SMACK policy, if the file in ExecStart= has no
SMACK64EXEC then the executed process will have given label by
SmackProcessLabel=. But if the file has SMACK64EXEC then the
SMACK64EXEC label will be overridden.

[zj: reword man page]

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
hwdb: fix a typo

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
hwdb: add a new db for the DPI/frequency settings of mice

Pointer acceleration for relative input devices (mice, trackballs, etc.)
applies to the deltas of the device. Alas, those deltas have no physical
reference point - a delta of 10 may be caused by a large movement of a
low-dpi mouse or by a minute movement of a high-dpi mouse.
Which makes pointer acceleration a bit useless and high-dpi devices
essentially unusable.

In an ideal world, we could read the DPI from the device directly and work
with that. In the world we actually live in, we need to compile this list
manually. This patch introduces the database, with the usual match formats
and a single property to be set on a device: MOUSE_DPI

That is either a single value for most mice, or a list of values for mice
that can change resolution at runtime. The exact format is detailed in the
hwdb file.

Note that we're explicitly overshooting the requirements we have for
libinput atm. Frequency could be detected in software and we don't
actually use the list of multiple resolutions (because we can't detect
when they change anyway). However, we might as well collect those values
from the get-go, adding/modifying what will eventually amount to hundreds
of entries is a bit cumbersome.

Note: we rely on the input_id builtin to tag us as mouse first, ordering
of the rules is important.

(David: fixed up typos and moved hwdb file into ./hwdb/)

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udevadm: split out find_device helper

The idea is to unify the way that devices can be specified.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udevadm trigger: allow matching by device name

This makes udevadm trigger mirror udevadm info, except that multiple
device names can be specified. Instructions in 60-keyboard.hwdb should
now actually work.

udevadm(8) is updated, but it could use a bit more polishing.

https://bugs.freedesktop.org/show_bug.cgi?id=82311

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>