POSIX_SPAWNATTR_GETEXECFD_NP(3) FreeBSD Library Functions Manual
NAME
posix_spawnattr_getexecfd_np, posix_spawnattr_setexecfd_np - get and set
the spawn-execfd attribute of a spawn attributes object
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <spawn.h>
int
posix_spawnattr_getexecfd_np(const posix_spawnattr_t *restrict attr,
int *restrict fdp);
int
posix_spawnattr_setexecfd_np(posix_spawnattr_t *attr, int fd);
DESCRIPTION
The posix_spawnattr_getexecfd_np() function obtains the value of the
spawn-execfd attribute from the attributes object referenced by attr.
The posix_spawnattr_setexecfd_np() function sets the spawn-execfd
attribute in an initialized attributes object referenced by attr.
The spawn-execfd attribute provides the file descriptor that is used to
execute new image in the spawned process by the posix_spawn(3) family of
functions. If the attribute is set to a value other then -1, it must be
a valid file descriptor which does not have the O_CLOFORK flag set.
Then, posix_spawn() executes the executable image referenced by the file
descriptor in the newly created process, using the fexecve(2) system
call. In this case, the path argument to posix_spawn() is ignored.
The default value for the spawn-execfd attribute is -1, which means that
the executed image is specified by the path argument to posix_spawn().
RETURN VALUES
The posix_spawnattr_getexecfd_np() and posix_spawnattr_setexecfd_np()
functions return zero.
SEE ALSO
posix_spawn(3), posix_spawnattr_destroy(3), posix_spawnattr_init(3),
posix_spawnp(3)
STANDARDS
The posix_spawnattr_getexecfd_np() and posix_spawnattr_setexecfd_np() are
FreeBSD extensions that first appeared in FreeBSD 16.0.
FreeBSD 15.1-STABLE-HBSD January 25, 2026
POSIX_SPAWNATTR_GETEXECFD_NP(3)