Is ignore 'kev_subclass' when 'kev_class = KEV_ANY_CLASS' on client?

I used broadcast to send messages to client from kext.


kev_msg:

struct kev_msg msg = {0};
msg.vendor_code = vendor_code;
msg.kev_class = KEV_NETWORK_CLASS;
msg.kev_subclass = KEV_IOKIT_CLASS;


kev_request:

struct kev_request kevRequest = {0};
kevRequest.vendor_code = vendor_code;
kevRequest.kev_class = KEV_ANY_CLASS;
kevRequest.kev_subclass = KEV_SYSTEM_CLASS;


Client can receive messages if you set it as above.

Is subclass ignored?

The more I want to know about the matching details of class and subclass.

Replies

I don’t really understand your question, but if you’d like to know the exact mechanics of kernel event matching you can look at the source in Darwin. See

xnu/bsd/kern/kern_event.c
, starting around line 8181.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

ps DTS is closed 21 Dec through 1 Jan.

My question is, do kev_class and kev_subclass have to match to receive the broadcast?

If kev_request.kev_class = KEV_ANY_CLASS, no matter what kind of class is kev_subclass, it will received.