summaryrefslogtreecommitdiff
path: root/src/libudev/libudev-monitor.c
Commit message (Collapse)AuthorAgeFilesLines
* libudev: fix return of udev_monitor_filter_add_match_subsystem_devtype()Zbigniew Jędrzejewski-Szmek2021-04-011-2/+8
| | | | | | | | | | | | | | | | Follow-up for 7117842657c0fc5a3446b6fe158615279cf2d650. sd_device_monitor_filter_add_match_subsystem_devtype() now returns 1 to signify that something was done, and 0 to signify that nothing was done, but udev_monitor_filter_add_match_subsystem_devtype() needs to return 0 as documented. udev_monitor_filter_add_match_tag() is adjusted to match. This makes gdm start successfully here again. Before, it would just not boot, with nothing very obvious in the logs: gdm[1756]: Gdm: GdmDisplay: Session never registered, failing Replaces #19171.
* libudev: shorten code a bitYu Watanabe2021-03-041-5/+3
| | | | fd_wait_for_event() or ppoll() does not return -EAGAIN.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* tree-wide: port to fd_wait_for_event()Lennart Poettering2020-06-101-13/+6
| | | | | | | | Prompted by the discussion on #16110, let's migrate more code to fd_wait_for_event(). This only leaves 7 places where we call into poll()/poll() directly in our entire codebase. (one of which is fd_wait_for_event() itself)
* tree-wide: check POLLNVAL everywhereLennart Poettering2020-06-101-1/+4
| | | | | | | | | | | | | poll() sets POLLNVAL inside of the poll structures if an invalid fd is passed. So far we generally didn't check for that, thus not taking notice of the error. Given that this specific kind of error is generally indication of a programming error, and given that our code is embedded into our projects via NSS or because people link against our library, let's explicitly check for this and convert it to EBADF. (I ran into a busy loop because of this missing check when some of my test code accidentally closed an fd it shouldn't close, so this is a real thing)
* codespell: fix spelling errorsBen Boeckel2019-04-291-1/+1
|
* libudev: introduce return_with_errno() and use it where applicableYu Watanabe2018-11-221-16/+8
|
* libudev-list: move libudev-list related definitions to libudev-list-internal.hYu Watanabe2018-11-201-3/+2
| | | | | This also rename libudev-private.h to libudev-util.h, and cleanups several unnecessary headers from udev.h and libudev-util.h
* libudev-monitor: drop unused private functionsYu Watanabe2018-11-201-54/+25
|
* libudev: re-implement udev-monitor by sd_device_monitorYu Watanabe2018-10-171-545/+41
|
* tree-wide: add a single version of "static const int one = 1"Lennart Poettering2018-10-151-2/+1
| | | | | | | | | | All over the place we define local variables for the various sockopts that take a bool-like "int" value. Sometimes they are const, sometimes static, sometimes both, sometimes neither. Let's clean this up, introduce a common const variable "const_int_one" (as well as one matching "const_int_zero") and use it everywhere, all acorss the codebase.
* libudev-monitor: use assert_return() in many placesYu Watanabe2018-09-111-14/+13
|
* libudev-monitor: add missing error checks in udev_monitor_enable_receiving()Yu Watanabe2018-09-111-15/+16
|
* libudev-monitor: introduce udev_monitor_send_sd_device()Yu Watanabe2018-09-111-22/+40
| | | | And use it in udev_monitor_send_device().
* libudev-monitor: re-implement udev_monitor_receive_sd_device()Yu Watanabe2018-09-111-125/+118
|
* libudev-monitor: use Hashmap or Set to store filtersYu Watanabe2018-09-111-76/+114
|
* libudev-monitor: use structured initializerYu Watanabe2018-09-111-41/+44
|
* libudev-monitor: rename monitor_set_nl_address() and make it return negative ↵Yu Watanabe2018-09-111-10/+10
| | | | errno
* libudev-monitor: rename udev_has_devtmpfs() and move it to mount-util.cYu Watanabe2018-09-111-41/+1
| | | | As the function itself is quite generic.
* libudev-monitor: use structured initializer in bpf_*()Yu Watanabe2018-09-111-18/+15
| | | | This also drop inline attribute from the functions.
* libudev-monitor: use 'unsigned' instead of 'unsigned int'Yu Watanabe2018-09-111-16/+15
|
* libudev: use DEFINE_PUBLIC_TRIVIAL_REF_UNREF_FUNC() macro where applicableYu Watanabe2018-09-111-22/+12
|
* libudev-monitor: use safe_close() in udev_monitor_disconnect()Yu Watanabe2018-09-111-6/+4
|
* libudev: introduce udev_monitor_receive_sd_device()Yu Watanabe2018-08-231-0/+14
|
* libudev: accept NULL as the argument 'struct udev*' for udev_monitor_new() ↵Yu Watanabe2018-08-231-5/+0
| | | | | | | or friends As udev_monitor struct or friends are now almost independent of udev struct. So, generating these objects without udev struct is reasonable.
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-3/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Replace free and return NULL with return mfreeDaniel Lockyer2017-11-241-2/+1
|
* udev: port udev_has_devtmpfs() to use path_get_mnt_id()Lennart Poettering2017-11-211-11/+8
| | | | | This means there's a good chance the code also works on kernels that lack name_to_handle_at().
* mount-util: add name_to_handle_at_loop() wrapper around name_to_handle_at()Lennart Poettering2017-11-211-2/+1
| | | | | | | | | | | | | As it turns out MAX_HANDLE_SZ is a lie, the handle buffer we pass into name_to_handle_at() might need to be larger than MAX_HANDLE_SZ, and we thus need to invoke name_to_handle_at() in a loop, growing the buffer as needed. This adds a new wrapper name_to_handle_at_loop() around name_to_handle_at() that does the necessary looping, and ports over all users. Fixes: #7082
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* libudev: add missing errno initialization/error propagation (#6781)Lennart Poettering2017-09-091-7/+32
| | | | | | | | | In libudev (which es much older code than the rest of systemd), we propagate errors in functions not returning an int, via (positive) errno (i.e. libc-style), and as negative Exyz values in those returning an int (much preferred, i.e. Linux kernel style). Let's fix up a few place, where this was incorrectly done, or not done at all. Fixes: #6613
* tree-wide: when %m is used in log_*, always specify errno explicitlyZbigniew Jędrzejewski-Szmek2017-05-191-1/+1
| | | | | | | | All those uses were correct, but I think it's better to be explicit. Using implicit errno is too error prone, and with this change we can require (in the sense of a style guideline) that the code is always specified. Helpful query: git grep -n -P 'log_[^s][a-z]+\(.*%m'
* Rename formats-util.h to format-util.hZbigniew Jędrzejewski-Szmek2016-11-071-1/+1
| | | | | | We don't have plural in the name of any other -util files and this inconsistency trips me up every time I try to type this file name from memory. "formats-util" is even hard to pronounce.
* tree-wide: use mfree moreZbigniew Jędrzejewski-Szmek2016-10-161-2/+1
|
* tree-wide: htonl() is weird, let's use htobe32() instead (#3538)Lennart Poettering2016-06-151-7/+7
| | | Super-important change, yeah!
* tree-wide: group include of libudev.h with sd-*Thomas Hindoe Paaboel Andersen2015-11-171-1/+2
|
* tree-wide: sort includesThomas Hindoe Paaboel Andersen2015-11-161-2/+1
| | | | Sort the includes accoding to the new coding style.
* treewide: apply errno.cocciMichal Schmidt2015-11-091-4/+2
| | | | with small manual cleanups for style.
* mount-util: move fstype_is_network() and name_to_handle_at() definitions overLennart Poettering2015-10-271-0/+1
|
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: move more file I/O related calls into fileio.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-0/+1
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-8/+10
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* libudev: monitor - set nl_pid when reusing fd in ↵Tom Gundersen2015-06-031-14/+22
| | | | | | | udev_monitor_new_from_netlink_fd This allows a fd to be created and configured as part of one monitor, to be passed in to create a second monitor without having to redo any of the configuration.
* libudev: monitor - fix typo in log messageTom Gundersen2015-04-291-1/+1
|
* libudev: monitor - clarify log messagesTom Gundersen2015-04-261-2/+2
|
* shared: add formats-util.hRonny Chevalier2015-04-101-0/+1
|