summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2014-01-09libudev: default log_priority to INFOTom Gundersen
This brings it in sync with the default config file. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-01-09macro: clean up usage of gcc attributesLennart Poettering
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-01-09build-sys: libudev - get rid of the needless selinux linking (again)Kay Sievers
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-01-09Never call qsort on potentially NULL arraysZbigniew Jędrzejewski-Szmek
This extends 62678ded 'efi: never call qsort on potentially NULL arrays' to all other places where qsort is used and it is not obvious that the count is non-zero. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-01-09device-nodes: move device node specific code to own fileDave Reisner
In the process, rename udev_encode_string which is poorly named for what it does. It deals specifically with encoding names that udev creates and has its own rules: utf8 is valid but some ascii is not (e.g. path separators), and everything else is simply escaped. Rename it to encode_devnode_name. Adopted for eudev: Anthony G. Basile <blueness@gentoo.org> Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-01-09move utf8 functions from libudev-private.h to utf8.hDave Reisner
There's now some more obvious overlap amongst the two utf8 validation functions, but no more than there already was previously. This also adds some menial tests for anyone who wants to do more merging of these two in the future. Adopted for eudev: Anthony G. Basile <blueness@gentoo.org> Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-10-26Merge pull request #80 from michaelforney/udevadm-symlinkblueness
src/udev/Makefile.am: Fix udevadm symlink
2013-10-25libudev-util.c: Handle -1 return from sysconf(_SC_GET{PW,GR}_R_SIZE_MAX)Michael Forney
POSIX says: Note that sysconf(_SC_GETGR_R_SIZE_MAX) may return -1 if there is no hard limit on the size of the buffer needed to store all the groups returned. The example from POSIX uses a default buffer size of 1024 in that case. Signed-off-by: Michael Forney <mforney@mforney.org>
2013-10-25libudev-util.c: Fix sysconf variable for util_lookup_groupMichael Forney
Signed-off-by: Michael Forney <mforney@mforney.org>
2013-10-25src/udev/Makefile.am: Fix udevadm symlinkMichael Forney
The symlink destination should not include DESTDIR. Signed-off-by: Michael Forney <mforney@mforney.org>
2013-09-26src/libudev/log.c: remove code to log to journalAnthony G. Basile
We remove all code which logs to the journal, preserving only write_to_console(), write_to_syslog() and write_to_kmsg(). https://github.com/gentoo/eudev/issues/77 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-09-14libudev: fix move_later comparisoneudev/v1.3Lukas Nykryn
At the beginning move_later is set to -1, but it is set to different value only if expression !move_later is true.
2013-09-10src/libudev/util.c: reintroduce cescape and octcharAnthony G. Basile
2013-09-10udev: fix printf(3) type specifierShawn Landden
src/udev/udev-rules.c: In function 'add_rule': src/udev/udev-rules.c:1078:33: warning: format '%lu' expects argument of type 'long unsigned int', but argument 8 has type 'int' [-Wformat=] log_error("invalid key/value pair in file %s on line %u," ^
2013-09-10udev: when complaining about invalid characters, print them outZbigniew Jędrzejewski-Szmek
systemd-udevd[6260]: invalid key/value pair in file /usr/lib/udev/rules.d/60-ffado.rules on line 46,starting at character 84 ('#')
2013-09-10udevd: respect the log-level set in /etc/udev/udev.confTom Gundersen
A regression introduced when we moved to systemd's logging is that the only way to adjust the log-level of the udev daemon is via the env var, kernel commandline or the commandline. This reintroduces support for specifying this in the configuration file. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-09-10udev: hwdb - try reading modalias for usb before falling back to the ↵Kay Sievers
composed one
2013-09-10libudev: enumerate - do not try to match against an empty subsystemKay Sievers
2013-09-10libudev: enumerate: fix NULL-deref for subsystem-matchesDavid Herrmann
udev_device_get_subsystem() may return NULL if no subsystem could be figured out by libudev. This might be due to OOM or if the device disconnected between the udev_device_new() call and udev_device_get_subsystem(). Therefore, we need to handle subsystem==NULL safely. Instead of testing for it in each helper, we treat subsystem==NULL as empty subsystem in match_subsystem(). Backtrace of udev_enumerate with an input-device disconnecting in exactly this time-frame: (gdb) bt #0 0x00007ffff569dc24 in strnlen () from /usr/lib/libc.so.6 #1 0x00007ffff56d9e04 in fnmatch@@GLIBC_2.2.5 () from /usr/lib/libc.so.6 #2 0x00007ffff5beb83d in match_subsystem (udev_enumerate=0x7a05f0, subsystem=0x0) at src/libudev/libudev-enumerate.c:727 #3 0x00007ffff5bebb30 in parent_add_child (enumerate=enumerate@entry=0x7a05f0, path=<optimized out>) at src/libudev/libudev-enumerate.c:834 #4 0x00007ffff5bebc3f in parent_crawl_children (enumerate=enumerate@entry=0x7a05f0, path=0x7a56b0 "/sys/devices/<shortened>/input/input97", maxdepth=maxdepth@entry=254) at src/libudev/libudev-enumerate.c:866 #5 0x00007ffff5bebc54 in parent_crawl_children (enumerate=enumerate@entry=0x7a05f0, path=0x79e8c0 "/sys/devices/<shortened>/input", maxdepth=maxdepth@entry=255) at src/libudev/libudev-enumerate.c:868 #6 0x00007ffff5bebc54 in parent_crawl_children (enumerate=enumerate@entry=0x7a05f0, path=path@entry=0x753190 "/sys/devices/<shortened>", maxdepth=maxdepth@entry=256) at src/libudev/libudev-enumerate.c:868 #7 0x00007ffff5bec7df in scan_devices_children (enumerate=0x7a05f0) at src/libudev/libudev-enumerate.c:882 #8 udev_enumerate_scan_devices (udev_enumerate=udev_enumerate@entry=0x7a05f0) at src/libudev/libudev-enumerate.c:919 #9 0x00007ffff5df8777 in <random_caller> () at some/file.c:181
2013-09-10libudev: fix memleak when enumerating childsDavid Herrmann
We need to free udev-devices again if they don't match. Funny that no-one noticed it yet since valgrind is quite verbose about it. Fix it and free non-matching devices.
2013-09-10libudev-enumerate.c:udev_enumerate_get_list_entry() fixed possible stale pointerHarald Hoyer
If a realloc() happens in syspath_add(), the move_later pointer could point to an invalid memory region. Let move_later store the array index, instead of the pointer to the entry.
2013-09-10typo fixes in man and commentsThomas Hindoe Paaboel Andersen
2013-09-10libudev: fix hwdb validation to look for the *new* fileKay Sievers
2013-09-10src/gpt-auto-generator/Makefile: move sym link introduced upstreamAnthony G. Basile
2013-09-10build-sys: add two makefile symlinksLennart Poettering
2013-08-16udev/udevadm-hwdb.c: remove usage of qsort_rrofl0r
while theoretically a nice interface, qsort_r on GLIBC was implemented with a prototype that shuffles the argument order around when compared to the traditional BSD implementations, yielding in 2 separate incompatible implementations. even worse, the arguments are all of pointer type so one would not even notice that the order is wrong and so this would yield in crashes or silent memory corruption. thus musl does not implement it, because configure scripts would check for its existance and use it unconditionally, even when assuming the BSD version. a more portable solution is to use TLS via __thread, which any modern GCC should provide. (even 3.4.6 on x86/x86_64 does so). Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-08-16libudev/sparse-endian.h: include header which defines __bswap_XXrofl0r
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-08-16fix usage of glibc-specific sys/poll.hrofl0r
sys/poll.h is a legacy alias used by glibc. according to POSIX #include <poll.h> is correct. on GLIBC, the POSIX header includes sys/poll.h, so everything continues working as it should. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-08-16libudev/log.c: using strlen without including string.h is no good idearofl0r
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-08-16libudev/path-util.c: remove usage of canonicalize_file_name()rofl0r
this is a glibc specific alias for realpath(path, NULL). to be portable, we need to use the real thing which is even less verbose. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-08-16libudev/strbuf.c: remove usage of glibc-internal __compar_fn_trofl0r
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-08-13src/udev/mkdir.c: remove usage of strndupa()rofl0r
strndupa() allocates memory using alloca() which is dangerous and non-conformant. Some libcs, like musl, deliberately do not implement it. Instead we allocate a buffer on the stack which is cleaned up on return. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-08-02util: make gcc shut up by passing a 0 mode param to open()Lennart Poettering
If we pass a variable to open()'s flags parameter it really wants a mode parameter too, otherwise some gcc version whine. Hence, pass 0 in that case.
2013-08-02src/libudev/{strv,util}.{h,c}: reorder functionsAnthony G. Basile
We reorder the functions prototypes and definitions to match upstream as in commit aa417a4d83999f6d7f092161d5c411b8cbce9977. The order was lost when that commit was revert and the functions re-introduced in later commits. Preserving the order helps to better track upstream changes when doing a diff between files. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-08-02rule-generator: proactively rename ifaces to avoid conflictsIan Stakenvicius
When a new network iface device is added, scan through the list of rules to see if its kernel-assigned name is used as a target for another device. If so, and said target device is not this device, rename it to a temporary interface name. Then rename the device in accordance with any rename rules that may apply to this device, if applicable. The temporary name assigned is the basename of the interface with a numeric compoment which is close to the inverse of the numeric id (127 - id#). This should provide a more user-friendly output than the old 'rename#' behaviour, when there is no final target name for the iface. This proactive temporary rename will prevent cases where old-style rule-generator rules are used and a target NAME= is set for one iface, assigning it to the iface name used by a second iface, and that second iface has no rename rule to apply. The original rename code would be blocked due to the conflict and time out when attempting to rename, leaving the interface assigned to the temporary 'rename[id#]' name and/or failing to rename other ifaces in accordance with the existing rules. This is a corner case that only occurrs when 75-persistent-net-generator.rules or the write_net_rules script it 'IMPORTS' fails to generate a new rule and rename the interface and there is no other interface-renaming rules that apply. There may also be performance benefits to renaming ifaces early, but no benchmarks have been run to confirm this. Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-07-31add new hexchar() callLennart Poettering
Based on systemd commit fb624d04e56018defe297eff1d88888b192caeaa , added to support commit f8e6d758cd65b28f94b62344bd95e7bab94370d4 Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-07-31add various escaping/path handling utility functionsLennart Poettering
This is a partial combination of two systemd commits: 5926cccae202f1b8869017d4bdaf9e9ce371bba6 4fe88d28a4cfa504c1f2362d4a7030fae4c4af29 ...and provides functions needed for the changes that were added in commit 6284c1ca41dca85e968e8d304cdc154c5a46d6d2 Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-07-31add various escaping/path handling utility functionsLennart Poettering
A portion of systemd commit 4fe88d28a4cfa504c1f2362d4a7030fae4c4af29 , needed to support changes made by commit 6284c1ca41dca85e968e8d304cdc154c5a46d6d2 Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-07-31Revert "static-nodes: remove creation of static nodes if HAVE_LIBKMOD"Ian Stakenvicius
This reverts commit aa417a4d83999f6d7f092161d5c411b8cbce9977. Preface: The kmod+tmpfiles static dev-node creation requires two commands to be executed at runtime -- it is not something that will automatically occur without a system's setup being explicitly designed or changed so that these commands are executed. Preface2: In order for the kmod+tmpfiles static dev-node creation to work properly, that -must- be executed at startup before {systemd-,}udevd starts. The reason for this is because udevd will only set permissions on those files at startup, and so if udevd starts beforehand then these nodes will exist with permissions that are (probably) too restrictive. The function in udevd which creates static-nodes is non-fatal and only updates mtime on the devnodes if they already exist. As such, if a system is configured to execute kmod+tmpfiles to create static-nodes, because that must occur first, eudev's udevd will not conflict. Also, if a system does not execute kmod+tmpfiles, then eudev will still create the static devnodes, even if kmod-14 or higher is installed. There *may* be a conflict if kmod+tmpfiles is executed after udevd starts, but as per "preface2" this is not a supported configuration. Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-07-31static-nodes: remove creation of static nodes if HAVE_LIBKMODAnthony G. Basile
This address upstream commit edeb68c53f1cdc452016b4c8512586a70b1262e3 and https://bugs.gentoo.org/show_bug.cgi?id=477890. If eudev is configured with --enable-libkmod then we check for kmod >= 14 and ifdef out the code removed in the upstream commit. Otherwise we retain it for modutils. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-30src/udev/udevadm-hwdb.c: rename variable to match upstreamAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-30udev: export tags of "dead" device nodes to /run/udev/static_node-tags/Anthony G. Basile
This is upstream 84b6ad702e64db534f67ce32d4dd2fec00a16784 Based on a patch by Kay Sievers. A tag is exported at boot as a symlinks to the device node in the folder /run/udev/static_node-tags/<tagname>/, if the device node exists. These tags are cleaned up by udevadm info --cleanup-db, but are otherwise never removed. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-30udev-rules: report rule parsing errors from get_keyDave Reisner
2013-07-30Bring collect.c and udevadm-hwdb.c in line with upstreamAnthony G. Basile
This brings these two files in line with upstream's commit: ef89eef77ee098a6828169a6d0d74128e236bcbd udev: fix two trivial memleaks in error path Based-on-a-patch-by: Ian Stakenvicius <axs@gentoo.org> Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-24Switch from external keymaps to internal (hwdb) keymapsIan Stakenvicius
This commit imports the new internal keyboard handling from upstream. This is a combination of many upstream commits, including those that added code, removed old code, and updated the hwdb. Some commits (hwdb ones specifically) were unrelated but brought in anyways to keep the whole hwdb consistent. Each upstream commit included is as follows: 9d7d42bc406a2ac04639674281ce3ff6beeda790 - internal keymap support 0c959b39175b126fdb70ae00de37ca6d9c8ca3a1 - hwdb: keyboard -- add file e8193554925a22b63bef0e77b8397b56d63a91ff - hwdb: keyboard -- update comments c79d894d590fc9df4861738555cc43c477e33376 - hwdb: import data aedc2eddd16e48d468e6ad0aea2caf00c7d37365 - hwdb: keyboard update 97a9313cafccf772ce03f5ebd36fe4d9d8412583 - hwdb: drop non-existant Samsung 900XC3 from keymap ddc77f62244bb41d5c8261517e2e1ff1b763fc94 - switch from udev keymaps to hwdb 0c3815773331b263713f4f7b9d80bc1ca159338e - also remove keymaps-force-release directory 1b6bce89b3383904d0dab619dd38bff673f7286e - keymap: re-add Logitech USB corded/cordless models bf89b99c5a39115112c2eda4c2103e2db54988d2 - 60-keyboard.hwdb: Fix syntax error ce39bb6909578017aa10031638e724e038f0b859 - hwdb: data update, upstream 884c86812c51479496edd50b278383d7bb67baf0 - rules: keyboard - use builtin command All code from each of the above commits is attributed to the original authors. There were some adjustments made in order to support the code differences between upstream and eudev, which was done by myself. Also of note is that the code can still be disabled via the --disable-keymaps configure option, which was removed from upstream. Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-07-11src/udev/udevadm-hwdb.c: fix double freeeudev/v1.1Anthony G. Basile
clang is stupid and I will never blindly trust it again. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-11src/udev/udev-builtin-kmod.c: fix char *const declarationAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-10Fix potential memleak and use-after-free errors as reported by clangIan Stakenvicius
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-10src/udev/udev-builtin-kmod.c: fix const char* declarationAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-10src/udev/mkdir.c: import path_startswith() from upstreamAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>