OpenBSD manual page server

Manual Page Search Parameters


posix_spawnattr_init, posix_spawnattr_destroycreate and destroy posix_spawn attributes object

#include <spawn.h>

posix_spawnattr_init(posix_spawnattr_t *attr);

posix_spawnattr_destroy(posix_spawnattr_t *attr);

posix_spawn(3) attributes objects can be initialized by () 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 () 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 (), is used to specify what process attributes will be passed across a spawn operation as implemented by () or ().

Attribute details are described in posix_spawnattr_setflags(3).

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

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


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

Ed Schouten <>

November 30, 2014 OpenBSD-current