diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-10 00:45:11 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-10 00:45:11 +0000 |
commit | 5ac907eb398c40e4aaecf788d6c9e473eac051a0 (patch) | |
tree | e6b6636cc080eefa1204a2e4ca55a12ec47d1ecb /nuttx/include | |
parent | 44fdf6fc7a8188577cc968233b3ee123e688ab71 (diff) | |
download | px4-firmware-5ac907eb398c40e4aaecf788d6c9e473eac051a0.tar.gz px4-firmware-5ac907eb398c40e4aaecf788d6c9e473eac051a0.tar.bz2 px4-firmware-5ac907eb398c40e4aaecf788d6c9e473eac051a0.zip |
Add spawn attribute logic which will eventually be needed to support posix_spawn()
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5501 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/spawn.h | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/nuttx/include/spawn.h b/nuttx/include/spawn.h index d453fb582..24b68585e 100644 --- a/nuttx/include/spawn.h +++ b/nuttx/include/spawn.h @@ -43,7 +43,10 @@ #include <nuttx/config.h> #include <sys/types.h> + +#include <sched.h> #include <signal.h> +#include <errno.h> /**************************************************************************** * Pre-processor Definitions @@ -65,14 +68,18 @@ ****************************************************************************/ /* "The spawn.h header shall define the posix_spawnattr_t and * posix_spawn_file_actions_t types used in performing spawn operations. + * + * The internal structure underlying the posix_spawnattr_t is exposed here + * because the user will be required to allocate this memory. */ struct posix_spawnattr_s { uint8_t flags; uint8_t priority; - pid_t group; - sigset_t sigset; + uint8_t policy; + sigset_t sigdefault; + sigset_t sigmask; }; typedef struct posix_spawnattr_s posix_spawnattr_t; @@ -99,6 +106,8 @@ extern "C" { #endif +/* posix_spawn[p] interfaces ************************************************/ + int posix_spawn(FAR pid_t *, FAR const char *, FAR const posix_spawn_file_actions_t *, FAR const posix_spawnattr_t *, FAR char *const [], FAR char *const []); @@ -106,9 +115,14 @@ int posix_spawnp(FAR pid_t *, FAR const char *, FAR const posix_spawn_file_actions_t *, FAR const posix_spawnattr_t *, FAR char *const [], FAR char *const []); +/* File action interfaces ***************************************************/ +/* File action initialization and destruction */ + int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *); int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *); +/* Add file action interfaces */ + int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *, int); int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *, @@ -116,11 +130,22 @@ int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *, int posix_spawn_file_actions_addopen(FAR posix_spawn_file_actions_t *, int, FAR const char *, int, mode_t); +/* Spawn attributes interfaces **********************************************/ +/* Spawn attributes initialization and destruction */ + int posix_spawnattr_init(FAR posix_spawnattr_t *); -int posix_spawnattr_destroy(FAR posix_spawnattr_t *); + +/* int posix_spawnattr_destroy(FAR posix_spawnattr_t *); */ +#ifdef CONFIG_DEBUG +# define posix_spawnattr_destroy(attr) (attr ? 0 : EINVAL) +#else +# define posix_spawnattr_destroy(attr) (0) +#endif + +/* Get spawn attributes interfaces */ int posix_spawnattr_getflags(FAR const posix_spawnattr_t *, FAR short *); -int posix_spawnattr_getpgroup(FAR const posix_spawnattr_t *, FAR pid_t *); +#define posix_spawnattr_getpgroup(attr,group) (ENOSYS) int posix_spawnattr_getschedparam(FAR const posix_spawnattr_t *, FAR struct sched_param *); int posix_spawnattr_getschedpolicy(FAR const posix_spawnattr_t *, @@ -130,8 +155,10 @@ int posix_spawnattr_getsigdefault(FAR const posix_spawnattr_t *, int posix_spawnattr_getsigmask(FAR const posix_spawnattr_t *, FAR sigset_t *); +/* Set spawn attributes interfaces */ + int posix_spawnattr_setflags(FAR posix_spawnattr_t *, short); -int posix_spawnattr_setpgroup(FAR posix_spawnattr_t *, pid_t); +#define posix_spawnattr_setpgroup(attr,group) (ENOSYS) int posix_spawnattr_setschedparam(FAR posix_spawnattr_t *, FAR const struct sched_param *); int posix_spawnattr_setschedpolicy(FAR posix_spawnattr_t *, int); |