1 / 4

shmget() : Argument Values

shmget() : Argument Values. key same as before; we use getuid() to make it unique size number of bytes to allocate shmflag Creating: IPC_CREAT and permissions 0 for accessing only. Notes on shmat() arguments. shmid is as before

Download Presentation

shmget() : Argument Values

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. shmget(): Argument Values key • same as before; we use getuid() to make it unique size • number of bytes to allocate shmflag • Creating: IPC_CREAT and permissions • 0 for accessing only

  2. Notes on shmat() arguments • shmid is as before • 2nd and 3rd arguments can be used to attach to a specific address within shmem, but it is an absolute address, requiring knowledge of the address of the shared memory segment • Almost always, 2nd and 3rd arguments are 0

  3. Shared Memory Data Structure /* One shmid data structure for each shared memory segment in the system. */ 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 */ };

  4. Virtual Memory Area Structure vm_area_struct • defines a memory VMM memory area. There is one of these per VM-area/task. A VM area is any part of the process virtual memory space that has a special rule for the page-fault handlers (ie a shared library, the executable area etc). struct vm_area_struct { struct mm_struct * vm_mm; unsigned long vm_start; unsigned long vm_end; struct vm_area_struct *vm_next; pgprot_t vm_page_prot; unsigned long vm_flags; rb_node_t vm_rb; struct vm_area_struct *vm_next_share; struct vm_area_struct **vm_pprev_share; struct vm_operations_struct * vm_ops; unsigned long vm_pgoff; struct file * vm_file; unsigned long vm_raend; void * vm_private_data; };

More Related