I use Kext, which provides services to one or more user space clients who communicate with it using the iokit service.
I would like for each such client to receive a link to kext, so it would be impossible to unload kext while there are still clients available.
according to the documentation, I can use IOServiceOpenand IOConnectAddRef, but you can still unload the driver using kextunload.
kextstat also shows that there are no links in the driver, these are links of other drivers, as mentioned in the documentation, but I thought that the above commands would do the trick.
Index Refs Address Size Wired Name (Version) UUID <Linked Against>
1 100 0xffffff7f80a46000 0x9d90 0x9d90 com.apple.kpi.bsd (16.7.0) 410B3B98-9DAB-4590-9086-7C57A5B3099A
2 8 0xffffff7f80fc3000 0x3940 0x3940 com.apple.kpi.dsep (16.7.0) FA744B47-913C-4B5D-8C16-2F8005D85935
3 127 0xffffff7f80a04000 0x21040 0x21040 com.apple.kpi.iokit (16.7.0) 80F2DA67-C67B-4583-9B09-082DB11F69FC
...
170 0 0xffffff7f80a04000 0x21040 0x32120 com.my-driver.nsl (1.0.0) 53390CCD-55F0-315F-BBD7-21645800E4A0
What should I do to increase #Refs from the above diagram?
EDIT: Apple kext info.plist.
KEXT , KEXT. OSBundleLibraries .
, , kext, . Windows , , .
thnaks