Don't build task_create() or task_spawn() interfaces if there is an addres environment

This commit is contained in:
Gregory Nutt 2014-09-14 08:22:21 -06:00
parent eae146d641
commit e12213592b
10 changed files with 37 additions and 6 deletions

View file

@ -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);

View file

@ -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 */

View file

@ -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

View file

@ -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

View file

@ -43,8 +43,10 @@
#include <spawn.h>
#include <assert.h>
#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 */

View file

@ -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;
}

View file

@ -43,8 +43,10 @@
#include <spawn.h>
#include <assert.h>
#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 */

View file

@ -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

View file

@ -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

View file

@ -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 */