posix_spawnattr_destroy()

Destroy the spawn attributes object

Synopsis:

#include <posix_spawnattr.h>

int posix_spawnattr_destroy(posix_spawnattr_t *attrp);

Arguments:

attrp
The posix_spawnattr_destroy() function destroys a spawn attributes object attrp with the default value for all of the individual attributes used by the implementation.
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.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The posix_spawnattr_destroy() function destroys a spawn attributes object. You can reinitialize a destroyed attrp attributes object by using posix_spawnattr_init(); the results of referencing the object after its 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 initializes a spawn attributes object attr 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 attr attributes object.

A spawn attributes object is of type posix_spawnattr_t (defined in <spawn.h>) and it specifies 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. Each implementation documents 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) doesn't affect any process that was spawned in this way.


Note:

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. POSIX specifies that results are undefined when using a posix_spawnattr_t object after it has been destroyed. If you attempt to reference a destroyed attributes object, all of the get() and set() operations, as well as posix_spawn(), will return EINVAL.


Returns:

Upon successful completion, posix_spawnattr_destroy() returns zero; otherwise, an error number is returned to indicate the error (errno).

Errors:

EINVAL
The value specified by attrp is invalid.
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_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_init(), 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()