modules: Add more information to registry just for procfs
This commit is contained in:
parent
795ddd7e80
commit
917dbc8540
4 changed files with 27 additions and 6 deletions
|
@ -249,11 +249,17 @@ int insmod(FAR const char *filename, FAR const char *modulename,
|
|||
/* Return the load information */
|
||||
|
||||
modp->alloc = (FAR void *)loadinfo.textalloc;
|
||||
modp->size = loadinfo.textsize + loadinfo.datasize;
|
||||
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MODULE)
|
||||
modp->textsize = loadinfo.textsize;
|
||||
modp->datasize = loadinfo.datasize;
|
||||
#endif
|
||||
|
||||
/* Get the module initializer entry point */
|
||||
|
||||
initializer = (mod_initializer_t)(loadinfo.textalloc + loadinfo.ehdr.e_entry);
|
||||
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MODULE)
|
||||
modp->initializer = initializer;
|
||||
#endif
|
||||
mod_dumpinitializer(initializer, &loadinfo);
|
||||
|
||||
/* Call the module initializer */
|
||||
|
|
|
@ -152,9 +152,12 @@ static int modprocfs_callback(FAR struct module_s *modp, FAR void *arg)
|
|||
DEBUGASSERT(modp != NULL && arg != NULL);
|
||||
priv = (FAR struct modprocfs_file_s *)arg;
|
||||
|
||||
linesize = snprintf(priv->line, MOD_LINELEN, "%s,%p,%p,%p,%lu\n",
|
||||
modp->modulename, modp->uninitializer, modp->arg,
|
||||
modp->alloc, (unsigned long)modp->size);
|
||||
linesize = snprintf(priv->line, MOD_LINELEN, "%s,%p,%p,%p,%p,%lu,%p,%lu\n",
|
||||
modp->modulename, modp->initializer,
|
||||
modp->uninitializer, modp->arg,
|
||||
modp->alloc, (unsigned long)modp->textsize,
|
||||
(FAR uint8_t *)modp->alloc + modp->textsize,
|
||||
(unsigned long)modp->datasize);
|
||||
copysize = procfs_memcpy(priv->line, linesize, priv->buffer,
|
||||
priv->remaining, &priv->offset);
|
||||
priv->totalsize += copysize;
|
||||
|
|
|
@ -111,6 +111,9 @@ int rmmod(FAR const char *modulename)
|
|||
|
||||
/* Nullify so that the uninitializer cannot be called again */
|
||||
|
||||
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MODULE)
|
||||
modp->initializer = NULL;
|
||||
#endif
|
||||
modp->uninitializer = NULL;
|
||||
modp->arg = NULL;
|
||||
}
|
||||
|
@ -126,7 +129,10 @@ int rmmod(FAR const char *modulename)
|
|||
/* Nullify so that the memory cannot be freed again */
|
||||
|
||||
modp->alloc = NULL;
|
||||
modp->size = 0;
|
||||
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MODULE)
|
||||
modp->textsize = 0;
|
||||
modp->datasize = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Remove the module from the registry */
|
||||
|
|
|
@ -59,10 +59,16 @@ struct module_s
|
|||
{
|
||||
FAR struct module_s *flink; /* Supports a singly linked list */
|
||||
FAR char modulename[MODULENAME_MAX]; /* Module name */
|
||||
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MODULE)
|
||||
mod_initializer_t initializer; /* Module initializer function */
|
||||
#endif
|
||||
mod_uninitializer_t uninitializer; /* Module uninitializer function */
|
||||
FAR void *arg; /* Uninitializer argument */
|
||||
FAR void *alloc; /* Allocated kernel memory */
|
||||
size_t size; /* Size of the kernel memory allocation */
|
||||
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MODULE)
|
||||
size_t textsize; /* Size of the kernel .text memory allocation */
|
||||
size_t datasize; /* Size of the kernel .bss/.data memory allocation */
|
||||
#endif
|
||||
};
|
||||
|
||||
/* This struct provides a description of the currently loaded instantiation
|
||||
|
|
Loading…
Reference in a new issue