---
name: "posix_spawnattr_getflags"
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_getflags"
---

# posix\_spawnattr\_getflags(3)

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

## NAME

**posix\_spawnattr\_getflags**, **posix\_spawnattr\_setflags** – get and set the spawn-flags attribute of a spawn attributes object

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

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

*int*\

**posix\_spawnattr\_getflags**(*const posix\_spawnattr\_t \*restrict attr*, *short \*restrict flags*);

*int*\

**posix\_spawnattr\_setflags**(*posix\_spawnattr\_t \*attr*, *short flags*);

## DESCRIPTION

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

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

The spawn-flags attribute is used to indicate which process attributes are to be changed in the new process image when invoking **posix\_spawn**() or **posix\_spawnp**(). It is the bitwise-inclusive OR of zero or more of the following flags (see **posix\_spawn**()):

- POSIX\_SPAWN\_RESETIDS

  - POSIX\_SPAWN\_SETPGROUP

  - POSIX\_SPAWN\_SETSIGDEF

  - POSIX\_SPAWN\_SETSIGMASK

  - POSIX\_SPAWN\_SETSCHEDPARAM

  - POSIX\_SPAWN\_SETSCHEDULER

  - POSIX\_SPAWN\_DISABLE\_ASLR\_NP

  These flags are defined in ⟨spawn.h⟩. The default value of this attribute is as if no flags were set.

## RETURN VALUES

The **posix\_spawnattr\_getflags**() function returns zero. The **posix\_spawnattr\_setflags**() function returns zero on success, and EINVAL on failure due to invalid flag specified.

## 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\_getflags**() and **posix\_spawnattr\_setflags**() functions conform to IEEE Std 1003.1-2001 (“POSIX.1”).

## HISTORY

The **posix\_spawnattr\_getflags**() and **posix\_spawnattr\_setflags**() functions first appeared in FreeBSD 8.0.

## AUTHORS

Ed Schouten ⟨*ed@FreeBSD.org*⟩
