Added Process exercise's chapter

This commit is contained in:
Fabio Scotto di Santolo
2024-08-26 15:35:43 +02:00
parent 2699b3ceec
commit da93cb8369
17 changed files with 665 additions and 0 deletions

21
cons.c Normal file
View File

@@ -0,0 +1,21 @@
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/shm.h>
#include <sys/mman.h>
#include <sys/stat.h>
int main()
{
const int SIZE = 4096;
const char *name = "OS";
int shm_fd;
void *ptr;
shm_fd = shm_open(name, O_RDONLY, 0666);
ptr = mmap(0, SIZE, PROT_READ, MAP_SHARED, shm_fd, 0);
printf("%s", (char *)ptr);
shm_unlink(name);
}