Re: modload - weird behavior
From: Dom (dominique.laigle_at_-nospam-internet.lu)
Date: 12/17/04
- Next message: Casper H.S. ***: "Re: Linux Advocates Fear Solaris 10."
- Previous message: Frank: "Re: SVM and MPXIO"
- In reply to: manu: "modload - weird behavior"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 17 Dec 2004 14:50:13 +0100
manu wrote:
> Guys, modload is giving strange error while trying to load a module.
> Following is the source code of module (flkm.c)
>
> /***************************************************/
> #include <sys/ddi.h>
> #include <sys/sunddi.h>
>
> /*
> * This is the loadable module wrapper.
> */
> #include <sys/modctl.h>
> extern struct mod_ops mod_miscops;
>
> /*
> * Module linkage information for the kernel.
> */
> static struct modlmisc modlmisc =
> {
> &mod_miscops,
> "First Loadable Kernel Module",
> };
>
> static struct modlinkage modlinkage =
> {
> MODREV_1,
> (void *) &modlmisc,
> NULL
> };
>
> int _init(void)
> {
> int i;
>
> if ((i = mod_install(&modlinkage)) != 0)
> cmn_err(CE_NOTE, "Could not install module\n");
> else
> cmn_err(CE_NOTE, "flkm: successfully installed");
>
> return i;
> }
>
> int _info(struct modinfo *modinfop)
> {
> return (mod_info(&modlinkage, modinfop));
> }
>
>
> int _fini(void)
> {
> int i;
>
> if ((i = mod_remove(&modlinkage)) != 0)
> cmn_err(CE_NOTE, "Could not remove module\n");
> else
> cmn_err(CE_NOTE, "flkm: successfully removed");
>
> return i;
> }
> /*************************************************/
>
>
> I compiled it using gcc:
> #############
> gcc -g -D_KERNEL -DSVR4 -DSOL2 -DDEBUG -O2 -c flkm.c
> ld -o flkm -r flkm.o
> ##############
>
> Output of gcc -v
> #############
> Reading specs from
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.3/specs
> Configured with: ../configure --disable-nls --with-as=/usr/ccs/bin/as
> --with-ld=/usr/ccs/bin/ld
> Thread model: posix
> gcc version 3.3
> #############
>
>
> But when I try to load the module flkm using modload, it spits out the
> following error:
> can't load module: No such file or directory
>
> I have also tried putting flkm in /usr/kernel and /kernel, but of no
> avail. Has anybody else also faced similar problem?
>
> Thanks,
> Manu
>
You probably did step on a bug...
Your code works all fine on Solaris 10/x86 in following conditions:
-- modules loaded directly from /tmp
-- gcc -v:
Reading specs from /usr/local/lib/gcc/i386-pc-solaris2.10/3.4.3/specs
Configured with: ./configure --enable-threads=posix
--enable-languages=c,c++ --disable-nls --with-system-zlib
Thread model: posix
gcc version 3.4.3
-- uname -a:
SunOS zelaptop 5.10 s10_70 i86pc i386 i86pc
- Next message: Casper H.S. ***: "Re: Linux Advocates Fear Solaris 10."
- Previous message: Frank: "Re: SVM and MPXIO"
- In reply to: manu: "modload - weird behavior"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]