首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 操作系统 > 其他操作系统 > The wrong message given by kldload
【标  题】:The wrong message given by kldload
【关键字】:The,wrong,message,given,by,kldload
【来  源】:http://www.cublog.cn/u/132/showart.php?id=146717

The wrong message given by kldload

I compile a module, and use kldload command to load the module, but kldload says: "can't load ./xxx.ko: No such file or directory". It is weird.
 
What's wrong? The module is there, kldload can't see it?
 
I constructed a module and declared sysctl varible. If I use SYSCTL_DECL instead of SYSCTL_NODE, kldload will print that message.
In this case, the parent node -- ss is not exist, the sysctl variable can't be registered, so kldload gets ENOENT from the inner functions.
 
The inner functions should return other errno except ENOENT.  ENOENT will confuse the programmer.

#include <sys/param.h>
#include <sys/malloc.h>
#include <sys/protosw.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/sysctl.h>

static int
xxx_modevent(module_t mod, int type, void *unused)
{
 switch (type) {
  case MOD_LOAD:
   printf("is here\n");
   break;
  case MOD_UNLOAD:
   break;
  default:
   return EINVAL;
 }
 return 0;
}


static moduledata_t xxx_mod = {
 "xxx",
 xxx_modevent,
 0
};

DECLARE_MODULE(xxx, xxx_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
MODULE_VERSION(xxx, 1);

SYSCTL_NODE(, OID_AUTO, ss, CTLFLAG_RW, 0, "SS");
/* wrong ..
 * SYSCTL_DECL(_ss);
 */
SYSCTL_NODE(_ss, OID_AUTO, son, CTLFLAG_RW, 0, "SON");
static u_long leaf = 0;
SYSCTL_ULONG(_ss_son, OID_AUTO, leaf, CTLFLAG_RD, &leaf, 0, "");

CVSUP系统同步及重建代码:【上一篇】
BSD@Root密码丢了咋办:【下一篇】
【相关文章】
  • (原创)CE MAPI实例讲解 --- 读取Message附件(八)
  • ASP VBScript 动态包含文件, FSO 实现 By Shawl.qiu
  • 针对Nokia全屏情况下getHeight的BUG重载getHeight方法
  • the problem I meet Extending the Python with c++
  • FTTH —— Fiber To The Home
  • Using ithread to deal with the network packets
  • The man page of ithread in 6.x is expired!
  • The Linux project.
  • NETCF开发之MessageQueue控件
  • 一些很好的建议和说明 by BlueWanderer
  • 【随机文章】
  • Solaris图形界面相关
  • 配置Linux下的动态DNS服务全功略
  • linux解压方式大集合
  • 如何学好JSP
  • wait()和notify()的简单调用程序
  • JDK6的新特性之十二:脚本语言支持(Scripting)
  • 教你几招,把有限的内存用在刀刃上
  • 今天开始找工作了!
  • 人民眼中的“八大无耻官员”
  • 找回还原精灵的密码的七种方法
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.