ERROR: Removing '***': Device or resource busy

本文记录了解决Linux驱动模块helloworld在卸载时遇到的“设备或资源忙”错误的过程。通过检查发现,该问题是由于系统GCC版本与内核GCC版本不匹配导致的。
AI助手已提取文章相关产品:

编写实验 《linux驱动设备》 中的第一个例子 helloworld,但是insmod安装成功

dmsg |grep ** 也能找到我的模块安装的打印信息,但是rmmod的时候出错了。

ERROR: Removing 'helloworld': Device or resource busy

rmmod -- force 强制删除也没有用

一些常见的原因就不多说了:

1、没有按规定编写module_exit;

2、还有看stackflow上很多的低级函数名写错的问题。

最后参考了:

http://forum.ubuntu.com.cn/viewtopic.php?f=97&t=364431

才发现原来是自己系统目前的gcc版本与 内核的GCC 版本不符合导致的。

由于之前=编译其他代码 将gcc连接改为4.4的版本的,但是我的ubuntu12.04内核gcc是 4.6的

ls -al /usr/bin/gcc查看 gcc版本

cat /proc/version 查看系统信息,包含内核的GCC版本信息

您可能感兴趣的与本文相关内容

// 获取几何体列表 NXOpen::CAM::GeometrySetList* geometrySetList = cutAreaGeometry->GeometryList(); // 查找第一个几何集 NXOpen::NXObject* geometrySetObj = geometrySetList->FindItem(0); NXOpen::CAM::GeometrySet* geometrySet = dynamic_cast<NXOpen::CAM::GeometrySet*>(geometrySetObj);报错:“"NXOpen::CAM::GeometrySet *" 类型的值不能用于初始化 "NXOpen::NXObject *" 类型的实体 ”以下参考:“#ifndef NXOpen_CAM_GEOMETRYSETLIST_HXX_INCLUDED #define NXOpen_CAM_GEOMETRYSETLIST_HXX_INCLUDED //-------------------------------------------------------------------------- // Copyright 2024 Siemens //-------------------------------------------------------------------------- // Header for C++ interface to JA API //-------------------------------------------------------------------------- // // Source File: // CAM_GeometrySetList.ja // // Generated by: // apiwrap // // WARNING: // This file is automatically generated - do not edit by hand // #ifdef _MSC_VER #pragma once #endif #include <NXOpen/NXDeprecation.hxx> #include <vector> #include <NXOpen/NXString.hxx> #include <NXOpen/Callback.hxx> #include <NXOpen/TaggedObject.hxx> #include <NXOpen/ObjectList.hxx> #include <NXOpen/libnxopencpp_cam_exports.hxx> #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4996) #endif #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif namespace NXOpen { namespace CAM { class GeometrySetList; } namespace CAM { class GeometrySet; } namespace CAM { class _GeometrySetListBuilder; class GeometrySetListImpl; /** Represents a list of objects. <br> To create a new instance of this class, use @link NXOpen::Part::CreateObjectList NXOpen::Part::CreateObjectList @endlink <br> <br> Created in NX4.0.0. <br> */ class NXOPENCPP_CAMEXPORT GeometrySetList : public NXOpen::TaggedObject { private: GeometrySetListImpl * m_geometrysetlist_impl; private: friend class _GeometrySetListBuilder; protected: GeometrySetList(); public: ~GeometrySetList(); /** Appends a set of objects to the list <br> Created in NX4.0.0. <br> <br> License requirements : None */ public: void Append ( const std::vector<NXOpen::CAM::GeometrySet *> & objects /** items to append */ ); /** Appends an object to the list <br> Created in NX5.0.0. <br> <br> License requirements : None */ public: void Append ( NXOpen::CAM::GeometrySet * object /** item to append */ ); /**Returns the length of the list <br> Created in NX5.0.0. <br> <br> License requirements : None */ public: int Length ( ); /** Deletes the item at the index specified. The size of the list does * not change, but the item at this index is set to NULL. <br> Created in NX4.0.0. <br> <br> License requirements : None */ public: void ClearIndex ( int deleteIdx /** index of item to be deleted */ ); /** Finds the index where the input object appears. If it does not appear, * -1 is returned. @return index of input object, -1 if not on list <br> Created in NX4.0.0. <br> <br> License requirements : None */ public: int FindIndex ( NXOpen::CAM::GeometrySet * obj /** Object to find index for */ ); /** Returns the object at the input index. May be NULL. @return object found at input index <br> Created in NX4.0.0. <br> <br> License requirements : None */ public: NXOpen::CAM::GeometrySet * FindItem ( int index /** index of object to return */ ); /** Erases the object from the list, but does not delete the object. The list is shifted so that there isn't a null where the object used to be. <br> Created in NX5.0.0. <br> <br> License requirements : None */ public: void Erase ( int index /** index of item to be removed from the list */ ); /** Erases the object at the given position from the list. The list is shifted so that there isn't a null where the object used to be. <br> Created in NX5.0.0. <br> <br> License requirements : None */ public: void Erase ( int index /** index of item to be removed from the list */, NXOpen::ObjectList::DeleteOption deleteOption /** whether to delete the object */ ); /** Erases the object from the list, but does not delete the object. The list is shifted so that there isn't a null where the object used to exist. <br> Created in NX5.0.0. <br> <br> License requirements : None */ public: void Erase ( NXOpen::CAM::GeometrySet * obj /** object to be removed from the list */ ); /** Erases the object from the list. The list is shifted so that there isn't a null where the object used to exist. <br> Created in NX5.0.0. <br> <br> License requirements : None */ public: void Erase ( NXOpen::CAM::GeometrySet * obj /** object to be removed from the list */, NXOpen::ObjectList::DeleteOption deleteOption /** whether to delete the object */ ); /** Clears the entire list without deleting the objects. The caller is responsible for accounting for these objects. If they are not used or deleted by the time the part is closed (in other words, leaked) an error will occur <br> Created in NX5.0.0. <br> <br> License requirements : None */ public: void Clear ( ); /** Clears the entire list <br> Created in NX5.0.0. <br> <br> License requirements : None */ public: void Clear ( NXOpen::ObjectList::DeleteOption deleteOption /** whether to delete the objects when removing them */ ); /** Gets the contents of the entire list @return The list contents <br> Created in NX5.0.0. <br> <br> License requirements : None */ public: std::vector<NXOpen::CAM::GeometrySet *> GetContents ( ); /** Sets the contents of the entire list. This overwrites the previous contents of this list, but does not delete any objects that were originally on the list. <br> Created in NX5.0.0. <br> <br> License requirements : None */ public: void SetContents ( const std::vector<NXOpen::CAM::GeometrySet *> & objects /** The list contents */ ); /** Exchanges the position of two objects inside the list. The first object is placed where the second used to be, and second object where the first used to be. <br> Created in NX5.0.0. <br> <br> License requirements : None */ public: void Swap ( int index1 /** location of the first item */, int index2 /** location of the second item */ ); /** Exchanges the position of two objects inside the list. The first object is placed where the second used to be, and second object where the first used to be. <br> Created in NX5.0.0. <br> <br> License requirements : None */ public: void Swap ( NXOpen::CAM::GeometrySet * object1 /** first item */, NXOpen::CAM::GeometrySet * object2 /** second item */ ); /** Inserts an object at the specified location <br> Created in NX5.0.0. <br> <br> License requirements : None */ public: void Insert ( int location /** location at which to insert the object */, NXOpen::CAM::GeometrySet * object /** object to be inserted */ ); /** Move object at the specified location to the top of the list. <br> Created in NX10.0.0. <br> <br> License requirements : None */ public: void MoveToTop ( int index /** location of the item */ ); /** Move object at the specified location to the bottom of the list. <br> Created in NX10.0.0. <br> <br> License requirements : None */ public: void MoveToBottom ( int index /** location of the item */ ); }; } } #ifdef _MSC_VER #pragma warning(pop) #endif #ifdef __GNUC__ #ifndef NX_NO_GCC_DEPRECATION_WARNINGS #pragma GCC diagnostic warning "-Wdeprecated-declarations" #endif #endif #undef EXPORTLIBRARY #endif ”
最新发布
09-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值