module

更新时间:2025-05-17 14:40:56 阅读: 评论:0

module

module,意思是宇宙飞船的分离舱。n. [计] 模组;组件;模数。[网路] 模组;模;模组。[专业] 模组 [计算机科学技术];模组 [电子、通信与自动控制技术];构件 [农业科学]。

基本介绍

外文名:module 发音: [ ‘mɔdju:l ] 简介:宇宙飞船的分离舱 例句:evel programs or modules.

单词词义

module: [ 'mɔdju:l ]1.[计算机] 模组n. 组件2. 单元【课程学习单元】a module in mathematics数学课的一个单元3.宇宙飞船的分离舱

例句用法

1. In software engineering, an individual unit or module that is utilized by higher-level programs or modules.在软体工程中,指较高一级程式或模组使用的一个单元或模组。2. Object repository support for creating shared, reusable form and data module.用于创建共享、可重用窗体和数据模组的对象储存库支持。3. The definition of a global symbol that is not explicitly available for reference by modules linked with the module in which the definition occurs.一种全局符号定义,它不能被与定义该全局符号的模组相连结的其它模组直接引用。4. My desk is my command module.我的书桌就是我的主要工作场所。

英英解释

名词module:1. one of the inherent cognitive or perceptual powers of the mind同义词:faculty, mental faculty2. detachable compartment of a spacecraft3. computer circuit consisting of an assembly of electronic components (as of computer hardware)4. a self-contained component (unit or item) that is used in combination with other components

同名软体

Linux modules是linux 2.0版本以后都支持模组化,因为核心中的一部分常驻在记忆体中,(如最常使用的进程,如scheduler等),但是其它的进程只是在需要的时候才被载入。如MS-DOS档案系统只有当mount此类系统的时候才需要,这种按需载入,就是模组。它能使核心保持较小的体积,虽然可以把所有的东东都放在核心中,这样的话,我们就不需要模组了,但是这样通常是有特殊的用途(所有要运行的进程都预先知道的情况)。模组另一个优点是核心可以动态的载入、卸载它们(或者自动地由kerneld守护程式完成)。Writing, Installing, and Removing ModulesWRiting Modules:
除了它们运行在核心空间中之外,模组与其它程式类似。所以,必须定义MODULE并且包含头档案module.h以及其它的一些核心头档案。模组即可以很简单也可以很複杂。一般的模组格式如下:

#define MODULE#include<linux/module.h>    /*...otherrequiredheaderfiles...*/    /**...moduledeclarationsandfunctions...*/intinit_module(){    /*codekernelwillcallwheninstallingmodule*/}    voidcleanup_module(){    /*codekernelwillcallwhenremovingmodule*/}

使用核心源码的模组在用gcc编译时,必须使用如下的选项:

-I/usr/src/linux/include

注意并不是所有核心中的变数都被导出供模组使用的,即使代码中用extern声明了。在/proc/ksyms档案或者程式ksyms中显示了被导出的符号。linux核心使用使用EXPORT_SYMBOL(x)宏来不仅导出符号,而且也导出版本号(version number)。如果是用户自己定义的变数,使用EXPORT_SYMBOL_NOVERS(x)宏。否则的话linker不会在kernel symbol table中保留此变数。可以使用EXPORT_NO_SYMBOLS宏不导出变数,预设情况是模组导出所有的变数。

InstallingandRemovingModules:

必须是超级用户才可以的。使用insmod来安装一个模组:

/sbin/insmodmodule_name

rmmod命令移除一个已经安装了的模组,以及任何此模组所导出的引用。

/sbin/rmmodmodule_name

使用lsmod列出所有安装了的模组。Example:
simple_module.c

/*simple_module.c**Thisprogramprovidesanexampleofhowtoinstallatrivialmodule*intotheLinuxkernel.Allthemoduledoesisputamessageinto*thelogfilewhenitisinstalledandremoved.**/#defineMODULE#include<linux/module.h>/*kernel.hcontainstheprintkfunction*/#include<linux/kernel.h>/*init_module*kernelcallsthisfunctionwhenitloadsthemodule*/intinit_module(){printk("<1>Thesimplemoduleinstalleditselfproperly./n");return0;}/*init_module*//*cleanup_module*thekernelcallsthisfunctionwhenitremovesthemodule*/voidcleanup_moudle(){printk("<1>Thesimplemoduleisnowuninstalled./n");}/*cleanup_module*/ThisistheMakefile:#Makefileforsimple_moduleCC=gcc-I/usr/src/linux/include/configCFLAGS=-O2-D__KERNEL__-Wallsimple_module.o:simple_module.cinstall:/sbin/insmodsimple_moduleremove:/sbin/rmmodsimple_module

本文发布于:2023-03-26 22:09:46,感谢您对本站的认可!

本文链接:http://www.ranqi119.com/to/1680222266267582.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:module
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 站长QQ:55-9-10-26|友情:优美诗词|电脑我帮您|扬州装修|369文学|学编程|软件玩家|水木编程|编程频道