sys_ipc.h(0P)

๐Ÿ’– sys_ipc.h โ€” XSI interprocess communication access structure ๐Ÿ’–

okay bestie, so this is sys_ipc.h, and it lives in the POSIX Programmer's Manual (section 0P, if you're keeping track, which you should be, iykyk). Pull up a chair, grab a strawberry ๐Ÿ“, and let's get into it.


๐ŸŒธ PROLOG ๐ŸŒธ

Real talk before we even start: 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. Or the interface might just... not be implemented on Linux at all. ๐Ÿ˜ญ Check before you commit, fr fr.


โœจ NAME โœจ

sys/ipc.h โ€” XSI interprocess communication access structure. That's it, that's the whole vibe. ๐Ÿ‘‘


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

#include <sys/ipc.h>

One include. So simple. So iconic. ๐Ÿ’…


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So the <sys/ipc.h> header is used by three whole mechanisms for XSI interprocess communication (IPC), and they are:

  • messages
  • semaphores
  • shared memory

And the way they all stay in sync? They all use one common structure type, ipc_perm, to pass along the information used in figuring out permission to perform an IPC operation. Main character energy for real. ๐Ÿซถ

The <sys/ipc.h> header shall define the ipc_perm structure, and it shall include these members:

uid_t    uid    Owner's user ID.
gid_t    gid    Owner's group ID.
uid_t    cuid   Creator's user ID.
gid_t    cgid   Creator's group ID.
mode_t   mode   Read/write permission.

Not me reading cuid and cgid and thinking "creator core" โ€” anyway. ๐ŸŽ€

The <sys/ipc.h> header shall also define the uid_t, gid_t, mode_t, and key_t types, exactly as described in <sys/types.h>. No reinventing, we reuse. Periodt.


๐ŸŒˆ Symbolic constants, besties ๐ŸŒˆ

The <sys/ipc.h> header shall define the following symbolic constants. Buckle up, there's three little sections:

๐Ÿ’ซ Mode bits

  • IPC_CREAT โ€” Create entry if key does not exist.
  • IPC_EXCL โ€” Fail if key exists.
  • IPC_NOWAIT โ€” Error if request must wait.

๐Ÿ”‘ Keys

  • IPC_PRIVATE โ€” Private key.

๐ŸŽ›๏ธ Control commands

  • IPC_RMID โ€” Remove identifier.
  • IPC_SET โ€” Set options.
  • IPC_STAT โ€” Get options.

Like, set and get? The duality. Obsessed. ๐Ÿ’–


๐Ÿงš The function (or macro, no pressure) ๐Ÿงš

The following shall be declared as a function and may also be defined as a macro. Either way, a function prototype shall be provided:

key_t  ftok(const char *, int);

One prototype. Two arguments. Zero drama. Slay. โœจ

Heads up: the following sections are informative. Which is fancy speak for "we're just chatting now, not laying down rules." ๐Ÿซถ

๐Ÿ™ˆ APPLICATION USAGE ๐Ÿ™ˆ

None.

(Truly nothing. The silence is deafening. ๐Ÿ’€)


๐Ÿ’ญ RATIONALE ๐Ÿ’ญ

None.

(Nothing to justify, nothing to explain. We simply are. โœจ)


๐Ÿ”ฎ FUTURE DIRECTIONS ๐Ÿ”ฎ

None.

(The future is bright and also completely unspecified. ๐Ÿฆ‹)


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

  • <sys_types.h>
  • The System Interfaces volume of POSIX.1โ€2017, ftok()

Go read those too, bestie, they're literally right there. ๐Ÿ’œ


okay so legal o'clock, bear with me:

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!! ๐Ÿ’…โœจ brought to you by IEEE/The Open Group, dated 2017 โ€” sys_ipc.h(0P) signing off, mwah ๐ŸŽ€๐Ÿ’–๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from