---
name: "posix_spawnattr_getschedpolicy"
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_getschedpolicy"
---

# posix\_spawnattr\_getschedpolicy(3)

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

## NAME

**posix\_spawnattr\_getschedpolicy**, **posix\_spawnattr\_setschedpolicy** – get and set the spawn-schedpolicy attribute of a spawn attributes object

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

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

*int*\

**posix\_spawnattr\_getschedpolicy**(*const posix\_spawnattr\_t \*restrict attr*, *int \*restrict schedpolicy*);

*int*\

**posix\_spawnattr\_setschedpolicy**(*posix\_spawnattr\_t \*attr*, *int schedpolicy*);

## DESCRIPTION

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

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

The spawn-schedpolicy attribute represents the scheduling policy to be assigned to the new process image in a spawn operation (if POSIX\_SPAWN\_SETSCHEDULER is set in the spawn-flags attribute). The default value of this attribute is unspecified.

## RETURN VALUES

The **posix\_spawnattr\_getschedpolicy**() and **posix\_spawnattr\_setschedpolicy**() functions return zero.

## SEE ALSO

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

## STANDARDS

The **posix\_spawnattr\_getschedpolicy**() and **posix\_spawnattr\_setschedpolicy**() functions conform to IEEE Std 1003.1-2001 (“POSIX.1”).

## HISTORY

The **posix\_spawnattr\_getschedpolicy**() and **posix\_spawnattr\_setschedpolicy**() functions first appeared in FreeBSD 8.0.

## AUTHORS

Ed Schouten ⟨*ed@FreeBSD.org*⟩
