POSIX_SPAWNATTR_INIT(3) | Library Functions Manual | POSIX_SPAWNATTR_INIT(3)

# NAME

`posix_spawnattr_init`, `posix_spawnattr_destroy` — create and destroy posix_spawn attributes object

# SYNOPSIS

`#include <spawn.h>`

int
`posix_spawnattr_init`(posix_spawnattr_t *attr);

int
`posix_spawnattr_destroy`(posix_spawnattr_t *attr);

# DESCRIPTION

posix_spawn(3) attributes objects can be initialized by `posix_spawnattr_init`() and destroyed by `posix_spawnattr_destroy`().

Initialization fills an attributes object pointed by attr with the default values for all the attributes.

Multiple initialization of the same object is undefined behavior and will lead to memory leaks.

Similarly, objects should be passed to `posix_spawnattr_destroy`() to reclaim memory. The object should not be re-used after destruction. It can however be initialized again with `posix_spawnattr_init`().

An attributes object, possibly modified by `posix_spawn_set*`(), is used to specify what process attributes will be passed across a spawn operation as implemented by `posix_spawn`() or `posix_spawnp`().

Attribute details are described in posix_spawnattr_setflags(3).

Modifying or destroying attributes object will not affect processes that have already been spawned.

# RETURN VALUES

These function return 0 on successful completion. They may return `ENOMEM` when running out of memory.

# SEE ALSO

posix_spawn(3)

# STANDARDS

Both functions conform to IEEE Std 1003.1-2001 (“POSIX.1”).

# AUTHORS

Ed Schouten <ed@FreeBSD.org>

November 30, 2014 | Debian