Provided by: manpages-zh_1.5.2-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>
                                                               query_module(2)