xref: /freebsd/lib/libc/gen/posix_spawnattr_init.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
162187b41SDavid Xu.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
262187b41SDavid Xu.\" All rights reserved.
362187b41SDavid Xu.\"
462187b41SDavid Xu.\" Redistribution and use in source and binary forms, with or without
562187b41SDavid Xu.\" modification, are permitted provided that the following conditions
662187b41SDavid Xu.\" are met:
762187b41SDavid Xu.\" 1. Redistributions of source code must retain the above copyright
862187b41SDavid Xu.\"    notice, this list of conditions and the following disclaimer.
962187b41SDavid Xu.\" 2. Redistributions in binary form must reproduce the above copyright
1062187b41SDavid Xu.\"    notice, this list of conditions and the following disclaimer in the
1162187b41SDavid Xu.\"    documentation and/or other materials provided with the distribution.
1262187b41SDavid Xu.\"
1362187b41SDavid Xu.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1462187b41SDavid Xu.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1562187b41SDavid Xu.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1662187b41SDavid Xu.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1762187b41SDavid Xu.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1862187b41SDavid Xu.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1962187b41SDavid Xu.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2062187b41SDavid Xu.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2162187b41SDavid Xu.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2262187b41SDavid Xu.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2362187b41SDavid Xu.\" SUCH DAMAGE.
2462187b41SDavid Xu.\"
2562187b41SDavid Xu.\" Portions of this text are reprinted and reproduced in electronic form
2662187b41SDavid Xu.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
2762187b41SDavid Xu.\" Portable Operating System Interface (POSIX), The Open Group Base
2862187b41SDavid Xu.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
2962187b41SDavid Xu.\" Electrical and Electronics Engineers, Inc and The Open Group.  In the
3062187b41SDavid Xu.\" event of any discrepancy between this version and the original IEEE and
3162187b41SDavid Xu.\" The Open Group Standard, the original IEEE and The Open Group Standard is
3262187b41SDavid Xu.\" the referee document.  The original Standard can be obtained online at
3362187b41SDavid Xu.\"	http://www.opengroup.org/unix/online.html.
3462187b41SDavid Xu.\"
35cf6c5eebSChristian Brueffer.Dd March 24, 2008
3662187b41SDavid Xu.Dt POSIX_SPAWNATTR_INIT 3
3762187b41SDavid Xu.Os
3862187b41SDavid Xu.Sh NAME
3962187b41SDavid Xu.Nm posix_spawnattr_init ,
4062187b41SDavid Xu.Nm posix_spawnattr_destroy
4162187b41SDavid Xu.Nd "initialize and destroy spawn attributes object"
4262187b41SDavid Xu.Sh LIBRARY
4362187b41SDavid Xu.Lb libc
4462187b41SDavid Xu.Sh SYNOPSIS
4562187b41SDavid Xu.In spawn.h
4662187b41SDavid Xu.Ft int
4762187b41SDavid Xu.Fn posix_spawnattr_init "posix_spawnattr_t * attr"
4862187b41SDavid Xu.Ft int
4962187b41SDavid Xu.Fn posix_spawnattr_destroy "posix_spawnattr_t * attr"
5062187b41SDavid Xu.Sh DESCRIPTION
5162187b41SDavid XuThe
5262187b41SDavid Xu.Fn posix_spawnattr_init
5362187b41SDavid Xufunction initializes a spawn attributes object
5462187b41SDavid Xu.Fa attr
5562187b41SDavid Xuwith the default value for all of the individual attributes used by the
5662187b41SDavid Xuimplementation.
5762187b41SDavid XuInitializing an already initialized spawn attributes object may cause
5862187b41SDavid Xumemory to be leaked.
5962187b41SDavid Xu.Pp
6062187b41SDavid XuThe
6162187b41SDavid Xu.Fn posix_spawnattr_destroy
6262187b41SDavid Xufunction destroys a spawn attributes object.
6362187b41SDavid XuA destroyed
6462187b41SDavid Xu.Fa attr
6562187b41SDavid Xuattributes object can be reinitialized using
6662187b41SDavid Xu.Fn posix_spawnattr_init .
6762187b41SDavid XuThe object should not be used after it has been destroyed.
6862187b41SDavid Xu.Pp
6962187b41SDavid XuA spawn attributes object is of type
7062187b41SDavid Xu.Vt posix_spawnattr_t
7162187b41SDavid Xu(defined in
7262187b41SDavid Xu.In spawn.h )
7362187b41SDavid Xuand is used to specify the inheritance of process attributes across a
7462187b41SDavid Xuspawn operation.
7562187b41SDavid Xu.Pp
7662187b41SDavid XuThe resulting spawn attributes object (possibly modified by setting
7762187b41SDavid Xuindividual attribute values), is used to modify the behavior of
7862187b41SDavid Xu.Fn posix_spawn
7962187b41SDavid Xuor
8062187b41SDavid Xu.Fn posix_spawnp .
8162187b41SDavid XuAfter a spawn attributes object has been used to spawn a process by a
8262187b41SDavid Xucall to a
8362187b41SDavid Xu.Fn posix_spawn
8462187b41SDavid Xuor
8562187b41SDavid Xu.Fn posix_spawnp ,
8662187b41SDavid Xuany function affecting the attributes object (including destruction)
8762187b41SDavid Xuwill not affect any process that has been spawned in this way.
8862187b41SDavid Xu.Sh RETURN VALUES
8962187b41SDavid XuUpon successful completion,
9062187b41SDavid Xu.Fn posix_spawnattr_init
9162187b41SDavid Xuand
9262187b41SDavid Xu.Fn posix_spawnattr_destroy
9362187b41SDavid Xureturn zero;
9462187b41SDavid Xuotherwise, an error number is returned to indicate the error.
9562187b41SDavid Xu.Sh ERRORS
9662187b41SDavid XuThe
9762187b41SDavid Xu.Fn posix_spawnattr_init
9862187b41SDavid Xufunction will fail if:
9962187b41SDavid Xu.Bl -tag -width Er
10062187b41SDavid Xu.It Bq Er ENOMEM
101196d2103SSergey KandaurovInsufficient memory exists to initialize the spawn attributes object.
10262187b41SDavid Xu.El
10362187b41SDavid Xu.Sh SEE ALSO
10462187b41SDavid Xu.Xr posix_spawn 3 ,
10562187b41SDavid Xu.Xr posix_spawnp 3
10662187b41SDavid Xu.Sh STANDARDS
10762187b41SDavid XuThe
10862187b41SDavid Xu.Fn posix_spawnattr_init
10962187b41SDavid Xuand
11062187b41SDavid Xu.Fn posix_spawnattr_destroy
11162187b41SDavid Xufunctions conform to
11262187b41SDavid Xu.St -p1003.1-2001 .
11362187b41SDavid Xu.Sh HISTORY
11462187b41SDavid XuThe
11562187b41SDavid Xu.Fn posix_spawnattr_init
11662187b41SDavid Xuand
11762187b41SDavid Xu.Fn posix_spawnattr_destroy
11862187b41SDavid Xufunctions first appeared in
11962187b41SDavid Xu.Fx 8.0 .
12062187b41SDavid Xu.Sh AUTHORS
121*18c5321dSBaptiste Daroussin.An \&Ed Schouten Aq Mt ed@FreeBSD.org
122