Modules are registered with the RAD daemon in the _rad_reg(). This is automatically generated from the information contained within the IDL defining the module.
Each module is required to provide a function, _rad_init(), for initializing the module. This function is called before any other function in the module. Similarly, the _rad_fini() in the module is called by the RAD daemon just prior to unloading the module.
Example 6-1 Module Initialization#include <rad/rad_modapi.h>
int
_rad_init(void)
{
adr_name _t *uname = adr_name_vcreate("com.oracle.solaris.rad.user", 1, "type", "User");
conerr_t cerr = rad_cont_insert_singleton(&rad_container, uname, &interface_User_svr);
adr_name_rele(uname);
if (cerr != CE_OK)
{
rad_log(RL_ERROR, "failed to insert module in container");
return(-1);
}
return (0);
}