query_module(2)

NAME
query_module - 向核心查詢和模組有關的各個位. /* 查詢有關的位?? */

總覽
#include <linux/module.h>

int query_module(const char *name, int which,void *buf, size_t bufsize, size _t *ret);

描述
query_module請求和可載入模組有關的來自核心的資訊.資訊的細緻的特性和格式依賴於 which引數,一些函式要求name引數來命名當前被載入的模組.一些允許引數name為null, 指明核心是正確的.: which的值 0 Always returns success. Used to probe for the system call. 0 總是返回成功,用來探測系統呼叫. /* 參見 insmod -p 和前面文章 */ QM_MODULES Returns the names of all loaded modules. The output buffer
 format is adjacent null-terminated strings; ret is set to the number of mod ules.
    返回所有已載入的模組的名字.輸出緩衝區的格式是鄰近的以null終止的字串;ret 被 設定為模組的數目. QM_DEPS Returns the names of all modules used by the indicated module. The output buffer format is adjacent null-terminated strings; ret is set t o the number of modules. 返回所有被name引數指定的模組使用的模組的名字.輸出 緩 衝區格式是鄰近的以null終止的字串;ret被設定為模組的數目. QM_REFS Returns the names of all modules using the indicated module. This is the inverse of QM_DEPS. The output buffer format is adjacent null-te rminated strings; ret is set to the number of modules.
    返回所有正使用被name引數指定的模組的模組名字.這和QM_DEPS是相反的.輸出緩衝 區 格式是以鄰近的null終止的字串;ret被設定為模組的數目. QM_SYMBOLS Returns the symbols and values exported by the kernel or t he indicated module. The buffer format is an array of:
               struct module_symbol
              {
                unsigned long value;
                unsigned long name;
              };
              followed by null-terminated strings. The value of name is the character offset of the string relative to the start of buf; ret is set to t he number of symbols.
    返回被核心或指定模組匯出(開放)的符號和值對.緩衝區格式是一個以null終止的 結構陣列,name的值是相對緩衝區的開始的字串的字元偏移;ret被設定為符號的數目.

    struct module_symbol
    {
      unsigned long value;
      unsigned long value;
    } QM_INFO Returns miscelaneous information about the indicated module. The output buffer format is:
              struct module_info
              {
                unsigned long address;
                unsigned long size;
                unsigned long flags;
              };
              where address is the kernel address at which the module reside s, size is the size of the module in bytes, and flags is a mask of MOD_RUNNI NG, MOD_AUTOCLEAN, et al that indicates the current status of the module. re t is set to the size of the module_info struct.
    返回各種和指定模組相關的各種資訊,輸出緩衝區的格式如下:
    struct module_info
    {
    unsigned long address;
    unsigned long size;
    unsigned long flags;
    }
 address是模組在核心空間中駐留的地址,size是模組以位元組計數的大小,flags是MOD_R UNING,MOD_AUTOCLEAN等指示模組當前狀態的標誌的按位或組成的掩瑪.ret被設定為mod ule_info結構的大小.

返回值
成功時總是返回0,錯誤是返回-1,全域性變數errno被相應設定.

錯誤

ENOENT
        被name指定的模組不存在.

EINVAL

ENOSPC
        提供的緩衝區太小,ret被設定為需要的最小大小.

EFAULT
        name,buf或ret中至少一個越出了程式可訪問的地址空間.

"雷勇" <nsinit@263.net>

跋
本頁面中文版由中文 man 手冊頁計劃提供。
中文 man 手冊頁計劃：https://github.com/man-pages-zh/manpages-zh