Add logic to automatically unload module on exit; Several patches from Mike Smith
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5528 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
b9012ee3ec
commit
cdc16263ee
@ -39,7 +39,7 @@ include $(APPDIR)/Make.defs
|
|||||||
# Source and object files
|
# Source and object files
|
||||||
|
|
||||||
ASRCS =
|
ASRCS =
|
||||||
CSRCS = builtin.c exec_builtin.c
|
CSRCS = builtin.c builtin_list.c exec_builtin.c
|
||||||
|
|
||||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||||
|
@ -55,27 +55,8 @@
|
|||||||
* Public Data
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#undef EXTERN
|
extern const struct builtin_s g_builtins[];
|
||||||
#if defined(__cplusplus)
|
extern const int g_builtin_count;
|
||||||
#define EXTERN extern "C"
|
|
||||||
extern "C" {
|
|
||||||
#else
|
|
||||||
#define EXTERN extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "builtin_proto.h"
|
|
||||||
|
|
||||||
const struct builtin_s g_builtins[] =
|
|
||||||
{
|
|
||||||
# include "builtin_list.h"
|
|
||||||
{ NULL, 0, 0, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
#undef EXTERN
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@ -89,9 +70,11 @@ const struct builtin_s g_builtins[] =
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int number_builtins(void)
|
FAR const struct builtin_s *builtin_for_index(int index)
|
||||||
{
|
{
|
||||||
return sizeof(g_builtins)/sizeof(struct builtin_s) - 1;
|
if (index < g_builtin_count)
|
||||||
|
{
|
||||||
|
return &g_builtins[index];
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,8 +142,17 @@ static void bultin_semtake(FAR sem_t *sem)
|
|||||||
|
|
||||||
static int builtin_taskcreate(int index, FAR const char **argv)
|
static int builtin_taskcreate(int index, FAR const char **argv)
|
||||||
{
|
{
|
||||||
|
FAR const struct builtin_s *b;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
b = builtin_for_index(index);
|
||||||
|
|
||||||
|
if (b == NULL)
|
||||||
|
{
|
||||||
|
errno = ENOENT;
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
/* Disable pre-emption. This means that although we start the builtin
|
/* Disable pre-emption. This means that although we start the builtin
|
||||||
* application here, it will not actually run until pre-emption is
|
* application here, it will not actually run until pre-emption is
|
||||||
* re-enabled below.
|
* re-enabled below.
|
||||||
@ -153,8 +162,7 @@ static int builtin_taskcreate(int index, FAR const char **argv)
|
|||||||
|
|
||||||
/* Start the builtin application task */
|
/* Start the builtin application task */
|
||||||
|
|
||||||
ret = TASK_CREATE(g_builtins[index].name, g_builtins[index].priority,
|
ret = TASK_CREATE(b->name, b->priority, b->stacksize, b->main,
|
||||||
g_builtins[index].stacksize, g_builtins[index].main,
|
|
||||||
(argv) ? &argv[1] : (FAR const char **)NULL);
|
(argv) ? &argv[1] : (FAR const char **)NULL);
|
||||||
|
|
||||||
/* If robin robin scheduling is enabled, then set the scheduling policy
|
/* If robin robin scheduling is enabled, then set the scheduling policy
|
||||||
@ -171,7 +179,7 @@ static int builtin_taskcreate(int index, FAR const char **argv)
|
|||||||
* new task cannot yet have changed from its initial value.
|
* new task cannot yet have changed from its initial value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
param.sched_priority = g_builtins[index].priority;
|
param.sched_priority = b->priority;
|
||||||
(void)sched_setscheduler(ret, SCHED_RR, ¶m);
|
(void)sched_setscheduler(ret, SCHED_RR, ¶m);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -293,8 +301,6 @@ static inline int builtin_startproxy(int index, FAR const char **argv,
|
|||||||
int errcode;
|
int errcode;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
DEBUGASSERT(path);
|
|
||||||
|
|
||||||
svdbg("index=%d argv=%p redirfile=%s oflags=%04x\n",
|
svdbg("index=%d argv=%p redirfile=%s oflags=%04x\n",
|
||||||
index, argv, redirfile, oflags);
|
index, argv, redirfile, oflags);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user