From 532ba867c6225d1fef4879fbcd1f922f799bbf09 Mon Sep 17 00:00:00 2001
From: patacongo User's Manual by Gregory Nutt
- Last Updated: January 23, 2013 Last Updated: February 2, 2013
Standard
+ Non-standard task control interfaces inspired by
@@ -336,7 +343,7 @@ VxWorks provides the following similar interface:
@@ -831,7 +838,7 @@ int posix_spawnp(FAR pid_t *pid, FAR const char *file,
Description:
- The
+ The
Input Parameters:
@@ -1403,6 +1410,206 @@ int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *attr, FAR const sigset_t *
On success, this function returns 0; on failure it will return an error number from
+ Function Prototype:
+
+ Description:
+ The NuttX Operating System
posix_spawn
interfaces:
+posix_spawn
:
+2.1.1 task_create
@@ -246,7 +253,7 @@ paragraphs.
Function Prototype:
#include <sched.h>
-int task_create(char *name, int priority, int stack_size, main_t entry, const char *argv[]);
+int task_create(char *name, int priority, int stack_size, main_t entry, char * const argv[]);
#include <sched.h>
int task_init(_TCB *tcb, char *name, int priority, uint32_t *stack, uint32_t stack_size,
- maint_t entry, const char *argv[]);
+ maint_t entry, char * const argv[]);
posix_spawn()
and posix_spawnp()
functions will create a new, child task, constructed from a regular executable file.posix_spawn()
and posix_spawnp()
functions will create a new, child task, constructed from a regular executable file.
<errno.h>
2.1.26 task_spawn
+
+#include <spawn.h>
+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[]);
+
+task_spawn()
function will create a new, child task, where the entry point to the task is an address in memory.
+
+ pid
:
+ Upon successful completion, task_spawn()
will return the task ID of the child task to the parent task, in the variable pointed to by a non-NULL pid
argument.
+ If the pid
argument is a null pointer, the process ID of the child is not returned to the caller.
+
+ name
:
+ The name to assign to the child task.
+
+ entry
:
+ The child task's entry point (an address in memory).
+
+ file_actions
:
+ If file_actions
is a null pointer, then file descriptors open in the calling process will remain open in the child process (unless CONFIG_FDCLONE_STDIO
is defined).
+ If file_actions
is not NULL, then the file descriptors open in the child process will be those open in the calling process as modified by the spawn file actions object pointed to by file_actions
.
+
+ attr
:
+ If the value of the attr
parameter is NULL
, the all default values for the POSIX spawn attributes will be used.
+ Otherwise, the attributes will be set according to the spawn flags.
+ The posix_spawnattr_t
spawn attributes object type is defined in spawn.h
.
+ It will contains these attributes, not all of which are supported by NuttX:
+
POSIX_SPAWN_SETPGROUP
:
+ Setting of the new task's process group is not supported.
+ NuttX does not support process groups.
+ POSIX_SPAWN_SETSCHEDPARAM
:
+ Set new tasks priority to the sched_param
value.
+ POSIX_SPAWN_SETSCHEDULER
:
+ Set the new task's scheduler policy to the sched_policy
value.
+ POSIX_SPAWN_RESETIDS
+ Resetting of the effective user ID of the child process is not supported.
+ NuttX does not support effective user IDs.
+ POSIX_SPAWN_SETSIGMASK
:
+ Set the new task's signal mask.
+ POSIX_SPAWN_SETSIGDEF
:
+ Resetting signal default actions is not supported.
+ NuttX does not support default signal actions.
+ + And the non-standard: +
+TASK_SPAWN_SETSTACKSIZE
:
+ Set the stack size for the new task.
+
+ argv
:
+ argv[]
is the argument list for the new task. argv[]
is an array of pointers to null-terminated strings.
+ The list is terminated with a null pointer.
+
+ envp
:
+ The envp[]
argument is not used by NuttX and may be NULL
.
+
+ Returned Value:
+ task_spawn()
will return zero on success.
+ Otherwise, an error number will be returned as the function return value to indicate the error:
+
+ POSIX Compatibility:
+ This is a non-standard interface inspired by posix_spawn()
.
+
+ Function Prototype: +
++#include <spawn.h> +int task_spawnattr_getstacksize(FAR const posix_spawnattr_t *attr, FAR size_t *stacksize); ++
+ Description:
+ The task_spawnattr_getstacksize()
function will obtain the value of the spawn-stacksize attribute from the attributes object referenced by attr
.
+
+ Input Parameters: +
+attr
:
+ The address spawn attributes to be queried.
+ policy
:
+ The location to return the spawn-stacksize value.
+
+ Returned Value:
+ On success, this function returns 0; on failure it will return an error number from <errno.h>
+
+ Function Prototype: +
++#include <spawn.h> +int task_spawnattr_setstacksize(FAR posix_spawnattr_t *attr, size_t stacksize); ++
+ Description:
+ The task_spawnattr_setstacksize()
function will set the spawn-stacksize attribute in an initialized attributes object referenced by attr
.
+
+ Input Parameters: +
+attr
:
+ The address spawn attributes to be used.
+ policy
:
+ The new value of the spawn-stacksize attribute.
+
+ Returned Value:
+ On success, this function returns 0; on failure it will return an error number from <errno.h>
+
+ Function Prototype: +
++#include <spawn.h> +int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *file_actions); ++
+ Description:
+ The posix_spawn_file_actions_init()
function initializes the object referenced by file_actions
to an empty set of file actions for subsequent use in a call to posix_spawn()
or posix_spawnp()
.
+
+ Input Parameters: +
+file_actions
:
+ The address of the posix_spawn_file_actions_t
to be initialized.
+
+ Returned Value:
+ On success, this function returns 0; on failure it will return an error number from <errno.h>
.
+
+
@@ -9277,9 +9484,9 @@ notify a task when a message is available on a queue.
|
- |
-
|
+
|