Provided by: manpages-zh_1.6.3.5-1_all bug

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

                                                                                  query_module(2)