On Thu, 2003-11-13 at 14:28, Daniel Jacobowitz wrote:
> On Thu, Nov 13, 2003 at 01:50:58PM -0700, Alex Tsariounov wrote: 
> > Are you saying that it is not and should not be used then?
> 
> Libc provides the function, as a convenience, esp. for architectures
> where the _syscall macros in <asm/unistd.h> can't be directly used.
> 
> However, it does not provide a prototype or associated definitions. 
> Which is what I said.

Well, this is why I said it was philosophical.  My root question would
be: is the system call query_module() (along with it's relatives
init_module, create_module, delete_module - although they are less
important here since you need to be root to use them) a public
interface?

If it is, then I would suggest it needs an include file which prototypes
its use and supplies any needed constants/definitions.

For my case now, and hence this bug, I've decided to quit using the
query_module() function because of the fud (it's not the first time it's
been a problem).  I've also attached below the example code that I used
to open this bug modified to use a different method to determine if a
module is loaded for those who are monitoring this bug stream.

By using this other method (and hence not including linux/module.h), my
build builds again.

Thanks,
Alex Tsariounov

-----8<----- Compile this:

#include <stdio.h>

main(int argc, char *argv[])
{
        FILE *fp;
        char line[4096];

        if (argc<2) {
                printf("Usage: %s module_name\n", argv[0]);
                exit(1);
        }

        fp = fopen("/proc/modules", "r");
        if (!fp) {
                perror("Opening /proc/modules");
                exit(1);
        }

        while (fgets(line, sizeof(line), fp)) {
                if (strncmp(line, argv[1], strlen(argv[1])) == 0) {
                        printf("Found %s loaded in kernel\n", argv[1]);
                        exit (0);
                }
        }

        printf("Can't find module %s in kernel\n", argv[1]);
        return 1;
        exit(0);
}

-----8<--------8<-------




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to