---
name: "posix_spawnattr_getprocdescp_np"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/posix_spawnattr_getprocdescp_np"
---

# posix\_spawnattr\_getprocdescp\_np(3)

get and set the spawn-procdescp attribute of a spawn attributes object

## NAME

**posix\_spawnattr\_getprocdesp\_np**, **posix\_spawnattr\_setprocdescp\_np** – get and set the spawn-procdescp attribute of a spawn attributes object

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<spawn.h\>**

*int*\

**posix\_spawnattr\_getprocdescp\_np**(*const posix\_spawnattr\_t \*restrict attr*, *int \*\*restrict fdpp*, *int \*restrict pdrflagsp*);

*int*\

**posix\_spawnattr\_setprocdescp\_np**(*posix\_spawnattr\_t \*attr*, *int \*restrict fdp*, *int pdrflags*);

## DESCRIPTION

The **posix\_spawnattr\_getprocdescp\_np**() function obtains the value of the spawn-procdescp attribute from the attributes object referenced by *attr*.

The **posix\_spawnattr\_procdescp\_np**() function sets the spawn-procdescp attribute in an initialized attributes object referenced by *attr*.

The spawn-procdescp attribute provides the location where the child process's file descriptor will be stored after a successful spawn. Setting the attribute to a non-NULL value implicitly request the creation of the file descriptor that references the child process. It wiil be created by the [pdrfork(2)](/pdrfork/2.md) system call. which will be used instead of fork/vfork/[rfork(2)](/rfork/2.md) when the attribute is set to *NULL.*

If the attribute is set to a value other then NULL, it must be a valid pointer to a variable of *int* type, where the resulting descriptor will be stored. The *pdrflags* argument specifies additional flags that are accepted by the [pdfork(2)](/pdfork/2.md) system call. See its description for the list of the valid flags. Note that the *PD\_CLOEXEC* flag is always set, preventing leakage of the process descriptor into the newly created child.

The default value for the spawn-procdescp attribute is NULL, which means that no process descriptor will be created.

## RETURN VALUES

The **posix\_spawnattr\_getprocdescp\_np**() and **posix\_spawnattr\_setprocdescp\_np**() functions return zero.

## SEE ALSO

[posix\_spawn(3)](/posix_spawn/3.md), [posix\_spawnattr\_destroy(3)](/posix_spawnattr_destroy/3.md), [posix\_spawnattr\_init(3)](/posix_spawnattr_init/3.md), [posix\_spawnp(3)](/posix_spawnp/3.md)

## STANDARDS

The **posix\_spawnattr\_getprocdescp\_np**() and **posix\_spawnattr\_setprocdescp\_np**() are FreeBSD extensions that first appeared in FreeBSD 16.0.
