---
name: "posix_spawnattr_setsigmask"
section: "3"
platform: "macos"
package: "xnu"
version: "12377.121.6"
release: "macOS 26.5"
platforms: ["freebsd", "macos"]
url: "https://new.carta.tech/posix_spawnattr_setsigmask"
---

# posix\_spawnattr\_setsigmask(3)

set or get the spawn-sigmask attribute on a posix\_spawnattr\_t

## NAME

**posix\_spawnattr\_setsigmask** **posix\_spawnattr\_getsigmask** – set or get the *spawn-sigmask* attribute on a *posix\_spawnattr\_t*

## SYNOPSIS

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

*int*\

**posix\_spawnattr\_setsigmask**(*posix\_spawnattr\_t \*restrict attr*, *const sigset\_t \*restrict sigmask*);

*int*\

**posix\_spawnattr\_getsigmask**(*const posix\_spawnattr\_t \*restrict attr*, *sigset\_t \*restrict sigmask*);

## DESCRIPTION

The **posix\_spawnattr\_setsigmask**() function sets the *sigmask* on the attributes object referenced by *attr*.

The **posix\_spawnattr\_getsigmask**() function retrieves the *sigmask* on the attributes object referenced by *attr*.

The argument *sigmask* is the initial signal mask to be set for the new process on creation if the *POSIX\_SPAWN\_SETSIGMASK* flag is set in the *posix\_spawnattr\_t*. It's default value must be set via a call to [posix\_spawnattr\_setflags(3)](/posix_spawnattr_setflags/3.md) or the behaviour is undefined.

## RETURN VALUES

On success, these functions return 0; on failure they return an error number from ⟨errno.h⟩. Additionally, if successful, **posix\_spawnattr\_getsigmask**() will modify the contents of the *sigmask* parameter with the current attribute value.

## ERRORS

These functions may fail if:

- \[EINVAL\]

  The value specified by *attr* is invalid.

- \[EINVAL\]

  The value of *attr* is invalid.

## SEE ALSO

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

## STANDARDS

Version 3 of the Single UNIX Specification (“SUSv3”)

## HISTORY

The **posix\_spawnattr\_setsigmask**() and **posix\_spawnattr\_getsigmask**() function calls appeared in Version 3 of the Single UNIX Specification (“SUSv3”).
