IPC::SysV(3perl)
π IPC::SysV β bestie's guide to System V IPC constants and syscalls π
okay so this is IPC::SysV from the Perl Programmers Reference Guide and it's literally your backstage pass to System V IPC. pull up a chair π«Ά
β¨ NAME β¨
IPC::SysV β System V IPC constants and system calls. that's the whole vibe. it gives you the constants and it gives you the syscalls, no cap. π
πΈ SYNOPSIS πΈ
use IPC::SysV qw(IPC_STAT IPC_PRIVATE);
that's it. that's the whole come-up. π
π¦ DESCRIPTION π¦
so IPC::SysV defines and conditionally exports every single constant defined in your system's include files that the SysV IPC calls need. conditionally, bestie β it only hands you what your system actually has. π
the common ones include:
IPC_CREAT IPC_EXCL IPC_NOWAIT IPC_PRIVATE IPC_RMID IPC_SET IPC_STAT
GETVAL SETVAL GETPID GETNCNT GETZCNT GETALL SETALL
SEM_A SEM_R SEM_UNDO
SHM_RDONLY SHM_RND SHMLBA
and then the auxiliary ones, aka the supporting cast that ate and left no crumbs:
S_IRUSR S_IWUSR S_IRWXU
S_IRGRP S_IWGRP S_IRWXG
S_IROTH S_IWOTH S_IRWXO
but heads up β your system might have more. every box is a little different, it's giving "your mileage may vary" energy. π
π the functions π
ftok( PATH )
ftok( PATH, ID )
returns a key based on PATH and ID, and that key is exactly what you'd feed to msgget, semget and shmget. see ftok(3) for the deets. π
if ID gets left out, it defaults to 1. and if you hand it a single character for ID, the numeric value of that character is what gets used. cute, right? β¨
shmat( ID, ADDR, FLAG )
attaches the shared memory segment identified by ID to the address space of the calling process. see shmat(2). π§
β οΈ ADDR should be undef unless you really know what you're doing. like, genuinely. i'm not being dramatic. bestie, if you're reaching for ADDR you better have main character credentials. π
shmdt( ADDR )
detaches the shared memory segment sitting at the address specified by ADDR from the address space of the calling process. see shmdt(2). goodbye segment, it was real π«‘
memread( ADDR, VAR, POS, SIZE )
reads SIZE bytes from a memory segment at ADDR, starting at position POS. VAR has to be a variable that'll hold the data that gets read. returns true if it worked, false if there was an error. and ngl, memread() taints the variable β that's a real thing that happens, keep that in mind. π
memwrite( ADDR, STRING, POS, SIZE )
writes SIZE bytes from STRING to a memory segment at ADDR, starting at position POS. if STRING is too long, only SIZE bytes get used. if STRING is too short, nulls get written to fill out SIZE bytes. returns true if it worked, false if there was an error. βοΈ
π SEE ALSO π
IPC::Msg, IPC::Semaphore, IPC::SharedMem, ftok(3), shmat(2), shmdt(2) β go read the whole family, they're all iconic π§
π AUTHORS π
Graham Barr <gbarr@pobox.com>, Jarkko Hietaniemi <jhi@iki.fi>, Marcus Holland-Moritz <mhx@cpan.org> β legends, all three, fr fr πΈ
π COPYRIGHT π
Version 2.x, Copyright (C) 2007-2013, Marcus Holland-Moritz.
Version 1.x, Copyright (c) 1997, Graham Barr.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
that's the whole page, bestie. eat it up π
perl v5.44.0 β 2026-10-17 β IPC::SysV(3perl) π mwah, go write some shared memory, you got this. ππ¦
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms