Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/tests/modules



On Sat, 22 Feb 2020, Kamil Rytarowski 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.

Sure that seems reasonable to me.

Assuming that noone else objects, please feel free to move it.  I
think we should also update the test program to use the new libutil
version (rather than duplicating the code).  Also update the libutil
man page?

I guess that the return type of get_modstat_info() should be changed
to int rather than bool?  And that it shouldn't directly print error
messages?  :)



+--------------------+--------------------------+-----------------------+
| 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   |
+--------------------+--------------------------+-----------------------+


Home | Main Index | Thread Index | Old Index