[systemd-devel] [libudev] is there a function to filter message from kernel with property and value

Wang, Yuan1 yuan1.wang at intel.com
Tue May 31 02:48:24 UTC 2022


Hi

Need your kind help for one question!

Do libudev have a function that could be used to filter the message with property from kernel socket?

I am writing an APPs like "udevadm monitor".

I see the function "udev_monitor_filter_add_match_subsystem_devtype()" could filter the devtype for the message.

And I see the "udev_monitor_filter_add_match_tag" could filter the tag. (But I don't know how does it work)

When I use "udevadm monitor --subsystem-match=pci --env" command, I could see some messages from kernel like below.

For example, I only want the messages contains "property=value" like "PCI_ID=8086:4941" could come up from kernel space.

Could you please shed a light on this?

################################################################################################################################################
KERNEL[76915.968785] bind     /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:07/VMBUS:01/ec21a818-5106-49c3-a6f6-e4cb872df440/pci5106:00/5106:00:00.0 (pci)
ACTION=bind
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:07/VMBUS:01/ec21a818-5106-49c3-a6f6-e4cb872df440/pci5106:00/5106:00:00.0
SUBSYSTEM=pci
DRIVER=4xxxvf
PCI_CLASS=B4000
PCI_ID=8086:4941
PCI_SUBSYS_ID=8086:0000
PCI_SLOT_NAME=5106:00:00.0
MODALIAS=pci:v00008086d00004941sv00008086sd00000000bc0Bsc40i00
SEQNUM=5527

UDEV  [76915.974190] change   /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:07/VMBUS:01/ec21a818-5106-49c3-a6f6-e4cb872df440/pci5106:00/5106:00:00.0 (pci)
ACTION=change
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:07/VMBUS:01/ec21a818-5106-49c3-a6f6-e4cb872df440/pci5106:00/5106:00:00.0
SUBSYSTEM=pci
qat_event=restarted
accelid=0
DRIVER=4xxxvf
PCI_CLASS=B4000
PCI_ID=8086:4941
PCI_SUBSYS_ID=8086:0000
PCI_SLOT_NAME=5106:00:00.0
MODALIAS=pci:v00008086d00004941sv00008086sd00000000bc0Bsc40i00
SEQNUM=5526
USEC_INITIALIZED=76915555086
ID_PCI_CLASS_FROM_DATABASE=Processor
ID_PCI_SUBCLASS_FROM_DATABASE=Co-processor
ID_VENDOR_FROM_DATABASE=Intel Corporation
################################################################################################################################################


- Yuan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20220531/aa2e2101/attachment.htm>


More information about the systemd-devel mailing list