Commit graph

85 commits

Author SHA1 Message Date
Lennart Poettering a38d99451f Revert "tree-wide: Always use recvmsg with MSG_CMSG_CLOEXEC"
This reverts commit d6d810fbf8.

It's apparently not OK to pass MSG_CMSG_CLOEXEC to recvmsg() of raw
sockets.
2015-02-12 11:45:39 +01:00
Cristian Rodríguez d6d810fbf8 tree-wide: Always use recvmsg with MSG_CMSG_CLOEXEC 2015-02-10 21:20:16 +01:00
Tom Gundersen 2df959ec3b libudev: monitor - move nulstr parsing to libudev-device
Hide the details a bit.
2015-01-26 14:45:12 +01:00
Zbigniew Jędrzejewski-Szmek 1fa2f38f0f Assorted format fixes
Types used for pids and uids in various interfaces are unpredictable.
Too bad.
2015-01-22 01:14:52 -05:00
Zbigniew Jędrzejewski-Szmek 2695c5c44e Add initialization helper for file_handle_union 2015-01-18 19:06:48 -05:00
Topi Miettinen 9c89c1cabd libudev: fix check for too long packet
Don't use recvmsg(2) return value to check for too long packets
(it doesn't work) but MSG_TRUNC flag.

(David: add parantheses around condition)
2015-01-18 23:31:11 +01:00
Shawn Paul Landden bf3dd6b1a7 libudev: fix strict aliasing violation 2014-12-25 10:55:41 -05:00
Michal Schmidt 56f64d9576 treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.

Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'

Plus some whitespace, linewrap, and indent adjustments.
2014-11-28 19:49:27 +01:00
Michal Schmidt ff49bc3212 treewide: drop unnecessary trailing \n in log_*() calls 2014-11-28 14:26:31 +01:00
Kay Sievers 25e773eeb4 udev: switch to systemd logging functions 2014-11-13 13:12:57 +01:00
Kay Sievers a974cacd9a libudev: we do not log errors from libraries 2014-11-13 11:42:24 +01:00
Tom Gundersen 9dedfe7f66 libudev: monitor - warn if we fail to request SO_PASSCRED
The function still succeeds, so there is no functional change. This fixes CID #996288.
2014-09-18 13:48:44 +02:00
Zbigniew Jędrzejewski-Szmek e6c474723d udev: warn when name_to_handle_at is not implemented
We have a bunch of reports from people who have a custom kernel and
are confused why udev is not running. Issue a warning on
error. Barring an error in the code, the only error that is possible
is ENOSYS.

https://bugzilla.redhat.com/show_bug.cgi?id=1072966
2014-04-24 19:21:51 -04:00
Lennart Poettering 21749924e1 util: make sure all our name_to_handle_at() code makes use of file_handle_union 2014-04-24 08:12:20 +02:00
Dave Reisner 370c860f74 implement a union to pad out file_handle
Cases where name_to_handle_at is used allocated the full struct to be
MAX_HANDLE_SZ, and assigned this size to handle_bytes. This is wrong
since handle_bytes should describe the length of the flexible array
member and not the whole struct.

Define a union type which includes sufficient padding to allow
assignment of MAX_HANDLE_SZ to be correct.
2014-04-21 09:52:08 -04:00
Kay Sievers 9ea28c55a2 udev: remove seqnum API and all assumptions about seqnums
The way the kernel namespaces have been implemented breaks assumptions
udev made regarding uevent sequence numbers. Creating devices in a
namespace "steals" uevents and its sequence numbers from the host. It
confuses the "udevadmin settle" logic, which might block until util a
timeout is reached, even when no uevent is pending.

Remove any assumptions about sequence numbers and deprecate libudev's
API exposing these numbers; none of that can reliably be used anymore
when namespaces are involved.
2014-04-13 17:12:14 -07:00
Lennart Poettering 955d98c9c1 everywhere: make use of new0() and macro() macros, and stop using perror() 2014-02-13 14:45:51 +01:00
Greg KH 29804cc1e0 use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of
memset() calls that should be using memzero() to make it more "obvious"
that the options are correct (i.e. 0 is not the length, but the data to
set).  So fix up all current calls to memset(foo, 0, length) to
memzero(foo, length).
2014-01-31 11:55:01 +01:00
Thomas Hindoe Paaboel Andersen 051dfe8708 remove unused variable 2013-12-19 22:06:47 +01:00
Kay Sievers e8a3b2dcfb libudev: monitor - only disallow "udev" type events 2013-12-18 22:30:26 +01:00
Kay Sievers df32a1caaf libudev: disable monitor inside a container
Uevents are events of the host, which should not leak into a container.
Containers do not support hotplug at the moment, and devices and uevents
are not namespace aware.
2013-12-18 22:01:31 +01:00
Kay Sievers ec76ec1fde bus: catch up with kdbus changes 2013-12-18 21:16:35 +01:00
Kay Sievers f6613dd959 libudev: devices received from udev are always initialized 2013-12-18 17:34:22 +01:00
Lennart Poettering 725d7e6ceb libudev: always return NULL in _unref() APIs
Returning anything else but NULL would suggest the caller's reference
might still be valid, but it isn't, because the caller just invoked
_unref() after all.

This turns the return value into a typesafe shortcut that allows
unreffing and resetting a reference in one line. In contrast to
solutions for this which take a pointer to a pointer to accomplish the
same this solution is just syntactic sugar the developer can make use of
but doesn't have to, and this is particularly useful when immediately
unreffing objects returned by function calls.
2013-11-20 19:36:14 +01:00
Lennart Poettering 994e023433 libudev: always return valid negative error codes on API functions 2013-11-20 19:36:14 +01:00
Thomas Hindoe Paaboel Andersen 090be86534 use streq instead of strcmp 2013-02-13 18:14:20 +01:00
Kay Sievers 88a6477ef3 libudev: update copyright headers 2012-11-12 17:50:33 +01:00
Kay Sievers b30b426025 libudev: clarify that udev_monitor_receive_device() is non-blocking
Based on a patch from: Sam Thursfield <ssssam@gmail.com>
https://bugs.freedesktop.org/show_bug.cgi?id=51202
2012-06-18 15:58:44 +02:00
Kay Sievers ee56538fa7 udev: silent gcc warnings 2012-05-25 14:25:46 +02:00
Kay Sievers c195956988 udev: update docs, NEWS 2012-05-15 23:44:28 +02:00
Kay Sievers 20bbd54f60 udev: libudev - bump soname, remove deprecated functions, introduce symbol versions 2012-05-15 23:06:26 +02:00
Kay Sievers c8f8394a93 libudev: prefix log macros with 'udev_' 2012-04-26 17:43:48 +02:00
Kay Sievers 8fef0ff25c udev: replace ARRAY_SIZE() with ELEMENTSOF() 2012-04-16 19:20:57 +02:00
Kay Sievers 80172751b7 udev: udev_monitor_new_from_socket() - log error and remove from public header 2012-04-15 18:52:42 +02:00
Kay Sievers bb061708d5 udev: move libudev, gudev to src/; move gudev/docs/, udev/docs/ to to docs/ 2012-04-13 19:22:06 +02:00
Renamed from src/udev/libudev-monitor.c (Browse further)