---
name: "sigvec"
section: "3"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/sigvec/3"
---

# sigvec(3)

BSD signal API

## NAME

sigvec, sigblock, sigsetmask, siggetmask, sigmask - BSD signal API

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#include <signal.h>
```

**\[\[deprecated\]\] int sigvec(int** *sig***, const struct sigvec \****vec***,**                           **struct sigvec \****ovec***);**

**\[\[deprecated\]\] int sigmask(int** *signum***);**

**\[\[deprecated\]\] int sigblock(int** *mask***);** **\[\[deprecated\]\] int sigsetmask(int** *mask***);** **\[\[deprecated\]\] int siggetmask(void);**

Feature Test Macro Requirements for glibc (see [**feature\_test\_macros**(7)](/feature_test_macros/7.md)):

All functions shown above:

```
    Since glibc 2.19:
        _DEFAULT_SOURCE
    glibc 2.19 and earlier:
        _BSD_SOURCE
```

## DESCRIPTION

These functions are provided in glibc as a compatibility interface for programs that make use of the historical BSD signal API. This API is obsolete: new applications should use the POSIX signal API ([**sigaction**(2)](/sigaction/2.md), [**sigprocmask**(2)](/sigprocmask/2.md), etc.).

The **sigvec**() function sets and/or gets the disposition of the signal *sig* (like the POSIX [**sigaction**(2)](/sigaction/2.md)). If *vec* is not NULL, it points to a *sigvec* structure that defines the new disposition for *sig*. If *ovec* is not NULL, it points to a *sigvec* structure that is used to return the previous disposition of *sig*. To obtain the current disposition of *sig* without changing it, specify NULL for *vec*, and a non-null pointer for *ovec*.

The dispositions for **SIGKILL** and **SIGSTOP** cannot be changed.

The *sigvec* structure has the following form:

```
struct sigvec {
    void (*sv_handler)(int); /* Signal disposition */
    int    sv_mask;          /* Signals to be blocked in handler */
    int    sv_flags;         /* Flags */
};
```

The *sv\_handler* field specifies the disposition of the signal, and is either: the address of a signal handler function; **SIG\_DFL**, meaning the default disposition applies for the signal; or **SIG\_IGN**, meaning that the signal is ignored.

If *sv\_handler* specifies the address of a signal handler, then *sv\_mask* specifies a mask of signals that are to be blocked while the handler is executing. In addition, the signal for which the handler is invoked is also blocked. Attempts to block **SIGKILL** or **SIGSTOP** are silently ignored.

If *sv\_handler* specifies the address of a signal handler, then the *sv\_flags* field specifies flags controlling what happens when the handler is called. This field may contain zero or more of the following flags:

- **SV\_INTERRUPT**

  If the signal handler interrupts a blocking system call, then upon return from the handler the system call is not restarted: instead it fails with the error **EINTR**. If this flag is not specified, then system calls are restarted by default.

- **SV\_RESETHAND**

  Reset the disposition of the signal to the default before calling the signal handler. If this flag is not specified, then the handler remains established until explicitly removed by a later call to **sigvec**() or until the process performs an [**execve**(2)](/execve/2.md).

- **SV\_ONSTACK**

  Handle the signal on the alternate signal stack (historically established under BSD using the obsolete **sigstack**() function; the POSIX replacement is [**sigaltstack**(2)](/sigaltstack/2.md)).

The **sigmask**() macro constructs and returns a "signal mask" for *signum*. For example, we can initialize the *vec.sv\_mask* field given to **sigvec**() using code such as the following:

```
vec.sv_mask = sigmask(SIGQUIT) | sigmask(SIGABRT);
            /* Block SIGQUIT and SIGABRT during
               handler execution */
```

The **sigblock**() function adds the signals in *mask* to the process's signal mask (like POSIX *sigprocmask(SIG\_BLOCK)*), and returns the process's previous signal mask. Attempts to block **SIGKILL** or **SIGSTOP** are silently ignored.

The **sigsetmask**() function sets the process's signal mask to the value given in *mask* (like POSIX *sigprocmask(SIG\_SETMASK)*), and returns the process's previous signal mask.

The **siggetmask**() function returns the process's current signal mask. This call is equivalent to *sigblock(0)*.

## RETURN VALUE

The **sigvec**() function returns 0 on success; on error, it returns -1 and sets *errno* to indicate the error.

The **sigblock**() and **sigsetmask**() functions return the previous signal mask.

The **sigmask**() macro returns the signal mask for *signum*.

## ERRORS

See the ERRORS under [**sigaction**(2)](/sigaction/2.md) and [**sigprocmask**(2)](/sigprocmask/2.md).

## ATTRIBUTES

For an explanation of the terms used in this section, see [**attributes**(7)](/attributes/7.md).

| | | |
| --- | --- | --- |
| **Interface** | **Attribute** | **Value** |
| **sigvec**(), **sigmask**(), **sigblock**(), **sigsetmask**(), **siggetmask**() | Thread safety | MT-Safe |

## STANDARDS

None.

## HISTORY

- **sigvec**() **sigblock**() **sigmask**() **sigsetmask**()

  4\.3BSD.

- **siggetmask**()

  Unclear origin.

- **sigvec**()

  Removed in glibc 2.21.

## NOTES

On 4.3BSD, the **signal**() function provided reliable semantics (as when calling **sigvec**() with *vec.sv\_mask* equal to 0). On System V, **signal**() provides unreliable semantics. POSIX.1 leaves these aspects of **signal**() unspecified. See [**signal**(2)](/signal/2.md) for further details.

In order to wait for a signal, BSD and System V both provided a function named [**sigpause**(3)](/sigpause/3.md), but this function has a different argument on the two systems. See [**sigpause**(3)](/sigpause/3.md) for details.

## SEE ALSO

[**kill**(2)](/kill/2.md), [**pause**(2)](/pause/2.md), [**sigaction**(2)](/sigaction/2.md), [**signal**(2)](/signal/2.md), [**sigprocmask**(2)](/sigprocmask/2.md), [**raise**(3)](/raise/3.md), [**sigpause**(3)](/sigpause/3.md), [**sigset**(3)](/sigset/3.md), [**signal**(7)](/signal/7.md)
