Commit Graph

200 Commits

Author SHA1 Message Date
illiliti 4510b27a9b udev_enumerate.c: fix pipeware
This is partial fix because pipeware relies on udev-specific
properties that aren't provided by libudev-zero.

Fixes: #26
2021-08-25 06:03:39 +03:00
illiliti d8c4dc4ce3 udev_device.c: define INPUT_PROP_CNT 2021-08-25 03:22:30 +03:00
illiliti 3d98bea289 *: code cleanup 2021-08-25 01:38:33 +03:00
illiliti 5f9186af41 contrib/*: be more explicit 2021-08-21 01:57:41 +03:00
illiliti bf23c9e5ba udev_device.c: fix integer overflow
Bitwise AND operation can produce value that may be larger than
test_bit() return value. Convert result to bool using `!!` to
avoid integer overflow.

Fixes: #33
2021-06-26 01:21:43 +03:00
illiliti bd7d1803e6 udev_enumerate.c: fix possible memory leak
Early return due to pthread_create() failure causes memory leak.
2021-06-11 14:06:20 +03:00
Naoto Yamaguchi eb30a8bc85 Fix install error at make install
At db72f8610d is missing change in Makefile.
This err was reporting at bkuhls.
This patch fix it.
2021-06-09 08:37:50 +00:00
illiliti 692cb07e55 readme: prettify
reading it in plain text was painful, now it's fixed.
2021-06-06 14:23:59 +03:00
illiliti 752403eb9c readme: drop TODO 2021-06-06 10:53:03 +03:00
illiliti e75aced4de udev_device.c: drop TODO 2021-06-06 10:52:20 +03:00
illiliti 7c94940e12 Revert "udev_device.c: use strrchr to trim newline"
This reverts commit 34f8727f28.
2021-06-06 10:50:38 +03:00
illiliti e23633ec56 udev_device.c: more accurate keys/keyboard detection 2021-06-06 10:29:55 +03:00
illiliti 34f8727f28 udev_device.c: use strrchr to trim newline 2021-06-06 10:29:55 +03:00
Naoto Yamaguchi 75a40e1040 Add license information to source files
Current libudev-zero source code doesn't have license information in source files.
This patch add license information to source files based on SPDX standard.
2021-06-05 07:38:25 +00:00
Naoto Yamaguchi db72f8610d Fix building library name from libudev.so to libudev.so.1
Currently, "-soname" set at "libudev.so.1", but building library file name was "libudev.so".
Typical shared library structure as a follow;
  libudev.so -> libudev.so.1
  libudev.so.1
Current installation is reversed.

This patch fix this.
2021-06-05 07:38:25 +00:00
Naoto Yamaguchi def1a43f53 Add PKGCONFIGDIR for installation
Ubuntu/Debian style file placement are ;
 No.1 libudev.so and libudev.so.1 in /lib or /lib/arch/
 No.2 libudev.h in /usr/include
 No.3 libudev.pc in /usr/lib/pkgconfig or /usr/lib/arch/pkgconfig

Current Makefile can install No.1 and No.2 pattern by
"make PREFIX=/usr LIBDIR=/lib INCLUDEDIR=/usr/include install",
but it can't install No.3 pattern.

This patch added PKGCONFIGDIR environment variable to achieve all install pattern by
"make PREFIX=/usr LIBDIR=/lib INCLUDEDIR=/usr/include PKGCONFIGDIR=/usr/lib install"
2021-06-05 07:38:25 +00:00
illiliti ed6c3e5c2d udev_monitor.c: check UDEV_MONITOR_DIR only for existence
Fixes #30
2021-06-04 20:15:45 +03:00
illiliti 23e9b6f8f4 udev_monitor.c: drip sticky bit for now 2021-06-04 00:35:15 +03:00
illiliti a81cb4444d udev_device.c: decrement size by 1
SUBSYSTEM == 9, not 10. same for others
2021-06-03 12:06:18 +03:00
illiliti 4cb97cd01e udev_device.c: use strncmp to compare uevent vars 2021-06-03 12:02:40 +03:00
illiliti 4623040b6c udev_monitor.c: free resources before return 2021-06-03 11:53:29 +03:00
illiliti 802c5b8695 udev_enumerate.c: check return value of pthread_create 2021-06-03 11:44:50 +03:00
illiliti b82f9d9e4f udev.c: move udev_hwdb here 2021-06-03 11:35:08 +03:00
illiliti e814cfa506 udev_device.c: fix possible uninitialized read 2021-06-03 11:20:51 +03:00
illiliti 496291c8dd udev_monitor.c: add a way to control UDEV_MONITOR_DIR at runtime 2021-06-03 10:38:40 +03:00
illiliti c9b824bd54 udev_monitor.c: skip inotify event if directory 2021-06-03 09:41:26 +03:00
illiliti fb44266bfd udev_monitor.c: check poll error early 2021-06-03 09:37:13 +03:00
illiliti 37e5fa7206 udev_monitor.c: inotify read of size 0 is impossible 2021-06-03 09:30:46 +03:00
illiliti 32f9d14551 udev_monitor.c: fix bad return value in udev_monitor_enable_receiving 2021-06-03 09:24:55 +03:00
illiliti f4b2b9331e udev_monitor.c: fail if monitored file is not dir 2021-06-03 09:19:45 +03:00
illiliti 4a6b31b8f1 udev_monitor.c: remove no longer required fcntl.h include 2021-06-03 09:17:39 +03:00
illiliti 0fd4054baf Revert "udev_device.c: replace strncmp with strcmp"
This reverts commit ff6cf67c23.
2021-06-03 07:24:19 +03:00
illiliti 0a1be0e4c0 Revert "contrib/helper.c: replace strncmp with strcmp"
This reverts commit b3f44ae7c9.
2021-06-03 07:23:30 +03:00
illiliti 53aa6f3b04 udev_device.c: abort if uevent file is malformed 2021-06-03 06:27:47 +03:00
illiliti ff6cf67c23 udev_device.c: replace strncmp with strcmp 2021-06-03 05:28:46 +03:00
illiliti b3f44ae7c9 contrib/helper.c: replace strncmp with strcmp 2021-06-03 05:19:14 +03:00
illiliti 41d6cc9976 udev_device.c: avoid passing NULL to atoi 2021-06-03 03:21:56 +03:00
illiliti 6dcad515e9 readme: add eventfd to deps 2021-06-01 22:08:50 +03:00
illiliti 93c48c86ec udev_device.c: nitpick 2021-06-01 22:08:00 +03:00
illiliti e06dfcd22c udev_monitor.c: minor fixes 2021-06-01 17:23:32 +03:00
Arthur Williams 03c53bc1c3 Removed THREAD_MAX and the barrier and pfd fields from udev_monitor
We can fix THREAD_MAX at one since we don't gain much by having multiple
threads. All the threads did were translate inotify events. We also
no longer need pfd and the barrier fields of udev_monitor since we don't
need to signal the single thread or guard against any races.
2021-06-01 03:12:11 +00:00
Arthur Williams af98e237cb Remove epoll dependency
Instead of using the Linux-specific epoll, we can use the
more portable poll.
2021-06-01 03:12:11 +00:00
illiliti 3d97786f09 udev_device.c: drop PAGESIZE
glibc violates POSIX and does not define it.
2021-05-27 19:13:04 +03:00
illiliti f44332df5a various: drop udev_* prefix from static functions 2021-05-26 17:55:29 +03:00
illiliti 0ea1528dfc udev_device.c: simplify bounds checking 2021-05-26 14:33:27 +03:00
illiliti 4b044ae52c udev_device.c: avoid off-by-one overflow 2021-05-26 13:37:02 +03:00
illiliti 145e2c814f udev_device.c: attempt to fix incorrect bitmask handling
Reference #22
2021-05-25 15:34:24 +03:00
illiliti f2083f0e47 udev_monitor.c: block signals within event loop
Fixes #23
Closes #24
2021-05-25 08:36:56 +03:00
illiliti a885b93c3c udev_device.c: correctly handle multiline sysattrs
Changed arbitrary size of sysattr to PAGESIZE[0]. Not sure about binary
sysattrs because they may be > PAGESIZE. Either way, we need dynamic
allocation to handle them.

Trim only trailing newlines, not the first one. Now content of the
sysattr not getting truncated. By the way, do we need to trim carrige
return '\r' too?

[0] https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt

> The buffer will always be PAGE_SIZE bytes in length. On i386, this
  is 4096.

Fixes #25
2021-05-21 05:49:41 +03:00
illiliti 1fd071f24e contrib/helper.sh: exec env command to inherit exit status 2021-05-18 20:27:26 +03:00