Elaborato_SO/src/custom_shm.c

17 lines
311 B
C
Raw Normal View History

2023-05-14 18:51:32 +02:00
#include <sys/shm.h>
#include <sys/stat.h>
#include <custom_shm.h>
#include <structures.h>
#include <errExit.h>
int getShmid() {
2023-05-14 21:56:50 +02:00
int shmid = shmget(ftok(KEYFILE, 'z'), SHM_SIZE, IPC_CREAT | S_IRUSR | S_IWUSR);
2023-05-14 18:51:32 +02:00
if (result == -1) {
errExit("shmget", "getShmid");
}
2023-05-14 21:43:25 +02:00
2023-05-14 18:51:32 +02:00
2023-05-14 21:44:03 +02:00
return shmid;
2023-05-14 18:51:32 +02:00
}