shm_unlink()¶
Purpose¶
Removes the name of a POSIX shared memory object.
Header¶
Prototype¶
Parameters¶
name: POSIX shared memory object name, such as/demo_shm.
Return Value¶
- Success: returns
0. - Failure: returns
-1and setserrno.
Minimal Example¶
Common Pitfalls¶
shm_unlink()removes the name, but existing mappings remain valid until unmapped.- Use it during cleanup to avoid stale shared memory objects.
- Coordinate cleanup when multiple processes may still attach.