---
name: "posixshmcontrol"
section: "1"
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/posixshmcontrol"
---

# posixshmcontrol(1)

Control POSIX shared memory segments

## NAME

**posixshmcontrol** – Control POSIX shared memory segments

## SYNOPSIS

**posixshmcontrol** *create* \[**-l** *pagesize*\] \[**-m** *mode*\] \[*path* *...*\]

**posixshmcontrol** *rm* \[*path* *...*\]

**posixshmcontrol** *ls* \[**-h**\] \[**-n**\] \[**-j** *jail*\]

**posixshmcontrol** *dump* \[*path* *...*\]

**posixshmcontrol** *stat* \[**-h**\] \[**-n**\] \[*path* *...*\]

**posixshmcontrol** *truncate* \[**-s** *length*\] \[*path* *...*\]

## DESCRIPTION

The **posixshmcontrol** command manipulates the named POSIX shared memory segments. It allows inspecting existing segments, dumping their metadata or contents, and unlinking them.

Unlinking removes the name from the system and, when the last process unmaps the segment and closes file descriptor pointing to the segment, frees underlying memory.

The number of hard links as displayed by the **stat** subcommand, is equal to the number of references to the underlying VM object. It is almost always equal to the number of mappings +1, except for transient references.

The following subcommands are provided:

- **create**

  Create segments with the specified paths, if they do not already exist.

  The optional *pagesize* argument specifies the size of the virtual pages used to map the object with [mmap(2)](/mmap/2.md). By default, the system page size is used, but on some platforms a larger page size can be specified. The size of an object backed by large pages must be a multiple of the specified page size. The *hw.pagesizes* sysctl variable lists the available page sizes.

  The optional numerical *mode* argument specifies the initial access mode.

- **rm**

  Unlink the paths specified.

- **ls**

  List all linked named shared memory segments visible to the caller. For each segment, the user and group owner, size, and path are displayed. The **-j** option limits the output to segments within the specified *jail* name or id.

- **dump**

  Output raw bytes values from the segment to standard output.

- **stat**

  Print metadata for the specified path, in the format similar to the [stat(1)](/stat/1.md) utility.

- **truncate**

  Change the length of the segments. Argument to the **-s** option specifies new length. The human-friendly 'k', 'm', 'g' suffixes can be used, see [expand\_number(3)](/expand_number/3.md). If the option is not specified, assumed length is zero.

For some commands, the following options may be provided:

- **-h**

  If specified, requests human-readable display of size, see [humanize\_number(3)](/humanize_number/3.md).

- **-n**

  Prevent translation of owner and group into symbolic names using name-switch services, instead the raw numeric values are printed.

## EXIT STATUS

The **posixshmcontrol** utility exits 0 on success, and \>0 if an error occurs.

## EXAMPLES

- To show content of the shared memory segment with the path */1*, use the command

  ```
  posixshmcontrol dump /1 | hexdump -C
  ```

- To create a segment with the path */2* and then enlarge it to 1M, use the sequence of commands

  ```
  posixshmcontrol create /2
  ```

  ```
  posixshmcontrol truncate -s 1m /2
  ```

## SEE ALSO

[hexdump(1)](/hexdump/1.md), [stat(1)](/stat/1.md), [ftruncate(2)](/ftruncate/2.md), [mmap(2)](/mmap/2.md), [read(2)](/read/2.md), [shm\_open(2)](/shm_open/2.md), [shm\_unlink(2)](/shm_unlink/2.md), [stat(2)](/stat/2.md), [expand\_number(3)](/expand_number/3.md), [humanize\_number(3)](/humanize_number/3.md), [shm\_create\_largepage(3)](/shm_create_largepage/3.md), [sysctl(3)](/sysctl/3.md)

## HISTORY

The **posixshmcontrol** command appeared in FreeBSD 12.1.

## AUTHORS

The **posixshmcontrol** command and this manual page were written by Konstantin Belousov ⟨*kib@FreeBSD.org*⟩ under sponsorship from The FreeBSD Foundation.
