卸载仍然有实例的kext [英] Unload kext which still has instances

查看:187
本文介绍了卸载仍然有实例的kext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在更新其中一台设备的驱动程序,并希望kextunload旧的驱动程序并kextload新的驱动程序,因此不再需要重新启动.

I'm updating the driver of one of my devices and would like to kextunload the old driver and kextload the new one so a restart isn't required anymore.

安装后,我尝试:

sudo kextunload /System/Library/Extensions/Driver.kext

发生的错误如下:

(内核)无法卸载kext com.driver.Driver;类具有实例: (内核)Kext com.driver.Driver类com_driver_Driver_USBAudioDevice具有1个实例. 无法卸载com.driver.Driver-(libkern/kext)kext正在使用或保留(无法卸载).

(kernel) Can't unload kext com.driver.Driver; classes have instances: (kernel) Kext com.driver.Driver class com_driver_Driver_USBAudioDevice has 1 instance. Failed to unload com.driver.Driver - (libkern/kext) kext is in use or retained (cannot unload).

该设备不在ioreg中. 我如何找出这个实例是什么导致我无法卸载驱动程序?

The device is not present in ioreg. How can I find out what this instance is which prevents me from unloading the driver?

推荐答案

如果调用命令 kextstat ,它将显示所有已加载内核扩展的列表,其信息如下:-

If you call the command kextstat, it will display a list of all the loaded kernel extensions with info like this one:-

115 3 0xffffff7f814f4000 0x32000 0x32000 com.apple.iokit.IOAudioFamily(1.8.9fc11)< 114 5 4 3 1>

115 3 0xffffff7f814f4000 0x32000 0x32000 com.apple.iokit.IOAudioFamily (1.8.9fc11) <114 5 4 3 1>

第一个数字(115)是内核扩展的ID.

The first number (115) is the id of the kernel extension.

最后,数字集< 114 5 4 3 1>是此特定kext所引用的其他内核扩展id.

At the end, the set of numbers <114 5 4 3 1> are the other kernel extension ids that are being referenced by this particular kext.

如果您将kext的ID与另一个中列出的ID匹配,则这是kextunload所引用的参考.

If you match the id of your kext to any of those listed in another, then that is a reference that kextunload is referring to.

还请注意,在内核中编写任何代码时,全局变量在整个内核中都是全局变量,因此,如果您声明的任何变量都可能没有唯一的名称,并且被另一个kext使用,我发现这会导致一个类似的问题.此处的解决方案是在所有全局变量前添加反向公司URI(例如com_apple_globalVarName).

Also note that when writing any code in the kernel, globals variables are global across the whole kernel, so if you've declared any that may not have a unique name and is used by another kext, I have found this to cause a similar issue. The solution here is to prepend any globals with a reverse company URI (e.g. com_apple_globalVarName).

这篇关于卸载仍然有实例的kext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆