View Issue Details

IDProjectCategoryView StatusLast Update
00019951003.1(2024)/Issue8System Interfacespublic2026-08-10 15:49
Reporterilliliti Assigned To 
PrioritynormalSeverityEditorialTypeEnhancement Request
Status Resolution ProposedResolutionFuture Enhancement 
NameMark lundblad
Organization
User Reference
Sectionshm_open
Page Number2023
Line Number66311
Interp Status---
Final Accepted Text
Summary0001995: Add SHM_ANON to shm_open()
DescriptionSHM_ANON can be used to create an unnamed shared memory object, which will be automatically destroyed when last reference to it is removed. It is mainly useful for avoiding potential conflicts with already existing shared memory objects, hiding the object from other processes and making the use of shm_unlink unnecessary since the object has no name.

This extension is known to be implemented at least by QNX and FreeBSD. Linux provides similar memfd_create() interface, which can be used to mimic SHM_ANON.

See also: https://github.com/lassik/shm_open_anon
Desired ActionChange
The shm_open() function shall establish a connection between a shared memory object and a file descriptor. It shall create an open file description that refers to the shared memory object and a file descriptor that refers to that open file description. The file descriptor shall be allocated as described in 2.6 File Descriptor Allocation, and can be used by other functions to refer to that shared memory object. The name argument points to a string naming a shared memory object. It is unspecified whether the name appears in the file system and is visible to other functions that take pathnames as arguments. The name argument conforms to the construction rules for a pathname, except that the interpretation of <slash> characters other than the leading <slash> character in name is implementation-defined, and that the length limits for the name argument are implementation-defined and need not be the same as the pathname limits {PATH_MAX} and {NAME_MAX}. If name begins with the <slash> character, then processes calling shm_open() with the same value of name refer to the same shared memory object, as long as that name has not been removed. If name does not begin with the <slash> character, the effect is implementation-defined.

to
The shm_open() function shall establish a connection between a shared memory object and a file descriptor. It shall create an open file description that refers to the shared memory object and a file descriptor that refers to that open file description. The file descriptor shall be allocated as described in 2.6 File Descriptor Allocation, and can be used by other functions to refer to that shared memory object. The name argument points to a string naming a shared memory object or SHM_ANON constant. It is unspecified whether the name appears in the file system and is visible to other functions that take pathnames as arguments. The name argument conforms to the construction rules for a pathname, except that the interpretation of <slash> characters other than the leading <slash> character in name is implementation-defined, and that the length limits for the name argument are implementation-defined and need not be the same as the pathname limits {PATH_MAX} and {NAME_MAX}. If name begins with the <slash> character, then processes calling shm_open() with the same value of name refer to the same shared memory object, as long as that name has not been removed. If name does not begin with the <slash> character, the effect is implementation-defined. if name is SHM_ANON, then an unnamed shared memory object shall be created. Since the shared memory object has no associated name, it cannot be removed with shm_unlink() and instead it will be destroyed once last reference to it is removed.
Tagsissue9

Activities

msbrown

2026-08-10 15:49

manager   bugnote:0007480

Interpretation response
------------------------
The standard is unclear on this issue, and no conformance distinction can be made between alternative implementations based on this. This is being referred to the sponsor.

Rationale:
-------------
As described, the value is unspecified, with no definitive definition at this time. This will be pursued in the next edition.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------

On Page 393 of sys/mman.h, after line 13782, add the following:
The <sys/mman.h> header shall define the following symbolic constants for use as flags for the
shm_open( ) function:
POSIX_SHM_ANON Used to indicate that an unnamed shared memory object shall be created

On Page 2023 of shm_open(), at line 66311 change:
    The name argument points to a string naming a shared memory object.
To:
   The name argument contains a pointer to a string naming a shared memory object, or the POSIX_SHM_ANON constant.

On page 2023 of shm_open(), at line 66320 add:
    If name is POSIX_SHM_ANON, then an unnamed shared memory object shall be created. Since the shared memory object has no associated name, it cannot be removed with shm_unlink() and instead it will be destroyed once last reference to it is removed.

Issue History

Date Modified Username Field Change
2026-08-09 17:18 illiliti New Issue
2026-08-10 15:23 msbrown Page Number - => 2023
2026-08-10 15:23 msbrown Line Number - => 66311
2026-08-10 15:23 msbrown Interp Status => ---
2026-08-10 15:45 msbrown Tag Attached: issue9
2026-08-10 15:49 msbrown Status New => Resolution Proposed
2026-08-10 15:49 msbrown Resolution Open => Future Enhancement
2026-08-10 15:49 msbrown Note Added: 0007480