sched/spawn: Support task_spawnattr_[set|get]stacksize in kernel mode
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
parent
55083b31a9
commit
b9b032af72
@ -106,12 +106,10 @@ int exec_spawn(FAR const char *filename, FAR char * const *argv,
|
||||
bin->priority = attr->priority;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_BUILD_KERNEL
|
||||
if (attr->stacksize > 0)
|
||||
{
|
||||
bin->stacksize = attr->stacksize;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Disable pre-emption so that the executed module does
|
||||
|
@ -87,12 +87,10 @@ struct posix_spawnattr_s
|
||||
#endif
|
||||
|
||||
sigset_t sigmask; /* Signals to be masked */
|
||||
size_t stacksize; /* Task stack size (non-standard) */
|
||||
|
||||
#ifndef CONFIG_BUILD_KERNEL
|
||||
/* Used only by task_spawn (non-standard) */
|
||||
|
||||
FAR void *stackaddr; /* Task stack address */
|
||||
size_t stacksize; /* Task stack size */
|
||||
FAR void *stackaddr; /* Task stack address (non-standard) */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCHED_SPORADIC
|
||||
@ -203,25 +201,21 @@ int posix_spawnattr_setschedpolicy(FAR posix_spawnattr_t *attr, int policy);
|
||||
int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *attr,
|
||||
FAR const sigset_t *sigmask);
|
||||
|
||||
/* Non-standard get/set spawn attributes interfaces for use only with
|
||||
* task_spawn()
|
||||
*/
|
||||
/* Non-standard get/set spawn attributes interfaces */
|
||||
|
||||
int task_spawnattr_getstacksize(FAR const posix_spawnattr_t *attr,
|
||||
FAR size_t *stacksize);
|
||||
int task_spawnattr_setstacksize(FAR posix_spawnattr_t *attr,
|
||||
size_t stacksize);
|
||||
|
||||
#ifndef CONFIG_BUILD_KERNEL
|
||||
int task_spawnattr_getstackaddr(FAR const posix_spawnattr_t *attr,
|
||||
FAR void **stackaddr);
|
||||
int task_spawnattr_setstackaddr(FAR posix_spawnattr_t *attr,
|
||||
FAR void *stackaddr);
|
||||
|
||||
int task_spawnattr_getstacksize(FAR const posix_spawnattr_t *attr,
|
||||
FAR size_t *stacksize);
|
||||
int task_spawnattr_setstacksize(FAR posix_spawnattr_t *attr,
|
||||
size_t stacksize);
|
||||
#else
|
||||
# define task_spawnattr_getstackaddr(attr, addr) (*(addr) = NULL, 0)
|
||||
# define task_spawnattr_setstackaddr(attr, addr) (0)
|
||||
# define task_spawnattr_getstacksize(attr, size) (*(size) = 0, 0)
|
||||
# define task_spawnattr_setstacksize(attr, size) (0)
|
||||
#endif
|
||||
|
||||
/* Non standard debug functions */
|
||||
|
@ -23,21 +23,17 @@
|
||||
CSRCS += lib_psfa_addaction.c lib_psfa_addclose.c lib_psfa_adddup2.c
|
||||
CSRCS += lib_psfa_addopen.c lib_psfa_destroy.c lib_psfa_init.c
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_FEATURES),y)
|
||||
CSRCS += lib_psfa_dump.c
|
||||
endif
|
||||
|
||||
CSRCS += lib_psa_getflags.c lib_psa_getschedparam.c lib_psa_getschedpolicy.c
|
||||
CSRCS += lib_psa_init.c lib_psa_setflags.c lib_psa_setschedparam.c
|
||||
CSRCS += lib_psa_setschedpolicy.c lib_psa_getsigmask.c lib_psa_setsigmask.c
|
||||
CSRCS += lib_psa_getstackaddr.c lib_psa_setstackaddr.c
|
||||
|
||||
ifneq ($(CONFIG_BUILD_KERNEL),y)
|
||||
CSRCS += lib_psa_getstackaddr.c lib_psa_setstackaddr.c
|
||||
CSRCS += lib_psa_getstacksize.c lib_psa_setstacksize.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_FEATURES),y)
|
||||
CSRCS += lib_psa_dump.c
|
||||
CSRCS += lib_psfa_dump.c lib_psa_dump.c
|
||||
endif
|
||||
|
||||
# Add the spawn directory to the build
|
||||
|
@ -28,8 +28,6 @@
|
||||
#include <spawn.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef CONFIG_BUILD_KERNEL
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -59,5 +57,3 @@ int task_spawnattr_getstacksize(FAR const posix_spawnattr_t *attr,
|
||||
*stacksize = attr->stacksize;
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_BUILD_KERNEL */
|
||||
|
@ -98,11 +98,9 @@ int posix_spawnattr_init(posix_spawnattr_t *attr)
|
||||
attr->budget.tv_nsec = param.sched_ss_init_budget.tv_nsec;
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ARCH_ADDRENV
|
||||
/* Default stack size */
|
||||
|
||||
attr->stacksize = CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE;
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -28,8 +28,6 @@
|
||||
#include <spawn.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef CONFIG_BUILD_KERNEL
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -59,5 +57,3 @@ int task_spawnattr_setstacksize(FAR posix_spawnattr_t *attr,
|
||||
attr->stacksize = stacksize;
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_BUILD_KERNEL */
|
||||
|
Loading…
Reference in New Issue
Block a user