new source committed

This commit is contained in:
2025-09-25 15:28:11 +09:00
parent a337ed6dd1
commit da9944924b

View File

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