---
name: "capsicum_helpers"
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/caph_cache_catpages"
---

# capsicum\_helpers(3)

set of the capsicum helpers, part of the libcapsicum

Part of [caph\_cache\_catpages(3)](/caph_cache_catpages/3.md).

## NAME

**caph\_limit\_stream**, **caph\_limit\_stdin**, **caph\_limit\_stderr**, **caph\_limit\_stdout**, **caph\_limit\_stdio**, **caph\_stream\_rights**, **caph\_cache\_tzdata**, **caph\_cache\_catpages**, **caph\_enter**, **caph\_enter\_casper**, **caph\_rights\_limit**, **caph\_ioctls\_limit**, **caph\_fcntls\_limit** – set of the capsicum helpers, part of the libcapsicum

## LIBRARY

library “libcapsicum”

## SYNOPSIS

**#include \<capsicum\_helpers.h\>**

*int*\

**caph\_enter**(*void*);

*int*\

**caph\_enter\_casper**(*void*);

*int*\

**caph\_rights\_limit**(*int fd*, *const cap\_rights\_t \*rights*);

*int*\

**caph\_ioctls\_limit**(*int fd*, *const unsigned long \*cmds*, *size\_t ncmds*);

*int*\

**caph\_fcntls\_limit**(*int fd*, *uint32\_t fcntlrights*);

*int*\

**caph\_limit\_stream**(*int fd*, *int flags*);

*int*\

**caph\_limit\_stdin**(*void*);

*int*\

**caph\_limit\_stderr**(*void*);

*int*\

**caph\_limit\_stdout**(*void*);

*int*\

**caph\_limit\_stdio**(*void*);

*void*\

**caph\_stream\_rights**(*cap\_rights\_t \**, *int flags*);

*void*\

**caph\_cache\_tzdata**(*void*);

*void*\

**caph\_cache\_catpages**(*void*);

## DESCRIPTION

The **caph\_enter**, **caph\_rights\_limit**, **caph\_ioctls\_limit** and **caph\_fcntls\_limit** are respectively equivalent to [cap\_enter(2)](/cap_enter/2.md), [cap\_rights\_limit(2)](/cap_rights_limit/2.md), [cap\_ioctls\_limit(2)](/cap_ioctls_limit/2.md) and [cap\_fcntls\_limit(2)](/cap_fcntls_limit/2.md), it returns success when the kernel is built without support of the capability mode.

The **caph\_enter\_casper** is equivalent to the **caph\_enter** it returns success when the system is built without Casper support.

The **capsicum** **helpers** are a set of a inline functions which simplify modifying programs to use Capsicum. The goal is to reduce duplicated code patterns. The **capsicum** **helpers** are part of **libcapsicum** but there is no need to link to the library.

**caph\_limit\_stream**() restricts capabilities on *fd* to only those needed by POSIX stream objects (that is, FILEs).

These flags can be provided:

- CAPH\_IGNORE\_EBADF

  Do not return an error if file descriptor is invalid.

- CAPH\_READ

  Set CAP\_READ on limited descriptor.

- CAPH\_WRITE

  Set CAP\_WRITE on limited descriptor.

**caph\_limit\_stdin**(), **caph\_limit\_stderr**() and **caph\_limit\_stdout**() limit standard descriptors using the **caph\_limit\_stream** function.

**caph\_limit\_stdio**() limits stdin, stderr and stdout.

**caph\_stream\_rights** may be used to initialize *rights* with the same rights that a stream would be limited to, as if **caph\_limit\_stream**() had been invoked using the same *flags*.

**caph\_cache\_tzdata**() precaches all timezone data needed to use libc local time functions.

**caph\_cache\_catpages**() caches Native Language Support (NLS) data. NLS data is used for localized error printing by [strerror(3)](/strerror/3.md) and [err(3)](/err/3.md), among others.

## RETURN VALUES

Upon successful completion, **caph\_enter**(), **caph\_enter\_casper**(), **caph\_rights\_limit**(), **caph\_ioctls\_limit**(), **caph\_fcntls\_limit**(), **caph\_limit\_stream**(), **caph\_limit\_stdin**(), **caph\_limit\_stderr**(), **caph\_limit\_stdout**(), and **caph\_limit\_stdio**() return a value of 0. Otherwise, a value of -1 is returned and the global variable *errno* is set to indicate the error.

Functions **caph\_stream\_rights**(), **caph\_cache\_tzdata**(), and **caph\_cache\_catpages**() can not fail.

## SEE ALSO

[cap\_enter(2)](/cap_enter/2.md), [cap\_rights\_limit(2)](/cap_rights_limit/2.md), [rights(4)](/rights/4.md)
