Check-in [8a0dedb7c5]
Overview
Comment:Added wildcard matching to modprobe
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8a0dedb7c5eabc0d228a0ceb7bcfbfd52d489b0a
User & Date: rkeene on 2014-12-15 16:19:19
Other Links: manifest | tags
Context
2014-12-15
16:55
Updated to support scanning /sys/devices for modules to load check-in: 882f8b5c54 user: rkeene tags: trunk
16:19
Added wildcard matching to modprobe check-in: 8a0dedb7c5 user: rkeene tags: trunk
2014-11-03
18:00
Work towards a better ifconfig interface check-in: e28b7fa02d user: rkeene tags: trunk
Changes

Modified test.tcl from [6bb651550d] to [3abe608065].

1
2
3
4
5
6
7
8

9




10
11
12
13
14
15
16
#! /usr/bin/env tclsh

puts [exec ./build-dyn.sh]

load ./tuapi.so

::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<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
#        inet 127.0.0.1 netmask ff000000 
#aggr100003:1: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2
#        inet 140.194.100.149 netmask ffffff00 broadcast 140.194.100.255







|

>
|
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /usr/bin/env tclsh

puts [exec ./build-dyn.sh]

load ./tuapi.so

::tuapi::modprobe pci:v000014E4d0000164Csv00001028sd000001B3bc03sc00i00

#foreach x [list AS CORE CPU DATA FSIZE LOCKS MEMLOCK MSGQUEUE NICE NOFILE OFILE NPROC RSS RTPRIO RTTIME SIGPENDING STACK] {
#	puts "\t\tcase [format 0x%xLU [::tuapi::internal::hash $x]]: /* $x */"
#	puts "\t\t\tresource_id = RLIMIT_$x;"
#	puts "\t\t\tbreak;"
#}
#exit

foreach iface [tuapi::syscall::ifconfig] {
#lo0:2: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
#        inet 127.0.0.1 netmask ff000000 
#aggr100003:1: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2
#        inet 140.194.100.149 netmask ffffff00 broadcast 140.194.100.255

Modified tuapi.tcl from [f5399ad231] to [f69d9c9167].

318
319
320
321
322
323
324



325
326
327
328
329
330
331
	set aliases_file [file join $modules_dir modules.alias]
	set fd [open $aliases_file]
	::tuapi::helper::foreach_line $fd " " {
		set alias [lindex $line 1]
		set module [lindex $line 2]

		set alias2module($alias) $module



	}
	close $fd

	# Load dependencies
	set deps_file [file join $modules_dir modules.dep]
	set fd [open $deps_file]
	::tuapi::helper::foreach_line $fd ":" {







>
>
>







318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
	set aliases_file [file join $modules_dir modules.alias]
	set fd [open $aliases_file]
	::tuapi::helper::foreach_line $fd " " {
		set alias [lindex $line 1]
		set module [lindex $line 2]

		set alias2module($alias) $module
		if {[string match {*\**} $alias]} {
			set alias2module_wildcards($alias) $module
		}
	}
	close $fd

	# Load dependencies
	set deps_file [file join $modules_dir modules.dep]
	set fd [open $deps_file]
	::tuapi::helper::foreach_line $fd ":" {
347
348
349
350
351
352
353








354
355






356
357
358
359
360
361
362
	close $fd

	# Load modules
	foreach modules $args {
		foreach module $modules {
			for {set try 0} {$try < 100} {incr try} {
				if {![info exists alias2module($module)]} {








					break
				}







				set module $alias2module($module)
			}

			if {[info exists module2deps($module)]} {
				set load $module2deps($module)
			} else {







>
>
>
>
>
>
>
>


>
>
>
>
>
>







350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
	close $fd

	# Load modules
	foreach modules $args {
		foreach module $modules {
			for {set try 0} {$try < 100} {incr try} {
				if {![info exists alias2module($module)]} {
					# If no exact match found, process wildcard entries
					set found_wildcard_match 0
					foreach alias [array name alias2module_wildcards] {
						if {[string match $alias $module]} {
							set module $alias2module_wildcards($alias)

							set found_wildcard_match 1

					break
				}
					}

					if {!$found_wildcard_match} {
						break
					}
				}

				set module $alias2module($module)
			}

			if {[info exists module2deps($module)]} {
				set load $module2deps($module)
			} else {