On Sat, 22 Feb 2020, Paul Goyette wrote:
While there, it would be good to implement modctl(MODCTL_MODSTAT, &modstat) to check whether a specific module is loaded into the kernel and retrieve modstat_t describing it. modstat_t m; strlcpy(&m.ms_name, "haxm", MAXMODNAME); if (modctl(MODCTL_MODSTAT, &modstat) == -1) err(EXIT_FAILURE, "modctl: haxm"); I have got use-cases for these checks and I envision their wider usage in future. We already have 3 use-cases in ATF tests.I can probably do this fairly quickly. But I'll have to look closer at the argument/result passing, especially WRT the module's list of "required" modules.
Thinking a bit more, it's probably easiest just to retrieve the entire list of modules with modctl(MODCTL_STAT, ...) and then scan the returned list and compare against ms_name, as is done in modstat(8). Before I invest much time in this, I'd appreciate other opinions on whether a new option is necessary/desirable. +--------------------+--------------------------+-----------------------+ | Paul Goyette | PGP Key fingerprint: | E-mail addresses: | | (Retired) | FA29 0E3B 35AF E8AE 6651 | paul%whooppee.com@localhost | | Software Developer | 0786 F758 55DE 53BA 7731 | pgoyette%netbsd.org@localhost | +--------------------+--------------------------+-----------------------+