mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Using "query_module"
@ 2002-02-04 10:04 Vlodavsky, Zvi
  2002-02-04 10:20 ` Keith Owens
  0 siblings, 1 reply; 2+ messages in thread
From: Vlodavsky, Zvi @ 2002-02-04 10:04 UTC (permalink / raw)
  To: 'linux-kernel@vger.kernel.org', 'kaos@ocs.com.au'
  Cc: Vlodavsky, Zvi


Please personally CC me with responses on this posting:

I would like to use the "query_module" system call with the QM_SYMBOLS flag
in an application, but I am not sure of what the appropriate way of doing it
is, and whether it is safe.

I have the man-page for query_module on the system on which I am compiling,
but I can't find the function prototype in <linux/module.h>. So, I just
wrote the prototype in my code. Is this the way this should be done?

Other than that, the man page states that struct module_symbol looks like
this:
  		struct module_symbol
            {
            	unsigned long value;
                	unsigned long name;
            };

But in module.h it is defined as:
		struct module_symbol
		{
        		unsigned long value;
        		const char *name;
		};

>From my understanding, the second definition is the way the kernel uses this
struct, and the first definition is the way the user should interpret the
result of query_module with the QM_SYMBOLS flag. Am I right? (Shouldn't
there be 2 different structures for this?)

Most importantly, I would like to understand whether it is safe to use this
system call. If I compile my application on a machine in which this function
is implemented (in libc), is the system call guaranteed to work on kernels
2.2 and up? Do I need to do a preliminary check such as "if
(query_module(NULL, 0, NULL, 0, NULL))" for the existence of the system
call, or would it simply fail if I use it regularly?

Thanks for your help,
Zvi.

---------------
Zvi Vlodavsky
Software Engineer
Network Communications Group, Intel Corp.
Zvi.Vlodavsky@intel.com

Disclaimer: In this e-mail, I do not speak on behalf of Intel corp.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Using "query_module"
  2002-02-04 10:04 Using "query_module" Vlodavsky, Zvi
@ 2002-02-04 10:20 ` Keith Owens
  0 siblings, 0 replies; 2+ messages in thread
From: Keith Owens @ 2002-02-04 10:20 UTC (permalink / raw)
  To: Vlodavsky, Zvi; +Cc: 'linux-kernel@vger.kernel.org'

On Mon, 4 Feb 2002 12:04:19 +0200 , 
"Vlodavsky, Zvi" <zvi.vlodavsky@intel.com> wrote:
>Please personally CC me with responses on this posting:
>I would like to use the "query_module" system call with the QM_SYMBOLS flag
>in an application, but I am not sure of what the appropriate way of doing it
>is, and whether it is safe.

query_module(NULL, 0, NULL, 0, NULL) returns 0 if the kernel supports
query_module, -ENOSYS if it does not.

If the kernel supports query_module,
  query_module(NULL, -1, NULL, 0, NULL)
returns -ENOSYS if the kernel has been compiled without modules,
-EINVAL if the kernel was compiled with module support.

Grab the modutils source and see utils/modstat.c::new_get_kernel_info,
it uses all the query_module facilities.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-02-04 10:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-04 10:04 Using "query_module" Vlodavsky, Zvi
2002-02-04 10:20 ` Keith Owens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®