Modules: Move last of many C files from sched/module to libc/modlib

This commit is contained in:
Gregory Nutt
2017-01-29 11:54:54 -06:00
parent 6da66fb5c8
commit 86bdd0a4c7
16 changed files with 151 additions and 152 deletions
+2 -2
View File
@@ -46,7 +46,7 @@
#include <assert.h> #include <assert.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/module.h> #include <nuttx/lib/modlib.h>
#include <nuttx/binfmt/symtab.h> #include <nuttx/binfmt/symtab.h>
#include <nuttx/nx/nx.h> #include <nuttx/nx/nx.h>
@@ -357,7 +357,7 @@ int boardctl(unsigned int cmd, uintptr_t arg)
(FAR const struct boardioc_symtab_s *)arg; (FAR const struct boardioc_symtab_s *)arg;
DEBUGASSERT(symdesc != NULL); DEBUGASSERT(symdesc != NULL);
mod_setsymtab(symdesc->symtab, symdesc->nsymbols); modlib_setsymtab(symdesc->symtab, symdesc->nsymbols);
ret = OK; ret = OK;
} }
break; break;
+40 -61
View File
@@ -189,8 +189,9 @@ struct mod_loadinfo_s
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/
FAR const struct symtab_s *g_mod_symtab; struct symtab_s;
FAR int g_mod_nsymbols; FAR const struct symtab_s *g_modlib_symtab;
FAR int g_modlib_nsymbols;
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
@@ -227,6 +228,40 @@ int modlib_initialize(FAR const char *filename,
int modlib_uninitialize(FAR struct mod_loadinfo_s *loadinfo); int modlib_uninitialize(FAR struct mod_loadinfo_s *loadinfo);
/****************************************************************************
* Name: modlib_getsymtab
*
* Description:
* Get the current symbol table selection as an atomic operation.
*
* Input Parameters:
* symtab - The location to store the symbol table.
* nsymbols - The location to store the number of symbols in the symbol table.
*
* Returned Value:
* None
*
****************************************************************************/
void modlib_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols);
/****************************************************************************
* Name: modlib_setsymtab
*
* Description:
* Select a new symbol table selection as an atomic operation.
*
* Input Parameters:
* symtab - The new symbol table.
* nsymbols - The number of symbols in the symbol table.
*
* Returned Value:
* None
*
****************************************************************************/
void modlib_setsymtab(FAR const struct symtab_s *symtab, int nsymbols);
/**************************************************************************** /****************************************************************************
* Name: modlib_load * Name: modlib_load
* *
@@ -247,7 +282,7 @@ int modlib_load(FAR struct mod_loadinfo_s *loadinfo);
* *
* Description: * Description:
* Bind the imported symbol names in the loaded module described by * Bind the imported symbol names in the loaded module described by
* 'loadinfo' using the exported symbol values provided by mod_setsymtab(). * 'loadinfo' using the exported symbol values provided by modlib_setsymtab().
* *
* Returned Value: * Returned Value:
* 0 (OK) is returned on success and a negated errno is returned on * 0 (OK) is returned on success and a negated errno is returned on
@@ -258,7 +293,7 @@ int modlib_load(FAR struct mod_loadinfo_s *loadinfo);
int modlib_bind(FAR struct module_s *modp, FAR struct mod_loadinfo_s *loadinfo); int modlib_bind(FAR struct module_s *modp, FAR struct mod_loadinfo_s *loadinfo);
/**************************************************************************** /****************************************************************************
* Name: mod_unload * Name: modlib_unload
* *
* Description: * Description:
* This function unloads the object from memory. This essentially undoes * This function unloads the object from memory. This essentially undoes
@@ -275,7 +310,7 @@ int modlib_bind(FAR struct module_s *modp, FAR struct mod_loadinfo_s *loadinfo);
* *
****************************************************************************/ ****************************************************************************/
int mod_unload(struct mod_loadinfo_s *loadinfo); int modlib_unload(struct mod_loadinfo_s *loadinfo);
/**************************************************************************** /****************************************************************************
* Name: modlib_depend * Name: modlib_depend
@@ -319,21 +354,6 @@ int modlib_depend(FAR struct module_s *importer, FAR struct module_s *exporter);
int modlib_undepend(FAR struct module_s *importer); int modlib_undepend(FAR struct module_s *importer);
#endif #endif
/****************************************************************************
* Name: mod_verifyheader
*
* Description:
* Given the header from a possible ELF executable, verify that it is
* an ELF executable.
*
* Returned Value:
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
****************************************************************************/
int mod_verifyheader(FAR const Elf32_Ehdr *header);
/**************************************************************************** /****************************************************************************
* Name: modlib_read * Name: modlib_read
* *
@@ -350,47 +370,6 @@ int mod_verifyheader(FAR const Elf32_Ehdr *header);
int modlib_read(FAR struct mod_loadinfo_s *loadinfo, FAR uint8_t *buffer, int modlib_read(FAR struct mod_loadinfo_s *loadinfo, FAR uint8_t *buffer,
size_t readsize, off_t offset); size_t readsize, off_t offset);
/****************************************************************************
* Name: mod_symvalue
*
* Description:
* Get the value of a symbol. The updated value of the symbol is returned
* in the st_value field of the symbol table entry.
*
* Input Parameters:
* modp - Module state information
* loadinfo - Load state information
* sym - Symbol table entry (value might be undefined)
*
* Returned Value:
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
* EINVAL - There is something inconsistent in the symbol table (should only
* happen if the file is corrupted)
* ENOSYS - Symbol lies in common
* ESRCH - Symbol has no name
* ENOENT - Symbol undefined and not provided via a symbol table
*
****************************************************************************/
int mod_symvalue(FAR struct module_s *modp,
FAR struct mod_loadinfo_s *loadinfo, FAR Elf32_Sym *sym);
/****************************************************************************
* Name: mod_freebuffers
*
* Description:
* Release all working buffers.
*
* Returned Value:
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
****************************************************************************/
int mod_freebuffers(FAR struct mod_loadinfo_s *loadinfo);
/**************************************************************************** /****************************************************************************
* Name: modlib_registry_lock * Name: modlib_registry_lock
* *
+1 -39
View File
@@ -57,44 +57,6 @@ extern "C"
#define EXTERN extern #define EXTERN extern
#endif #endif
/****************************************************************************
* Name: mod_getsymtab
*
* Description:
* Get the current kernel symbol table selection as an atomic operation.
*
* Input Parameters:
* symtab - The location to store the symbol table.
* nsymbols - The location to store the number of symbols in the symbol table.
*
* Returned Value:
* None
*
****************************************************************************/
#if defined(__KERNEL__) || defined(CONFIG_BUILD_FLAT)
void mod_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols);
#endif
/****************************************************************************
* Name: mod_setsymtab
*
* Description:
* Select a new kernel symbol table selection as an atomic operation.
*
* Input Parameters:
* symtab - The new symbol table.
* nsymbols - The number of symbols in the symbol table.
*
* Returned Value:
* None
*
****************************************************************************/
#if defined(__KERNEL__) || defined(CONFIG_BUILD_FLAT)
void mod_setsymtab(FAR const struct symtab_s *symtab, int nsymbols);
#endif
/**************************************************************************** /****************************************************************************
* Name: insmod * Name: insmod
* *
@@ -102,7 +64,7 @@ void mod_setsymtab(FAR const struct symtab_s *symtab, int nsymbols);
* Verify that the file is an ELF module binary and, if so, load the * Verify that the file is an ELF module binary and, if so, load the
* module into kernel memory and initialize it for use. * module into kernel memory and initialize it for use.
* *
* NOTE: mod_setsymtab had to have been called in board-specific OS logic * NOTE: modlib_setsymtab had to have been called in board-specific OS logic
* prior to calling this function from application logic (perhaps via * prior to calling this function from application logic (perhaps via
* boardctl(BOARDIOC_OS_SYMTAB). Otherwise, insmod will be unable to * boardctl(BOARDIOC_OS_SYMTAB). Otherwise, insmod will be unable to
* resolve symbols in the OS module. * resolve symbols in the OS module.
+2 -1
View File
@@ -42,6 +42,7 @@
#include <dllfcn.h> #include <dllfcn.h>
#include <nuttx/module.h> #include <nuttx/module.h>
#include <nuttx/lib/modlib.h>
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@@ -71,7 +72,7 @@ int dlsymtab(FAR const struct symtab_s *symtab, int nsymbols)
* module. * module.
*/ */
mod_setsymtab(symtab, nsymbols); modlib_setsymtab(symtab, nsymbols);
return OK; return OK;
#elif defined(CONFIG_BUILD_PROTECTED) #elif defined(CONFIG_BUILD_PROTECTED)
+2 -1
View File
@@ -39,7 +39,8 @@ ifeq ($(CONFIG_LIBC_MODLIB),y)
CSRCS += modlib_bind.c modlib_depend.c modlib_init.c modlib_iobuffer.c CSRCS += modlib_bind.c modlib_depend.c modlib_init.c modlib_iobuffer.c
CSRCS += modlib_load.c modlib_read.c modlib_registry.c modlib_sections.c CSRCS += modlib_load.c modlib_read.c modlib_registry.c modlib_sections.c
CSRCS += modlib_symbols.c modlib_uninit.c CSRCS += modlib_symbols.c modlib_symtab.c modlib_uninit.c modlib_unload.c
CSRCS += modlib_verify.c
# Add the modlib directory to the build # Add the modlib directory to the build
+56
View File
@@ -52,6 +52,21 @@
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: modlib_verifyheader
*
* Description:
* Given the header from a possible ELF executable, verify that it is
* an ELF executable.
*
* Returned Value:
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
****************************************************************************/
int modlib_verifyheader(FAR const Elf32_Ehdr *header);
/**************************************************************************** /****************************************************************************
* Name: modlib_findsymtab * Name: modlib_findsymtab
* *
@@ -86,6 +101,33 @@ int modlib_findsymtab(FAR struct mod_loadinfo_s *loadinfo);
int modlib_readsym(FAR struct mod_loadinfo_s *loadinfo, int index, int modlib_readsym(FAR struct mod_loadinfo_s *loadinfo, int index,
FAR Elf32_Sym *sym); FAR Elf32_Sym *sym);
/****************************************************************************
* Name: modlib_symvalue
*
* Description:
* Get the value of a symbol. The updated value of the symbol is returned
* in the st_value field of the symbol table entry.
*
* Input Parameters:
* modp - Module state information
* loadinfo - Load state information
* sym - Symbol table entry (value might be undefined)
*
* Returned Value:
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
* EINVAL - There is something inconsistent in the symbol table (should only
* happen if the file is corrupted)
* ENOSYS - Symbol lies in common
* ESRCH - Symbol has no name
* ENOENT - Symbol undefined and not provided via a symbol table
*
****************************************************************************/
int modlib_symvalue(FAR struct module_s *modp,
FAR struct mod_loadinfo_s *loadinfo, FAR Elf32_Sym *sym);
/**************************************************************************** /****************************************************************************
* Name: modlib_loadshdrs * Name: modlib_loadshdrs
* *
@@ -150,4 +192,18 @@ int modlib_allocbuffer(FAR struct mod_loadinfo_s *loadinfo);
int modlib_reallocbuffer(FAR struct mod_loadinfo_s *loadinfo, size_t increment); int modlib_reallocbuffer(FAR struct mod_loadinfo_s *loadinfo, size_t increment);
/****************************************************************************
* Name: modlib_freebuffers
*
* Description:
* Release all working buffers.
*
* Returned Value:
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
****************************************************************************/
int modlib_freebuffers(FAR struct mod_loadinfo_s *loadinfo);
#endif /* __LIBC_MODLIB_MODLIB_H */ #endif /* __LIBC_MODLIB_MODLIB_H */
+2 -2
View File
@@ -150,7 +150,7 @@ static int modlib_relocate(FAR struct module_s *modp,
/* Get the value of the symbol (in sym.st_value) */ /* Get the value of the symbol (in sym.st_value) */
ret = mod_symvalue(modp, loadinfo, &sym); ret = modlib_symvalue(modp, loadinfo, &sym);
if (ret < 0) if (ret < 0)
{ {
/* The special error -ESRCH is returned only in one condition: The /* The special error -ESRCH is returned only in one condition: The
@@ -217,7 +217,7 @@ static int modlib_relocateadd(FAR struct module_s *modp,
* *
* Description: * Description:
* Bind the imported symbol names in the loaded module described by * Bind the imported symbol names in the loaded module described by
* 'loadinfo' using the exported symbol values provided by mod_setsymtab(). * 'loadinfo' using the exported symbol values provided by modlib_setsymtab().
* *
* Input Parameters: * Input Parameters:
* modp - Module state information * modp - Module state information
+5 -3
View File
@@ -51,6 +51,8 @@
#include <nuttx/module.h> #include <nuttx/module.h>
#include <nuttx/lib/modlib.h> #include <nuttx/lib/modlib.h>
#include "modlib/modlib.h"
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
@@ -181,13 +183,13 @@ int modlib_initialize(FAR const char *filename,
/* Verify the ELF header */ /* Verify the ELF header */
ret = mod_verifyheader(&loadinfo->ehdr); ret = modlib_verifyheader(&loadinfo->ehdr);
if (ret < 0) if (ret < 0)
{ {
/* This may not be an error because we will be called to attempt loading /* This may not be an error because we will be called to attempt loading
* EVERY binary. If mod_verifyheader() does not recognize the ELF header, * EVERY binary. If modlib_verifyheader() does not recognize the ELF header,
* it will -ENOEXEC whcih simply informs the system that the file is not an * it will -ENOEXEC whcih simply informs the system that the file is not an
* ELF file. mod_verifyheader() will return other errors if the ELF header * ELF file. modlib_verifyheader() will return other errors if the ELF header
* is not correctly formed. * is not correctly formed.
*/ */
+1 -1
View File
@@ -287,6 +287,6 @@ int modlib_load(FAR struct mod_loadinfo_s *loadinfo)
/* Error exits */ /* Error exits */
errout_with_buffers: errout_with_buffers:
mod_unload(loadinfo); modlib_unload(loadinfo);
return ret; return ret;
} }
+7 -7
View File
@@ -308,7 +308,7 @@ int modlib_readsym(FAR struct mod_loadinfo_s *loadinfo, int index,
} }
/**************************************************************************** /****************************************************************************
* Name: mod_symvalue * Name: modlib_symvalue
* *
* Description: * Description:
* Get the value of a symbol. The updated value of the symbol is returned * Get the value of a symbol. The updated value of the symbol is returned
@@ -331,8 +331,8 @@ int modlib_readsym(FAR struct mod_loadinfo_s *loadinfo, int index,
* *
****************************************************************************/ ****************************************************************************/
int mod_symvalue(FAR struct module_s *modp, int modlib_symvalue(FAR struct module_s *modp,
FAR struct mod_loadinfo_s *loadinfo, FAR Elf32_Sym *sym) FAR struct mod_loadinfo_s *loadinfo, FAR Elf32_Sym *sym)
{ {
FAR const struct symtab_s *symbol; FAR const struct symtab_s *symbol;
struct mod_exportinfo_s exportinfo; struct mod_exportinfo_s exportinfo;
@@ -400,11 +400,11 @@ int mod_symvalue(FAR struct module_s *modp,
if (symbol == NULL) if (symbol == NULL)
{ {
#ifdef CONFIG_SYMTAB_ORDEREDBYNAME #ifdef CONFIG_SYMTAB_ORDEREDBYNAME
symbol = symtab_findorderedbyname(g_mod_symtab, exportinfo.name, symbol = symtab_findorderedbyname(g_modlib_symtab, exportinfo.name,
g_mod_nsymbols); g_modlib_nsymbols);
#else #else
symbol = symtab_findbyname(g_mod_symtab, exportinfo.name, symbol = symtab_findbyname(g_modlib_symtab, exportinfo.name,
g_mod_nsymbols); g_modlib_nsymbols);
#endif #endif
} }
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* sched/module/mod_symtab.c * libc/modlib/modlib_symtab.c
* *
* Copyright (C) 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -49,15 +49,15 @@
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/
FAR const struct symtab_s *g_mod_symtab; FAR const struct symtab_s *g_modlib_symtab;
FAR int g_mod_nsymbols; FAR int g_modlib_nsymbols;
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: mod_getsymtab * Name: modlib_getsymtab
* *
* Description: * Description:
* Get the current kernel symbol table selection as an atomic operation. * Get the current kernel symbol table selection as an atomic operation.
@@ -71,20 +71,20 @@ FAR int g_mod_nsymbols;
* *
****************************************************************************/ ****************************************************************************/
void mod_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols) void modlib_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols)
{ {
DEBUGASSERT(symtab != NULL && nsymbols != NULL); DEBUGASSERT(symtab != NULL && nsymbols != NULL);
/* Borrow the registry lock to assure atomic access */ /* Borrow the registry lock to assure atomic access */
modlib_registry_lock(); modlib_registry_lock();
*symtab = g_mod_symtab; *symtab = g_modlib_symtab;
*nsymbols = g_mod_nsymbols; *nsymbols = g_modlib_nsymbols;
modlib_registry_unlock(); modlib_registry_unlock();
} }
/**************************************************************************** /****************************************************************************
* Name: mod_setsymtab * Name: modlib_setsymtab
* *
* Description: * Description:
* Select a new kernel symbol table selection as an atomic operation. * Select a new kernel symbol table selection as an atomic operation.
@@ -98,12 +98,12 @@ void mod_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols)
* *
****************************************************************************/ ****************************************************************************/
void mod_setsymtab(FAR const struct symtab_s *symtab, int nsymbols) void modlib_setsymtab(FAR const struct symtab_s *symtab, int nsymbols)
{ {
/* Borrow the registry lock to assure atomic access */ /* Borrow the registry lock to assure atomic access */
modlib_registry_lock(); modlib_registry_lock();
g_mod_symtab = symtab; g_modlib_symtab = symtab;
g_mod_nsymbols = nsymbols; g_modlib_nsymbols = nsymbols;
modlib_registry_unlock(); modlib_registry_unlock();
} }
+4 -3
View File
@@ -48,6 +48,7 @@
#include <nuttx/lib/modlib.h> #include <nuttx/lib/modlib.h>
#include "libc.h" #include "libc.h"
#include "modlib/modlib.h"
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@@ -70,7 +71,7 @@ int modlib_uninitialize(struct mod_loadinfo_s *loadinfo)
{ {
/* Free all working buffers */ /* Free all working buffers */
mod_freebuffers(loadinfo); modlib_freebuffers(loadinfo);
/* Close the ELF file */ /* Close the ELF file */
@@ -83,7 +84,7 @@ int modlib_uninitialize(struct mod_loadinfo_s *loadinfo)
} }
/**************************************************************************** /****************************************************************************
* Name: mod_freebuffers * Name: modlib_freebuffers
* *
* Description: * Description:
* Release all working buffers. * Release all working buffers.
@@ -94,7 +95,7 @@ int modlib_uninitialize(struct mod_loadinfo_s *loadinfo)
* *
****************************************************************************/ ****************************************************************************/
int mod_freebuffers(struct mod_loadinfo_s *loadinfo) int modlib_freebuffers(struct mod_loadinfo_s *loadinfo)
{ {
/* Release all working allocations */ /* Release all working allocations */
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* sched/module/mod_unload.c * libc/modlib/modlib_unload.c
* *
* Copyright (C) 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -42,16 +42,17 @@
#include <stdlib.h> #include <stdlib.h>
#include <debug.h> #include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/module.h> #include <nuttx/module.h>
#include <nuttx/lib/modlib.h> #include <nuttx/lib/modlib.h>
#include "libc.h"
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: mod_unload * Name: modlib_unload
* *
* Description: * Description:
* This function unloads the object from memory. This essentially undoes * This function unloads the object from memory. This essentially undoes
@@ -64,17 +65,17 @@
* *
****************************************************************************/ ****************************************************************************/
int mod_unload(struct mod_loadinfo_s *loadinfo) int modlib_unload(struct mod_loadinfo_s *loadinfo)
{ {
/* Free all working buffers */ /* Free all working buffers */
mod_freebuffers(loadinfo); modlib_freebuffers(loadinfo);
/* Release memory holding the relocated ELF image */ /* Release memory holding the relocated ELF image */
if (loadinfo->textalloc != 0) if (loadinfo->textalloc != 0)
{ {
kmm_free((FAR void *)loadinfo->textalloc); lib_free((FAR void *)loadinfo->textalloc);
} }
/* Clear out all indications of the allocated address environment */ /* Clear out all indications of the allocated address environment */
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* sched/module/mod_verify.c * libc/modlib/modlib_verify.c
* *
* Copyright (C) 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -45,7 +45,7 @@
#include <errno.h> #include <errno.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/module.h> #include <nuttx/lib/modlib.h>
/**************************************************************************** /****************************************************************************
* Private Constant Data * Private Constant Data
@@ -61,7 +61,7 @@ static const char g_modmagic[EI_MAGIC_SIZE] =
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: mod_verifyheader * Name: modlib_verifyheader
* *
* Description: * Description:
* Given the header from a possible ELF executable, verify that it * Given the header from a possible ELF executable, verify that it
@@ -77,7 +77,7 @@ static const char g_modmagic[EI_MAGIC_SIZE] =
* *
****************************************************************************/ ****************************************************************************/
int mod_verifyheader(FAR const Elf32_Ehdr *ehdr) int modlib_verifyheader(FAR const Elf32_Ehdr *ehdr)
{ {
if (!ehdr) if (!ehdr)
{ {
+1 -5
View File
@@ -37,11 +37,7 @@ ifeq ($(CONFIG_MODULE),y)
# OS module interfaces # OS module interfaces
CSRCS += mod_insmod.c mod_rmmod.c mod_modsym.c mod_symtab.c mod_modhandle.c CSRCS += mod_insmod.c mod_rmmod.c mod_modsym.c mod_modhandle.c
# Loadable module library
CSRCS += mod_unload.c mod_verify.c
# procfs support # procfs support
+3 -3
View File
@@ -166,8 +166,8 @@ static void mod_dumpinitializer(mod_initializer_t initializer,
* Verify that the file is an ELF module binary and, if so, load the * Verify that the file is an ELF module binary and, if so, load the
* module into kernel memory and initialize it for use. * module into kernel memory and initialize it for use.
* *
* NOTE: mod_setsymtab had to have been called in board-specific OS logic * NOTE: modlib_setsymtab() had to have been called in board-specific OS
* prior to calling this function from application logic (perhaps via * logicprior to calling this function from application logic (perhaps via
* boardctl(BOARDIOC_OS_SYMTAB). Otherwise, insmod will be unable to * boardctl(BOARDIOC_OS_SYMTAB). Otherwise, insmod will be unable to
* resolve symbols in the OS module. * resolve symbols in the OS module.
* *
@@ -284,7 +284,7 @@ FAR void *insmod(FAR const char *filename, FAR const char *modulename)
return (FAR void *)modp; return (FAR void *)modp;
errout_with_load: errout_with_load:
mod_unload(&loadinfo); modlib_unload(&loadinfo);
(void)modlib_undepend(modp); (void)modlib_undepend(modp);
errout_with_registry_entry: errout_with_registry_entry:
kmm_free(modp); kmm_free(modp);