I written a program in C to create and attach shared memory.
#include <stdio.h>
#include <sys/shm.h>
#include <sys/stat.h>
int main ()
{
int segment_id;
const int shared_segment_size = 0x6400;
char* shared_memory;
key_t key = ftok("/etc/passwd",53);
/* Allocate a shared memory segment. */
printf("IPC Key: %d\n",key);
segment_id = shmget (key, shared_segment_size, IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR);
shared_memory = (char*) shmat (segment_id, (void*) 0x0300000, 0);
printf ("shared memory attached at address %p\n", shared_memory);
printf("Segment ID: %d\n",segment_id);
while(1);
return 0;
}
I am attaching shared memory at address 0x0300000. The maps file of corresponding process shown below:
00300000-00307000 rw-s 00000000 00:05 23232567 /SYSV350115f8 (deleted)
00400000-00401000 r-xp 00000000 08:01 9177256 /home/gyan/Desktop/To Lab/shared memory/a.out
00600000-00601000 r--p 00000000 08:01 9177256 /home/gyan/Desktop/To Lab/shared memory/a.out
00601000-00602000 rw-p 00001000 08:01 9177256 /home/gyan/Desktop/To Lab/shared memory/a.out
00c77000-00c98000 rw-p 00000000 00:00 0 [heap]
7f00b0d29000-7f00b0ee9000 r-xp 00000000 08:01 2625958 /lib/x86_64-linux-gnu/libc-2.23.so
7f00b0ee9000-7f00b10e8000 ---p 001c0000 08:01 2625958 /lib/x86_64-linux-gnu/libc-2.23.so
7f00b10e8000-7f00b10ec000 r--p 001bf000 08:01 2625958 /lib/x86_64-linux-gnu/libc-2.23.so
7f00b10ec000-7f00b10ee000 rw-p 001c3000 08:01 2625958 /lib/x86_64-linux-gnu/libc-2.23.so
7f00b10ee000-7f00b10f2000 rw-p 00000000 00:00 0
7f00b10f2000-7f00b1118000 r-xp 00000000 08:01 2625930 /lib/x86_64-linux-gnu/ld-2.23.so
7f00b12f9000-7f00b12fc000 rw-p 00000000 00:00 0
7f00b1315000-7f00b1317000 rw-p 00000000 00:00 0
7f00b1317000-7f00b1318000 r--p 00025000 08:01 2625930 /lib/x86_64-linux-gnu/ld-2.23.so
7f00b1318000-7f00b1319000 rw-p 00026000 08:01 2625930 /lib/x86_64-linux-gnu/ld-2.23.so
7f00b1319000-7f00b131a000 rw-p 00000000 00:00 0
7ffce31e9000-7ffce320a000 rw-p 00000000 00:00 0 [stack]
7ffce333f000-7ffce3341000 r--p 00000000 00:00 0 [vvar]
7ffce3341000-7ffce3343000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
What is meaning of "/SYSV350115f8 (deleted)" at shared memory attachment section. Why it has been written as deleted?