Index: test.tcl ================================================================== --- test.tcl +++ test.tcl @@ -2,11 +2,11 @@ puts [exec ./build-dyn.sh] load ./tuapi.so -::tuapi::modprobe fuse +::tuapi::modprobe /dev/fuse ::tuapi::syscall::tsmf_start_svc blah /bin/true /tmp/logfile [list PATH=/bin] / 022 0 0 10 foreach iface [tuapi::syscall::ifconfig] { #lo0:2: flags=2001000849 mtu 8232 index 1 Index: tuapi.tcl ================================================================== --- tuapi.tcl +++ tuapi.tcl @@ -272,12 +272,32 @@ } uplevel 1 [list unset -nocomplain line] } proc ::tuapi::modprobe args { - # Load aliases + # Set module base directory set modules_dir [file join /lib/modules $::tcl_platform(osVersion)] + + # Load device names + set devnames_file [file join $modules_dir modules.devname] + set fd [open $devnames_file] + ::tuapi::internal::foreach_line $fd " " { + set module [lindex $line 0] + set device [lindex $line 1] + set id [lindex $line 2] + + set id_type [string index $id 0] + set id_type [string map [list "c" "char" "b" "block"] $id_type] + set id [split [string range $id 1 end] :] + set id_alias "${id_type}-major-[lindex $id 0]-[lindex $id 1]" + + set "alias2module(/dev/${device})" $module + set alias2module($id_alias) $module + } + close $fd + + # Load aliases set aliases_file [file join $modules_dir modules.alias] set fd [open $aliases_file] ::tuapi::internal::foreach_line $fd " " { set alias [lindex $line 1] set module [lindex $line 2] @@ -325,12 +345,16 @@ } lappend load $module foreach module $load { + if {[string match "/dev/*" $module]} { + return -code error "Unable to lookup device node module for $module" + } + set module [file join $modules_dir $module] ::tuapi::syscall::insmod $module } } } }