When _init(9E) is executing, its call to mod_install() enables other threads to call attach(9E) even prior to mod_install() returning and _init(9E) completion.
From a programming standpoint this means that all _init(9E) initialization must occur prior to _init(9E) calling mod_install(). If mod_install() fails (non-zero return value), any initialization must be undone.

When _fini(9E) is executing, another thread may call attach
(9E) prior to _fini(9E) calling mod_remove(). If this occurs, the mod_remove() fails
(non-zero return). From a programming standpoint, this means that _init(9E) initilizations should only be undone after a successful return from mod_remove
().

To query the name of a module, use mod_modname(). If the module is a driver, the module name is the same as the driver name. This function can be used to avoid compiled-in knowledge of the module name, and is of particular use when _init(9E) needs to call a function like kstat_create(9F).

Return Values

mod_install() and mod_remove() return 0 upon success and non-zero on failure.

mod_info() returns a non-zero value on success and 0 upon failure.

mod_modname() returns the name of the module. The returned name remains valid as long as the module remains loaded.