Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

posix_spawnattr_init()

Initialize the spawn attributes object.

Synopsis:

#include  <posix_spawnattr.h>

int posix_spawnattr_init(posix_spawnattr_t *attrp);

Arguments:

attrp
The posix_spawnattr_init() function initializes a spawn attributes object attrp with the default value for all of the individual attributes used by the implementation. Results are undefined if posix_spawnattr_init() is called specifying an already initialized attrp attributes object.
posix_spawnattr_t
A spawn attributes object is of type posix_spawnattr_t (defined in <spawn.h>) and is used to specify the inheritance of process attributes across a spawn operation. IEEE Std 1003.1-2001 doesn't define comparison or assignment operators for the type posix_spawnattr_t.

Description:

A destroyed attrp attributes object can be reinitialized using posix_spawnattr_init(); the results of otherwise referencing the object after it has been destroyed are undefined. An implementation may cause posix_spawnattr_destroy() to set the object referenced by attr to an invalid value.

The posix_spawnattr_init() function shall initialize a spawn attributes object attrp with the default value for all of the individual attributes used by the implementation. Results are undefined if posix_spawnattr_init() is called specifying an already initialized attrp attributes object. A spawn attributes object is of type posix_spawnattr_t (defined in <spawn.h>) and is used to specify the inheritance of process attributes across a spawn operation. IEEE Std 1003.1-2001 does not define comparison or assignment operators for the type posix_spawnattr_t.

Each implementation shall document the individual attributes it uses and their default values unless these values are defined by IEEE Std 1003.1-2001. Attributes not defined by IEEE Std 1003.1-2001, their default values, and the names of the associated functions to get and set those attribute values are implementation-defined. The resulting spawn attributes object (possibly modified by setting individual attribute values), is used to modify the behavior of posix_spawn() or posix_spawnp().

After a spawn attributes object has been used to spawn a process by a call to a posix_spawn() or posix_spawnp(), any function affecting the attributes object (including destruction) shall not affect any process that has been spawned in this way.


Note:

POSIX indicates that the results are undefined when re-initializing an already initialized posix_spawnattr_t object. The QNX implementation defines the behavior as identical to the case when the previous object is destroyed and then re-initialized, meaning that it is safe to re-initialize an already initialized posix_spawnattr_t object; however, it doesn't support the re-initialization of a posix_spawnattr_t object without an intervening destruction of the object. Repeated calls to posix_spawnattr_init() with the same posix_spawnattr_t object could result in a memory leak.


The posix_spawnattr_destroy() function will render the posix_spawnattr_t unusable. Before the object can be reused, it must be initialized with posix_spawnattr_init(), which includes calling posix_spawnattr_destroy() on an already destroyed object.

Returns:

Upon successful completion, posix_spawnattr_init() will return zero; otherwise, an error number is returned to indicate the error (errno).

Errors:

ENOMEM
Insufficient memory exists to initialize the spawn attributes object.
EOK
Success.

Classification:

POSIX 1003.1 RTS

Safety:
Cancellation point No
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

posix_spawn(), posix_spawn_file_actions_addclose(), posix_spawn_file_actions_adddup2(), posix_spawn_file_actions_addopen(), posix_spawn_file_actions_destroy(), posix_spawn_file_actions_init(), posix_spawnattr_addpartid(), posix_spawnattr_addpartition(), posix_spawnattr_destroy(), posix_spawnattr_getcred(), posix_spawnattr_getflags(), posix_spawnattr_getnode(), posix_spawnattr_getpartid(), posix_spawnattr_getpgroup(), posix_spawnattr_getrunmask(), posix_spawnattr_getschedparam(), posix_spawnattr_getschedpolicy(), posix_spawnattr_getsigdefault(), posix_spawnattr_getsigignore(), posix_spawnattr_getsigmask(), posix_spawnattr_getstackmax(), posix_spawnattr_getxflags(), posix_spawnattr_setcred(), posix_spawnattr_setflags(), posix_spawnattr_setnode(), posix_spawnattr_setpgroup(), posix_spawnattr_setschedparam(), posix_spawnattr_setrunmask(), posix_spawnattr_setschedpolicy(), posix_spawnattr_setsigdefault(), posix_spawnattr_setsigignore(), posix_spawnattr_setsigmask(), posix_spawnattr_setstackmax(), posix_spawnattr_setxflags(), posix_spawnp()