SHMDT(3P)
π SHMDT(3P) β POSIX Programmer's Manual π
okay bestie, welcome to the shmdt page, straight out of the POSIX Programmer's Manual (that's the 3P right there in the name, iykyk). let's get into it π«Ά
β¨ PROLOG β¨
so like, real talk first: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ β so if you're on Linux, go consult the corresponding Linux manual page for the deets on Linux behavior. and honestly? the interface may not even be implemented on Linux at all. vibe check accordingly π
πΈ NAME πΈ
shmdt β XSI shared memory detach operation. that's it, that's the whole name, and she's iconic for it.
π SYNOPSIS π
#include <sys/shm.h>
int shmdt(const void *shmaddr);
π¦ DESCRIPTION π¦
so the shmdt() function operates on XSI shared memory β and if you wanna be all official about it, that's the Base Definitions volume of POSIX.1β2017, Section 3.346, Shared Memory Object. and here's a lil spicy caveat: it is unspecified whether this function interoperates with the realtime interprocess communication facilities defined in Section 2.8, Realtime. so like, don't count on it, bestie π
and what does she actually do? the shmdt() function detaches the shared memory segment located at the address specified by shmaddr from the address space of the calling process. bye-bye segment, you were so real π
π₯ RETURN VALUE π₯
upon successful completion, shmdt() shall decrement the value of shm_nattch in the data structure associated with the shared memory ID of the attached shared memory segment, and return 0. also, the shm_dtime timestamp shall be set to the current time, as described in Section 2.7.1, IPC General Description. cute little bookkeeping moment, love that for her β¨
otherwise? the shared memory segment shall not be detached, shmdt() shall return -1, and errno shall be set to indicate the error. sad girl hours π
π ERRORS π
the shmdt() function shall fail if:
EINVALβ the value ofshmaddris not the data segment start address of a shared memory segment.
the following sections are informative. (translation: the important bits are done, everything after this is lore π§)
π EXAMPLES π
None.
yeah. nothing. empty. the void. moving on bestie π
π APPLICATION USAGE π
so the POSIX Realtime Extension defines alternative interfaces for interprocess communication. if you're an application developer who needs to use IPC, the move is to design your applications so that modules using the IPC routines described in Section 2.7, XSI Interprocess Communication can be easily modified to use the alternative interfaces. future-proofing, periodt π
π RATIONALE π
None.
she said no thoughts, head empty π
β FUTURE DIRECTIONS β
None.
the future is, apparently, uneventful. slay.
π SEE ALSO π
go read these too, bestie, they're all in the family:
- Section 2.7, XSI Interprocess Communication
- Section 2.8, Realtime
execexit()fork()shmat()shmctl()shmget()shm_open()shm_unlink()- The Base Definitions volume of POSIX.1β2017, Section 3.346, Shared Memory Object
<sys_shm.h>
π COPYRIGHT π
okay legal moment, but make it cute:
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie!! this little masterpiece was brought to you by IEEE/The Open Group, 2017 β yes, SHMDT(3P) herself, 2017 edition, no cap. mwah π detach safely out there π«Άβ¨
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms