Shmget

https://man7.org/linux/man-pages/man2/shmget.2.html Create your shared memory (does NOT get a pointer back!) Gotta specify size You get an ID back Remember your error codes!

#include <errno.h>      //errno
 
	//if return from shmget is -1, you have an error!
    if ()
    {
        switch (errno)
        {
        case EACCES:
            break;
        case EEXIST:
            printf("USE IPCRM YOU DOLT!/n");
            break;
        case EINVAL:
            break;
        case ENFILE:
            break;
        case ENOENT:
            break;
        case ENOMEM:
            break;
        case ENOSPC:
            break;
        case EPERM:
            break;
        }
    }

Shmat

Attach your shared memory (gets a pointer to it!) https://man7.org/linux/man-pages/man3/shmat.3p.html

Shmdt

Detach your shared memory from THIS process https://man7.org/linux/man-pages/man3/shmdt.3p.html

Shmctl

Kill your shared memory https://man7.org/linux/man-pages/man2/shmctl.2.html

Helpful Linux/WSL Commands

htop List currently active processes and their info

ipcs List shared resources on this system

ipcrm -m shmid Remove shared memory, where “shmid” is the shared memory ID