Re: How to find all the tasks with a Sys V shm?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 7 Mar 2006, Kamran Karimi wrote:
> 
> id = ipc_findkey(&shm_ids, key);
> shp = shm_lock(id);
> ...
> 
> But here we only get the vma of the task that created the shm, and not any
> other task who has attached it.
> 
> How can we find all the vma structures that represent a shm?

The simplest example to follow would be reset_vma_truncate_counts() in
mm/memory.c: shp->shm_file->f_mapping gives you the struct address_space *
mapping to pass to vma_prio_tree_foreach().  Ignore the i_mmap_nonlinear
lines, you can't get nonlinear shm (because shm_vm_ops lacks .populate).
You'll need to spin_lock(&mapping->i_mmap_lock) first, spin_unlock after.

Hugh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux