From 944ae31c93bdce6f00549d261c3654778eca3ece Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 14 Sep 2014 08:22:21 -0600 Subject: Don't build task_create() or task_spawn() interfaces if there is an addres environment --- nuttx/include/sched.h | 3 +++ nuttx/include/spawn.h | 4 ++++ nuttx/libc/Kconfig | 1 + nuttx/libc/spawn/Make.defs | 9 ++++++--- nuttx/libc/spawn/lib_psa_getstacksize.c | 6 +++++- nuttx/libc/spawn/lib_psa_init.c | 2 ++ nuttx/libc/spawn/lib_psa_setstacksize.c | 6 +++++- nuttx/sched/task/Make.defs | 6 +++++- nuttx/sched/task/task_create.c | 2 ++ nuttx/sched/task/task_spawn.c | 4 ++++ 10 files changed, 37 insertions(+), 6 deletions(-) diff --git a/nuttx/include/sched.h b/nuttx/include/sched.h index 96afbedb8..64d6a6b82 100644 --- a/nuttx/include/sched.h +++ b/nuttx/include/sched.h @@ -98,8 +98,11 @@ int task_init(FAR struct tcb_s *tcb, const char *name, int priority, FAR uint32_t *stack, uint32_t stack_size, main_t entry, FAR char * const argv[]); int task_activate(FAR struct tcb_s *tcb); + +#ifndef CONFIG_ARCH_ADDRENV int task_create(FAR const char *name, int priority, int stack_size, main_t entry, FAR char * const argv[]); +#endif int task_delete(pid_t pid); int task_restart(pid_t pid); diff --git a/nuttx/include/spawn.h b/nuttx/include/spawn.h index 7ab9bb498..f994ac51f 100644 --- a/nuttx/include/spawn.h +++ b/nuttx/include/spawn.h @@ -89,9 +89,11 @@ struct posix_spawnattr_s sigset_t sigmask; /* Signals to be masked */ #endif +#ifndef CONFIG_ARCH_ADDRENV /* Used only by task_spawn (non-standard) */ size_t stacksize; /* Task stack size */ +#endif }; typedef struct posix_spawnattr_s posix_spawnattr_t; @@ -139,6 +141,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, posix_spawn(pid,path,file_actions,attr,argv,envp) #endif +#ifndef CONFIG_ARCH_ADDRENV /* Non-standard task_spawn interface. This function uses the same * semantics to execute a file in memory at 'entry', giving it the name * 'name'. @@ -148,6 +151,7 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry, FAR const posix_spawn_file_actions_t *file_actions, FAR const posix_spawnattr_t *attr, FAR char *const argv[], FAR char *const envp[]); +#endif /* File action interfaces ***************************************************/ /* File action initialization and destruction */ diff --git a/nuttx/libc/Kconfig b/nuttx/libc/Kconfig index e11e0a7cc..07f549c08 100644 --- a/nuttx/libc/Kconfig +++ b/nuttx/libc/Kconfig @@ -154,6 +154,7 @@ config POSIX_SPAWN_PROXY_STACKSIZE config TASK_SPAWN_DEFAULT_STACKSIZE int "Default task_spawn Stack Size" default 2048 + depends on !ARCH_ADDRENV ---help--- The actual size to use for the child task's stack can be set with task_spawnattr_setstacksize(). This value specifies the default diff --git a/nuttx/libc/spawn/Make.defs b/nuttx/libc/spawn/Make.defs index f453a7d2d..d186de38e 100644 --- a/nuttx/libc/spawn/Make.defs +++ b/nuttx/libc/spawn/Make.defs @@ -43,14 +43,17 @@ CSRCS += lib_psfa_dump.c endif CSRCS += lib_psa_getflags.c lib_psa_getschedparam.c lib_psa_getschedpolicy.c -CSRCS += lib_psa_getstacksize.c lib_psa_init.c lib_psa_setflags.c -CSRCS += lib_psa_setschedparam.c lib_psa_setschedpolicy.c -CSRCS += lib_psa_setstacksize.c +CSRCS += lib_psa_init.c lib_psa_setflags.c lib_psa_setschedparam.c +CSRCS += lib_psa_setschedpolicy.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CSRCS += lib_psa_getsigmask.c lib_psa_setsigmask.c endif +ifneq ($(CONFIG_ARCH_ADDRENV),y) +CSRCS += lib_psa_getstacksize.c lib_psa_setstacksize.c +endif + ifeq ($(CONFIG_DEBUG),y) CSRCS += lib_psa_dump.c endif diff --git a/nuttx/libc/spawn/lib_psa_getstacksize.c b/nuttx/libc/spawn/lib_psa_getstacksize.c index ab499f5de..892c92265 100644 --- a/nuttx/libc/spawn/lib_psa_getstacksize.c +++ b/nuttx/libc/spawn/lib_psa_getstacksize.c @@ -43,8 +43,10 @@ #include #include +#ifndef CONFIG_ARCH_ADDRENV + /**************************************************************************** - * Global Functions + * Public Functions ****************************************************************************/ /**************************************************************************** @@ -72,3 +74,5 @@ int task_spawnattr_getstacksize(FAR const posix_spawnattr_t *attr, *stacksize = attr->stacksize; return OK; } + +#endif /* CONFIG_ARCH_ADDRENV */ diff --git a/nuttx/libc/spawn/lib_psa_init.c b/nuttx/libc/spawn/lib_psa_init.c index ba1134281..815376e7b 100644 --- a/nuttx/libc/spawn/lib_psa_init.c +++ b/nuttx/libc/spawn/lib_psa_init.c @@ -100,8 +100,10 @@ int posix_spawnattr_init(posix_spawnattr_t *attr) attr->sigmask = 0; #endif +#ifndef CONFIG_ARCH_ADDRENV /* Default stack size */ attr->stacksize = CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE; +#endif return OK; } diff --git a/nuttx/libc/spawn/lib_psa_setstacksize.c b/nuttx/libc/spawn/lib_psa_setstacksize.c index d49a1d611..c7d815106 100644 --- a/nuttx/libc/spawn/lib_psa_setstacksize.c +++ b/nuttx/libc/spawn/lib_psa_setstacksize.c @@ -43,8 +43,10 @@ #include #include +#ifdef CONFIG_ARCH_ADDRENV + /**************************************************************************** - * Global Functions + * Public Functions ****************************************************************************/ /**************************************************************************** @@ -71,3 +73,5 @@ int task_spawnattr_setstacksize(FAR posix_spawnattr_t *attr, size_t stacksize) attr->stacksize = stacksize; return OK; } + +#endif /* CONFIG_ARCH_ADDRENV */ diff --git a/nuttx/sched/task/Make.defs b/nuttx/sched/task/Make.defs index 9a265056a..e393f9947 100644 --- a/nuttx/sched/task/Make.defs +++ b/nuttx/sched/task/Make.defs @@ -35,7 +35,7 @@ TSK_SRCS = task_create.c task_init.c task_setup.c task_activate.c TSK_SRCS += task_start.c task_delete.c task_exit.c task_exithook.c -TSK_SRCS += task_recover.c task_restart.c task_spawn.c task_spawnparms.c +TSK_SRCS += task_recover.c task_restart.c task_spawnparms.c TSK_SRCS += task_terminate.c task_getgroup.c task_prctl.c task_getpid.c TSK_SRCS += exit.c @@ -45,6 +45,10 @@ TSK_SRCS += task_vfork.c endif endif +ifneq ($(CONFIG_ARCH_ADDRENV),y) +TSK_SRCS += task_spawn.c +endif + ifneq ($(CONFIG_BINFMT_DISABLE),y) ifeq ($(CONFIG_LIBC_EXECFUNCS),y) TSK_SRCS += task_posixspawn.c diff --git a/nuttx/sched/task/task_create.c b/nuttx/sched/task/task_create.c index cb01ff496..f2078b592 100644 --- a/nuttx/sched/task/task_create.c +++ b/nuttx/sched/task/task_create.c @@ -240,11 +240,13 @@ errout: * ****************************************************************************/ +#ifndef CONFIG_ARCH_ADDRENV int task_create(FAR const char *name, int priority, int stack_size, main_t entry, FAR char * const argv[]) { return thread_create(name, TCB_FLAG_TTYPE_TASK, priority, stack_size, entry, argv); } +#endif /**************************************************************************** * Name: kernel_thread diff --git a/nuttx/sched/task/task_spawn.c b/nuttx/sched/task/task_spawn.c index 2b09e63bb..eb2983bf0 100644 --- a/nuttx/sched/task/task_spawn.c +++ b/nuttx/sched/task/task_spawn.c @@ -49,6 +49,8 @@ #include "task/spawn.h" #include "task/task.h" +#ifndef CONFIG_ARCH_ADDRENV + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -452,3 +454,5 @@ errout_with_lock: spawn_semgive(&g_spawn_parmsem); return ret; } + +#endif /* CONFIG_ARCH_ADDRENV */ -- cgit v1.2.3