1.\"	$OpenBSD: posix_spawnattr_init.3,v 1.8 2014/11/30 02:41:43 schwarze Exp $
2.\"
3.\" Copyright (c) 2012 Marc Espie <espie@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: November 30 2014 $
18.Dt POSIX_SPAWNATTR_INIT 3
19.Os
20.Sh NAME
21.Nm posix_spawnattr_init ,
22.Nm posix_spawnattr_destroy
23.Nd create and destroy posix_spawn attributes object
24.Sh SYNOPSIS
25.In spawn.h
26.Ft int
27.Fn posix_spawnattr_init "posix_spawnattr_t *attr"
28.Ft int
29.Fn posix_spawnattr_destroy "posix_spawnattr_t *attr"
30.Sh DESCRIPTION
31.Xr posix_spawn 3
32attributes objects can be initialized by
33.Fn posix_spawnattr_init
34and destroyed by
35.Fn posix_spawnattr_destroy .
36.Pp
37Initialization fills an attributes object pointed by
38.Fa attr
39with the default values for all the attributes.
40.Pp
41Multiple initialization of the same object is undefined behavior
42and will lead to memory leaks.
43.Pp
44Similarly, objects should be passed to
45.Fn posix_spawnattr_destroy
46to reclaim memory.
47The object should not be re-used after destruction.
48It can however be initialized again with
49.Fn posix_spawnattr_init .
50.Pp
51An attributes object, possibly modified by
52.Fn posix_spawn_set* ,
53is used to specify what process attributes
54will be passed across a spawn operation as implemented by
55.Fn posix_spawn
56or
57.Fn posix_spawnp .
58.Pp
59Attribute details are described in
60.Xr posix_spawnattr_setflags 3 .
61.Pp
62Modifying or destroying attributes object
63will not affect processes that have already been spawned.
64.Sh RETURN VALUES
65These function return 0 on successful completion.
66They may return
67.Er ENOMEM
68when running out of memory.
69.Sh SEE ALSO
70.Xr posix_spawn 3
71.Sh STANDARDS
72Both functions conform to
73.St -p1003.1-2001 .
74.Sh AUTHORS
75.An \&Ed Schouten Aq Mt ed@FreeBSD.org
76