sched/task: Simplify the syscall handling of task_spawn

It's better to save one argument by returning pid directly.
This change also follow the convention of task_create.
BTW, it is reasonable to adjust the function prototype a
little bit from both implementation and consistency since
task_spawn is NuttX specific API.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2021-05-12 11:34:50 +08:00
committed by Masayuki Ishikawa
parent 72d2fc547e
commit ae216cf9e9
8 changed files with 34 additions and 178 deletions
+1 -1
View File
@@ -68,7 +68,6 @@
"nx_pipe","nuttx/fs/fs.h","defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0","int","int [2]|FAR int *","size_t","int"
"nx_pthread_create","nuttx/pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_trampoline_t","FAR pthread_t *","FAR const pthread_attr_t *","pthread_startroutine_t","pthread_addr_t","pthread_exitroutine_t"
"nx_pthread_exit","nuttx/pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","noreturn","pthread_addr_t"
"nx_task_spawn","nuttx/spawn.h","defined(CONFIG_LIB_SYSCALL) && !defined(CONFIG_BUILD_KERNEL)","int","FAR const struct spawn_syscall_parms_s *"
"nx_vsyslog","nuttx/syslog/syslog.h","","int","int","FAR const IPTR char *","FAR va_list *"
"nxsched_get_stackinfo","nuttx/sched.h","","int","pid_t","FAR struct stackinfo_s *"
"nxsched_get_streams","nuttx/sched.h","defined(CONFIG_FILE_STREAM)","FAR struct streamlist *"
@@ -169,6 +168,7 @@
"task_restart","sched.h","","int","pid_t"
"task_setcancelstate","sched.h","","int","int","FAR int *"
"task_setcanceltype","sched.h","defined(CONFIG_CANCELLATION_POINTS)","int","int","FAR int *"
"task_spawn","nuttx/spawn.h","!defined(CONFIG_BUILD_KERNEL)","int","FAR const char *","main_t","FAR const posix_spawn_file_actions_t *","FAR const posix_spawnattr_t *","FAR char * const []|FAR char * const *","FAR char * const []|FAR char * const *"
"task_testcancel","pthread.h","defined(CONFIG_CANCELLATION_POINTS)","void"
"tcdrain","termios.h","defined(CONFIG_SERIAL_TERMIOS)","int","int"
"telldir","dirent.h","","off_t","FAR DIR *"
1 _exit unistd.h noreturn int
68 nx_pipe nuttx/fs/fs.h defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0 int int [2]|FAR int *
69 nx_pthread_create nuttx/pthread.h !defined(CONFIG_DISABLE_PTHREAD) int pthread_trampoline_t
70 nx_pthread_exit nuttx/pthread.h !defined(CONFIG_DISABLE_PTHREAD) noreturn pthread_addr_t
nx_task_spawn nuttx/spawn.h defined(CONFIG_LIB_SYSCALL) && !defined(CONFIG_BUILD_KERNEL) int FAR const struct spawn_syscall_parms_s *
71 nx_vsyslog nuttx/syslog/syslog.h int int
72 nxsched_get_stackinfo nuttx/sched.h int pid_t
73 nxsched_get_streams nuttx/sched.h defined(CONFIG_FILE_STREAM) FAR struct streamlist *
168 task_restart sched.h int pid_t
169 task_setcancelstate sched.h int int
170 task_setcanceltype sched.h defined(CONFIG_CANCELLATION_POINTS) int int
171 task_spawn nuttx/spawn.h !defined(CONFIG_BUILD_KERNEL) int FAR const char *
172 task_testcancel pthread.h defined(CONFIG_CANCELLATION_POINTS) void
173 tcdrain termios.h defined(CONFIG_SERIAL_TERMIOS) int int
174 telldir dirent.h off_t FAR DIR *