Weblog

All | General | Solaris
« Previous day (Aug 10, 2005) | Main | Next day (Aug 12, 2005) »
20050811 Thursday August 11, 2005

moddebug fun... moddebug fun... There is a kernel variable 'moddebug' which can be set to different values
mentioned in usr/src/uts/common/sys/modctl.h :

#define MODDEBUG_LOADMSG         0x80000000      /* print "[un]loading..." msg */
#define MODDEBUG_ERRMSG            0x40000000      /* print detailed error msgs */
#define MODDEBUG_LOADMSG2       0x20000000      /* print 2nd level msgs */
....

This variable controls the verbosity level of messages printed by the kernel (module
loading and unloading subsystem of the kernel, to be precise).

This value can be set either through /etc/system or on a running system using
'mdb -kw'.  Advantage with the later option is, system doesn't need a reboot and will
become effective immdiately.

Modules get loaded on demand or 'cos of a  modload(1M) request.
And  unloaded in response to modunload(1M) or whenever there is shortage
of memory or by 'mod auto unload thread' in case of DEBUG kernels.

Messages are printed onto the console as well as to the messages file.
It will be fun to watch what all modules are getting loaded and unloaded -

# mdb -kw
Loading modules: [ unix krtld ... ]
> moddebug/W 80000000
moddebug:       0               =       0x80000000
> $q

Because I am not running a debug kernel and the possibilty of memory shortage is
less, I will issue a modunload and see what happens:

# modunload -i 0
# dmesg
...
Aug 11 14:52:07 t1 genunix: [ID 762576 kern.notice] uninstalled elfexec
Aug 11 14:52:07 t1 genunix: [ID 659089 kern.notice] unloading elfexec, module id 62, loadcnt 2.
Aug 11 14:52:07 t1 genunix: [ID 762576 kern.notice] uninstalled intpexec
Aug 11 14:52:07 t1 genunix: [ID 659089 kern.notice] unloading intpexec, module id 101, loadcnt 3.
Aug 11 14:52:23 t1 genunix: [ID 943528 kern.notice] load 'exec/intpexec' id 101 loaded @ 0x120460f/0x78117f60 size 1049/156
Aug 11 14:52:23 t1 genunix: [ID 131579 kern.notice] installing intpexec, module id 101.
Aug 11 14:52:23 t1 genunix: [ID 943528 kern.notice] load 'exec/elfexec' id 62 loaded @ 0x1325e6f/0x14dcce7 size 18763/259
Aug 11 14:52:23 t1 genunix: [ID 131579 kern.notice] installing elfexec, module id 62.
#

Modules 'intpexec' and 'elfexec' were unloaded; but had to be loaded immediatly
because I ran 'dmesg' command which happens to be a shell script which in turn
calls ELF binaries !!!
( Aug 11 2005, 02:55:45 AM PDT ) Permalink Comments [1]

Calendar

RSS Feeds

Search

Links

Navigation

Referers