---
name: "posix_spawn_file_actions_destroy"
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_spawn_file_actions_destroy"
---

# posix\_spawn\_file\_actions\_destroy(3)

initialize and destroy spawn file actions object

## NAME

**posix\_spawn\_file\_actions\_init**, **posix\_spawn\_file\_actions\_destroy** – initialize and destroy spawn file actions object

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

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

*int*\

**posix\_spawn\_file\_actions\_init**(*posix\_spawn\_file\_actions\_t \* file\_actions*);

*int*\

**posix\_spawn\_file\_actions\_destroy**(*posix\_spawn\_file\_actions\_t \* file\_actions*);

## DESCRIPTION

The **posix\_spawn\_file\_actions\_init**() function initialize the object referenced by **file\_actions**() to contain no file actions for **posix\_spawn**() or **posix\_spawnp**(). Initializing an already initialized spawn file actions object may cause memory to be leaked.

The **posix\_spawn\_file\_actions\_destroy**() function destroy the object referenced by *file\_actions*; the object becomes, in effect, uninitialized. A destroyed spawn file actions object can be reinitialized using **posix\_spawn\_file\_actions\_init**(). The object should not be used after it has been destroyed.

## RETURN VALUES

Upon successful completion, these functions return zero; otherwise, an error number is returned to indicate the error.

## ERRORS

The **posix\_spawn\_file\_actions\_init**() function will fail if:

- \[ENOMEM\]

  Insufficient memory exists to initialize the spawn file actions object.

## SEE ALSO

[posix\_spawn(3)](/posix_spawn/3.md), [posix\_spawn\_file\_actions\_addclose(3)](/posix_spawn_file_actions_addclose/3.md), [posix\_spawn\_file\_actions\_addclosefrom\_np(3)](/posix_spawn_file_actions_addclosefrom_np/3.md), [posix\_spawn\_file\_actions\_adddup2(3)](/posix_spawn_file_actions_adddup2/3.md), [posix\_spawn\_file\_actions\_addopen(3)](/posix_spawn_file_actions_addopen/3.md), [posix\_spawnp(3)](/posix_spawnp/3.md)

## STANDARDS

The **posix\_spawn\_file\_actions\_init**() and **posix\_spawn\_file\_actions\_destroy**() functions conform to IEEE Std 1003.1-2001 (“POSIX.1”).

## HISTORY

The **posix\_spawn\_file\_actions\_init**() and **posix\_spawn\_file\_actions\_destroy**() functions first appeared in FreeBSD 8.0.

## AUTHORS

Ed Schouten ⟨*ed@FreeBSD.org*⟩
