sys_shm.h(0P)
πΈ sys_shm.h(0P) β bestie edition πΈ
okay so real talk, this one's a page from the POSIX Programmer's Manual β it's sys_shm.h(0P), the XSI shared memory facility header. it's giving "header file lore" and honestly? kind of iconic. π
β¨ PROLOG β¨
so this manual page is literally part of the POSIX Programmer's Manual, periodt. but β and this is the important bit, bestie β the Linux implementation of this interface may differ, so you gotta consult the corresponding Linux manual page for details on Linux behavior. OR, plot twist, the interface may just... not be implemented on Linux at all. π vibe check accordingly.
π NAME π
sys/shm.h β the XSI shared memory facility. that's it, that's the name. short, sweet, main character energy. π
π¦ SYNOPSIS π¦
#include <sys/shm.h>
just one include line. lowkey elegant. β¨
π DESCRIPTION π
okay so the <sys/shm.h> header shall define the following symbolic constants:
SHM_RDONLYβ attach read-only (else it's read-write). read-only girlies rise π«ΆSHM_RNDβ round the attach address toSHMLBA.SHMLBAβ segment low boundary address multiple.
then, through typedef, <sys/shm.h> shall define these data types:
shmatt_tβ an unsigned integer used for the number of current attaches, and it must be able to store values at least as large as a typeunsigned short. no overflow shenanigans, we don't do that here. π
and now the moment you've all been waiting for... π₯ the <sys/shm.h> header shall define the shmid_ds structure, which shall include the following members:
struct ipc_perm shm_perm Operation permission structure.
size_t shm_segsz Size of segment in bytes.
pid_t shm_lpid Process ID of last shared memory operation.
pid_t shm_cpid Process ID of creator.
shmatt_t shm_nattch Number of current attaches.
time_t shm_atime Time of last shmat().
time_t shm_dtime Time of last shmdt().
time_t shm_ctime Time of last change by shmctl().
look at that little struct. so organized. so slay. π
the <sys/shm.h> header shall define the pid_t, size_t, and time_t types exactly as described in <sys/types.h> β no reinventing the wheel, we borrow from the neighbors. π
now, the following shall be declared as functions and may also be defined as macros. function prototypes shall be provided:
void *shmat(int, const void *, int);
int shmctl(int, int, struct shmid_ds *);
int shmdt(const void *);
int shmget(key_t, size_t, int);
four little functions, all lined up, all perfect. β
and IN ADDITION, the <sys/shm.h> header shall include the <sys/ipc.h> header. it's a package deal, iykyk. π«
π heads up bestie: the following sections are informative. that means they're the chill, non-binding part of the page.
πΈ APPLICATION USAGE πΈ
None. literally nothing. the section said "no thoughts, head empty." π
π§ RATIONALE π§
None. also nothing. we're keeping it mysterious. π
β FUTURE DIRECTIONS β
None. the future is unwritten, babe. π¦
π₯ SEE ALSO π₯
<sys_ipc.h><sys_types.h>- The System Interfaces volume of POSIX.1β2017:
shmat(),shmctl(),shmdt(),shmget()
go read those next, they're the sequels. π
π COPYRIGHT π
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.
β οΈ and this part MATTERS: 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 one was brought to you by IEEE/The Open Group, 2017 β yeah that's the footer, we're folding it in like a little bow π β so go forth and attach some shared memory, you absolute icon. mwah. πβ¨π«Ά
π¦ 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