- 3 Develop A Program To Do The Follows A Access A Shared Memory Segemnt Using Key Ftok Tmp Z B Attach The 1 (130.58 KiB) Viewed 21 times
= 3. Develop a program to do the follows. a) Access a shared memory segemnt using key ftok ("/tmp", 'z'); b) Attach the
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
= 3. Develop a program to do the follows. a) Access a shared memory segemnt using key ftok ("/tmp", 'z'); b) Attach the
= 3. Develop a program to do the follows. a) Access a shared memory segemnt using key ftok ("/tmp", 'z'); b) Attach the shared memory segment. c) Output the content of the shared memory segment. d) Use IPC_STAT to output the value of shm_nattch, No. of current attaches. See the strut below. e) Detach the shared memory segment. */ struct shmid_ds { struct ipc_perm shm_perm; /* operation perms */ int shm_segsz; /* size of segment (bytes) */ time t shm_atime; /* last attach time */ time t shm_dtime; /* last detach time * time t shm_ctime; /* last change time */ unsigned short shm_cpid; /* pid of creator */ unsigned short shm_lpid; /* pid of last operator */ short shm_nattch; /* no. of current attaches */ /* the following are private */ unsigned short shm_npages; /* size of segment (pages) */ unsigned long *shm_pages; /*array of ptrs to frames -> SHMMAX* / struct vm_area_struct *attaches; /* descriptors for attaches */ };