On 22.02.2020 15:32, Paul Goyette wrote: > 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. > > Performance is probably not critical so it sounds fine. I would like to have at least get_modstat_info() from t_modctl.c in libutil.
Attachment:
signature.asc
Description: OpenPGP digital signature