alcinnz,
@alcinnz@floss.social avatar

To load additional code into kernel-space, you can use various commandline tools which call the appropriate syscalls & device files. With the kmod command dispatching to the appropriate subcommand.

After parsing commandline flags insmod converts remaining arguments into a multi-string, & constructs a Module object to (with preprocessing) call the init_module syscall.

There's someadditional logging infrastructure, which might write to Syslog.

1/3?

alcinnz,
@alcinnz@floss.social avatar

After validating no further args are given lsmod parses each line of /proc/modules (via LibKMod) & iterates over the linkedlist to serialize textual output. Any benefit here beyond cat /proc/modules?

After parsing commandline flags (filling in missing args with uname) depmod constructs some directory paths to consult, validates a dependency files/directory, initializes various objects, iterates over a given file (one format or another) gathering symbols to link into a hashmap, ...
2/4

alcinnz,
@alcinnz@floss.social avatar

... loads all the config files & a directory of modules OR loads the modules listed in commandline args, converts the modules hashmap into an array, parses a modules.order file consulting the hashmap, computes a topological sort of dependencies from the gathered collections, & outputs the results in a choice of format.

After parsing flags filling in missing onesmodinfo builds a KMod context & iterates over remaining args (which it validates exist) loading their modules in 1 of 3 ways.

3/4?

alcinnz,
@alcinnz@floss.social avatar

For each of those modinfos modinfo serializes various info LibKMod has parsed from device files.

After parsing commandline flags modprobe initializes logging, fills in missing parameters, initializes a LibKMod context having it parse its "resources", & runs a chosen subsubcommand.

These subcommands may output various properties of the LibKMod context, output loaded version numbers, output a module's symbols, or hand off to rmmod or insmod.

4/5?

alcinnz,
@alcinnz@floss.social avatar

After parsing commandline flags rmmod initializes a LibKMod context & iterates over remaining commandline args (validating they exist) leading each given module in 1 of 2 ways. Calling the delete_module syscall on each via a light LibKMod wrapper.

After parsing commandline flags static-nodes opens modules.devname device file directly & an output file, to parse the modules.devname to reformat into a chosen format.

5/5 Fin for today! Tomorrow: Kernel-side!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • DreamBathrooms
  • InstantRegret
  • GTA5RPClips
  • magazineikmin
  • mdbf
  • rosin
  • Youngstown
  • khanakhh
  • everett
  • slotface
  • thenastyranch
  • osvaldo12
  • kavyap
  • ngwrru68w68
  • JUstTest
  • ethstaker
  • modclub
  • cubers
  • cisconetworking
  • Durango
  • tacticalgear
  • tester
  • normalnudes
  • Leos
  • megavids
  • provamag3
  • anitta
  • lostlight
  • All magazines