Solved List of kernel modules in use

The dmesg(8) output is usually a good place to start looking. But in case that got rotated away, /var/log/messages. Look for the kernel messages just after booting. That will show you what's detected.
 
Yes but for example my dmesg shows u3g started when I am using a wired connection and no modem in use. So module is showing in kldstat with its memory address used but it is not in use..Dynamically loaded but not in use until called.

So really to find modules "in use" you would need to use top or ps correct?
How would you show memory usage by module?
 
Code:
: ${_DIR_TREE_MODULES:="$(find /usr/src/sys/modules -type d | egrep -v "tests|dtb" | awk -F "/usr/src/sys/modules/" '{ print $2 }' )"}
_LIST_MENU="$(echo "${_DIR_TREE_MODULES}" | awk -v path="/usr/src/sys/modules" '{ print "awk -F \x27KMOD\x27 \x27/^KMOD/ {print \""$1 "\" $2 \" off \"}\x27 "path"/"$1"/Makefile" }' | egrep -v "^&"  | tr '\t' ' ' | sh 2>/dev/null  | sed 's|=| |g'  | tr '\t' ' ')"
 
Code:
: ${_DIR_TREE_MODULES:="$(find /usr/src/sys/modules -type d | egrep -v "tests|dtb" | awk -F "/usr/src/sys/modules/" '{ print $2 }' )"}
_LIST_MENU="$(echo "${_DIR_TREE_MODULES}" | awk -v path="/usr/src/sys/modules" '{ print "awk -F \x27KMOD\x27 \x27/^KMOD/ {print \""$1 "\" $2 \" off \"}\x27 "path"/"$1"/Makefile" }' | egrep -v "^&"  | tr '\t' ' ' | sh 2>/dev/null  | sed 's|=| |g'  | tr '\t' ' ')"
lol. Maybe some explanation is needed here? Looks amazing, but what does it do? Not sure anyone will want to copy/paste and run this on their system without having a summary of what it's doing. 😆
 
Back
Top